NEW: Add cross compile support on X86_64 Linux with MinGW toolchain.

This commit is contained in:
Hacksign
2025-05-29 18:48:04 +08:00
parent 0fa037adc3
commit e9a6911019
13 changed files with 114 additions and 5 deletions

View File

@@ -11,7 +11,16 @@ target_include_directories(emulator-common INTERFACE "${CMAKE_CURRENT_LIST_DIR}"
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(emulator-common PUBLIC
Threads::Threads
zlibstatic
)
if(CMAKE_C_COMPILER MATCHES "/.*/x86_64-w64-mingw32-gcc$")
target_link_libraries(emulator-common PUBLIC
Threads::Threads
zlibstatic
ws2_32
)
else()
target_link_libraries(emulator-common PUBLIC
Threads::Threads
zlibstatic
)
endif()

View File

@@ -2,8 +2,14 @@
#if _WIN32
#include "../utils/win.hpp"
#ifdef __MINGW64__
#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdint.h>
#else
#include <WinSock2.h>
#include <WS2tcpip.h>
#endif
#else
#include <sys/types.h>

View File

@@ -18,6 +18,10 @@
#define WIN32_LEAN_AND_MEAN
#endif
#ifdef __MINGW64__
#include <windows.h>
#else
#include <Windows.h>
#endif
#endif