summaryrefslogtreecommitdiff
path: root/CMakeModules
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeModules')
-rw-r--r--CMakeModules/MinGWCross.cmake54
1 files changed, 54 insertions, 0 deletions
diff --git a/CMakeModules/MinGWCross.cmake b/CMakeModules/MinGWCross.cmake
new file mode 100644
index 000000000..25750f521
--- /dev/null
+++ b/CMakeModules/MinGWCross.cmake
@@ -0,0 +1,54 @@
1SET(MINGW_PREFIX /usr/x86_64-w64-mingw32/)
2SET(CMAKE_SYSTEM_NAME Windows)
3SET(CMAKE_SYSTEM_PROCESSOR x86_64)
4# Actually a hack, w/o this will cause some strange errors
5SET(CMAKE_HOST_WIN32 TRUE)
6
7
8SET(CMAKE_FIND_ROOT_PATH ${MINGW_PREFIX})
9SET(SDL2_PATH ${MINGW_PREFIX})
10SET(MINGW_TOOL_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32-)
11
12# Specify the cross compiler
13SET(CMAKE_C_COMPILER ${MINGW_TOOL_PREFIX}gcc-posix)
14SET(CMAKE_CXX_COMPILER ${MINGW_TOOL_PREFIX}g++-posix)
15SET(CMAKE_RC_COMPILER ${MINGW_TOOL_PREFIX}windres)
16
17# Mingw tools
18SET(STRIP ${MINGW_TOOL_PREFIX}strip)
19SET(WINDRES ${MINGW_TOOL_PREFIX}windres)
20SET(ENV{PKG_CONFIG} ${MINGW_TOOL_PREFIX}pkg-config)
21
22# ccache wrapper
23OPTION(USE_CCACHE "Use ccache for compilation" OFF)
24IF(USE_CCACHE)
25 FIND_PROGRAM(CCACHE ccache)
26 IF (CCACHE)
27 MESSAGE(STATUS "Using ccache found in PATH")
28 SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
29 SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
30 ELSE(CCACHE)
31 MESSAGE(WARNING "USE_CCACHE enabled, but no ccache found")
32 ENDIF(CCACHE)
33ENDIF(USE_CCACHE)
34
35# Search for programs in the build host directories
36SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
37
38
39# Echo modified cmake vars to screen for debugging purposes
40IF(NOT DEFINED ENV{MINGW_DEBUG_INFO})
41 MESSAGE("")
42 MESSAGE("Custom cmake vars: (blank = system default)")
43 MESSAGE("-----------------------------------------")
44 MESSAGE("* CMAKE_C_COMPILER : ${CMAKE_C_COMPILER}")
45 MESSAGE("* CMAKE_CXX_COMPILER : ${CMAKE_CXX_COMPILER}")
46 MESSAGE("* CMAKE_RC_COMPILER : ${CMAKE_RC_COMPILER}")
47 MESSAGE("* WINDRES : ${WINDRES}")
48 MESSAGE("* ENV{PKG_CONFIG} : $ENV{PKG_CONFIG}")
49 MESSAGE("* STRIP : ${STRIP}")
50 MESSAGE("* USE_CCACHE : ${USE_CCACHE}")
51 MESSAGE("")
52 # So that the debug info only appears once
53 SET(ENV{MINGW_DEBUG_INFO} SHOWN)
54ENDIF()