diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a34e0c..d036fee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,6 @@ option(STEAM "Build for Steam" OFF) option(DEBUG "Debug mode" ON) option(SANITIZERS "Enable sanitizers" OFF) option(NATIVE "Use native instructions(for local use only)" OFF) -option(LINUX_CROSSCOMPILATION "Forces MiNGW use" OFF) option(STATIC "Build more static build" OFF) option(CPU_ARCH "CPU arch(x86, arm64, ia-64)" "x86") @@ -23,31 +22,6 @@ if(STATIC) set(OPENSSL_USE_STATIC_LIBS ON) endif() -# https://www.mingw-w64.org/build-systems/cmake/ -if(LINUX_CROSSCOMPILATION) - # toolchain-mingw64.cmake - set(CMAKE_SYSTEM_NAME Windows) - set(CMAKE_SYSTEM_PROCESSOR x86_64) - - # specify the cross compiler - set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) - set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) - set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) - - # where is the target environment - set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) - - # search for programs in the build host directories -# set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) - # for libraries and headers in the target directories -# set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -# set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - - # CMake determines how to examine dependencies based on the *host* system, leading to - # a `file unknown error` unless the target platform is explicitly specified. - set(CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM "windows+pe") -endif() - # main stuff set(MAIN_HEADERS src/quadarray.h @@ -426,15 +400,6 @@ else() ) endif() -if(LINUX_CROSSCOMPILATION) - target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE - /usr/x86_64-w64-mingw32/include - ) - target_compile_options(oneshot PRIVATE - -idirafter /usr/x86_64-w64-mingw32/include - ) -endif() - if(POLICY CMP0167) # suppress Boost warning cmake_policy(SET CMP0167 OLD) endif() diff --git a/toolchain/linux_to_windows_mingw_w64.cmake b/toolchain/linux_to_windows_mingw_w64.cmake new file mode 100644 index 0000000..7096b5d --- /dev/null +++ b/toolchain/linux_to_windows_mingw_w64.cmake @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.16) +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR x86_64) +set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) +set(CMAKE_SYSROOT /usr/x86_64-w64-mingw32)