From: Joel Rosdahl Date: Mon, 11 Mar 2024 19:24:36 +0000 (+0100) Subject: ci: Add CMake toolchain files for cross-compiling to Windows X-Git-Tag: v4.10~77 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a27abfa7cb6af2ae1c9b0a9cee602adf1b0cd2cf;p=thirdparty%2Fccache.git ci: Add CMake toolchain files for cross-compiling to Windows --- diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 990e6a13..aa687769 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -287,17 +287,13 @@ jobs: - name: Linux MinGW 32-bit os: ubuntu-20.04 - CC: i686-w64-mingw32-gcc-posix - CXX: i686-w64-mingw32-g++-posix - CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DCMAKE_SYSTEM_NAME=Windows -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON + CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -D CMAKE_TOOLCHAIN_FILE=../toolchains/i686-w64-mingw32-posix.cmake -D ZSTD_FROM_INTERNET=ON -D HIREDIS_FROM_INTERNET=ON RUN_TESTS: none apt_get: elfutils mingw-w64 - name: Linux MinGW 64-bit os: ubuntu-20.04 - CC: x86_64-w64-mingw32-gcc-posix - CXX: x86_64-w64-mingw32-g++-posix - CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DCMAKE_SYSTEM_NAME=Windows -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON + CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -D CMAKE_TOOLCHAIN_FILE=../toolchains/x86_64-w64-mingw32-posix.cmake -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON RUN_TESTS: unittest-in-wine apt_get: elfutils mingw-w64 wine diff --git a/toolchains/i686-w64-mingw32-posix.cmake b/toolchains/i686-w64-mingw32-posix.cmake new file mode 100644 index 00000000..c84ee86e --- /dev/null +++ b/toolchains/i686-w64-mingw32-posix.cmake @@ -0,0 +1,8 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(TOOLCHAIN_PREFIX i686-w64-mingw32) +set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc-posix) +set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++-posix) +set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/toolchains/x86_64-w64-mingw32-posix.cmake b/toolchains/x86_64-w64-mingw32-posix.cmake new file mode 100644 index 00000000..03c3ef33 --- /dev/null +++ b/toolchains/x86_64-w64-mingw32-posix.cmake @@ -0,0 +1,8 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) +set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc-posix) +set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++-posix) +set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)