Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[build] #5359 - added copy and custom-layer and remaining make targets
Browse files Browse the repository at this point in the history
  • Loading branch information
ivovandongen committed Jul 23, 2016
1 parent b44d7c3 commit d32dd8a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,10 @@ build/android-$1/$(BUILDTYPE)/Makefile: build/android-$1/$(BUILDTYPE)/toolchain.
-DCMAKE_TOOLCHAIN_FILE=build/android-$1/$(BUILDTYPE)/toolchain.cmake \
-DCMAKE_BUILD_TYPE=$(BUILDTYPE) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DMBGL_PLATFORM=android

android-lib-$1: build/android-$1/$(BUILDTYPE)/Makefile
$(MAKE) VERBOSE=1 -j$(JOBS) -C build/android-$1/$(BUILDTYPE) mapbox-gl
$(MAKE) -j$(JOBS) -C build/android-$1/$(BUILDTYPE) all

android-$1: android-lib-$1
cd platform/android && ./gradlew --parallel --max-workers=$(JOBS) assemble$(BUILDTYPE)
Expand All @@ -401,6 +400,12 @@ $(foreach abi,$(ANDROID_ABIS),$(eval $(call ANDROID_RULES,$(abi))))

android: android-arm-v7

test-android:
cd platform/android && ./gradlew testReleaseUnitTest --continue

apackage:
cd platform/android && ./gradlew --parallel-threads=$(JOBS) assemble$(BUILDTYPE)

#### Miscellaneous targets #####################################################

style-code:
Expand Down
28 changes: 27 additions & 1 deletion platform/android/config.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#Include to use build specific variables
include(${CMAKE_CURRENT_BINARY_DIR}/toolchain.cmake)

mason_use(geojson 0.1.4)
mason_use(jni.hpp 2.0.0)
mason_use(libjpeg-turbo 1.4.2)
Expand Down Expand Up @@ -69,7 +72,6 @@ macro(mbgl_platform_core)
)
endmacro()


add_library(mapbox-gl SHARED
platform/android/src/jni.cpp
platform/android/src/attach_env.cpp
Expand All @@ -78,3 +80,27 @@ add_library(mapbox-gl SHARED
target_link_libraries(mapbox-gl
PUBLIC mbgl-core
)

add_library(example-custom-layer SHARED
platform/android/src/example_custom_layer.cpp
)

target_link_libraries(example-custom-layer
PRIVATE mbgl-core
)

set(ANDROID_TARGET_DIR ${CMAKE_CURRENT_SOURCE_DIR}/platform/android/MapboxGLAndroidSDK/src/main/jniLibs/${ANDROID_JNIDIR}/)

add_custom_target(copy-binaries
DEPENDS mapbox-gl
DEPENDS example-custom-layer
COMMAND ${CMAKE_COMMAND} -E make_directory ${ANDROID_TARGET_DIR}
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:mapbox-gl> ${ANDROID_TARGET_DIR}
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:example-custom-layer> ${ANDROID_TARGET_DIR}
)

add_custom_target(_all ALL
DEPENDS mapbox-gl
DEPENDS example-custom-layer
DEPENDS copy-binaries
)
2 changes: 1 addition & 1 deletion platform/android/scripts/toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ echo "set(CMAKE_SYSTEM_NAME Linux)"
echo "set(CMAKE_SYSTEM_VERSION 1)"
echo "set(CMAKE_CXX_COMPILER \"`which $(mason env CXX)`\")"
echo "set(CMAKE_C_COMPILER \"`which $(mason env CC)`\")"
echo "set(JNIDIR \"`mason env JNIDIR`\")"
echo "set(ANDROID_JNIDIR \"`mason env JNIDIR`\")"

0 comments on commit d32dd8a

Please sign in to comment.