-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
79 lines (65 loc) · 2.55 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
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(BAND LANGUAGES CXX)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "-Wall")
set(SOCI_CXX_C11 ON)
add_subdirectory(3pc/soci)
find_path(POSTGRESQL_INCLUDE_DIRS
NAMES postgresql/libpq-fe.h
)
set(POSTGRESQL_INCLUDE_DIRS "${POSTGRESQL_INCLUDE_DIRS}/postgresql")
set(${CMAKE_PREFIX_PATH} "~/" ${CMAKE_PREFIX_PATH})
find_package(Boost 1.65.1 COMPONENTS system serialization REQUIRED)
find_package(Protobuf 3.0.0 REQUIRED)
find_package(Sodium REQUIRED)
find_package(CxxTest REQUIRED)
find_package(RocksDB REQUIRED)
include_directories(3pc/spdlog-0.17.0/include)
include_directories(3pc/gsl-0cebbd7/include)
include_directories(3pc/json-3.1.2/include)
include_directories(3pc/optional-lite-3.0.0/include)
include_directories(3pc/better-enum-0.11.1/include)
include_directories(3pc/cxxopts-2.1.1/include)
include_directories(3pc/soci/include)
include_directories(${SOCI_CORE_INCLUDE_DIRS})
include_directories(${SOCI_INCLUDE_DIRS})
include_directories(${SOCI_BUILD_INCLUDE_DIRS})
include_directories(${CONFIG_INCLUDE_DIR})
include_directories(${POSTGRESQL_INCLUDE_DIRS})
include_directories(. src test)
file(GLOB source_files
"src/band/*.h" "src/band/*.cc"
"src/contract/*.h" "src/contract/*.cc"
"src/crypto/*.h" "src/crypto/*.cc"
"src/inc/*.h" "src/inc/*.cc"
"src/listener/*.h" "src/listener/*.cc"
"src/msg/*.h" "src/msg/*.cc"
"src/net/*.h" "src/net/*.cc"
"src/state/*.h" "src/state/*.cc"
"src/store/*.h" "src/store/*.cc"
"src/util/*.h" "src/util/*.cc")
add_library(bandprotocol STATIC
abci/abci.pb.h
abci/abci.pb.cc
${source_files})
target_link_libraries(bandprotocol
${Boost_LIBRARIES}
${Protobuf_LIBRARIES}
${sodium_LIBRARY_RELEASE}
${ROCKSDB_LIBRARIES}
${SOCI_CORE_TARGET}
soci_postgresql)
enable_testing()
file(GLOB test_files "test/*_test.h")
CXXTEST_ADD_TEST(band_test_runner band_test_runner.cc "${test_files}")
target_link_libraries(band_test_runner bandprotocol)
file(GLOB main_files "src/main/*.cc")
foreach(main_file ${main_files})
get_filename_component(executable "${main_file}" NAME)
string(REGEX REPLACE "\\.[^.]*$" "" executable ${executable})
add_executable("${executable}" ${main_file})
target_link_libraries("${executable}" bandprotocol)
endforeach()