Skip to content

Commit 559c44f

Browse files
committed
Minor update
1 parent 9dd3803 commit 559c44f

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

platform/android/MapLibreAndroid/src/cpp/MultiBackend.cmake

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Android multi-backend build (Gradle `multiBackend` flavor only).
22
#
3-
# Builds libmaplibre.so (OpenGL) and libmaplibre-vulkan.so (Vulkan) by invoking this directory's
3+
# Builds libmaplibre.so (Vulkan) and libmaplibre-opengl.so (OpenGL) by invoking this directory's
44
# stock single-backend build twice via ExternalProject, and surfaces both to AGP as SHARED
55
# targets so both .so land in the multiBackend AAR.
66
#
@@ -58,18 +58,19 @@ ExternalProject_Add(maplibre-vulkan-build
5858
set(_stub ${CMAKE_BINARY_DIR}/maplibre_multi_stub.cpp)
5959
file(WRITE ${_stub} "extern \"C\" void maplibre_multi_backend_stub() {}\n")
6060

61-
add_library(maplibre-opengl SHARED ${_stub})
62-
# Produce libmaplibre.so (not libmaplibre-opengl.so) so the OpenGL output matches the
63-
# single-backend OpenGL AAR's library name.
64-
set_target_properties(maplibre-opengl PROPERTIES OUTPUT_NAME maplibre)
61+
add_library(maplibre-opengl SHARED ${_stub}) # -> libmaplibre-opengl.so
6562
add_dependencies(maplibre-opengl maplibre-opengl-build)
6663
add_custom_command(TARGET maplibre-opengl POST_BUILD
6764
COMMAND ${CMAKE_COMMAND} -E copy
6865
${_gl}/lib/libmaplibre.so
6966
$<TARGET_FILE:maplibre-opengl>
7067
VERBATIM)
7168

72-
add_library(maplibre-vulkan SHARED ${_stub}) # -> libmaplibre-vulkan.so
69+
add_library(maplibre-vulkan SHARED ${_stub})
70+
# Produce libmaplibre.so (not libmaplibre-vulkan.so): Vulkan is the multiBackend AAR's
71+
# default/primary library, matching the SDK-wide convention where Vulkan is the default
72+
# backend and OpenGL ships as the explicitly-named "-opengl" variant.
73+
set_target_properties(maplibre-vulkan PROPERTIES OUTPUT_NAME maplibre)
7374
add_dependencies(maplibre-vulkan maplibre-vulkan-build)
7475
add_custom_command(TARGET maplibre-vulkan POST_BUILD
7576
COMMAND ${CMAKE_COMMAND} -E copy

platform/android/MapLibreAndroid/src/multiBackend/java/org/maplibre/android/module/loader/LibraryLoaderProviderImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/**
88
* multiBackend flavor: when asked to load "maplibre", routes to either
9-
* libmaplibre.so (OpenGL, the default name) or libmaplibre-vulkan.so based on
9+
* libmaplibre.so (Vulkan, the default name) or libmaplibre-opengl.so based on
1010
* {@link RenderingEngine#getCurrentType()}. Any other library name is loaded
1111
* verbatim.
1212
*/
@@ -21,8 +21,8 @@ private static class MultiBackendLibraryLoader extends LibraryLoader {
2121
@Override
2222
public void load(String name) {
2323
if ("maplibre".equals(name)
24-
&& RenderingEngine.getCurrentType() == RenderingEngine.Type.VULKAN) {
25-
System.loadLibrary("maplibre-vulkan");
24+
&& RenderingEngine.getCurrentType() == RenderingEngine.Type.OPENGL) {
25+
System.loadLibrary("maplibre-opengl");
2626
} else {
2727
System.loadLibrary(name);
2828
}

0 commit comments

Comments
 (0)