diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f75a75c..67ff451 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -137,3 +137,20 @@ jobs: - uses: Swatinem/rust-cache@v2 - run: cargo doc + success: + needs: + - clippy + - test + - cross_compile_test + - ios_cross_compile_test + - rustfmt + - doc + runs-on: ubuntu-latest + # GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency + # failed" as success. So we have to do some contortions to ensure the job fails if any of its + # dependencies fails. + if: always() # make sure this is never "skipped" + steps: + # Manually check the status of all dependencies. `if: failure()` does not work. + - name: check if any dependency failed + run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' diff --git a/CHANGELOG.md b/CHANGELOG.md index b587562..107cce3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ ## [Unreleased] +## [0.1.52](https://github.com/rust-lang/cmake-rs/compare/v0.1.51...v0.1.52) - 2024-11-25 + +### Other + +- Expose cc-rs no_default_flags for hassle-free cross-compilation ([#225](https://github.com/rust-lang/cmake-rs/pull/225)) +- Add a `success` job to CI +- Change `--build` to use an absolute path +- Merge pull request [#195](https://github.com/rust-lang/cmake-rs/pull/195) from meowtec/feat/improve-fail-hint +- Improve hint for cmake not installed in Linux (code 127) + ## [0.1.51](https://github.com/rust-lang/cmake-rs/compare/v0.1.50...v0.1.51) - 2024-08-15 ### Added diff --git a/Cargo.toml b/Cargo.toml index 5b248c3..4d30aec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cmake" -version = "0.1.51" +version = "0.1.52" authors = ["Alex Crichton "] license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index 0f9b89a..35ce4cb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -77,6 +77,7 @@ pub struct Config { uses_cxx11: bool, always_configure: bool, no_build_target: bool, + no_default_flags: bool, verbose_cmake: bool, verbose_make: bool, pic: Option, @@ -184,6 +185,7 @@ impl Config { path: env::current_dir().unwrap().join(path), generator: None, generator_toolset: None, + no_default_flags: false, cflags: OsString::new(), cxxflags: OsString::new(), asmflags: OsString::new(), @@ -297,6 +299,13 @@ impl Config { self } + /// Disables the generation of default compiler flags. The default compiler + /// flags may cause conflicts in some cross compiling scenarios. + pub fn no_default_flags(&mut self, no_default_flags: bool) -> &mut Config { + self.no_default_flags = no_default_flags; + self + } + /// Sets the host triple for this compilation. /// /// This is automatically scraped from `$HOST` which is set for Cargo @@ -515,7 +524,7 @@ impl Config { .debug(false) .warnings(false) .host(&host) - .no_default_flags(ndk); + .no_default_flags(ndk || self.no_default_flags); if !ndk { c_cfg.target(&target); } @@ -527,7 +536,7 @@ impl Config { .debug(false) .warnings(false) .host(&host) - .no_default_flags(ndk); + .no_default_flags(ndk || self.no_default_flags); if !ndk { cxx_cfg.target(&target); } @@ -846,7 +855,7 @@ impl Config { } } - cmd.arg("--build").arg("."); + cmd.arg("--build").arg(&build); if !self.no_build_target { let target = self @@ -1075,6 +1084,12 @@ fn run(cmd: &mut Command, program: &str) { Err(e) => fail(&format!("failed to execute command: {}", e)), }; if !status.success() { + if status.code() == Some(127) { + fail(&format!( + "command did not execute successfully, got: {}, is `{}` not installed?", + status, program + )); + } fail(&format!( "command did not execute successfully, got: {}", status