-
Notifications
You must be signed in to change notification settings - Fork 232
/
CMakeLists.txt
142 lines (121 loc) · 3.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
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
cmake_minimum_required(VERSION 3.18)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
project(tilemaker)
OPTION(TILEMAKER_BUILD_STATIC "Attempt to link dependencies static" OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are not allowed, please use a separate build directory.")
endif()
if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
IF (TILEMAKER_BUILD_STATIC)
MESSAGE (STATUS "Staticly linking with Boost")
SET (Boost_USE_STATIC_LIBS TRUE)
SET (CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
ELSE ()
MESSAGE (STATUS "Dynamically linking with Boost")
SET (Boost_USE_STATIC_LIBS FALSE)
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
ENDIF ()
find_package(Boost 1.66 REQUIRED COMPONENTS system filesystem program_options)
find_package(libshp REQUIRED)
find_package(Rapidjson REQUIRED)
find_package(Lua)
if(LUA_FOUND)
include_directories(${LUA_INCLUDE_DIR})
else()
find_package(LuaJIT REQUIRED)
add_definitions(-DLUAJIT)
include_directories(${LUAJIT_INCLUDE_DIR})
endif()
set(CMAKE_CXX_STANDARD 17)
if(!TM_VERSION)
execute_process(
COMMAND git describe --tags --abbrev=0
OUTPUT_VARIABLE tm_version)
add_compile_definitions(TM_VERSION=${tm_version})
endif()
if(MSVC)
find_package(unofficial-sqlite3 CONFIG REQUIRED)
add_library(SQLite::SQLite3 ALIAS unofficial::sqlite3::sqlite3)
add_definitions(-D_USE_MATH_DEFINES -DWIN32_LEAN_AND_MEAN -DNOGDI -D__restrict__=__restrict)
set(THREAD_LIB "")
else()
find_package(SQLite3 REQUIRED)
set(THREAD_LIB pthread)
endif()
file(GLOB tilemaker_src_files
src/attribute_store.cpp
src/coordinates.cpp
src/coordinates_geom.cpp
src/external/streamvbyte_decode.c
src/external/streamvbyte_encode.c
src/external/streamvbyte_zigzag.c
src/external/libdeflate/lib/adler32.c
src/external/libdeflate/lib/arm/cpu_features.c
src/external/libdeflate/lib/crc32.c
src/external/libdeflate/lib/deflate_compress.c
src/external/libdeflate/lib/deflate_decompress.c
src/external/libdeflate/lib/gzip_compress.c
src/external/libdeflate/lib/gzip_decompress.c
src/external/libdeflate/lib/utils.c
src/external/libdeflate/lib/x86/cpu_features.c
src/external/libdeflate/lib/zlib_compress.c
src/external/libdeflate/lib/zlib_decompress.c
src/geojson_processor.cpp
src/geom.cpp
src/helpers.cpp
src/mbtiles.cpp
src/mmap_allocator.cpp
src/node_stores.cpp
src/options_parser.cpp
src/osm_lua_processing.cpp
src/osm_mem_tiles.cpp
src/osm_store.cpp
src/output_object.cpp
src/pbf_processor.cpp
src/pbf_reader.cpp
src/pmtiles.cpp
src/pooled_string.cpp
src/relation_roles.cpp
src/sharded_node_store.cpp
src/sharded_way_store.cpp
src/shared_data.cpp
src/shp_mem_tiles.cpp
src/shp_processor.cpp
src/significant_tags.cpp
src/sorted_node_store.cpp
src/sorted_way_store.cpp
src/tag_map.cpp
src/tile_coordinates_set.cpp
src/tile_data.cpp
src/tilemaker.cpp
src/tile_worker.cpp
src/visvalingam.cpp
src/way_stores.cpp
)
add_executable(tilemaker ${tilemaker_src_files})
target_include_directories(tilemaker PRIVATE include)
target_include_directories(tilemaker PRIVATE ${CMAKE_BINARY_DIR}) # for generated files
target_link_libraries(tilemaker
${THREAD_LIB} ${CMAKE_DL_LIBS}
${LUA_LIBRARIES}
shapelib::shp
SQLite::SQLite3
Rapidjson::rapidjson
Boost::system Boost::filesystem Boost::program_options)
include(CheckCxxAtomic)
if(NOT HAVE_CXX11_ATOMIC)
string(APPEND CMAKE_CXX_STANDARD_LIBRARIES
" ${LIBATOMIC_LINK_FLAGS}")
endif()
install(FILES docs/man/tilemaker.1 DESTINATION share/man/man1)
add_executable(tilemaker-server server/server.cpp)
target_include_directories(tilemaker-server PRIVATE include)
target_link_libraries(tilemaker-server ${THREAD_LIB} ${CMAKE_DL_LIBS} SQLite::SQLite3 Boost::filesystem Boost::program_options)
install(TARGETS tilemaker tilemaker-server RUNTIME DESTINATION bin)