-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
95 lines (79 loc) · 3.54 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
PROJECT(Engine)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(ENGINE_NAME "engine" CACHE STRING "Engine name")
SET(COMMONLIB_NAME "CommonLib" CACHE STRING "CommonLib name")
SET(GAME_NAME "test" CACHE STRING "Game name")
SET(COMPANY_NAME "testcompany" CACHE STRING "Company name")
SET(ENGINESRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/enginesrc" CACHE STRING "Engine source directory")
SET(FRAMEWORKSRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/frameworksrc" CACHE STRING "Framework source directory")
SET(COMMONLIB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/CommonLibSrc" CACHE STRING "CommonLib source directory")
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_scripts")
MARK_AS_ADVANCED(COMMONLIB_NAME)
MARK_AS_ADVANCED(ENGINE_NAME)
MARK_AS_ADVANCED(ENGINESRC_DIR)
#SET(Boost_USE_STATIC_LIBS ON)
#SET(Boost_USE_MULTITHREADED ON)
#SET(Boost_ADDITIONAL_VERSIONS "1.40" "1.40.0")
#FIND_PACKAGE(Boost 1.36.0 COMPONENTS thread signals date_time regex filesystem REQUIRED)
#FIND_PACKAGE(OIS REQUIRED)
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
ADD_CUSTOM_TARGET(docs ${DOXYGEN_EXECUTABLE} "${CMAKE_SOURCE_DIR}/doxygen.conf" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Generating engine's documentation")
ELSE(DOXYGEN_FOUND)
ADD_CUSTOM_TARGET(docs COMMENT "Doxygen not found.")
ENDIF(DOXYGEN_FOUND)
INCLUDE("CheckTypeSize")
CHECK_TYPE_SIZE("wchar_t" "WCHAR_SIZE")
# System specific setup
IF(WIN32)
IF(MSVC)
# This option is to enable the /MP switch for Visual Studio 2005 and above compilers
OPTION(WIN32_USE_MP "Set to ON to build projects with the /MP option (Visual Studio 2005 and above)." OFF)
MARK_AS_ADVANCED(WIN32_USE_MP)
IF(WIN32_USE_MP)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
ENDIF(WIN32_USE_MP)
# Disable exceptions handling
STRING(REGEX REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# Disable RTTI
STRING(REGEX REPLACE "/GR+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
LIST(APPEND COMMON_DEFINITIONS "BOOST_NO_TYPEID")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
# Turn off various warnings
# 4530 - C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
# C++ exception handling was used but /EHsc was not selected.
FOREACH(WARNING 4530 4251)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd${WARNING}")
ENDFOREACH(WARNING)
# More MSVC specific compilation flags
LIST(APPEND COMMON_DEFINITIONS "_SCL_SECURE_NO_WARNINGS")
LIST(APPEND COMMON_DEFINITIONS "_CRT_SECURE_NO_DEPRECATE")
LIST(APPEND COMMON_DEFINITIONS "_UNICODE")
LIST(APPEND COMMON_DEFINITIONS "UNICODE")
LIST(APPEND COMMON_DEFINITIONS "MSVC")
ENDIF(MSVC)
LIST(APPEND COMMON_DEFINITIONS "WINDOWS")
ENDIF(WIN32)
IF(UNIX)
LIST(APPEND COMMON_DEFINITIONS "UNIX")
ENDIF(UNIX)
FIND_PACKAGE(OpenMP)
IF(OPENMP_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
ENDIF(OPENMP_FOUND)
LIST(APPEND COMMON_DEFINITIONS "WCHAR_SIZE=${WCHAR_SIZE}")
LIST(APPEND COMMON_DEFINITIONS "ENGINE_NAME=\"${ENGINE_NAME}\"")
LIST(APPEND COMMON_DEFINITIONS "COMPANY_NAME=\"${COMPANY_NAME}\"")
LIST(APPEND COMMON_DEFINITIONS "GAME_NAME=\"${GAME_NAME}\"")
INCLUDE("CMakeListsCommonLib.txt")
#INCLUDE("CMakeListsEngine.txt")
#INCLUDE("CMakeListsFramework.txt")
#INCLUDE("CMakeListsRendererDirectX.txt")
#INCLUDE("CMakeListsRendererOpenGL.txt")
SET(COMMONLIBTESTSRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/CommonLibTestSrc")
SET(TEST_NAME "test")
SET(COMMONLIBTEST_NAME "Test")
INCLUDE("CMakeListsCommonLibTest.txt")
SOURCE_GROUP("" REGULAR_EXPRESSION ".*")
# EOF