Skip to content

Commit 6387b4f

Browse files
alexcrichtonabrown
andauthored
Use MSVC for the Windows toolchain instead of MinGW (#456)
* Use MSVC for the Windows toolchain instead of MinGW Explicitly use MSVC to avoid the runtime dependencies that the default toolchain CMake is using is bringing in. Closes #454 * Update .github/workflows/main.yml Co-authored-by: Andrew Brown <andrew.brown@intel.com> * Specify MinSizeRel in `build.sh` Looks like MSVC defaults to "Debug" instead of an empty string to so the default logic which works for other compilers isn't kicking in here. * Don't persist ccache stats across runs * Move zeroing --------- Co-authored-by: Andrew Brown <andrew.brown@intel.com>
1 parent fef66e3 commit 6387b4f

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

.github/workflows/main.yml

+18-3
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ jobs:
125125
run: sudo apt install ccache
126126
if: runner.os == 'Linux'
127127

128+
- name: Clear ccache statistics
129+
run: ccache --zero-stats
130+
128131
- name: Build and test (macOS)
129132
run: ./ci/build.sh
130133
if: runner.os == 'macOS'
@@ -133,11 +136,23 @@ jobs:
133136
run: ./ci/docker-build.sh ${{ matrix.artifact }}
134137
if: runner.os == 'Linux'
135138

136-
# Use a shorter build directory than the default on Windows to avoid
137-
# hitting path length and command line length limits. See
138-
# WebAssembly/wasi-libc#514
139+
# Setup the VS Developoer Prompt environment variables to explicitly use
140+
# MSVC to compile LLVM as that avoids extra runtime dependencies
141+
# msys/mingw might bring.
142+
#
143+
# As of 2024-07-22 this sha is the "v1.13.0" tag.
144+
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756
145+
if: runner.os == 'Windows'
139146
- name: Build and test (Windows)
140147
run: |
148+
# Delete a troublesome binary as recommended here
149+
# https://github.com/ilammy/msvc-dev-cmd?tab=readme-ov-file#name-conflicts-with-shell-bash
150+
rm /usr/bin/link
151+
# Use a shorter build directory than the default on Windows to avoid
152+
# hitting path length and command line length limits. See
153+
# WebAssembly/wasi-libc#514. Despite using a different build directory
154+
# though still move the `dist` folder to `build/dist` so the upload
155+
# step below doesn't need a windows-specific hook.
141156
./ci/build.sh C:/wasi-sdk
142157
mkdir build
143158
cp -r C:/wasi-sdk/dist build

ci/build.sh

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ fi
1818

1919
cmake -G Ninja -B $build_dir/toolchain -S . \
2020
-DWASI_SDK_BUILD_TOOLCHAIN=ON \
21+
-DCMAKE_BUILD_TYPE=MinSizeRel \
2122
"-DCMAKE_INSTALL_PREFIX=$build_dir/install" \
2223
$WASI_SDK_CI_TOOLCHAIN_CMAKE_ARGS \
2324
"-DLLVM_CMAKE_FLAGS=$WASI_SDK_CI_TOOLCHAIN_LLVM_CMAKE_ARGS"

0 commit comments

Comments
 (0)