-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
72 lines (60 loc) · 1.93 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
cmake_minimum_required(VERSION 3.0)
include(${CMAKE_SOURCE_DIR}/system-config.cmake OPTIONAL)
project(mon)
add_subdirectory(third_party/bunsan_cmake)
add_subdirectory(third_party/bunsan_testing)
add_subdirectory(third_party/bunsan_common)
add_subdirectory(third_party/bunsan_protobuf)
add_subdirectory(third_party/bunsan_web)
if(BunsanCMakeBuiltin)
BunsanCMakeLoad()
else()
find_package(BunsanCMake CONFIG REQUIRED)
endif()
bunsan_add_protobuf_cxx_library(
TARGET ${PROJECT_NAME}_pb
PROTOS
mon/server.proto
GRPC
LIBRARIES ${bunsan_common_LIBRARIES}
INCLUDE_DIRECTORIES ${bunsan_common_INCLUDE_DIRS}
INSTALL
)
bunsan_add_library(${PROJECT_NAME}
src/lib/engine.cpp
src/lib/poller.cpp
src/web/monitor.cpp
)
bunsan_use_target(${PROJECT_NAME} ${PROJECT_NAME}_pb)
bunsan_add_executable(${PROJECT_NAME}_server
src/bin/server.cpp
)
bunsan_use_target(${PROJECT_NAME}_server ${PROJECT_NAME})
bunsan_use_bunsan_package(${PROJECT_NAME}_server bunsan_web bunsan_web)
bunsan_use_bunsan_package(${PROJECT_NAME}_server bunsan_protobuf bunsan_protobuf)
target_link_libraries(${PROJECT_NAME}_server PUBLIC cppdb)
if(BunsanWebBuiltin)
BunsanWebLoad()
else()
find_package(BunsanWeb CONFIG REQUIRED)
endif()
bunsan_web_add_skin(${PROJECT_NAME}_skin_plain plain
view/plain/base.tmpl
view/plain/base_form.tmpl
view/plain/error.tmpl
view/plain/edit.tmpl
view/plain/show.tmpl
)
bunsan_use_target(${PROJECT_NAME}_skin_plain ${PROJECT_NAME})
bunsan_add_executable(${PROJECT_NAME}_agent
src/lib/agent.cpp
src/bin/agent.cpp
)
bunsan_use_target(${PROJECT_NAME}_agent ${PROJECT_NAME}_pb)
bunsan_use_bunsan_package(${PROJECT_NAME}_agent bunsan_common bunsan_common)
bunsan_install_headers()
bunsan_install_targets(${PROJECT_NAME} ${PROJECT_NAME}_server ${PROJECT_NAME}_agent)
bunsan_web_install_skins(${PROJECT_NAME}_skin_plain)
bunsan_web_install_static()
bunsan_install_project()
bunsan_include_tests()