-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
136 lines (116 loc) · 4.09 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
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/dependencies/maplibre-native/platform/windows/custom-toolchain.cmake)
project("MaplibreNative.NET" LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 17)
if(NOT MSVC)
return()
endif()
add_library(mbgl-dotnet SHARED)
set(ASSEMBLY_NAME "MaplibreNative.NET")
set_target_properties(
mbgl-dotnet
PROPERTIES
COMMON_LANGUAGE_RUNTIME ""
VS_GLOBAL_CLRSupport "true"
OUTPUT_NAME ${ASSEMBLY_NAME}
)
target_compile_options(mbgl-dotnet PRIVATE "/doc" "/GT")
if(CMAKE_GENERATOR STREQUAL "Ninja")
set(_TARGET_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
set_target_properties(
mbgl-dotnet
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${_TARGET_DIRECTORY}
LIBRARY_OUTPUT_DIRECTORY ${_TARGET_DIRECTORY}
RUNTIME_OUTPUT_DIRECTORY ${_TARGET_DIRECTORY}
)
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
target_compile_options(mbgl-dotnet PRIVATE "/clr" "/EHa")
add_custom_command(
TARGET mbgl-dotnet
POST_BUILD
COMMAND xdcmake "..\\*.xdc" /nologo /assembly:"${ASSEMBLY_NAME}" /out:"${ASSEMBLY_NAME}.xml"
WORKING_DIRECTORY ${_TARGET_DIRECTORY}
VERBATIM
)
unset(_TARGET_DIRECTORY)
endif()
target_compile_definitions(
mbgl-dotnet
PRIVATE
_USE_MATH_DEFINES
NOMINMAX
DOTNET_NAMESPACE=MaplibreNative
)
if(MLN_WITH_EGL)
target_compile_definitions(mbgl-dotnet PRIVATE MLN_WITH_EGL)
elseif(MLN_WITH_OSMESA)
target_compile_definitions(mbgl-dotnet PRIVATE MLN_WITH_OSMESA)
target_include_directories(mbgl-dotnet PRIVATE ${PROJECT_SOURCE_DIR}/dependencies/maplibre-native/platform/windows/vendor/mesa3d/include)
endif()
target_sources(
mbgl-dotnet
PRIVATE
${PROJECT_SOURCE_DIR}/src/AlphaImage.cpp
${PROJECT_SOURCE_DIR}/src/AnimationOptions.cpp
${PROJECT_SOURCE_DIR}/src/AsyncRequest.cpp
${PROJECT_SOURCE_DIR}/src/BackendScope.cpp
${PROJECT_SOURCE_DIR}/src/BoundOptions.cpp
${PROJECT_SOURCE_DIR}/src/CameraOptions.cpp
${PROJECT_SOURCE_DIR}/src/CanonicalTileID.cpp
${PROJECT_SOURCE_DIR}/src/ClientOptions.cpp
${PROJECT_SOURCE_DIR}/src/EdgeInsets.cpp
${PROJECT_SOURCE_DIR}/src/ExternalRenderingContextBackend.cpp
${PROJECT_SOURCE_DIR}/src/ExternalRenderingContextFrontend.cpp
${PROJECT_SOURCE_DIR}/src/FileSource.cpp
${PROJECT_SOURCE_DIR}/src/FileSourceManager.cpp
${PROJECT_SOURCE_DIR}/src/FreeCameraOptions.cpp
${PROJECT_SOURCE_DIR}/src/GeoJSON.cpp
${PROJECT_SOURCE_DIR}/src/HeadlessFrontend.cpp
${PROJECT_SOURCE_DIR}/src/Image.cpp
${PROJECT_SOURCE_DIR}/src/LatLng.cpp
${PROJECT_SOURCE_DIR}/src/Map.cpp
${PROJECT_SOURCE_DIR}/src/MapObserver.cpp
${PROJECT_SOURCE_DIR}/src/MapOptions.cpp
${PROJECT_SOURCE_DIR}/src/OverscaledTileID.cpp
${PROJECT_SOURCE_DIR}/src/PremultipliedImage.cpp
${PROJECT_SOURCE_DIR}/src/Projection.cpp
${PROJECT_SOURCE_DIR}/src/ProjectionMode.cpp
${PROJECT_SOURCE_DIR}/src/Renderer.cpp
${PROJECT_SOURCE_DIR}/src/RendererBackend.cpp
${PROJECT_SOURCE_DIR}/src/RendererObserver.cpp
${PROJECT_SOURCE_DIR}/src/RenderingStats.cpp
${PROJECT_SOURCE_DIR}/src/Resource.cpp
${PROJECT_SOURCE_DIR}/src/ResourceOptions.cpp
${PROJECT_SOURCE_DIR}/src/ResourceTransform.cpp
${PROJECT_SOURCE_DIR}/src/Response.cpp
${PROJECT_SOURCE_DIR}/src/RunLoop.cpp
${PROJECT_SOURCE_DIR}/src/Shader.cpp
${PROJECT_SOURCE_DIR}/src/ShaderGroup.cpp
${PROJECT_SOURCE_DIR}/src/ShaderRegistry.cpp
${PROJECT_SOURCE_DIR}/src/Size.cpp
${PROJECT_SOURCE_DIR}/src/Style.cpp
${PROJECT_SOURCE_DIR}/src/TileCoordinate.cpp
${PROJECT_SOURCE_DIR}/src/TransformState.cpp
${PROJECT_SOURCE_DIR}/src/UnassociatedImage.cpp
${PROJECT_SOURCE_DIR}/src/UnitBezier.cpp
${PROJECT_SOURCE_DIR}/src/UnwrappedTileID.cpp
${PROJECT_SOURCE_DIR}/src/UpdateParameters.cpp
${PROJECT_SOURCE_DIR}/src/Value.cpp
${PROJECT_SOURCE_DIR}/src/Vector.cpp
)
target_include_directories(
mbgl-dotnet
PRIVATE
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/dependencies/maplibre-native/src
)
add_subdirectory(${PROJECT_SOURCE_DIR}/dependencies/maplibre-native EXCLUDE_FROM_ALL)
find_package(libuv REQUIRED)
target_link_libraries(
mbgl-dotnet
PRIVATE
Mapbox::Map
libuv::uv_a
)