-
-
Notifications
You must be signed in to change notification settings - Fork 299
/
CMakeLists.txt
140 lines (120 loc) · 3.28 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
find_package(OpenGL REQUIRED)
if(WIN32)
if(MLN_WITH_OSMESA)
message(WARNING "mbgl-glfw does not work with -DMLN_WITH_OSMESA=ON. If you want to build this target, don't use this option.")
return()
endif()
find_package(glfw3 REQUIRED)
find_package(libuv REQUIRED)
else()
find_package(PkgConfig REQUIRED)
pkg_search_module(GLFW glfw3 REQUIRED)
endif()
add_executable(
mbgl-glfw
${PROJECT_SOURCE_DIR}/platform/glfw/main.cpp
${PROJECT_SOURCE_DIR}/platform/glfw/glfw_view.cpp
${PROJECT_SOURCE_DIR}/platform/glfw/glfw_renderer_frontend.cpp
${PROJECT_SOURCE_DIR}/platform/glfw/settings_json.cpp
${PROJECT_SOURCE_DIR}/platform/glfw/test_writer.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/map/map_snapshotter.cpp
)
set_property(
SOURCE ${PROJECT_SOURCE_DIR}/platform/glfw/glfw_view.cpp
PROPERTY COMPILE_DEFINITIONS MAPBOX_PUCK_ASSETS_PATH=\"${PROJECT_SOURCE_DIR}/platform/glfw/assets/\"
)
if(MLN_WITH_OPENGL)
target_sources(
mbgl-glfw
PRIVATE ${PROJECT_SOURCE_DIR}/platform/glfw/glfw_gl_backend.cpp
)
target_compile_definitions(
mbgl-glfw
PRIVATE MLN_RENDER_BACKEND_OPENGL=1
)
endif()
if(MLN_WITH_EGL)
target_compile_definitions(
mbgl-glfw
PRIVATE MBGL_WITH_EGL=1
)
endif()
if(MLN_WITH_VULKAN)
target_sources(
mbgl-glfw
PRIVATE ${PROJECT_SOURCE_DIR}/platform/glfw/glfw_vulkan_backend.cpp
)
target_compile_definitions(
mbgl-glfw
PRIVATE MLN_RENDER_BACKEND_VULKAN=1
)
endif()
if(MLN_WITH_METAL)
target_sources(
mbgl-glfw
PRIVATE
${PROJECT_SOURCE_DIR}/platform/glfw/glfw_metal_backend.mm
${PROJECT_SOURCE_DIR}/platform/glfw/metal_backend.mm
${PROJECT_SOURCE_DIR}/platform/glfw/glfw_metal_backend.h
${PROJECT_SOURCE_DIR}/platform/glfw/metal_backend.h
)
target_compile_definitions(
mbgl-glfw
PRIVATE MLN_RENDER_BACKEND_METAL=1
)
target_link_libraries(
mbgl-glfw
PRIVATE
mbgl-vendor-metal-cpp
)
endif()
target_include_directories(
mbgl-glfw
PRIVATE
${GLFW_INCLUDE_DIRS}
# For /platform/default/src/mbgl/map/map_snapshotter.hpp
PRIVATE ${PROJECT_SOURCE_DIR}/src
)
# Use target_link_directories when we move away from CMake 3.10.
target_link_libraries(
mbgl-glfw
PRIVATE $<$<BOOL:${GLFW_LIBRARY_DIRS}>:-L${GLFW_LIBRARY_DIRS}>
)
if(WIN32)
target_compile_definitions(
mbgl-glfw
PRIVATE
NOMINMAX
CURL_STATICLIB
)
target_link_libraries(
mbgl-glfw
PRIVATE
glfw
$<IF:$<TARGET_EXISTS:libuv::uv_a>,libuv::uv_a,libuv::uv>
)
else()
target_link_libraries(
mbgl-glfw
PRIVATE
${GLFW_LIBRARIES}
)
endif()
target_link_libraries(
mbgl-glfw
PRIVATE
Mapbox::Base::Extras::args
Mapbox::Base::Extras::filesystem
Mapbox::Base::Extras::rapidjson
Mapbox::Map
mbgl-compiler-options
Mapbox::Base::cheap-ruler-cpp
)
if(NOT WIN32 AND MLN_WITH_OPENGL)
target_link_libraries(
mbgl-glfw
PRIVATE OpenGL::GL
)
endif()
set_property(TARGET mbgl-glfw PROPERTY FOLDER MapLibre)
install(TARGETS mbgl-glfw RUNTIME DESTINATION bin)