# This toolchain configuration file can be used cross-compile from linux to windows # Ref.: https://github.com/glfw/glfw/blob/master/CMake/x86_64-w64-mingw32-clang.cmake MESSAGE("Cross-Compiling with toolchain file: ${CMAKE_TOOLCHAIN_FILE}") # llvm-mingw-x86_64 is expected to be avilable under this directory set(MINGW_DIRECTORY /llvm-mingw-x86_64) # Define the environment for cross-compiling with 64-bit MinGW-w64 Clang set(CMAKE_SYSTEM_NAME Windows) SET(CMAKE_SYSTEM_VERSION 1) set(CMAKE_C_COMPILER ${MINGW_DIRECTORY}/bin/x86_64-w64-mingw32-clang) set(CMAKE_CXX_COMPILER ${MINGW_DIRECTORY}/bin/x86_64-w64-mingw32-clang++) set(CMAKE_RC_COMPILER ${MINGW_DIRECTORY}/bin/x86_64-w64-mingw32-windres) set(CMAKE_RANLIB ${MINGW_DIRECTORY}/bin/x86_64-w64-mingw32-ranlib) set(CMAKE_AR ${MINGW_DIRECTORY}/bin/x86_64-w64-mingw32-ar) set(CMAKE_STRIP ${MINGW_DIRECTORY}/bin/x86_64-w64-mingw32-strip) # Configure the behaviour of the find commands set(CMAKE_FIND_ROOT_PATH ${MINGW_DIRECTORY}/x86_64-w64-mingw32 ${MINGW_DIRECTORY} /spacegame_deps) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Note: For windows we supply all libraries in use directly through mingw => Full static linking! set(CMAKE_CXX_FLAGS_INIT "-stdlib=libc++") set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld -static") set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld -static") set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld -static") set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL TRUE)