-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
130 lines (107 loc) · 3.62 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
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
project(KappaDBMS)
set(BUILD_MAJOR "0")
set(BUILD_MINOR "0")
set(BUILD_VERSION "1")
set(BUILD_VERSION ${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_VERSION})
set(EXECUTABLE kappa)
set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_BINARY_DIR}/../src)
set(src ${CMAKE_CURRENT_SOURCE_DIR})
set(lib ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(dir ${CMAKE_BINARY_DIR}/bin)
set(lib_cmake ${CMAKE_BINARY_DIR}/../cmake)
set(EXECUTABLE_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE)
set(LIBRARY_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE)
set(LIBRARY_OUTPUT_DIRECTORY ${dir})
set(CMAKE_LIBRARY_OUTPUT_PATH ${dir})
set(CMAKE_ARCHIVE_OUTPUT_PATH ${dir})
set(CMAKE_RUNTIME_OUTPUT_PATH ${dir})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${dir})
set(CMAKE_BUILD_FILES_DIRECTORY ${dir})
set(CMAKE_BUILD_DIRECTORY ${dir})
set(CMAKE_CACHEFILE_DIR ${dir})
set(CMAKE_BINARY_DIR ${dir})
set(CMAKE_CURRENT_BINARY_DIR ${dir})
set(PROJECT_BINARY_DIR ${dir})
# set(CMAKE_C_COMPILER gcc)
# set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb3 -std=c++14") # -Wall -Wextra -Werror
# OS and compiler checks.
if(UNIX)
# linux / normal unix
add_definitions(-D_LINUX)
if(CYGWIN)
# Special Cygwin stuff here
elseif(APPLE)
# Special Apple stuff here
remove_definitions(-D_LINUX)
add_definitions(-D_DARWIN)
endif()
elseif(WIN32)
add_definitions(-DWIN32)
if(MINGW)
# Special MINGW stuff here
elseif(MSVC)
# Special MSVC stuff here
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
else()
# No idea what it is, but there's a good chance it's too weird.
MESSAGE( FATAL_ERROR "Using unknown WIN32 compiler... NOT. Please add to build system." )
endif()
endif()
option(BUILD_PARSER "Build PARSER" ON)
option(BUILD_STORAGE "Build STORAGE" ON)
option(BUILD_DRIVER "Build DRIVER" ON)
option(BUILD_SERVER "Build SERVER" ON)
option(BUILD_TESTS "Build TESTS" ON)
option(COVERALLS "Turn on coveralls" ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${PROJECT_SOURCE_DIR}/coveralls-cmake/cmake)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}:${dir})
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}:${lib}/clsocket)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}:${lib}/cppfs)
include_directories(
${lib}/ctpl
${lib}/clsocket/src
${lib}/cppfs/source/cppfs/include
)
set(OPTION_BUILD_TESTS OFF)
set(CLSOCKET_DEP_ONLY ON)
add_subdirectory(${lib}/cppfs)
add_subdirectory(${lib}/clsocket)
add_subdirectory(${lib}/googletest)
set(LINK_LIBS clsocket cppfs pthread)
if (BUILD_PARSER)
add_subdirectory(${src}/parser)
list(APPEND LINK_LIBS parser)
endif(BUILD_PARSER)
unset(BUILD_PARSER CACHE)
if (BUILD_STORAGE)
add_subdirectory(${src}/storage)
list(APPEND LINK_LIBS storage)
endif(BUILD_STORAGE)
unset(BUILD_STORAGE CACHE)
if (BUILD_DRIVER)
add_subdirectory(${src}/driver)
list(APPEND LINK_LIBS driver)
endif(BUILD_DRIVER)
unset(BUILD_DRIVER CACHE)
###############tests part <----------- VOVA, IT's URS
if (BUILD_TESTS)
add_subdirectory(tests)
endif(BUILD_TESTS)
unset(BUILD_TESTS CACHE)
if (BUILD_SERVER)
file(GLOB_RECURSE SRC_SERVER . ${src}/server/*.cpp)
add_executable(${EXECUTABLE} ${src}/main.cpp ${SRC_SERVER})
set_target_properties(${EXECUTABLE} PROPERTIES VERSION ${BUILD_VERSION} SOVERSION ${BUILD_MAJOR})
target_link_libraries(${EXECUTABLE} ${LINK_LIBS})
target_include_directories(${EXECUTABLE} PUBLIC
${src}/
${src}/include
)
endif()