Skip to content

Commit a27abfa

Browse files
committedMar 16, 2024
ci: Add CMake toolchain files for cross-compiling to Windows
1 parent 749be5f commit a27abfa

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed
 

‎.github/workflows/build.yaml

+2-6
Original file line numberDiff line numberDiff line change
@@ -287,17 +287,13 @@ jobs:
287287

288288
- name: Linux MinGW 32-bit
289289
os: ubuntu-20.04
290-
CC: i686-w64-mingw32-gcc-posix
291-
CXX: i686-w64-mingw32-g++-posix
292-
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DCMAKE_SYSTEM_NAME=Windows -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON
290+
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
293291
RUN_TESTS: none
294292
apt_get: elfutils mingw-w64
295293

296294
- name: Linux MinGW 64-bit
297295
os: ubuntu-20.04
298-
CC: x86_64-w64-mingw32-gcc-posix
299-
CXX: x86_64-w64-mingw32-g++-posix
300-
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DCMAKE_SYSTEM_NAME=Windows -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON
296+
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
301297
RUN_TESTS: unittest-in-wine
302298
apt_get: elfutils mingw-w64 wine
303299

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
set(CMAKE_SYSTEM_NAME Windows)
2+
set(TOOLCHAIN_PREFIX i686-w64-mingw32)
3+
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc-posix)
4+
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++-posix)
5+
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
6+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
7+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
8+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
set(CMAKE_SYSTEM_NAME Windows)
2+
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
3+
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc-posix)
4+
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++-posix)
5+
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
6+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
7+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
8+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

0 commit comments

Comments
 (0)
Please sign in to comment.