-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
281 lines (219 loc) · 9.41 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
#GLOBAL CMAKE SETTINGS
set (CMAKE_VERBOSE_MAKEFILE 0)
set (tester ${CMAKE_CURRENT_SOURCE_DIR}/Testing/scripts/tester.sh)
MESSAGE(STATUS " TESTER: ${tester}")
################################################################################
#DEBUG INFO #MESSAGE(STATUS "DEB CXX ${CMAKE_CXX_FLAGS_DEBUG}")
#MESSAGE(STATUS "REL CXX ${CMAKE_CXX_FLAGS_RELEASE}")
#MESSAGE(STATUS "DEB C ${CMAKE_C_FLAGS_DEBUG}")
#MESSAGE(STATUS "REL C ${CMAKE_C_FLAGS_RELEASE}")
#MESSAGE(STATUS "NONE LINK ${CMAKE_EXE_LINKER_FLAGS}") #MESSAGE(STATUS "REL LINK ${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
#MESSAGE(STATUS "DEB LINK ${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
################################################################################
#Determining processor type, works only unix systems
FIND_PROGRAM(CMAKE_UNAME uname
PATHS
/bin
/usr/bin
/usr/local/bin
/usr/pkg/bin
/usr/pkg/usr/bin )
IF (UNIX AND NOT WIN32)
IF (CMAKE_UNAME)
EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR)
MESSAGE (STATUS "CMAKE_SYSTEM_PROCESSOR- " ${CMAKE_SYSTEM_PROCESSOR})
ENDIF (CMAKE_UNAME)
ENDIF (UNIX AND NOT WIN32)
#ON 64 bit processor in debug mode you can do code coverage or have shared library never both of them
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_|amd)64" )
IF (CMAKE_BUILD_TYPE MATCHES "Debug" )
IF (USER_COVERAGE)
SET (DO_NOT_BUILD_SHARED 1)
ENDIF (USER_COVERAGE)
ENDIF (CMAKE_BUILD_TYPE MATCHES "Debug" )
ENDIF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_|amd)64" )
################################################################################
#BUILD FLAGS DEFINITIONS
SET(WARNING_FLAGS_COMMON "-Wall -Wunused-function -Wwrite-strings -Wformat -Wformat-security -Wparentheses -Wsequence-point -Wno-system-headers -Werror")
SET(WARNING_CFLAGS_COMMON "${WARNING_FLAGS_COMMON}")
SET(WARNING_CXXFLAGS_COMMON "${WARNING_FLAGS_COMMON} -Wno-deprecated")
SET(WARNING_CFLAGS_RELEASE "${WARNING_CFLAGS_COMMON} -Wuninitialized -Winit-self ")
SET(WARNING_CFLAGS_DEBUG "${WARNING_CFLAGS_COMMON}")
SET(WARNING_CXXFLAGS_RELEASE "${WARNING_CXXFLAGS_COMMON} -Wuninitialized -Winit-self")
SET(WARNING_CXXFLAGS_DEBUG "${WARNING_CXXFLAGS_COMMON}")
SET(DEBUG_LINKER_FLAGS " -fPIC")
SET(DEBUG_LINKER_FLAGS_COVERAGE "${DEBUG_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
SET(DEBUG_C_FLAGS "${DEBUG_LINKER_FLAGS} -g -O0 -fstack-protector-all ${WARNING_CFLAGS_DEBUG}")
SET(DEBUG_C_FLAGS_COVERAGE "${DEBUG_LINKER_FLAGS_COVERAGE} -g -O0 ${WARNING_CFLAGS_DEBUG} " )
SET(DEBUG_CPP_FLAGS "${DEBUG_LINKER_FLAGS} -g -O0 -fstack-protector-all ${WARNING_CXXFLAGS_DEBUG}" )
SET(DEBUG_CPP_FLAGS_COVERAGE "${DEBUG_LINKER_FLAGS_COVERAGE} -g -O0 ${WARNING_CXXFLAGS_DEBUG} " )
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_|amd)64" )
IF (USER_COVERAGE)
SET(CMAKE_CXX_FLAGS_DEBUG ${DEBUG_CPP_FLAGS_COVERAGE})
SET(CMAKE_C_FLAGS_DEBUG ${DEBUG_C_FLAGS_COVERAGE})
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG ${DEBUG_LINKER_FLAGS_COVERAGE})
ELSE (USER_COVERAGE)
SET(CMAKE_CXX_FLAGS_DEBUG ${DEBUG_CPP_FLAGS})
SET(CMAKE_C_FLAGS_DEBUG ${DEBUG_C_FLAGS})
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG ${DEBUG_LINKER_FLAGS})
ENDIF (USER_COVERAGE)
ELSE (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_|amd)64" )
SET(CMAKE_CXX_FLAGS_DEBUG ${DEBUG_CPP_FLAGS_COVERAGE})
SET(CMAKE_C_FLAGS_DEBUG ${DEBUG_C_FLAGS_COVERAGE})
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG ${DEBUG_LINKER_FLAGS_COVERAGE})
ENDIF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_|amd)64" )
SET(CMAKE_CXX_FLAGS_RELEASE "-fPIC -O2 -DNDEBUG ${WARNING_CXXFLAGS_RELEASE}")
SET(CMAKE_C_FLAGS_RELEASE "-fPIC -O2 -DNDEBUG ${WARNING_CFLAGS_RELEASE}")
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "-fPIC")
#BUILD TYPE DEFINITION
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Debug)
ENDIF(NOT CMAKE_BUILD_TYPE)
MESSAGE(STATUS "CURRNET BUILD TYPE -- ${CMAKE_BUILD_TYPE}")
################################################################################
cmake_minimum_required (VERSION 2.6)
#Definitions for packaging
project (LoXiM)
set (LoXiM_VERSION_MAJOR 0)
set (LoXiM_VERSION_MINOR 01)
set (GLOBAL_DEPENDS_DEBUG_MODE 1)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Obcject oriented semistructual DBMS")
SET(CPACK_PACKAGE_VENDOR "Grzegorz Timoszuk")
SET(CPACK_PACKAGE_CONTACT "Grzegorz Timoszuk gtimoszuk@gmail.com")
#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "01")
#SET(CPACK_PACKAGE_VERSION_PATCH "2")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "LoXiM-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
MESSAGE (STATUS "CPACK_SOURCE_INGNORE_FILES ${CPACK_SOURCE_INGNORE_FILES}")
SET(CPACK_SOURCE_IGNORE_FILES ${CPACK_SOURCE_IGNORE_FILES} CMakeFiles/ CMakeCache.txt _CPack_Packages .svn/ CPackConfig.cmake DartConfiguration.tcl CPackSourceConfig.cmake LoXiM-0.01.1* Protogen/ lw_protogen/ cmake_install.cmake CTestTestfile.cmake install_manifest.txt "\\\\.swp$" "~$" "\\\\.a$" "\\\\.tmp$" loxim_server lsbql )
MESSAGE (STATUS "CPACK_SOURCE_INGNORE_FILES ${CPACK_SOURCE_INGNORE_FILES}")
#path to addtional modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeScripts")
#set(INCDIR
# ${CMAKE_SOURCE_DIR}/src/
# ${CMAKE_SOURCE_DIR}/src/AdminParser/
# ${CMAKE_SOURCE_DIR}/src/ARIESLog/
# ${CMAKE_SOURCE_DIR}/src/CBindings/
# ${CMAKE_SOURCE_DIR}/src/Client/
# ${CMAKE_SOURCE_DIR}/src/config/
# ${CMAKE_SOURCE_DIR}/src/Errors/
# ${CMAKE_SOURCE_DIR}/src/Indexes/
# ${CMAKE_SOURCE_DIR}/Lock/
# ${CMAKE_SOURCE_DIR}/Log/
# ${CMAKE_SOURCE_DIR}/Protocol/
# ${CMAKE_SOURCE_DIR}/Protocol/Enums/
# ${CMAKE_SOURCE_DIR}/Protocol/Packages/
# ${CMAKE_SOURCE_DIR}/Protocol/Packages/Data/
# ${CMAKE_SOURCE_DIR}/Protocol/Streams/
# ${CMAKE_SOURCE_DIR}/QueryExecutor/
# ${CMAKE_SOURCE_DIR}/QueryParser/
# ${CMAKE_SOURCE_DIR}/Server/
# ${CMAKE_SOURCE_DIR}/Store/
# ${CMAKE_SOURCE_DIR}/SystemStats/
# ${CMAKE_SOURCE_DIR}/TransactionManager/
# ${CMAKE_SOURCE_DIR}/Util/
# ${CMAKE_SOURCE_DIR}/TypeCheck/)
################################################################################
#programs and libs required by LoXiM to build
set(READLINE_DIR "${CMAKE_SOURCE_DIR}/CMakeScripts/")
find_package(READLINE REQUIRED)
find_program(BISON_EXECUTABLE bison
PATHS
/usr/bin
/bin
/usr/pkg/bin
/usr/pkg/usr/bin)
find_program(FLEX_EXECUTABLE flex
PATHS
/usr/bin
/bin
/usr/pkg/bin
/usr/pkg/usr/bin)
if(BISON_EXECUTABLE)
MESSAGE (STATUS "bison found -- ${BISON_EXECUTABLE}")
else (BISON_EXECUTABLE)
MESSAGE (FATAL_ERROR "bison NOT found")
endif (BISON_EXECUTABLE)
if(FLEX_EXECUTABLE)
MESSAGE (STATUS "flex found -- ${FLEX_EXECUTABLE}")
else (FLEX_EXECUTABLE)
MESSAGE (FATAL_ERROR "flex NOT found")
endif(FLEX_EXECUTABLE)
SET (CMAKE_PREFIX_PATH "/usr/pkg/qt4")
find_package(Qt4)
SET (CMAKE_PREFIX_PATH "")
###############################################################################
#Libraries needed by googletest - unit testing framework
set(GOOGLETEST_DIR "${CMAKE_SOURCE_DIR}/CMakeScripts/")
find_package(GOOGLETEST)
include(FindPythonInterp)
include(FindPythonLibs)
find_package (PythonInterp)
find_package (PythonLibs)
if (PYTHONINTERP_FOUND)
MESSAGE(STATUS "python found -- ${PYTHON_EXECUTABLE}")
endif (PYTHONINTERP_FOUND)
if (PYTHONLIBS_FOUND)
MESSAGE(STATUS "python libs -- ${PYTHON_LIBRARIES}, includes ${PYTHON_INCLUDE_PATH}")
endif ( PYTHONLIBS_FOUND )
if ( GOOGLETEST_FOUND )
if ( PYTHONINTERP_FOUND )
if ( PYTHONLIBS_FOUND )
if ( ${CMAKE_BUILD_TYPE} MATCHES "Debug" )
SET ( G_UNIT_TESTS_ENABLED 1 )
# MESSAGE(STATUS "HHHHHHHUUUUUUUUURRRRA")
endif ( ${CMAKE_BUILD_TYPE} MATCHES "Debug" )
endif ( PYTHONLIBS_FOUND )
endif ( PYTHONINTERP_FOUND )
endif ( GOOGLETEST_FOUND )
################################################################################
#Libraries and programs used during optmimalization tests
set(TCMALLOC_DIR "${CMAKE_SOURCE_DIR}/CMakeScripts/")
find_package(TCMALLOC)
if ( USE_TCMALLOC )
if ( TCMALLOC_FOUND )
SET ( G_PERF_TOOLS_TESTS_ENABLED 1 )
endif ( TCMALLOC_FOUND )
endif ( USE_TCMALLOC )
find_program(VALGRIND_EXECUTABLE valgrind valgrind.bin
PATHS
/usr/bin
/bin
/usr/pkg/bin
/usr/pkg/usr/bin)
if(VALGRIND_EXECUTABLE)
MESSAGE(STATUS "Found valgrind -- ${VALGRIND_EXECUTABLE}")
SET ( VALGRING_TESTS_ENABLED 1 )
else (VALGRIND_EXECUTABLE)
MESSAGE(STATUS "Valgrind not found")
endif(VALGRIND_EXECUTABLE)
if ( G_PERF_TOOLS_TESTS_ENABLED )
if ( VALGRING_TESTS_ENABLED )
SET ( VALGRING_TESTS_ENABLED 0 )
endif ( VALGRING_TESTS_ENABLED )
endif ( G_PERF_TOOLS_TESTS_ENABLED )
###############################################################################
include (CPack)
include (CTest)
include (CheckCSourceCompiles)
enable_testing()
#recursive build for subdirectiories
if (FLEX_EXECUTABLE)
if(BISON_EXECUTABLE)
add_subdirectory (src)
add_subdirectory (Documentation)
add_subdirectory (Testing)
endif (BISON_EXECUTABLE)
endif (FLEX_EXECUTABLE)
################################################################################
#CMAKE DEBUG INFO
MESSAGE(STATUS "DEB CXX ${CMAKE_CXX_FLAGS_DEBUG}")
MESSAGE(STATUS "REL CXX ${CMAKE_CXX_FLAGS_RELEASE}")
MESSAGE(STATUS "DEB C ${CMAKE_C_FLAGS_DEBUG}")
MESSAGE(STATUS "REL C ${CMAKE_C_FLAGS_RELEASE}")
MESSAGE(STATUS "NONE LINK ${CMAKE_EXE_LINKER_FLAGS}")
MESSAGE(STATUS "REL LINK ${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
MESSAGE(STATUS "DEB LINK ${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
################################################################################