forked from mgerhardy/simpleai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
102 lines (85 loc) · 3.06 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
96
97
98
99
100
101
102
cmake_minimum_required(VERSION 2.6)
project(SIMPLEAI C CXX)
include(CheckFunctionExists)
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
set(SIMPLEAI_VERSION "0.1")
option(SIMPLEAI_RUN "Compile run program" ON)
option(SIMPLEAI_TEST "Compile tests" OFF)
option(SIMPLEAI_LUA "Compile with lua support" ON)
option(SIMPLEAI_XML "Compile with xml support" OFF)
option(SIMPLEAI_EXCEPTIONS "Compile with exception support" OFF)
if (${CMAKE_EXTRA_GENERATOR} MATCHES "Eclipse CDT4")
add_definitions(-DCMAKE_CXX_COMPILER_ARG1=-std=c++11)
add_definitions(-DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=TRUE)
add_definitions(-DCMAKE_ECLIPSE_VERSION=4.2)
endif()
find_package(Threads)
option(SIMPLEAI_PROFILER "Use Google cpu profiler" OFF)
if (SIMPLEAI_PROFILER)
FIND_LIBRARY(GOOGLE_PROFILER_LIB profiler)
FIND_LIBRARY(GOOGLE_TCMALLOC_LIB tcmalloc)
if (GOOGLE_PROFILER_LIB AND GOOGLE_TCMALLOC_LIB)
message(STATUS "Found Google profiler: ${GOOGLE_PROFILER_LIB} ${GOOGLE_TCMALLOC_LIB}")
add_definitions(-DAI_PROFILER)
else()
message(STATUS "Can't find Google profiler")
endif()
endif()
if (SIMPLEAI_EXCEPTIONS)
add_definitions(-DAI_EXCEPTIONS=1)
message(STATUS "Build with exception support")
else()
add_definitions(-DLUA_USE_LONGJMP -DAI_EXCEPTIONS=0)
message(STATUS "Build without exception support")
endif()
if (NOT SIMPLEAI_LUA)
set(SIMPLEAI_RUN FALSE)
message(STATUS "Lua is needed for the run tool")
endif()
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
set(CMAKE_CXX_STANDARD_LIBRARIES "kernel32.lib user32.lib wsock32.lib ws2_32.lib wininet.lib")
set(CMAKE_C_STANDARD_LIBRARIES "kernel32.lib user32.lib wsock32.lib ws2_32.lib wininet.lib")
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -ftree-vectorize -msse3 -Wall -Wextra -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0 -DDEBUG -Wall -Wextra -Werror")
if (NOT SIMPLEAI_EXCEPTIONS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
endif()
else()
message(ERROR "unsupported compiler")
endif()
endif()
add_subdirectory(src/ai)
add_subdirectory(src/run)
add_subdirectory(src/test)
add_subdirectory(src/libs)
if (SIMPLEAI_RUN)
message(STATUS "Build the run tool")
else()
message(STATUS "Don't build the run tool - use -DSIMPLEAI_RUN=TRUE to build it")
endif()
if (SIMPLEAI_LUA)
message(STATUS "Build with lua support")
else()
message(STATUS "Don't build with lua support - use -DSIMPLEAI_LUA=TRUE to enable it")
endif()
if (SIMPLEAI_XML)
message(STATUS "Build with XML support")
else()
message(STATUS "Don't build with XML support - use -DSIMPLEAI_XML=TRUE to enable it")
endif()
if (SIMPLEAI_TEST)
message(STATUS "Build the tests")
else()
message(STATUS "Don't build the tests - use -DSIMPLEAI_TEST=TRUE to build it")
endif()
find_program(DOXYGEN "doxygen")
if (DOXYGEN)
message(STATUS "doxygen found")
else()
message(STATUS "doxygen not found")
endif()
# TODO execute doxygen