-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
120 lines (102 loc) · 3.65 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Author: [email protected] (Petter Strandmark)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
PROJECT(MCTS C CXX)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# Default locations to search for on various platforms.
LIST(APPEND SEARCH_LIBS /usr/lib)
LIST(APPEND SEARCH_LIBS /usr/local/lib)
LIST(APPEND SEARCH_LIBS /usr/local/homebrew/lib) # Mac OS X
LIST(APPEND SEARCH_LIBS /opt/local/lib)
LIST(APPEND SEARCH_HEADERS /usr/include)
LIST(APPEND SEARCH_HEADERS /usr/local/include)
LIST(APPEND SEARCH_HEADERS /usr/local/homebrew/include) # Mac OS X
LIST(APPEND SEARCH_HEADERS /opt/local/include)
ENABLE_TESTING()
# Change the default build type from Debug to Release, while still
# supporting overriding the build type.
#
# The CACHE STRING logic here and elsewhere is needed to force CMake
# to pay attention to the value of these variables.
IF (NOT CMAKE_BUILD_TYPE)
MESSAGE("-- No build type specified; defaulting to CMAKE_BUILD_TYPE=Release.")
# SET(CMAKE_BUILD_TYPE Release CACHE STRING
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF (NOT CMAKE_BUILD_TYPE)
# C++11 support.
include(EnableCPP11.cmake)
SET (MY_LIBRARY_DEPENDENCIES)
# Multithreading using OpenMP
OPTION(OPENMP
"Enable multi-threading (requires OpenMP)"
ON)
IF (${OPENMP})
FIND_PACKAGE(OpenMP)
IF(${OPENMP_FOUND})
MESSAGE("-- Found OpenMP.")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
ADD_DEFINITIONS(-DUSE_OPENMP)
IF (NOT MSVC)
# OpenMP needs to be included as a library on some platforms.
LIST(APPEND MY_LIBRARY_DEPENDENCIES gomp)
ENDIF (NOT MSVC)
ELSE(${OPENMP_FOUND})
MESSAGE("-- Can't find OpenMP. Continuing without it.")
ENDIF(${OPENMP_FOUND})
ENDIF (${OPENMP})
#SET(USE_CINDER ON)
#FIND_PATH(CINDER_INCLUDE NAMES cinder/Cinder.h PATHS ${SEARCH_HEADERS})
#IF (NOT EXISTS ${CINDER_INCLUDE})
# MESSAGE("-- Did not find Cinder include directory.")
# SET(USE_CINDER OFF)
#ELSE()
# MESSAGE("-- Found Cinder include directory.")
#ENDIF()
#FIND_LIBRARY(CINDER_LIB cinder)
#IF (NOT EXISTS ${CINDER_LIB})
# MESSAGE("-- Did not find the Cinder library.")
# SET(USE_CINDER OFF)
#ELSE()
# MESSAGE("-- Found the Cinder library.")
#ENDIF()
#
# gcc settings.
#
IF (CMAKE_COMPILER_IS_GNUCXX)
# No warnings for C. The Meschach library contains really old code.
# -fPIC for building a shared library.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -fpic")
ENDIF (CMAKE_COMPILER_IS_GNUCXX)
#
# Clang settings
#
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -fpic")
ENDIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
#
# MSVC settings
#
IF (MSVC)
# Disable deprecation warning for standard functions.
ADD_DEFINITIONS("/wd4996")
# To get rid of annoying min and max macros if windows.h
# is included.
ADD_DEFINITIONS("-DNOMINMAX=1")
ADD_DEFINITIONS("-D_VARIADIC_MAX=6")
ENDIF (MSVC)
#
# Include directories
#
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
INCLUDE_DIRECTORIES(third-party/Catch)
IF (${USE_CINDER})
MESSAGE("-- Will be using Cinder.")
INCLUDE_DIRECTORIES(${CINDER_INCLUDE})
ENDIF()
FILE(GLOB MCTS_HEADERS ${CMAKE_SOURCE_DIR}/*.h)
ADD_SUBDIRECTORY(games)
#ADD_SUBDIRECTORY(tests)