forked from maplibre/maplibre-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
windows.cmake
260 lines (232 loc) · 8.71 KB
/
windows.cmake
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
if(MLN_WITH_EGL)
set(_RENDERER EGL)
elseif(MLN_WITH_OSMESA)
set(_RENDERER OSMesa)
else()
set(_RENDERER OpenGL)
endif()
execute_process(COMMAND powershell -ExecutionPolicy Bypass -File ${CMAKE_CURRENT_LIST_DIR}/Get-VendorPackages.ps1 -Triplet ${VCPKG_TARGET_TRIPLET} -Renderer ${_RENDERER})
unset(_RENDERER)
add_compile_definitions(NOMINMAX GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
target_compile_options(
mbgl-compiler-options
INTERFACE
$<$<CXX_COMPILER_ID:MSVC>:/MP>
)
find_package(CURL REQUIRED)
find_package(dlfcn-win32 REQUIRED)
find_package(ICU OPTIONAL_COMPONENTS i18n uc)
find_package(JPEG REQUIRED)
find_package(libuv REQUIRED)
find_package(PNG REQUIRED)
find_package(WebP REQUIRED)
find_path(DLFCN_INCLUDE_DIRS dlfcn.h)
find_path(LIBUV_INCLUDE_DIRS uv.h)
target_sources(
mbgl-core
PRIVATE
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/gfx/headless_backend.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/gfx/headless_frontend.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/gl/headless_backend.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/i18n/collator.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/i18n/number_format.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/layermanager/layer_manager.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/platform/time.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/asset_file_source.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/database_file_source.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/file_source_manager.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/file_source_request.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/http_file_source.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/local_file_request.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/local_file_source.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/mbtiles_file_source.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/main_resource_loader.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/offline.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/offline_database.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/offline_download.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/online_file_source.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/sqlite3.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/text/bidi.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/text/local_glyph_rasterizer.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/async_task.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/compression.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/filesystem.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/image.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/jpeg_reader.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/webp_reader.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/logging_stderr.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/monotonic_timer.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/png_reader.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/png_writer.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/run_loop.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/string_stdlib.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/timer.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/utf.cpp
${PROJECT_SOURCE_DIR}/platform/windows/src/thread.cpp
${PROJECT_SOURCE_DIR}/platform/windows/src/thread_local.cpp
)
target_compile_definitions(
mbgl-core
PRIVATE
CURL_STATICLIB
USE_STD_FILESYSTEM
)
if(MLN_WITH_EGL)
find_package(unofficial-angle CONFIG REQUIRED)
target_sources(
mbgl-core
PRIVATE
${PROJECT_SOURCE_DIR}/platform/windows/src/headless_backend_egl.cpp
${PROJECT_SOURCE_DIR}/platform/windows/src/gl_functions.cpp
)
target_compile_definitions(
mbgl-core
PRIVATE
KHRONOS_STATIC
)
target_link_libraries(
mbgl-core
PRIVATE
unofficial::angle::libEGL
unofficial::angle::libGLESv2
)
elseif(MLN_WITH_OSMESA)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR}/vendor/mesa3d)
find_package(OSMesa REQUIRED)
target_sources(
mbgl-core
PRIVATE
${PROJECT_SOURCE_DIR}/platform/windows/src/headless_backend_osmesa.cpp
${PROJECT_SOURCE_DIR}/platform/windows/src/gl_functions.cpp
)
set_property(
SOURCE ${PROJECT_SOURCE_DIR}/platform/windows/src/headless_backend_osmesa.cpp
PROPERTY INCLUDE_DIRECTORIES ${OSMesa_INCLUDE_DIRS}
)
target_link_libraries(
mbgl-core
PRIVATE
OSMesa::osmesa
OSMesa::libGLESv2
)
else()
find_package(OpenGL REQUIRED)
target_sources(
mbgl-core
PRIVATE
${PROJECT_SOURCE_DIR}/platform/windows/src/headless_backend_wgl.cpp
)
target_compile_definitions(
mbgl-core
PRIVATE
KHRONOS_STATIC
)
target_link_libraries(
mbgl-core
PRIVATE
OpenGL::GL
)
endif()
# FIXME: Should not be needed, but now needed by node because of the headless frontend.
target_include_directories(
mbgl-core
PUBLIC ${PROJECT_SOURCE_DIR}/platform/default/include
PRIVATE
${PROJECT_SOURCE_DIR}/platform/windows/include
${CURL_INCLUDE_DIRS}
${DLFCN_INCLUDE_DIRS}
${JPEG_INCLUDE_DIRS}
${LIBUV_INCLUDE_DIRS}
${WEBP_INCLUDE_DIRS}
)
include(${PROJECT_SOURCE_DIR}/vendor/nunicode.cmake)
include(${PROJECT_SOURCE_DIR}/vendor/sqlite.cmake)
if(NOT ${ICU_FOUND} OR "${ICU_VERSION}" VERSION_LESS 62.0)
message(STATUS "ICU not found or too old, using builtin.")
set(MLN_USE_BUILTIN_ICU TRUE)
include(${PROJECT_SOURCE_DIR}/vendor/icu.cmake)
set_source_files_properties(
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/i18n/number_format.cpp
PROPERTIES
COMPILE_DEFINITIONS
MBGL_USE_BUILTIN_ICU
)
endif()
target_link_libraries(
mbgl-core
PRIVATE
${CURL_LIBRARIES}
${JPEG_LIBRARIES}
${LIBUV_LIBRARIES}
${WEBP_LIBRARIES}
dlfcn-win32::dl
$<$<NOT:$<BOOL:${MLN_USE_BUILTIN_ICU}>>:ICU::data>
$<$<NOT:$<BOOL:${MLN_USE_BUILTIN_ICU}>>:ICU::i18n>
$<$<NOT:$<BOOL:${MLN_USE_BUILTIN_ICU}>>:ICU::uc>
$<$<BOOL:${MLN_USE_BUILTIN_ICU}>:mbgl-vendor-icu>
PNG::PNG
mbgl-vendor-nunicode
mbgl-vendor-sqlite
)
add_subdirectory(${PROJECT_SOURCE_DIR}/bin)
add_subdirectory(${PROJECT_SOURCE_DIR}/expression-test)
add_subdirectory(${PROJECT_SOURCE_DIR}/platform/glfw)
if(MLN_WITH_NODE)
add_subdirectory(${PROJECT_SOURCE_DIR}/platform/node)
endif()
add_executable(
mbgl-test-runner
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/test/main.cpp
)
target_compile_definitions(
mbgl-test-runner
PRIVATE MBGL_BUILDING_LIB WORK_DIRECTORY=${PROJECT_SOURCE_DIR}
)
target_include_directories(
mbgl-test-runner
PRIVATE
${PROJECT_SOURCE_DIR}/platform/windows/include
)
target_link_libraries(
mbgl-test-runner
PRIVATE
mbgl-compiler-options
-Wl,--whole-archive
mbgl-test
-Wl,--no-whole-archive
)
add_executable(
mbgl-benchmark-runner
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/benchmark/main.cpp
)
target_link_libraries(
mbgl-benchmark-runner
PRIVATE
mbgl-compiler-options
mbgl-benchmark
-WHOLEARCHIVE:mbgl-benchmark
$<IF:$<TARGET_EXISTS:libuv::uv_a>,libuv::uv_a,libuv::uv>
shlwapi
)
add_executable(
mbgl-render-test-runner
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/render-test/main.cpp
)
target_compile_definitions(
mbgl-render-test-runner
PRIVATE MBGL_BUILDING_LIB
)
target_link_libraries(
mbgl-render-test-runner
PRIVATE
mbgl-compiler-options
mbgl-render-test
$<IF:$<TARGET_EXISTS:libuv::uv_a>,libuv::uv_a,libuv::uv>
)
# Disable benchmarks in CI as they run in VM environment
if(NOT DEFINED ENV{CI})
add_test(NAME mbgl-benchmark-runner COMMAND mbgl-benchmark-runner WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
endif()
add_test(NAME mbgl-test-runner COMMAND mbgl-test-runner WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
install(TARGETS mbgl-render-test-runner RUNTIME DESTINATION bin)