]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
ci: Add CMake toolchain files for cross-compiling to Windows
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 11 Mar 2024 19:24:36 +0000 (20:24 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 16 Mar 2024 20:54:53 +0000 (21:54 +0100)
.github/workflows/build.yaml
toolchains/i686-w64-mingw32-posix.cmake [new file with mode: 0644]
toolchains/x86_64-w64-mingw32-posix.cmake [new file with mode: 0644]

index 990e6a13fda81af23bfe939b3835360f970f854d..aa687769305f60f1082565198037de932c55425e 100644 (file)
@@ -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 (file)
index 0000000..c84ee86
--- /dev/null
@@ -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 (file)
index 0000000..03c3ef3
--- /dev/null
@@ -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)