Skip to content

Commit 80933d6

Browse files
committed
try using prebuilt maplibre native
1 parent 7d1c61f commit 80933d6

File tree

10 files changed

+48
-49
lines changed

10 files changed

+48
-49
lines changed

.gitmodules

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
[submodule "lib/maplibre-native-bindings-jni/maplibre-native"]
2-
path = lib/maplibre-native-bindings-jni/vendor/maplibre-native
3-
url = https://github.com/sargunv/maplibre-native.git
4-
ignore = dirty
51
[submodule "lib/maplibre-native-bindings-jni/SimpleJNI"]
62
path = lib/maplibre-native-bindings-jni/vendor/SimpleJNI
73
url = https://github.com/gershnik/SimpleJNI.git

AGENTS.md

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,12 @@
33
This file provides guidance to OpenCode and other agents when working with code
44
in this repository.
55

6-
## SEARCHING VENDORED MAPLIBRE-NATIVE CODEBASE:
7-
8-
When searching the vendored maplibre-native codebase:
9-
10-
- Location: Look in `lib/maplibre-native-bindings-jni/vendor/maplibre-native/`
11-
- Key Directories:
12-
- `platform/linux/` `- Linux-specific code (includes linux.cmake)
13-
- `platform/windows/` - Windows-specific code (includes windows.cmake)
14-
- `platform/darwin/` - macOS/iOS-specific code (includes darwin.cmake)
15-
- `platform/default/` - Cross-platform code
16-
- `include/mbgl/` - Public headers
17-
- `src/mbgl/` - Implementation files
18-
- Common Search Patterns:
19-
- Platform-specific cmake: `platform/*/platform/*.cmake`
20-
- MLN options: `option(MLN*WITH*\*`
21-
- Compiler flags: `target_compile_options`, `target_link_options`
22-
- Feature detection: `MLN_WITH_OPENGL`, `MLN_WITH_VULKAN`
6+
## Searching MapLibre Native headers
7+
8+
When searching the MapLibre Native headers, look in
9+
`lib/maplibre-native-bindings-jni/build/cmake/windows-opengl/maplibre-native-headers-src/include/`
10+
11+
This directory is gitignored, so search tools may not find it by default.
2312

2413
## Development Commands
2514

justfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ pre-commit-uninstall:
1212
format:
1313
pre-commit run --all-files
1414

15-
# Reset the vcpkg submodule to a clean state
16-
clean-vcpkg:
17-
cd lib/maplibre-native-bindings-jni/vendor/maplibre-native/platform/windows/vendor/vcpkg; git reset --hard; git clean -fdx
18-
1915
run-desktop:
2016
./gradlew :demo-app:run
2117

lib/maplibre-native-bindings-jni/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
cmake_minimum_required(VERSION 3.21)
22

3+
include(FetchContent)
34
include(cmake/vars.cmake)
45

56
project(maplibre-jni)

lib/maplibre-native-bindings-jni/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ if (config.shouldConfigureForPublishing) {
112112
inputs.file(layout.projectDirectory.file("CMakeLists.txt"))
113113
inputs.file(layout.projectDirectory.dir("cmake"))
114114
inputs.file(layout.projectDirectory.file("vendor/SimpleJNI/CMakeLists.txt"))
115-
inputs.file(layout.projectDirectory.file("vendor/maplibre-native/CMakeLists.txt"))
116115
inputs.file(layout.projectDirectory.file("CMakePresets.json"))
117116
inputs.dir(layout.projectDirectory.dir("src/main/cpp"))
118117
inputs.dir(layout.buildDirectory.dir("generated/simplejni-headers"))

lib/maplibre-native-bindings-jni/cmake/backends/metal.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,5 @@ if(NOT APPLE)
88
message(FATAL_ERROR "Metal backend is only supported on macOS")
99
endif()
1010

11-
target_include_directories(maplibre-jni SYSTEM PRIVATE
12-
${maplibre-native_SOURCE_DIR}/vendor/metal-cpp
13-
)
14-
1511
target_compile_definitions(maplibre-jni PRIVATE USE_METAL_BACKEND)
1612
target_link_libraries(maplibre-jni PRIVATE "-framework Metal")
Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,45 @@
11
# MapLibre Native dependency configuration
22

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+
)
538

6-
add_subdirectory(${maplibre-native_SOURCE_DIR} EXCLUDE_FROM_ALL SYSTEM)
7-
target_include_directories(maplibre-jni SYSTEM PRIVATE ${maplibre-native_SOURCE_DIR}/include)
839
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
1245
)
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# SimpleJNI dependency configuration
22

3-
# FetchContent causes problems with the vcpkg toolchain
4-
# So we use git submodules instead and add_subdirectory() AFTER project()
5-
6-
add_subdirectory(${SimpleJNI_SOURCE_DIR} EXCLUDE_FROM_ALL SYSTEM)
3+
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/vendor/SimpleJNI" EXCLUDE_FROM_ALL SYSTEM)
74
target_include_directories(maplibre-jni SYSTEM PRIVATE ${SIMPLEJNI_HEADERS_DIR})
85
target_link_libraries(maplibre-jni PRIVATE smjni::smjni)

lib/maplibre-native-bindings-jni/cmake/vars.cmake

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,3 @@ endif()
1616
if(APPLE)
1717
enable_language(OBJCXX)
1818
endif()
19-
20-
set(SimpleJNI_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/SimpleJNI")
21-
set(maplibre-native_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/maplibre-native")
22-
23-
if(WIN32)
24-
set(CMAKE_TOOLCHAIN_FILE ${maplibre-native_SOURCE_DIR}/platform/windows/custom-toolchain.cmake)
25-
endif()
Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)