forked from organicmaps/organicmaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
210 lines (199 loc) · 5.18 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
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
project(platform)
set(SRC
../private.h # To properly detect its changes with CMake.
battery_tracker.cpp
battery_tracker.hpp
chunks_download_strategy.cpp
chunks_download_strategy.hpp
constants.hpp
country_defines.cpp
country_defines.hpp
country_file.cpp
country_file.hpp
distance.cpp
distance.hpp
downloader_defines.hpp
downloader_utils.cpp
downloader_utils.hpp
get_text_by_id.cpp
get_text_by_id.hpp
gui_thread.hpp
http_client.cpp
http_client.hpp
http_payload.cpp
http_payload.hpp
http_request.cpp
http_request.hpp
http_thread_callback.hpp
http_uploader.hpp
http_uploader_background.hpp
local_country_file.cpp
local_country_file.hpp
local_country_file_utils.cpp
local_country_file_utils.hpp
locale.hpp
localization.cpp
localization.hpp
location.hpp
measurement_utils.cpp
measurement_utils.hpp
mwm_traits.cpp
mwm_traits.hpp
mwm_version.cpp
mwm_version.hpp
platform.cpp
platform.hpp
preferred_languages.cpp
preferred_languages.hpp
remote_file.cpp
remote_file.hpp
secure_storage.hpp
servers_list.cpp
servers_list.hpp
settings.cpp
settings.hpp
socket.hpp
string_storage_base.cpp
string_storage_base.hpp
utm_mgrs_utils.cpp
utm_mgrs_utils.hpp
)
if (NOT SKIP_QT_GUI AND PLATFORM_DESKTOP AND PLATFORM_LINUX)
message("Building with Qt Positioning")
find_package(Qt6 REQUIRED COMPONENTS Positioning)
set(QT_POSITIONING true)
append(SRC
qt_location_service.hpp
qt_location_service.cpp
)
else()
message("Building without Qt Positioning")
set(QT_POSITIONING false)
endif()
if (PLATFORM_IPHONE)
append(SRC
background_downloader_ios.h
background_downloader_ios.mm
gui_thread_apple.mm
http_thread_apple.h
http_thread_apple.mm
http_client_apple.mm
http_uploader_apple.mm
http_user_agent_ios.mm
localization.mm
locale.mm
network_policy_ios.h
network_policy_ios.mm
platform_ios.mm
platform_unix_impl.cpp
platform_unix_impl.hpp
secure_storage_ios.mm
socket_apple.mm
)
elseif(${PLATFORM_ANDROID})
append(SRC
platform_android.cpp
platform_unix_impl.cpp
platform_unix_impl.hpp
)
else() # neither iPhone nor Android
# Find bash first, on Windows it can be either in Git or in WSL
find_program(BASH bash REQUIRED)
# Generate version header file.
execute_process(COMMAND "${BASH}" tools/unix/version.sh qt_version
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE OM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
execute_process(COMMAND "${BASH}" tools/unix/version.sh qt_int_version
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE OM_INT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/platform_qt_version.cpp.in"
"${CMAKE_CURRENT_BINARY_DIR}/platform_qt_version.cpp"
@ONLY)
append(SRC
localization_dummy.cpp
location_service.cpp
location_service.hpp
network_policy_dummy.cpp
platform_qt.cpp
"${CMAKE_CURRENT_BINARY_DIR}/platform_qt_version.cpp"
)
if (${PLATFORM_WIN})
append(SRC
gui_thread_qt.cpp
http_client_curl.cpp
http_thread_qt.cpp
http_thread_qt.hpp
http_uploader_background_dummy.cpp
http_uploader_dummy.cpp
locale_std.cpp
platform_win.cpp
secure_storage_dummy.cpp
)
elseif(${PLATFORM_MAC})
append(SRC
apple_location_service.mm
gui_thread_apple.mm
http_client_apple.mm
http_thread_apple.h
http_thread_apple.mm
http_uploader_apple.mm
http_uploader_background_dummy.cpp
locale.mm
platform_mac.mm
platform_unix_impl.cpp
platform_unix_impl.hpp
secure_storage_qt.cpp
socket_apple.mm
http_session_manager.mm
)
elseif(${PLATFORM_LINUX})
append(SRC
gui_thread_qt.cpp
http_client_curl.cpp
http_thread_qt.cpp
http_thread_qt.hpp
http_uploader_dummy.cpp
http_uploader_background_dummy.cpp
locale_std.cpp
platform_linux.cpp
platform_unix_impl.cpp
platform_unix_impl.hpp
secure_storage_qt.cpp
)
endif()
endif()
omim_add_library(${PROJECT_NAME} ${SRC})
if (QT_POSITIONING)
target_compile_definitions(${PROJECT_NAME} PRIVATE "QT_LOCATION_SERVICE")
endif()
if (APPLE)
target_compile_options(${PROJECT_NAME} PRIVATE -fobjc-arc -Wno-nullability-completeness)
endif()
if (PLATFORM_LINUX OR PLATFORM_WIN)
set_target_properties(${PROJECT_NAME} PROPERTIES AUTOMOC ON)
endif()
target_link_libraries(${PROJECT_NAME}
geometry # mercator::YToLat
coding
$<$<BOOL:${PLATFORM_DESKTOP}>:Qt6::Core>
$<$<BOOL:${PLATFORM_LINUX}>:Qt6::Network>
$<$<BOOL:${PLATFORM_WIN}>:Qt6::Network>
$<$<BOOL:${QT_POSITIONING}>:Qt6::Positioning>
$<$<BOOL:${PLATFORM_MAC}>:
-framework\ Foundation
-framework\ SystemConfiguration
-framework\ CoreLocation
-framework\ CFNetwork
-framework\ Security # SecPKCS12Import
>
)
omim_add_test_subdirectory(platform_tests_support)
omim_add_test_subdirectory(platform_tests)
# strings::UniChar clashes with Apple's definition.
set_property(SOURCE preferred_languages.cpp PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)