-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
77 lines (67 loc) · 2.7 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
cmake_minimum_required(VERSION 3.4)
project(Gradido_Node C CXX)
add_definitions("-pthread" "-g")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
# TODO: require 64 bit arch
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE git_hash)
add_definitions(-DGIT_HASH_VERSION=${git_hash})
# protoc generated header files cause some warnings about deprecation
add_compile_options(-Wno-deprecated-declarations)
set(CMAKE_CXX_COMPILER_LAUNCHER ccache)
include_directories(
"lib/include"
"proto_gen"
"src"
)
link_directories(
"lib"
"build"
)
FILE(GLOB LOCAL_SRC "src/*.cpp" "src/*.c" "src/*.h")
FILE(GLOB GRADIDO_MATH "src/gradidomath/*.c" "src/gradidomath/*.h")
FILE(GLOB PROTOS "proto_gen/*.cc" "proto_gen/*.h")
FILE(GLOB PROTOS_MIRROR "proto_gen/mirror/*.cc" "proto_gen/mirror/*.h")
FILE(GLOB PROTOS_GRADIDO "proto_gen/gradido/*.cc"
"proto_gen/gradido/*.h")
FILE(GLOB UNITTEST_SRC "unittest/*.cpp" "unittest/*.h")
FILE(GLOB JSONRPC "src/json_rpc/*.cpp" "src/json_rpc/*.h")
##### libraries
add_library(gradido_math ${GRADIDO_MATH})
add_library(gradido_proto ${PROTOS} ${PROTOS_MIRROR} ${PROTOS_GRADIDO})
# disabling all warnings as proto file compilation produces them in large
# numbers
target_compile_options(gradido_proto PRIVATE -w)
add_library(gradido_base ${LOCAL_SRC} ${JSONRPC})
##### nodes + tools
file(GLOB APP_SOURCES "src/bins/*.cpp")
foreach(sourcefile ${APP_SOURCES})
file(RELATIVE_PATH filename ${CMAKE_CURRENT_SOURCE_DIR}
${sourcefile})
get_filename_component(file0 ${sourcefile} NAME)
string(REPLACE ".cpp" "" file ${file0})
add_executable(${file} ${filename})
target_link_libraries(${file}
${CMAKE_CURRENT_SOURCE_DIR}/build/libgradido_base.a
${CMAKE_CURRENT_SOURCE_DIR}/build/libgradido_proto.a
${CMAKE_CURRENT_SOURCE_DIR}/build/libgradido_math.a)
target_link_libraries(${file} -lmpfr -lgmp -led25519 -lPocoNet
-lPocoUtil -lPocoJSON -lPocoFoundation -lPocoData -lPocoNetSSL
-lall -ldl -lpthread)
add_dependencies(${file} gradido_proto gradido_base gradido_math)
endforeach(sourcefile ${APP_SOURCES})
##### unit tests
add_executable(unit_tests ${LOCAL_SRC} ${JSONRPC} ${UNITTEST_SRC})
target_link_libraries(unit_tests
${CMAKE_CURRENT_SOURCE_DIR}/build/libgradido_base.a
${CMAKE_CURRENT_SOURCE_DIR}/build/libgradido_proto.a
${CMAKE_CURRENT_SOURCE_DIR}/build/libgradido_math.a)
target_link_libraries(unit_tests -lmpfr -lgmp -led25519
-lPocoNet -lPocoUtil -lPocoJSON -lPocoFoundation -lPocoData
-lPocoNetSSL -lall -ldl -lgmock -lgtest -lgtest_main -lgradido_math
-lpthread)
add_dependencies(unit_tests gradido_proto gradido_base gradido_math)