@@ -273,6 +273,13 @@ jobs:
273273
274274 cd llvm-project
275275 # Build
276+ mkdir native_build
277+ cd native_build
278+ cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_BUILD_TYPE=Release -G Ninja ../llvm/
279+ cmake --build . --target llvm-tblgen clang-tblgen --parallel $(nproc --all)
280+ $env:PWD_DIR= $PWD.Path
281+ $env:NATIVE_DIR="$env:PWD_DIR/bin/"
282+ cd ..
276283 mkdir build
277284 if ( "${{ matrix.cling }}" -imatch "On" )
278285 {
@@ -301,23 +308,21 @@ jobs:
301308 -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
302309 -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
303310 -DLLVM_ENABLE_LTO=Full `
311+ -DLLVM_NATIVE_TOOL_DIR="$env:NATIVE_DIR" `
304312 ..\llvm
305313 emmake make clang cling lld gtest_main
306314 }
307315 else
308316 {
309317 cp -r ..\patches\llvm\emscripten-clang${{ matrix.clang-runtime }}*
310- cp -r ..\patches\llvm\Windows-emscripten-clang${{ matrix.clang-runtime }}*
311318 #FIXME: Apply patches without hardcoding
312319 if ( "${{ matrix.clang-runtime }}" -imatch "19" )
313320 {
314- git apply -v Windows-emscripten-clang19-1-CrossCompile.patch
315321 git apply -v emscripten-clang19-2-shift-temporary-files-to-tmp-dir.patch
316322 git apply -v emscripten-clang19-3-remove-zdefs.patch
317323 }
318324 elseif ( "${{ matrix.clang-runtime }}" -imatch "20" )
319325 {
320- git apply -v Windows-emscripten-clang20-1-CrossCompile.patch
321326 git apply -v emscripten-clang20-2-shift-temporary-files-to-tmp-dir.patch
322327 }
323328 cd build
@@ -344,6 +349,7 @@ jobs:
344349 -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
345350 -DLLVM_ENABLE_LTO=Full `
346351 -G Ninja `
352+ -DLLVM_NATIVE_TOOL_DIR="$env:NATIVE_DIR" `
347353 ..\llvm
348354 emmake ninja libclang clangInterpreter clangStaticAnalyzerCore lldWasm
349355 }
@@ -510,6 +516,8 @@ jobs:
510516 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
511517 -DLLVM_ENABLE_WERROR=On \
512518 -DSYSROOT_PATH=$SYSROOT_PATH \
519+ -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \
520+ -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \
513521 ../
514522 else
515523 emcmake cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
@@ -523,6 +531,8 @@ jobs:
523531 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
524532 -DLLVM_ENABLE_WERROR=On \
525533 -DSYSROOT_PATH=$SYSROOT_PATH \
534+ -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \
535+ -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \
526536 ../
527537 fi
528538
@@ -676,6 +686,8 @@ jobs:
676686 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
677687 -DLLVM_ENABLE_WERROR=On \
678688 -DSYSROOT_PATH=$SYSROOT_PATH \
689+ -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \
690+ -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \
679691 ../
680692 else
681693 emcmake cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
@@ -688,6 +700,8 @@ jobs:
688700 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
689701 -DLLVM_ENABLE_WERROR=On \
690702 -DSYSROOT_PATH=$SYSROOT_PATH \
703+ -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \
704+ -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" \
691705 ../
692706 fi
693707 os="${{ matrix.os }}"
@@ -760,7 +774,6 @@ jobs:
760774 if : ${{ runner.os == 'windows' }}
761775 shell : powershell
762776 run : |
763- $ErrorActionPreference = "Stop"
764777 micromamba create -f environment-wasm.yml --platform=emscripten-wasm32
765778 .\emsdk\emsdk activate ${{matrix.emsdk_ver}}
766779 .\emsdk\emsdk_env.ps1
@@ -821,6 +834,8 @@ jobs:
821834 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON `
822835 -DLLVM_ENABLE_WERROR=On `
823836 -DSYSROOT_PATH="$env:SYSROOT_PATH" `
837+ -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
838+ -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
824839 ..\
825840 }
826841 else
@@ -836,9 +851,23 @@ jobs:
836851 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON `
837852 -DLLVM_ENABLE_WERROR=On `
838853 -DSYSROOT_PATH="$env:SYSROOT_PATH" `
854+ -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
855+ -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
839856 ..\
840857 }
841- emmake make -j ${{ env.ncpus }} check-cppinterop
858+ function Error-OnFailure {
859+ param (
860+ [Parameter(Mandatory)]
861+ [ScriptBlock]$Command
862+ )
863+
864+ & $Command
865+
866+ if ($LASTEXITCODE -ne 0) {
867+ exit $LASTEXITCODE
868+ }
869+ }
870+ Error-OnFailure{ emmake make -j ${{ env.ncpus }} check-cppinterop }
842871 cd .\unittests\CppInterOp\
843872 Invoke-WebRequest -Uri "https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win/1411573/chrome-win.zip" -OutFile "$PWD\chrome-win.zip" -Verbose
844873 Expand-Archive -Path "$PWD\chrome-win.zip" -DestinationPath "$PWD" -Force -Verbose
@@ -848,23 +877,34 @@ jobs:
848877 echo "PATH=$env:PATH"
849878 echo "PATH=$env:PATH" >> $env:GITHUB_ENV
850879 echo "Running CppInterOpTests in Firefox"
851- emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html
880+ Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html }
852881 echo "Running DynamicLibraryManagerTests in Firefox"
853- emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html
882+ Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html }
854883 echo "Running CppInterOpTests in Chromium"
855- emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html
884+ Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html }
856885 echo "Running DynamicLibraryManagerTests in Chromium"
857- emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html
886+ Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html }
858887 cd ..\..
859- emmake make -j ${{ env.ncpus }} install
888+ Error-OnFailure { emmake make -j ${{ env.ncpus }} install }
860889
861890 - name : Build and Test/Install CppInterOp on Windows systems (static library)
862891 if : ${{ runner.os == 'windows' }}
863892 shell : powershell
864893 run : |
865- $ErrorActionPreference = "Stop"
866894 .\emsdk\emsdk activate ${{matrix.emsdk_ver}}
867895 .\emsdk\emsdk_env.ps1
896+ function Error-OnFailure {
897+ param (
898+ [Parameter(Mandatory)]
899+ [ScriptBlock]$Command
900+ )
901+
902+ & $Command
903+
904+ if ($LASTEXITCODE -ne 0) {
905+ exit $LASTEXITCODE
906+ }
907+ }
868908 $env:PWD_DIR= $PWD.Path
869909 $env:SYSROOT_PATH="$env:EMSDK/upstream/emscripten/cache/sysroot"
870910 $env:PREFIX="%CONDA_PREFIX%/envs/CppInterOp-wasm"
@@ -921,6 +961,8 @@ jobs:
921961 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON `
922962 -DLLVM_ENABLE_WERROR=On `
923963 -DSYSROOT_PATH="$env:SYSROOT_PATH" `
964+ -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
965+ -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
924966 ..\
925967 }
926968 else
@@ -935,18 +977,20 @@ jobs:
935977 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON `
936978 -DLLVM_ENABLE_WERROR=On `
937979 -DSYSROOT_PATH="$env:SYSROOT_PATH" `
980+ -DCMAKE_C_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
981+ -DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0 -DNDEBUG" `
938982 ..\
939983 }
940- emmake make -j ${{ env.ncpus }} check-cppinterop
984+ Error-OnFailure { emmake make -j ${{ env.ncpus }} check-cppinterop }
941985 cd .\unittests\CppInterOp\
942986 echo "Running CppInterOpTests in Firefox"
943- emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html
987+ Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html }
944988 echo "Running DynamicLibraryManagerTests in Firefox"
945- emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html
989+ Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" DynamicLibraryManagerTests.html }
946990 echo "Running CppInterOpTests in Chromium"
947- emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html
991+ Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" CppInterOpTests.html }
948992 echo "Running DynamicLibraryManagerTests in Chromium"
949- emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html
993+ Error-OnFailure{ emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html }
950994
951995 - name : Build xeus-cpp
952996 if : ${{ runner.os != 'windows' }}
0 commit comments