-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
94 lines (85 loc) · 2.84 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
cmake_minimum_required(VERSION 3.20)
project(adr)
include(cmake/pkg.cmake)
option(ADR_MIMALLOC "use mimalloc" OFF)
if (ADR_MIMALLOC)
if(WIN32)
set(adr-mimalloc-lib mimalloc)
target_link_libraries(cista INTERFACE mimalloc)
else()
set(adr-mimalloc-lib mimalloc-obj)
target_link_libraries(cista INTERFACE mimalloc-static)
endif()
target_compile_definitions(cista INTERFACE CISTA_USE_MIMALLOC=1)
target_compile_definitions(boost INTERFACE BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC=1)
endif()
file(GLOB_RECURSE adr-files src/*.cc)
add_library(adr ${adr-files})
target_compile_features(adr PRIVATE cxx_std_23)
target_include_directories(adr PUBLIC include)
target_link_libraries(adr
osmium
geo
cista
utl
protozero
boost
zlibstatic
unordered_dense
tiles-import-library
utf8proc
tg
rtree
)
target_compile_definitions(adr PUBLIC RAPIDJSON_HAS_STDSTRING)
add_executable(adr-extract exe/extract.cc)
target_link_libraries(adr-extract adr boost-program_options ${adr-mimalloc-lib})
add_executable(adr-reverse exe/reverse.cc)
target_link_libraries(adr-reverse adr boost-program_options ${adr-mimalloc-lib})
add_executable(adr-typeahead exe/typeahead.cc)
target_link_libraries(adr-typeahead
adr
boost-program_options
ftxui::screen
ftxui::dom
ftxui::component
${adr-mimalloc-lib}
)
if (MOTIS_MIMALLOC AND WIN32)
add_custom_command(
TARGET adr-extract POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
$<TARGET_FILE:mimalloc>
$<TARGET_FILE_DIR:adr-extract>
COMMENT "Copy mimalloc.dll to output directory"
)
add_custom_command(
TARGET adr-extract POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
"${CMAKE_CURRENT_BINARY_DIR}/deps/mimalloc/mimalloc-redirect.dll"
$<TARGET_FILE_DIR:adr-extract>
COMMENT "Copy mimalloc-redirect.dll to output directory"
)
add_custom_command(
TARGET adr-typeahead POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
$<TARGET_FILE:mimalloc>
$<TARGET_FILE_DIR:adr-typeahead>
COMMENT "Copy mimalloc.dll to output directory"
)
add_custom_command(
TARGET adr-typeahead POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
"${CMAKE_CURRENT_BINARY_DIR}/deps/mimalloc/mimalloc-redirect.dll"
$<TARGET_FILE_DIR:adr-typeahead>
COMMENT "Copy mimalloc-redirect.dll to output directory"
)
endif()
file(GLOB_RECURSE adr-test-files test/*cc)
configure_file (
${CMAKE_CURRENT_SOURCE_DIR}/test/test_dir.h.in
${CMAKE_CURRENT_BINARY_DIR}/generated/test_dir.h
)
add_executable(adr-test ${adr-test-files})
target_include_directories(adr-test PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/generated)
target_link_libraries(adr-test gtest adr utl)