diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abaa23bf03..14c87182c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,9 +143,6 @@ jobs: - run: rustup toolchain install --no-self-update --profile=minimal 1.66.0 - - run: echo "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\x64\bin" >> $GITHUB_PATH - shell: bash - - run: sh mk/package.sh shell: bash @@ -483,11 +480,6 @@ jobs: - if: ${{ contains(matrix.host_os, 'windows') && contains(matrix.target, '86') }} run: ./mk/install-build-tools.ps1 - - if: ${{ matrix.target == 'aarch64-pc-windows-msvc' && !contains(matrix.host_os, 'arm') }} - run: | - echo "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\x64\bin" >> $GITHUB_PATH - shell: bash - - if: ${{ !contains(matrix.host_os, 'windows') }} run: | mk/cargo.sh +${{ matrix.rust_channel }} test --lib --tests -vv --target=${{ matrix.target }} ${{ matrix.cargo_options }} ${{ matrix.features }} ${{ matrix.mode }} ${{ matrix.cargo_test_options }} diff --git a/BUILDING.md b/BUILDING.md index d263bdfb68..b8cdc9fc0a 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -25,19 +25,6 @@ supported. For Windows ARM64 targets (aarch64-pc-windows-msvc), the Visual Studio Build Tools “VS 2022 C++ ARM64 build tools” and "clang" components must be installed. -Add Microsoft's provided version of `clang` to `%PATH%`, which will allow the -build to work in GitHub Actions without installing anything: -``` -$env:Path += ";C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\x64\bin" -``` -If you (locally) have “Build Tools for Visual Studio 2022” instead, use: -``` -$env:Path += ";C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin" -``` -Alternatively, if the host machine is already a Windows ARM64 then use: -``` -$env:Path += ";C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\ARM64\bin" -``` Packaged Builds --------------- diff --git a/Cargo.lock b/Cargo.lock index 0861ad114e..54114c7cfa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,10 +43,11 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.27" +version = "1.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc" +checksum = "5252b3d2648e5eedbc1a6f501e3c795e07025c1e93bbf8bbdd6eef7f447a6d54" dependencies = [ + "find-msvc-tools", "shlex", ] @@ -154,6 +155,12 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "find-msvc-tools" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fd99930f64d146689264c637b5af2f0233a933bef0d8570e2526bf9e083192d" + [[package]] name = "getrandom" version = "0.2.16" diff --git a/Cargo.toml b/Cargo.toml index 278c3ccf58..fee93c79c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -172,7 +172,7 @@ wasm-bindgen-test = { version = "0.3.37", default-features = false, features = [ libc = { version = "0.2.172", default-features = false } [build-dependencies] -cc = { version = "1.2.8", default-features = false } +cc = { version = "1.2.36", default-features = false } [features] # These features are documented in the top-level module's documentation. diff --git a/build.rs b/build.rs index 2851fafdb8..cf7f89a180 100644 --- a/build.rs +++ b/build.rs @@ -188,7 +188,6 @@ fn cpp_flags(compiler: &cc::Tool) -> &'static [&'static str] { "/Zc:forScope", "/Zc:inline", // Warnings. - "/Wall", "/wd4127", // C4127: conditional expression is constant "/wd4464", // C4464: relative include path contains '..' "/wd4514", // C4514: : unreferenced inline function has be @@ -591,13 +590,11 @@ fn obj_path(out_dir: &Path, src: &Path) -> PathBuf { fn configure_cc(c: &mut cc::Build, target: &Target, c_root_dir: &Path, include_dir: &Path) { let compiler = c.get_compiler(); - // FIXME: On Windows AArch64 we currently must use Clang to compile C code - let compiler = if target.os == WINDOWS && target.arch == AARCH64 && !compiler.is_like_clang() { - let _ = c.compiler("clang"); - c.get_compiler() - } else { - compiler - }; + // On Windows AArch64 we currently must use Clang to compile C code. + // clang-cl.exe has support for MSVC-style command-line arguments. + if target.os == WINDOWS && target.arch == AARCH64 && !compiler.is_like_clang() { + c.prefer_clang_cl_over_msvc(true); + } let _ = c.include(c_root_dir.join("include")); let _ = c.include(include_dir); diff --git a/mk/package.sh b/mk/package.sh index 9dd3cc14d1..ba2fb79f65 100644 --- a/mk/package.sh +++ b/mk/package.sh @@ -11,7 +11,7 @@ fi msrv=1.66.0 cargo clean --target-dir=target/pregenerate_asm -RING_PREGENERATE_ASM=1 CC_AARCH64_PC_WINDOWS_MSVC=clang \ +RING_PREGENERATE_ASM=1 \ cargo +${msrv} build -p ring --target-dir=target/pregenerate_asm if [[ -n "$(git status --porcelain -- ':(exclude)pregenerated/')" ]]; then echo Repository is dirty.