Windows support
This commit is contained in:
18
cmake/mingw-w64-x86_64.cmake
Normal file
18
cmake/mingw-w64-x86_64.cmake
Normal file
@@ -0,0 +1,18 @@
|
||||
# Cross-compile for 64-bit Windows from Linux with mingw-w64 (UCRT).
|
||||
# cmake -S . -B build_win -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/mingw-w64-x86_64.cmake \
|
||||
# -DMINGW_SYSROOT=<dir with include/ lib/ bin/ of MSYS2 ucrt64 packages>
|
||||
# tools/package_windows.sh downloads that sysroot and runs this for you.
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
|
||||
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
|
||||
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
|
||||
|
||||
set(MINGW_SYSROOT "" CACHE PATH "MSYS2 ucrt64 package tree (include/, lib/, bin/)")
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 ${MINGW_SYSROOT})
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
# The host's pkg-config would report Linux libraries.
|
||||
set(CMAKE_DISABLE_FIND_PACKAGE_PkgConfig ON)
|
||||
Reference in New Issue
Block a user