|
1 | 1 | # MapLibre Native dependency configuration
|
2 | 2 |
|
3 |
| -# FetchContent causes problems with the vcpkg toolchain |
4 |
| -# So we use git submodules instead and add_subdirectory() AFTER project() |
| 3 | +include(FetchContent) |
| 4 | + |
| 5 | +set(MAPLIBRE_NATIVE_VERSION core-9b6325a14e2cf1cc29ab28c1855ad376f1ba4903) |
| 6 | +set(MAPLIBRE_NATIVE_BASE_URL https://github.com/maplibre/maplibre-native/releases/download/${MAPLIBRE_NATIVE_VERSION}) |
| 7 | + |
| 8 | +# TODO: detect set arch and renderer properly |
| 9 | +if(WIN32) |
| 10 | + # TODO: need amalgam version or libraries |
| 11 | + set(MAPLIBRE_NATIVE_LIBRARY_NAME maplibre-native-core-windows-x64-opengl.lib) |
| 12 | +elseif(APPLE) |
| 13 | + set(MAPLIBRE_NATIVE_LIBRARY_NAME libmaplibre-native-core-amalgam-macos-arm64-metal.a) |
| 14 | +elseif(LINUX) |
| 15 | + set(MAPLIBRE_NATIVE_LIBRARY_NAME libmaplibre-native-core-amalgam-linux-x64-opengl.a) |
| 16 | +endif() |
| 17 | + |
| 18 | +FetchContent_Populate(maplibre-native-lib |
| 19 | + URL ${MAPLIBRE_NATIVE_BASE_URL}/${MAPLIBRE_NATIVE_LIBRARY_NAME} |
| 20 | + URL_HASH SHA256=543cd81afc4ed32fd3ed8c813de557a9730e51ba5943d7f4cab20adef5a114fa |
| 21 | + DOWNLOAD_NO_EXTRACT TRUE |
| 22 | +) |
| 23 | + |
| 24 | +FetchContent_Populate(maplibre-native-headers |
| 25 | + URL ${MAPLIBRE_NATIVE_BASE_URL}/maplibre-native-headers.tar.gz |
| 26 | + URL_HASH SHA256=56354473ff88653046f62c4ffe2ee879e97eee0cb7f8385210e8b650322a78b7 |
| 27 | +) |
| 28 | + |
| 29 | +target_include_directories(maplibre-jni SYSTEM PRIVATE |
| 30 | + ${maplibre-native-headers_SOURCE_DIR}/include |
| 31 | + ${maplibre-native-headers_SOURCE_DIR}/vendor/metal-cpp |
| 32 | + ${maplibre-native-headers_SOURCE_DIR}/vendor/maplibre-native-base/include |
| 33 | + ${maplibre-native-headers_SOURCE_DIR}/vendor/maplibre-native-base/extras/expected-lite/include |
| 34 | + ${maplibre-native-headers_SOURCE_DIR}/vendor/maplibre-native-base/deps/geojson.hpp/include |
| 35 | + ${maplibre-native-headers_SOURCE_DIR}/vendor/maplibre-native-base/deps/geometry.hpp/include |
| 36 | + ${maplibre-native-headers_SOURCE_DIR}/vendor/maplibre-native-base/deps/variant/include |
| 37 | +) |
5 | 38 |
|
6 |
| -add_subdirectory(${maplibre-native_SOURCE_DIR} EXCLUDE_FROM_ALL SYSTEM) |
7 |
| -target_include_directories(maplibre-jni SYSTEM PRIVATE ${maplibre-native_SOURCE_DIR}/include) |
8 | 39 | target_link_libraries(maplibre-jni PRIVATE
|
9 |
| - Mapbox::Map |
10 |
| - mbgl-compiler-options |
11 |
| - mbgl-vendor-unique_resource |
| 40 | + ${maplibre-native-lib_SOURCE_DIR}/${MAPLIBRE_NATIVE_LIBRARY_NAME} |
| 41 | +) |
| 42 | + |
| 43 | +target_compile_definitions(maplibre-jni PRIVATE |
| 44 | + M_PI=3.14159265358979323846 |
12 | 45 | )
|
0 commit comments