2014-05-20 12:35:27 -04:00
|
|
|
SET(CMAKE_SYSTEM_NAME Windows)
|
|
|
|
|
2014-08-23 13:28:29 -04:00
|
|
|
SET(COMPILER_PREFIX i686-w64-mingw32)
|
|
|
|
SET(CMAKE_C_COMPILER ${COMPILER_PREFIX}-gcc)
|
|
|
|
SET(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}-c++)
|
|
|
|
SET(CMAKE_RC_COMPILER ${COMPILER_PREFIX}-windres)
|
|
|
|
SET(CMAKE_PKGCONFIG_EXECUTABLE ${COMPILER_PREFIX}-pkg-config)
|
|
|
|
SET(PKG_CONFIG_EXECUTABLE ${COMPILER_PREFIX}-pkg-config)
|
2014-05-20 12:35:27 -04:00
|
|
|
|
2014-05-20 18:07:57 -04:00
|
|
|
# potential flags to make code more similar to MSVC:
|
2014-05-27 17:24:09 -04:00
|
|
|
# -fshort-wchar -fshort-enums -mms-bitfields
|
2014-05-20 18:07:57 -04:00
|
|
|
#
|
2015-05-25 15:38:33 -04:00
|
|
|
set(CMAKE_C_FLAGS "-masm=intel -std=gnu99 -fpack-struct=1" CACHE STRING "" FORCE)
|
|
|
|
set(CMAKE_CXX_FLAGS "-masm=intel -std=c++0x -std=gnu++0x -fpack-struct=1" CACHE STRING "" FORCE)
|
2015-07-03 05:54:42 -04:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static -lpthread" CACHE STRING "" FORCE)
|
|
|
|
else()
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++" CACHE STRING "" FORCE)
|
|
|
|
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2014-05-20 12:35:27 -04:00
|
|
|
|
|
|
|
# find and include SDL2
|
2014-05-24 07:22:01 -04:00
|
|
|
INCLUDE(FindPkgConfig)
|
|
|
|
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
|
|
|
|
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS})
|
2014-05-20 12:35:27 -04:00
|
|
|
|
2014-08-24 10:40:57 -04:00
|
|
|
if(APPLE)
|
2015-05-25 15:38:33 -04:00
|
|
|
SET(TARGET_ENVIRONMENT /usr/local/mingw-w32-bin_i686-darwin/i686-w64-mingw32)
|
2014-08-24 10:40:57 -04:00
|
|
|
else()
|
|
|
|
SET(TARGET_ENVIRONMENT /usr/i686-w64-mingw32)
|
|
|
|
endif(APPLE)
|
|
|
|
|
2014-05-20 12:35:27 -04:00
|
|
|
# here is the target environment located
|
2014-08-24 10:40:57 -04:00
|
|
|
SET(CMAKE_FIND_ROOT_PATH ${TARGET_ENVIRONMENT})
|
2014-05-20 12:35:27 -04:00
|
|
|
|
|
|
|
# adjust the default behaviour of the FIND_XXX() commands:
|
2014-05-23 23:16:52 -04:00
|
|
|
# search headers and libraries in the target environment, search
|
2014-05-20 12:35:27 -04:00
|
|
|
# programs in the host environment
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|