2011-05-16 21:12:07 +08:00
|
|
|
|
|
|
|
if(NOT ARCH)
|
|
|
|
set(ARCH i386)
|
|
|
|
endif()
|
|
|
|
|
2015-05-23 19:45:59 +08:00
|
|
|
# Default to Debug for the build type
|
|
|
|
if(NOT DEFINED CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
|
|
|
|
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
|
|
|
endif()
|
|
|
|
|
2011-09-18 08:57:17 +08:00
|
|
|
# Choose the right MinGW toolchain prefix
|
|
|
|
if (NOT DEFINED MINGW_TOOLCHAIN_PREFIX)
|
2012-08-28 02:58:27 +08:00
|
|
|
if(ARCH STREQUAL "i386")
|
2011-09-18 08:57:17 +08:00
|
|
|
|
2013-02-07 06:10:51 +08:00
|
|
|
if(CMAKE_HOST_WIN32)
|
2011-09-18 08:57:17 +08:00
|
|
|
set(MINGW_TOOLCHAIN_PREFIX "" CACHE STRING "MinGW Toolchain Prefix")
|
|
|
|
else()
|
2012-12-15 05:56:11 +08:00
|
|
|
if(NOT $ENV{_ROSBE_VERSION} VERSION_LESS 2.1)
|
|
|
|
set(MINGW_TOOLCHAIN_PREFIX "i686-w64-mingw32-" CACHE STRING "MinGW-W64 Toolchain Prefix")
|
|
|
|
else()
|
|
|
|
set(MINGW_TOOLCHAIN_PREFIX "mingw32-" CACHE STRING "MinGW Toolchain Prefix")
|
|
|
|
endif()
|
|
|
|
endif()
|
2011-09-18 08:57:17 +08:00
|
|
|
|
2012-08-28 02:58:27 +08:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
2011-09-18 08:57:17 +08:00
|
|
|
set(MINGW_TOOLCHAIN_PREFIX "x86_64-w64-mingw32-" CACHE STRING "MinGW Toolchain Prefix")
|
2012-08-28 02:58:27 +08:00
|
|
|
elseif(ARCH STREQUAL "arm")
|
2011-09-18 08:57:17 +08:00
|
|
|
set(MINGW_TOOLCHAIN_PREFIX "arm-mingw32ce-" CACHE STRING "MinGW Toolchain Prefix")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT DEFINED MINGW_TOOLCHAIN_SUFFIX)
|
|
|
|
set(MINGW_TOOLCHAIN_SUFFIX "" CACHE STRING "MinGW Toolchain Suffix")
|
2011-05-16 21:12:07 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_CCACHE)
|
|
|
|
set(CCACHE "ccache" CACHE STRING "ccache")
|
|
|
|
else()
|
|
|
|
set(CCACHE "" CACHE STRING "ccache")
|
|
|
|
endif()
|
|
|
|
|
2011-06-13 18:36:40 +08:00
|
|
|
# The name of the target operating system
|
2011-05-16 21:12:07 +08:00
|
|
|
set(CMAKE_SYSTEM_NAME Windows)
|
|
|
|
set(CMAKE_SYSTEM_PROCESSOR i686)
|
|
|
|
|
2011-09-18 08:57:17 +08:00
|
|
|
# Which tools to use
|
2011-09-28 05:21:59 +08:00
|
|
|
set(CMAKE_C_COMPILER ${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX})
|
|
|
|
set(CMAKE_CXX_COMPILER ${MINGW_TOOLCHAIN_PREFIX}g++${MINGW_TOOLCHAIN_SUFFIX})
|
2011-09-18 08:57:17 +08:00
|
|
|
set(CMAKE_ASM_COMPILER ${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX})
|
2011-09-28 19:13:53 +08:00
|
|
|
set(CMAKE_ASM_COMPILER_ID "GNU")
|
2011-09-18 08:57:17 +08:00
|
|
|
set(CMAKE_MC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windmc)
|
|
|
|
set(CMAKE_RC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windres)
|
|
|
|
set(CMAKE_DLLTOOL ${MINGW_TOOLCHAIN_PREFIX}dlltool)
|
2014-08-15 19:17:16 +08:00
|
|
|
#set(CMAKE_AR ${MINGW_TOOLCHAIN_PREFIX}gcc-ar${MINGW_TOOLCHAIN_SUFFIX})
|
2011-05-16 21:12:07 +08:00
|
|
|
|
2014-08-15 19:12:09 +08:00
|
|
|
set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> crT <TARGET> <LINK_FLAGS> <OBJECTS>")
|
2013-11-02 21:56:47 +08:00
|
|
|
set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
|
|
|
|
set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
|
2011-06-02 06:18:48 +08:00
|
|
|
|
2011-06-13 18:36:40 +08:00
|
|
|
# Don't link with anything by default unless we say so
|
2011-05-16 21:12:07 +08:00
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C Libraries")
|
|
|
|
|
|
|
|
#MARK_AS_ADVANCED(CLEAR CMAKE_CXX_STANDARD_LIBRARIES)
|
2014-02-02 19:11:53 +08:00
|
|
|
set(CMAKE_CXX_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C++ Libraries")
|
2011-05-16 21:12:07 +08:00
|
|
|
|
2011-09-18 08:57:17 +08:00
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import")
|
2012-02-26 06:01:20 +08:00
|
|
|
|
|
|
|
# Get GCC version
|
|
|
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
|