summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-02-17 22:19:05 +0100
committerAki <please@ignore.pl>2024-02-17 22:19:05 +0100
commit7f5562530f9a1decfae9e4c88b95422c82ed829c (patch)
tree83afdea2458363d0c68c1428b6407a7abf19b6e2
parent764bd0b8bff46b944cf8cc123527938ed2ceabad (diff)
downloadstarshatter-7f5562530f9a1decfae9e4c88b95422c82ed829c.zip
starshatter-7f5562530f9a1decfae9e4c88b95422c82ed829c.tar.gz
starshatter-7f5562530f9a1decfae9e4c88b95422c82ed829c.tar.bz2
Fix running cross-compiled executables by CMake with i686-w64-mingw
-rwxr-xr-xcmake/toolchains/i686-w64-mingw32-wine7
-rw-r--r--cmake/toolchains/i686-w64-mingw32.cmake11
2 files changed, 13 insertions, 5 deletions
diff --git a/cmake/toolchains/i686-w64-mingw32-wine b/cmake/toolchains/i686-w64-mingw32-wine
new file mode 100755
index 0000000..65b4aad
--- /dev/null
+++ b/cmake/toolchains/i686-w64-mingw32-wine
@@ -0,0 +1,7 @@
+#!/bin/sh -e
+toolchain=i686-w64-mingw32
+prefix=/usr/$toolchain
+export WINEPREFIX=$HOME/.wine-$toolchain
+export WINEPATH=$prefix/bin
+export WINEARCH=win32
+exec /usr/bin/wine "$@"
diff --git a/cmake/toolchains/i686-w64-mingw32.cmake b/cmake/toolchains/i686-w64-mingw32.cmake
index 30df69e..b4d66eb 100644
--- a/cmake/toolchains/i686-w64-mingw32.cmake
+++ b/cmake/toolchains/i686-w64-mingw32.cmake
@@ -6,19 +6,20 @@
# Or use CMAKE_TOOLCHAIN_FILE variable.
set(CMAKE_SYSTEM_NAME Windows)
+set(CMAKE_SYSTEM_PROCESSOR i686)
set(CMAKE_CROSSCOMPILING ON)
+set(TOOLCHAIN_DIR "${CMAKE_CURRENT_LIST_DIR}")
-find_program(WINE wine)
-if(WINE)
- set(CMAKE_CROSSCOMPILING_EMULATOR ${WINE})
-endif()
+set(CMAKE_CROSSCOMPILING_EMULATOR "${TOOLCHAIN_DIR}/i686-w64-mingw32-wine")
set(TOOLCHAIN_PREFIX i686-w64-mingw32)
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
+set(CMAKE_MC_COMPILER ${TOOLCHAIN_PREFIX}-windmc)
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) \ No newline at end of file
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)