This repository has been archived by the owner on Oct 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
210 lines (165 loc) · 5.92 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# ----------------------------------------------------------------------------
# prepare
cmake_minimum_required(VERSION 2.8.8)
set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# ============================================================================
# ----------------------------------------------------------------------------
# customisation
set ( PROJECT_NAME aitown )
# ============================================================================
# ----------------------------------------------------------------------------
# configure the project
project(${PROJECT_NAME})
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_U)
string(TIMESTAMP ${PROJECT_NAME}_BUILD_TIME UTC)
# may be either Release or Debug
if ( CMAKE_BUILD_TYPE STREQUAL "" )
set ( CMAKE_BUILD_TYPE "Release" )
endif (CMAKE_BUILD_TYPE STREQUAL "")
# the version as known to CMake
set ( ${PROJECT_NAME}_MAJOR_VERSION 1)
set ( ${PROJECT_NAME}_MINOR_VERSION 0)
set ( ${PROJECT_NAME}_PATCH_VERSION 0)
set ( ${PROJECT_NAME}_VERSION
"${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_VERSION}")
# set some paths
set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/build/bin" )
set ( EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/build/bin" )
set ( LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/build/lib" )
set ( INCLUDE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/build/include/${PROJECT_NAME}" )
include_directories(
"${PROJECT_SOURCE_DIR}"
"${PROJECT_BINARY_DIR}/build/include"
)
if (WIN32)
# set stuff for windows
add_definitions( -DAITOWN_WIN32=1 )
else (WIN32)
# set stuff for other systems
endif (WIN32)
# configure compiler
if ( CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake)" )
add_definitions(/W4)
else ( CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake)" )
add_definitions(-Wall)
endif()
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions( -DQT_DEBUG=1 -DAITOWN_DEBUG=1 -D_DEBUG=1 )
set ( DebugLogEnabled true )
else (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions( -DQT_NO_DEBUG=1 -DAITOWN_NO_DEBUG=1 -D_NDEBUG=1 )
set ( DebugLogEnabled false )
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
set ( CMAKE_DEBUG_POSTFIX "_debug")
# Find includes in corresponding build directories
set ( CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set ( CMAKE_AUTOMOC ON)
# accumulate testing source files
set (modules_testing_src)
# ============================================================================
# ----------------------------------------------------------------------------
# external libraries
# enable_language(Fortran REQUIRED)
find_package(OGRE)
include_directories(${OGRE_INCLUDE_DIRS})
find_package(ZeroMQ REQUIRED)
include_directories(${ZEROMQ_INCLUDE_DIRS})
find_package(ArgTable REQUIRED)
include_directories(${ARGTABLE_INCLUDE_DIRS})
find_package(ProtobufC REQUIRED)
include_directories(${PROTOBUFC_INCLUDE_DIR})
find_package(KyotoCabinet)
include_directories(${KYOTOCABINET_INCLUDE_DIR})
find_package(TokyoCabinet)
include_directories(${TOKYOCABINET_INCLUDE_DIR})
find_package(MySQL)
include_directories(${MYSQL_INCLUDE_DIR})
# -DBLA_VENDOR=ATLAS,Goto, etc; see FindBLASS.cmake
# sets BLAS_LIBRARIES; BLAS_INCLUDE_DIRS not set
find_package(BLAS REQUIRED)
#include_directories(${BLAS_INCLUDE_DIRS})
#message (${BLAS_LIBRARIES})
# -DCMAKE_BUILD_TYPE=Debug -DBLA_VENDOR=ATLAS
add_subdirectory( "googletest" )
include_directories(googletest/include)
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()
# ============================================================================
add_definitions(-DUSE_KYOTO_CABINET=1)
# ----------------------------------------------------------------------------
# configure a header file to pass some of the CMake settings
# to the source code
configure_file (
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_BINARY_DIR}/build/include/aitown/config.h"
)
# ============================================================================
# ----------------------------------------------------------------------------
# modules
set ( lib_modules
"aitown-utils"
"aitown-cfg"
"aitown-core"
"aitown-plugin"
"aitown-dstorage"
"aitown-image"
"aitown-db"
"aitown-compress"
"aitown-dejavu"
)
set ( modules
"ccan"
"sglib"
"inih"
"cfgpath"
"kdtree"
${lib_modules}
"aitown-index"
"aitown-client"
"aitown-server"
)
# generated libraries are accumulated in modules_libs
FOREACH ( mod ${modules} )
add_subdirectory( "${mod}" )
ENDFOREACH(mod)
# ============================================================================
# ----------------------------------------------------------------------------
# internal tests
add_subdirectory( "tests" )
list( REMOVE_DUPLICATES modules_testing_src )
if (modules_testing_src)
add_executable(internal-test
${modules_testing_src}
)
target_link_libraries ( internal-test
${lib_modules}
gtest_main gtest
${KYOTOCABINET_LIBRARIES}
cfgpath
)
set ( props "AITOWN_INTERNAL_TESTS=1")
set_target_properties ( internal-test
PROPERTIES COMPILE_DEFINITIONS "${props}"
)
endif (modules_testing_src)
# ============================================================================
# ----------------------------------------------------------------------------
# documentation
find_package(Doxygen)
configure_file (
"${PROJECT_SOURCE_DIR}/Doxyfile.in"
"${PROJECT_BINARY_DIR}/Doxyfile"
@ONLY
)
if(DOXYGEN_FOUND)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
# ============================================================================