-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
93 lines (74 loc) · 2.02 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
# CMakeLists.txt
# Copyright (c) 2023 IndoorJson
# Author: Kunlin Yu <[email protected]>
# Create Date: 2023/12/20
cmake_minimum_required(VERSION 3.12)
project(indoorjson-cpp)
### C++ standard
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall --coverage")
# json-schema-validator
find_package(nlohmann_json_schema_validator REQUIRED)
# libgeos
find_package(GEOS REQUIRED)
add_compile_definitions(USE_UNSTABLE_GEOS_CPP_API)
# gtest
find_package(GTest REQUIRED)
# glog
find_package(glog REQUIRED)
if(WIN32)
add_compile_definitions(GLOG_NO_ABBREVIATED_SEVERITIES)
endif()
### include
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_INCLUDE_PATH})
### source code
set(SOURCE_CODE
src/serialization/feature.cpp
src/serialization/cell_space.cpp
src/serialization/cell_boundary.cpp
src/serialization/node.cpp
src/serialization/edge.cpp
src/serialization/thematic_layer.cpp
src/serialization/dual_space_layer.cpp
src/serialization/primal_space_layer.cpp
src/serialization/connection.cpp
src/serialization/indoor_features.cpp
src/id_lookup.cpp
)
### library
add_library(${PROJECT_NAME} ${SOURCE_CODE})
### executable
add_executable(main src/main.cpp)
target_link_libraries(main PRIVATE
${PROJECT_NAME}
GEOS::geos
nlohmann_json::nlohmann_json
nlohmann_json_schema_validator
glog::glog
)
### tests
enable_testing()
set(TEST_CASES
test_feature
test_node
test_edge
test_serialization
test_deserialization
)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/tests/resources DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
set(TEST_RESOURCES "${CMAKE_CURRENT_BINARY_DIR}/resources")
add_definitions(-DTEST_RESOURCES="${TEST_RESOURCES}")
foreach(CASE ${TEST_CASES})
add_executable(${CASE} tests/${CASE}.cpp)
add_test(NAME ${CASE} COMMAND ${CASE})
target_link_libraries(${CASE}
${PROJECT_NAME}
GEOS::geos
nlohmann_json::nlohmann_json
nlohmann_json_schema_validator
glog::glog
GTest::GTest
)
endforeach()