forked from cyang-kth/fmm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
181 lines (152 loc) · 5.5 KB
/
Copy pathCMakeLists.txt
File metadata and controls
181 lines (152 loc) · 5.5 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
cmake_minimum_required( VERSION 3.5.1)
message(STATUS "CMAKE version ${CMAKE_VERSION}")
if (POLICY CMP0074)
message(STATUS "Set CMP0074 state to NEW")
cmake_policy(SET CMP0074 NEW)
endif()
if (POLICY CMP0086)
message(STATUS "Set CMP0086 state to NEW")
cmake_policy(SET CMP0086 NEW)
endif()
if (POLICY CMP0078)
message(STATUS "Set CMP0078 state to NEW")
cmake_policy(SET CMP0078 NEW)
endif()
# Prevent in source build
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Skip resetting RPATH to empty
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
project(fmm)
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "-O3 -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build")
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/cmake")
if(NOT OSMIUM_INCLUDE_DIR)
set(OSMIUM_INCLUDE_DIR "third_party/libosmium/include")
endif()
if(NOT PROTOZERO_INCLUDE_DIR)
set(PROTOZERO_INCLUDE_DIR "third_party/protozero/include")
endif()
find_package(Osmium REQUIRED COMPONENTS io)
if(OSMIUM_FOUND)
message(STATUS "OSMium found at ${OSMIUM_INCLUDE_DIRS}")
message(STATUS "OSMium library found at ${OSMIUM_LIBRARIES}")
include_directories(${OSMIUM_INCLUDE_DIR})
else()
message(FATAL_ERROR "Libosmium not found!\n")
endif()
find_package(GDAL 2.2 REQUIRED)
if (GDAL_FOUND)
message(STATUS "GDAL headers found at ${GDAL_INCLUDE_DIR}")
message(STATUS "GDAL library found at ${GDAL_LIBRARIES}")
include_directories(${GDAL_INCLUDE_DIR})
else()
message(FATAL_ERROR "GDAL Not Found!")
endif (GDAL_FOUND)
find_package(Boost 1.54.0 REQUIRED serialization)
if (Boost_FOUND)
message(STATUS "Boost headers found at ${Boost_INCLUDE_DIR}")
message(STATUS "Boost library found at ${Boost_LIBRARIES}")
message(STATUS "Boost library version ${Boost_LIB_VERSION}")
else()
message(FATAL_ERROR "Boost Not Found!")
endif (Boost_FOUND)
find_package(OpenMP REQUIRED)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
message(STATUS "OpenMP_HEADERS found at ${OpenMP_CXX_INCLUDE_DIRS}")
message(STATUS "OpenMP_CXX_LIBRARIES found at ${OpenMP_CXX_LIBRARIES}")
endif()
include_directories(third_party)
include_directories(third_party/libosmium/include)
include_directories(third_party/protozero/include)
include_directories(src)
file(GLOB CoreGlob src/core/*.cpp)
file(GLOB AlgorithmGlob src/algorithm/*.cpp)
file(GLOB ConfigGlob src/config/*.cpp)
file(GLOB IOGlob src/io/*.cpp)
file(GLOB NetworkGlob src/network/*.cpp)
file(GLOB UtilGlob src/util/*.cpp)
file(GLOB MMGlob src/mm/*.cpp)
file(GLOB FMMGlob src/mm/fmm/*.cpp)
file(GLOB STMATCHGlob src/mm/stmatch/*.cpp)
add_library(CORE OBJECT ${CoreGlob})
add_library(ALGORITHM OBJECT ${AlgorithmGlob})
add_library(CONFIG OBJECT ${ConfigGlob})
add_library(IO OBJECT ${IOGlob})
add_library(UTIL OBJECT ${UtilGlob})
add_library(NETWORK OBJECT ${NetworkGlob})
add_library(MM_OBJ OBJECT ${MMGlob})
add_library(FMM_OBJ OBJECT ${FMMGlob})
add_library(STMATCH_OBJ OBJECT ${STMATCHGlob})
add_executable(fmm src/app/fmm.cpp
$<TARGET_OBJECTS:MM_OBJ>
$<TARGET_OBJECTS:CORE>
$<TARGET_OBJECTS:CONFIG>
$<TARGET_OBJECTS:ALGORITHM>
$<TARGET_OBJECTS:UTIL>
$<TARGET_OBJECTS:IO>
$<TARGET_OBJECTS:NETWORK>
$<TARGET_OBJECTS:FMM_OBJ>)
target_link_libraries(fmm ${GDAL_LIBRARIES}
${OSMIUM_LIBRARIES}
${Boost_LIBRARIES}
${OpenMP_CXX_LIBRARIES})
add_executable(ubodt_gen src/app/ubodt_gen_app.cpp
$<TARGET_OBJECTS:MM_OBJ>
$<TARGET_OBJECTS:FMM_OBJ>
$<TARGET_OBJECTS:CORE>
$<TARGET_OBJECTS:CONFIG>
$<TARGET_OBJECTS:ALGORITHM>
$<TARGET_OBJECTS:UTIL>
$<TARGET_OBJECTS:IO>
$<TARGET_OBJECTS:NETWORK>)
target_link_libraries(ubodt_gen
${GDAL_LIBRARIES}
${Boost_LIBRARIES}
${OSMIUM_LIBRARIES}
${OpenMP_CXX_LIBRARIES})
add_executable(stmatch src/app/stmatch.cpp
$<TARGET_OBJECTS:MM_OBJ>
$<TARGET_OBJECTS:STMATCH_OBJ>
$<TARGET_OBJECTS:CORE>
$<TARGET_OBJECTS:CONFIG>
$<TARGET_OBJECTS:ALGORITHM>
$<TARGET_OBJECTS:UTIL>
$<TARGET_OBJECTS:IO>
$<TARGET_OBJECTS:NETWORK>)
target_link_libraries(stmatch
${OSMIUM_LIBRARIES}
${GDAL_LIBRARIES}
${OpenMP_CXX_LIBRARIES})
# Build h3
set(UNCONFIGURED_API_HEADER third_party/h3/src/h3lib/include/h3api.h.in)
set(CONFIGURED_API_HEADER third_party/h3/src/h3lib/include/h3api.h)
configure_file(${UNCONFIGURED_API_HEADER} ${CONFIGURED_API_HEADER})
message(STATUS "Copy h3 header to ${CONFIGURED_API_HEADER}")
set(H3_INCLUDE_PATH
${CMAKE_CURRENT_BINARY_DIR}/third_party/h3/src/h3lib/include
${CMAKE_CURRENT_SOURCE_DIR}/third_party/h3/src/h3lib/include)
file(GLOB h3Glob third_party/h3/src/h3lib/lib/*.c)
add_library(H3_OBJ OBJECT ${h3Glob})
target_include_directories(H3_OBJ PUBLIC ${H3_INCLUDE_PATH})
add_executable(h3mm src/app/h3mm.cpp
$<TARGET_OBJECTS:H3_OBJ>)
target_include_directories(
h3mm PUBLIC ${H3_INCLUDE_PATH})
target_link_libraries(h3mm
$<TARGET_OBJECTS:CONFIG>
$<TARGET_OBJECTS:UTIL>
$<TARGET_OBJECTS:ALGORITHM>
$<TARGET_OBJECTS:IO>
$<TARGET_OBJECTS:CORE>
${GDAL_LIBRARIES}
${OpenMP_CXX_LIBRARIES})
add_subdirectory(python)
add_subdirectory(test EXCLUDE_FROM_ALL)
install(TARGETS fmm ubodt_gen stmatch h3mm DESTINATION bin)