Skip to content

Commit

Permalink
Merge pull request #551 from Chilledheart/gh_action_use_ucrt_for_ming…
Browse files Browse the repository at this point in the history
…w_bots

Gh action use ucrt for mingw bots
  • Loading branch information
Chilledheart authored Dec 18, 2023
2 parents 2eaa820 + b74da12 commit cb52935
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 45 deletions.
39 changes: 14 additions & 25 deletions .github/workflows/compiler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
with:
path: |
llvm-mingw-*.tar.xz
key: ${{ runner.os }}-mingw64-llvm-20230614-and-ucrt
key: ${{ runner.os }}-mingw64-llvm-20230614-ucrt
- name: Cache mingw64 curl
id: curl-cache
uses: actions/cache@v3
Expand Down Expand Up @@ -186,7 +186,6 @@ jobs:
- name: "Download dependency: llvm-mingw"
if: ${{ steps.mingw-cache.outputs.cache-hit != 'true' }}
run: |
curl -L -O https://github.com/mstorsjo/llvm-mingw/releases/download/20230614/llvm-mingw-20230614-msvcrt-ubuntu-20.04-x86_64.tar.xz
curl -L -O https://github.com/mstorsjo/llvm-mingw/releases/download/20230614/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64.tar.xz
- name: "Download dependency: curl"
if: ${{ steps.curl-cache.outputs.cache-hit != 'true' }}
Expand All @@ -199,17 +198,10 @@ jobs:
curl -L -O https://curl.se/windows/dl-8.4.0_7/curl-8.4.0_7-win32-mingw.zip
7z x curl-8.4.0_7-win32-mingw.zip -aoa
rm -vf curl*.zip
- name: Specify mingw variant
run: |
if [ "${{ matrix.arch }}" = "i686" ] || [ "${{ matrix.arch }}" = "x86_64" ]; then
echo "VARIANT=msvcrt" >> $GITHUB_ENV
else
echo "VARIANT=ucrt" >> $GITHUB_ENV
fi
- name: Populate llvm-mingw
run: |
sudo tar -C /opt -xvf llvm-mingw-20230614-${{ env.VARIANT }}-ubuntu-20.04-x86_64.tar.xz
sudo ln -sf libclang_rt.builtins-i386.a /opt/llvm-mingw-20230614-${{ env.VARIANT }}-ubuntu-20.04-x86_64/lib/clang/16/lib/windows/libclang_rt.builtins-i686.a
sudo tar -C /opt -xvf llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64.tar.xz
sudo ln -sf libclang_rt.builtins-i386.a /opt/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64/lib/clang/16/lib/windows/libclang_rt.builtins-i686.a
- name: Populate depedencies
run: |
sudo apt-get update -qq
Expand Down Expand Up @@ -239,26 +231,23 @@ jobs:
set(CMAKE_CXX_FLAGS "--rtlib=compiler-rt -stdlib=libc++ -Wno-unused-command-line-argument")
set(CMAKE_SHARED_LINKER_FLAGS "--rtlib=compiler-rt --unwindlib=libunwind")
set(CMAKE_EXE_LINKER_FLAGS "--rtlib=compiler-rt --unwindlib=libunwind")
set(USE_COMPILER_RT TRUE)
set(USE_LIBUNWIND TRUE)
set(COMPILER_RT_PATH "/opt/llvm-mingw-20230614-${{ env.VARIANT }}-ubuntu-20.04-x86_64/lib/clang/16/lib/windows/libclang_rt.builtins-${{ matrix.arch }}.a")
# cross compilers to use for C and C++
set(CMAKE_C_COMPILER "/opt/llvm-mingw-20230614-${{ env.VARIANT }}-ubuntu-20.04-x86_64/bin/clang")
set(CMAKE_CXX_COMPILER "/opt/llvm-mingw-20230614-${{ env.VARIANT }}-ubuntu-20.04-x86_64/bin/clang++")
set(CMAKE_LINKER "/opt/llvm-mingw-20230614-${{ env.VARIANT }}-ubuntu-20.04-x86_64/bin/ld.lld")
set(CMAKE_AR "/opt/llvm-mingw-20230614-${{ env.VARIANT }}-ubuntu-20.04-x86_64/bin/llvm-ar")
set(CMAKE_CXX_COMPILER_AR "/opt/llvm-mingw-20230614-${{ env.VARIANT }}-ubuntu-20.04-x86_64/bin/llvm-ar")
set(CMAKE_RANLIB "/opt/llvm-mingw-20230614-${{ env.VARIANT }}-ubuntu-20.04-x86_64/bin/llvm-ranlib")
set(CMAKE_CXX_COMPILER_RANLIB "/opt/llvm-mingw-20230614-${{ env.VARIANT }}-ubuntu-20.04-x86_64/bin/llvm-ranlib")
set(CMAKE_C_COMPILER "/opt/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64/bin/clang")
set(CMAKE_CXX_COMPILER "/opt/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64/bin/clang++")
set(CMAKE_LINKER "/opt/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64/bin/ld.lld")
set(CMAKE_AR "/opt/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64/bin/llvm-ar")
set(CMAKE_CXX_COMPILER_AR "/opt/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64/bin/llvm-ar")
set(CMAKE_RANLIB "/opt/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64/bin/llvm-ranlib")
set(CMAKE_CXX_COMPILER_RANLIB "/opt/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64/bin/llvm-ranlib")
# disabled because it is missing from binary
# set(CMAKE_RC_COMPILER "/opt/llvm-mingw-20230614-${{ env.VARIANT }}-ubuntu-20.04-x86_64/bin/llvm-rc")
set(CMAKE_RC_COMPILER "/opt/llvm-mingw-20230614-${{ env.VARIANT }}-ubuntu-20.04-x86_64/bin/\${GNU_TARGET}-windres")
# set(CMAKE_RC_COMPILER "/opt/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64/bin/llvm-rc")
set(CMAKE_RC_COMPILER "/opt/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64/bin/\${GNU_TARGET}-windres")
set(CMAKE_SYSROOT "/opt/llvm-mingw-20230614-${{ env.VARIANT }}-ubuntu-20.04-x86_64/\${GNU_TARGET}" CACHE STRING "")
set(CMAKE_SYSROOT "/opt/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64/\${GNU_TARGET}" CACHE STRING "")
# target environment on the build host system
set(CMAKE_FIND_ROOT_PATH /opt/llvm-mingw-20230614-${{ env.VARIANT }}-ubuntu-20.04-x86_64/\${GNU_TARGET})
set(CMAKE_FIND_ROOT_PATH /opt/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64/\${GNU_TARGET})
# modify default behavior of FIND_XXX() commands
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/releases-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:
REM start to build with workaround
mkdir build-mingw
cd build-mingw
cmake -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_BENCHMARKS=on -DBUILD_TESTS=on -DGUI=on -DMINGW_WORKAROUND=on -DUSE_ICU=off .. ${{ env.CMAKE_OPTIONS }} -DCMAKE_C_COMPILER_TARGET=${{ matrix.arch }}-pc-windows-gnu -DCMAKE_CXX_COMPILER_TARGET=${{ matrix.arch }}-pc-windows-gnu -DCMAKE_ASM_COMPILER_TARGET=${{ matrix.arch }}-pc-windows-gnu
cmake -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_BENCHMARKS=on -DBUILD_TESTS=on -DGUI=on -DMINGW_WORKAROUND=on -DUSE_ICU=off .. ${{ env.CMAKE_OPTIONS }} -DCMAKE_C_COMPILER_TARGET=${{ matrix.arch }}-pc-windows-gnu -DCMAKE_CXX_COMPILER_TARGET=${{ matrix.arch }}-pc-windows-gnu -DCMAKE_ASM_COMPILER_TARGET=${{ matrix.arch }}-pc-windows-gnu -DMINGW_MSVCRT100=on
ninja yass yass_benchmark yass_test
- name: Packaging
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion third_party/abseil-cpp
2 changes: 1 addition & 1 deletion third_party/boringssl/src
Submodule src updated 1 files
+4 −0 CMakeLists.txt
25 changes: 8 additions & 17 deletions third_party/libc++/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ else()
${libcxx_PUBLIC_LIBRARIES}
pthread c gcc_s m rt
)
elseif (COMPILER_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0 AND NOT (MINGW AND NOT OS_AARCH64))
elseif (COMPILER_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0 AND NOT (MINGW AND MINGW_MSVCRT100))
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nostdlib++")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib++")
else()
Expand Down Expand Up @@ -170,22 +170,13 @@ else()
gcc_s rt
)
endif()
elseif (MINGW)
if (USE_LIBUNWIND AND USE_COMPILER_RT)
set(libcxx_PUBLIC_LIBRARIES
${libcxx_PUBLIC_LIBRARIES}
mingw32 ${COMPILER_RT_PATH} unwind moldname mingwex msvcr100
advapi32 shell32 user32 kernel32
mingw32 ${COMPILER_RT_PATH} unwind moldname mingwex msvcr100 kernel32
)
else()
set(libcxx_PUBLIC_LIBRARIES
${libcxx_PUBLIC_LIBRARIES}
mingw32 gcc_eh gcc moldname mingwex msvcr100
advapi32 shell32 user32 kernel32
mingw32 gcc_eh gcc moldname mingwex msvcr100 kernel32
)
endif()
elseif (MINGW AND MINGW_MSVCRT100)
set(libcxx_PUBLIC_LIBRARIES
${libcxx_PUBLIC_LIBRARIES}
mingw32 gcc_eh gcc moldname mingwex msvcr100
advapi32 shell32 user32 kernel32
mingw32 gcc_eh gcc moldname mingwex msvcr100 kernel32
)
endif()
endif()
endif()
Expand Down

0 comments on commit cb52935

Please sign in to comment.