-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
89 lines (76 loc) · 2.37 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
cmake_minimum_required(VERSION 3.14)
project(synopsis VERSION 0.8.0 DESCRIPTION "Science Yield improvemeNt via Onboard Prioritization and Summary of Information System")
# GoogleTest requires at least C++11
set(CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_FLAGS "-Wnon-virtual-dtor")
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
FetchContent_Declare(
json
URL https://github.com/nlohmann/json/releases/download/v3.10.5/json.tar.xz
)
FetchContent_MakeAvailable(json)
add_library(synopsis SHARED
src/sqlite3.c
src/Sqlite3Statement.cpp
src/synopsis.cpp
src/ASDS.cpp
src/DpMsg.cpp
src/DpDbMsg.cpp
src/PassthroughASDS.cpp
src/SqliteASDPDB.cpp
src/StdLogger.cpp
src/LinuxClock.cpp
src/Timer.cpp
src/RuleAST.cpp
src/DownlinkPlanner.cpp
src/MaxMarginalRelevanceDownlinkPlanner.cpp
src/Similarity.cpp
)
set_target_properties(synopsis PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(synopsis PROPERTIES PUBLIC_HEADER include/synopsis.hpp)
target_include_directories(synopsis PRIVATE include)
target_include_directories(synopsis PRIVATE src)
target_link_libraries(synopsis PRIVATE nlohmann_json::nlohmann_json ${CMAKE_DL_LIBS})
include(GNUInstallDirs)
install(TARGETS synopsis
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# CLI
add_executable(
synopsis_cli
bin/synopsis_cli.cpp
)
target_include_directories(synopsis_cli PRIVATE include)
target_link_libraries(
synopsis_cli PRIVATE nlohmann_json::nlohmann_json
synopsis
)
# Unit Testing
enable_testing()
add_executable(
synopsis_test
test/synopsis_test.cpp
)
target_include_directories(synopsis_test PRIVATE include)
target_link_libraries(
synopsis_test
gtest_main
synopsis
)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
target_link_libraries(synopsis PRIVATE Threads::Threads)
include(GoogleTest)
gtest_discover_tests(synopsis_test PROPERTIES ENVIRONMENT
"SYNOPSIS_TEST_DATA=${CMAKE_CURRENT_LIST_DIR}/test/data"
)
include(test/CodeCoverage.cmake)
APPEND_COVERAGE_COMPILER_FLAGS()