Build: Add MinGW cross-compilation support

This commit is contained in:
xiaozhou233 committed 2026-08-12 09:49:34 +08:00
1 parent 18726e59f4
commit 3842585777
4 files changed
+28 -1

No files matched your search

+1
View File
@@ -4,3 +4,4 @@ debug/*
UserDir/*
CMakeCache.txt
examples/loop/loop.class
build-mingw/*
+12
View File
@@ -17,6 +17,18 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "mingw-release",
"inherits": "ninja-release",
"binaryDir": "${sourceDir}/build-mingw",
"toolchainFile": "${sourceDir}/toolchains/x86_64-w64-mingw32.cmake"
},
{
"name": "mingw-debug",
"inherits": "ninja-debug",
"binaryDir": "${sourceDir}/build-mingw",
"toolchainFile": "${sourceDir}/toolchains/x86_64-w64-mingw32.cmake"
}
]
}
@@ -30,7 +30,7 @@
#define WIN32_LEAN_AND_MEAN
#include <Winsock2.h>
#include <winsock2.h>
#include <windows.h>
#include <intrin.h>
+14
View File
@@ -0,0 +1,14 @@
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR amd64)
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(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
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)