summaryrefslogtreecommitdiffstats
path: root/CMakeModules
diff options
context:
space:
mode:
authorlat9nq <lat9nq@gmail.com>2022-05-29 09:32:16 +0200
committerlat9nq <lat9nq@gmail.com>2022-06-17 05:57:39 +0200
commitfef3d8acb51e6a23a73b7f3d2fbf21a80c41351c (patch)
tree8fe40d02cc4da296d677c143f50d524b57373e3f /CMakeModules
parentci/windows: Split up cmake command (diff)
downloadyuzu-fef3d8acb51e6a23a73b7f3d2fbf21a80c41351c.tar
yuzu-fef3d8acb51e6a23a73b7f3d2fbf21a80c41351c.tar.gz
yuzu-fef3d8acb51e6a23a73b7f3d2fbf21a80c41351c.tar.bz2
yuzu-fef3d8acb51e6a23a73b7f3d2fbf21a80c41351c.tar.lz
yuzu-fef3d8acb51e6a23a73b7f3d2fbf21a80c41351c.tar.xz
yuzu-fef3d8acb51e6a23a73b7f3d2fbf21a80c41351c.tar.zst
yuzu-fef3d8acb51e6a23a73b7f3d2fbf21a80c41351c.zip
Diffstat (limited to 'CMakeModules')
-rw-r--r--CMakeModules/MinGWClangCross.cmake55
1 files changed, 55 insertions, 0 deletions
diff --git a/CMakeModules/MinGWClangCross.cmake b/CMakeModules/MinGWClangCross.cmake
new file mode 100644
index 000000000..ccf4dbf40
--- /dev/null
+++ b/CMakeModules/MinGWClangCross.cmake
@@ -0,0 +1,55 @@
+set(MINGW_PREFIX /usr/x86_64-w64-mingw32/)
+set(CMAKE_SYSTEM_NAME Windows)
+set(CMAKE_SYSTEM_PROCESSOR x86_64)
+
+set(CMAKE_FIND_ROOT_PATH ${MINGW_PREFIX})
+set(SDL2_PATH ${MINGW_PREFIX})
+set(MINGW_TOOL_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32-)
+
+# Specify the cross compiler
+set(CMAKE_C_COMPILER ${MINGW_TOOL_PREFIX}clang)
+set(CMAKE_CXX_COMPILER ${MINGW_TOOL_PREFIX}clang++)
+set(CMAKE_RC_COMPILER ${MINGW_TOOL_PREFIX}windres)
+set(CMAKE_C_COMPILER_AR ${MINGW_TOOL_PREFIX}ar)
+set(CMAKE_CXX_COMPILER_AR ${MINGW_TOOL_PREFIX}ar)
+set(CMAKE_C_COMPILER_RANLIB ${MINGW_TOOL_PREFIX}ranlib)
+set(CMAKE_CXX_COMPILER_RANLIB ${MINGW_TOOL_PREFIX}ranlib)
+
+# Mingw tools
+set(STRIP ${MINGW_TOOL_PREFIX}strip)
+set(WINDRES ${MINGW_TOOL_PREFIX}windres)
+set(ENV{PKG_CONFIG} ${MINGW_TOOL_PREFIX}pkg-config)
+
+# ccache wrapper
+option(USE_CCACHE "Use ccache for compilation" OFF)
+if(USE_CCACHE)
+ find_program(CCACHE ccache)
+ if(CCACHE)
+ message(STATUS "Using ccache found in PATH")
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
+ else(CCACHE)
+ message(WARNING "USE_CCACHE enabled, but no ccache found")
+ endif(CCACHE)
+endif(USE_CCACHE)
+
+# Search for programs in the build host directories
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+
+
+# Echo modified cmake vars to screen for debugging purposes
+if(NOT DEFINED ENV{MINGW_DEBUG_INFO})
+ message("")
+ message("Custom cmake vars: (blank = system default)")
+ message("-----------------------------------------")
+ message("* CMAKE_C_COMPILER : ${CMAKE_C_COMPILER}")
+ message("* CMAKE_CXX_COMPILER : ${CMAKE_CXX_COMPILER}")
+ message("* CMAKE_RC_COMPILER : ${CMAKE_RC_COMPILER}")
+ message("* WINDRES : ${WINDRES}")
+ message("* ENV{PKG_CONFIG} : $ENV{PKG_CONFIG}")
+ message("* STRIP : ${STRIP}")
+ message("* USE_CCACHE : ${USE_CCACHE}")
+ message("")
+ # So that the debug info only appears once
+ set(ENV{MINGW_DEBUG_INFO} SHOWN)
+endif()