blob: 911af25bc4be622084831dfd7e634fcda7db276e (
plain)
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
|
# This file is to be reused by target platforms that don't
# support `mason` (i.e. Yocto). Do not add any `mason` macro.
option(WITH_QT_DECODERS "Use builtin Qt image decoders" OFF)
option(WITH_QT_I18N "Use builtin Qt i18n support" OFF)
add_definitions("-D__QT__")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(MBGL_QT_CORE_FILES
# Headless view
PRIVATE platform/default/src/mbgl/gl/headless_frontend.cpp
PRIVATE platform/default/include/mbgl/gl/headless_frontend.hpp
PRIVATE platform/default/src/mbgl/gl/headless_backend.cpp
PRIVATE platform/default/include/mbgl/gl/headless_backend.hpp
PRIVATE platform/qt/src/headless_backend_qt.cpp
# Thread pool
PRIVATE platform/default/src/mbgl/util/shared_thread_pool.cpp
PRIVATE platform/default/include/mbgl/util/shared_thread_pool.hpp
PRIVATE platform/default/src/mbgl/util/default_thread_pool.cpp
PRIVATE platform/default/include/mbgl/util/default_thread_pool.hpp
# Thread
PRIVATE platform/qt/src/thread_local.cpp
# Platform integration
PRIVATE platform/qt/src/async_task.cpp
PRIVATE platform/qt/src/async_task_impl.hpp
PRIVATE platform/qt/src/local_glyph_rasterizer.cpp
PRIVATE platform/qt/src/qt_logging.cpp
PRIVATE platform/qt/src/qt_image.cpp
PRIVATE platform/qt/src/run_loop.cpp
PRIVATE platform/qt/src/run_loop_impl.hpp
PRIVATE platform/qt/src/string_stdlib.cpp
PRIVATE platform/qt/src/timer.cpp
PRIVATE platform/qt/src/timer_impl.hpp
PRIVATE platform/qt/src/utf.cpp
PRIVATE platform/qt/src/gl_functions.cpp
PRIVATE platform/default/src/mbgl/text/collator.cpp
PRIVATE platform/default/src/mbgl/text/unaccent.cpp
PRIVATE platform/default/include/mbgl/text/unaccent.hpp
#Layer manager
PRIVATE platform/default/src/mbgl/layermanager/layer_manager.cpp
)
set(MBGL_QT_FILESOURCE_FILES
# File source
PRIVATE platform/default/src/mbgl/storage/file_source.cpp
PRIVATE platform/qt/src/http_file_source.cpp
PRIVATE platform/qt/src/http_file_source.hpp
PRIVATE platform/qt/src/http_request.cpp
PRIVATE platform/qt/src/http_request.hpp
# Database
PRIVATE platform/qt/src/sqlite3.cpp
)
# Shared library
add_library(qmapboxgl SHARED
platform/qt/include/qmapbox.hpp
platform/qt/include/qmapboxgl.hpp
platform/qt/src/qt_conversion.hpp
platform/qt/src/qt_geojson.cpp
platform/qt/src/qt_geojson.hpp
platform/qt/src/qmapbox.cpp
platform/qt/src/qmapboxgl.cpp
platform/qt/src/qmapboxgl_p.hpp
platform/qt/src/qmapboxgl_map_observer.cpp
platform/qt/src/qmapboxgl_map_observer.hpp
platform/qt/src/qmapboxgl_map_renderer.cpp
platform/qt/src/qmapboxgl_map_renderer.hpp
platform/qt/src/qmapboxgl_renderer_backend.cpp
platform/qt/src/qmapboxgl_renderer_backend.hpp
platform/qt/src/qmapboxgl_scheduler.cpp
platform/qt/src/qmapboxgl_scheduler.hpp
platform/default/include/mbgl/util/default_styles.hpp
)
target_include_directories(qmapboxgl
PUBLIC platform/qt/include
PRIVATE src
)
target_compile_definitions(qmapboxgl
PRIVATE "-DQT_BUILD_MAPBOXGL_LIB"
)
target_link_libraries(qmapboxgl
PRIVATE mbgl-core
PRIVATE mbgl-filesource
${MBGL_QT_CORE_LIBRARIES}
${MBGL_QT_FILESOURCE_LIBRARIES}
)
# C++ app
add_executable(mbgl-qt
platform/qt/app/main.cpp
platform/qt/app/mapwindow.cpp
platform/qt/app/mapwindow.hpp
platform/qt/resources/common.qrc
)
target_compile_options(qmapboxgl
PRIVATE -std=c++03
)
target_link_libraries(mbgl-qt
PRIVATE qmapboxgl
)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5OpenGL REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Sql REQUIRED)
# Qt5 always build OpenGL ES2 which is the compatibility
# mode. Qt5 will take care of translating the desktop
# version of OpenGL to ES2.
add_definitions("-DMBGL_USE_GLES2")
set(MBGL_QT_CORE_LIBRARIES
PUBLIC Qt5::Core
PUBLIC Qt5::Gui
PUBLIC Qt5::OpenGL
)
set(MBGL_QT_FILESOURCE_LIBRARIES
PUBLIC Qt5::Network
PUBLIC Qt5::Sql
)
target_link_libraries(mbgl-qt
PRIVATE Qt5::Widgets
)
xcode_create_scheme(TARGET mbgl-qt)
# OS specific configurations
if (MASON_PLATFORM STREQUAL "osx" OR MASON_PLATFORM STREQUAL "ios")
list(APPEND MBGL_QT_CORE_FILES
PRIVATE platform/darwin/src/nsthread.mm
)
list(APPEND MBGL_QT_CORE_LIBRARIES
PRIVATE "-framework Foundation"
)
elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
list(APPEND MBGL_QT_CORE_FILES
PRIVATE platform/default/src/mbgl/util/thread.cpp
)
elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
add_definitions("-DQT_COMPILING_QIMAGE_COMPAT_CPP")
add_definitions("-DRAPIDJSON_HAS_CXX11_RVALUE_REFS")
add_definitions("-D_USE_MATH_DEFINES")
add_definitions("-Wno-deprecated-declarations")
add_definitions("-Wno-macro-redefined")
add_definitions("-Wno-microsoft-exception-spec")
add_definitions("-Wno-unknown-argument")
add_definitions("-Wno-unknown-warning-option")
add_definitions("-Wno-unused-command-line-argument")
add_definitions("-Wno-unused-local-typedef")
add_definitions("-Wno-unused-private-field")
add_definitions("-Wno-inconsistent-missing-override")
list(APPEND MBGL_QT_CORE_FILES
PRIVATE platform/qt/src/thread.cpp
)
elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "QNX")
list(APPEND MBGL_QT_CORE_FILES
PRIVATE platform/qt/src/thread.cpp
)
add_definitions("-Wno-narrowing")
endif()
add_custom_command(
TARGET qmapboxgl
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/platform/qt/include
${CMAKE_CURRENT_BINARY_DIR}/platform/qt/include
)
xcode_create_scheme(TARGET qmapboxgl)
|