summaryrefslogtreecommitdiff
path: root/next
diff options
context:
space:
mode:
authorJuha Alanen <juha.alanen@mapbox.com>2019-12-17 14:51:04 +0200
committerJuha Alanen <juha.alanen@mapbox.com>2020-01-03 11:52:50 +0200
commitee66940409ab5e0b5128fedcd889238f1f76f3c8 (patch)
tree04191d57dab6bcd8d6032f4389af1f8068c9ed1f /next
parent6d876f1d6bf95827598809b965ed6a6e06008675 (diff)
downloadqtlocation-mapboxgl-ee66940409ab5e0b5128fedcd889238f1f76f3c8.tar.gz
[benchmark] Run benchmark as NativeActivity application on Android
Diffstat (limited to 'next')
-rw-r--r--next/benchmark/CMakeLists.txt10
-rw-r--r--next/platform/android/android.cmake48
-rw-r--r--next/platform/linux/linux.cmake6
3 files changed, 52 insertions, 12 deletions
diff --git a/next/benchmark/CMakeLists.txt b/next/benchmark/CMakeLists.txt
index c42ef0815a..7e783da377 100644
--- a/next/benchmark/CMakeLists.txt
+++ b/next/benchmark/CMakeLists.txt
@@ -1,5 +1,5 @@
add_library(
- mbgl-benchmark SHARED EXCLUDE_FROM_ALL
+ mbgl-benchmark STATIC EXCLUDE_FROM_ALL
${MBGL_ROOT}/benchmark/api/query.benchmark.cpp
${MBGL_ROOT}/benchmark/api/render.benchmark.cpp
${MBGL_ROOT}/benchmark/function/camera_function.benchmark.cpp
@@ -31,12 +31,8 @@ get_target_property(MBGL_CORE_PRIVATE_LIBRARIES mbgl-core LINK_LIBRARIES)
target_link_libraries(
mbgl-benchmark
- PRIVATE
- ${MBGL_CORE_PRIVATE_LIBRARIES}
- mbgl-vendor-benchmark
- mbgl-compiler-options
- mbgl-core
- $<$<PLATFORM_ID:Android>:mbgl-core-android>
+ PRIVATE ${MBGL_CORE_PRIVATE_LIBRARIES} mbgl-vendor-benchmark mbgl-compiler-options
+ PUBLIC mbgl-core
)
set_property(TARGET mbgl-benchmark PROPERTY FOLDER Core)
diff --git a/next/platform/android/android.cmake b/next/platform/android/android.cmake
index c60704d542..89eddaaae6 100644
--- a/next/platform/android/android.cmake
+++ b/next/platform/android/android.cmake
@@ -334,19 +334,59 @@ target_link_libraries(
mbgl-test
)
-add_executable(
+add_library(
+ mbgl-benchmark-runner SHARED
+ ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c
+ ${MBGL_ROOT}/platform/android/src/test/benchmark_runner.cpp
+ ${MBGL_ROOT}/platform/default/src/mbgl/text/local_glyph_rasterizer.cpp
+ ${MBGL_ROOT}/platform/android/src/test/render_test_collator.cpp
+ ${MBGL_ROOT}/platform/android/src/test/render_test_number_format.cpp
+ ${MBGL_ROOT}/platform/default/src/mbgl/storage/file_source.cpp
+ ${MBGL_ROOT}/platform/default/src/mbgl/storage/default_file_source.cpp
+)
+
+target_include_directories(
mbgl-benchmark-runner
- ${MBGL_ROOT}/platform/android/src/test/benchmark_runner.cpp ${MBGL_ROOT}/platform/android/src/test/runtime.cpp
- ${MBGL_ROOT}/platform/android/src/test/runtime.hpp
+ PRIVATE
+ ${ANDROID_NDK}/sources/android/native_app_glue
+ ${MBGL_ROOT}/platform/android/src
+ ${MBGL_ROOT}/src
+ ${MBGL_ROOT}/platform/default/include
)
target_link_libraries(
mbgl-benchmark-runner
PRIVATE
Mapbox::Base::jni.hpp
- mapbox-gl
+ android
+ log
mbgl-compiler-options
+ -Wl,--whole-archive
mbgl-benchmark
+ -Wl,--no-whole-archive
+)
+
+add_custom_command(
+ TARGET mbgl-benchmark-runner PRE_BUILD
+ COMMAND
+ ${CMAKE_COMMAND}
+ -E
+ make_directory
+ ${MBGL_ROOT}/benchmark/results
+ COMMAND
+ ${CMAKE_COMMAND}
+ -E
+ tar
+ "chf"
+ "benchmark/android/app/src/main/assets/data.zip"
+ --format=zip
+ --files-from=benchmark/android/app/src/main/assets/to_zip.txt
+ COMMAND
+ ${CMAKE_COMMAND}
+ -E
+ remove_directory
+ ${MBGL_ROOT}/benchmark/results
+ WORKING_DIRECTORY ${MBGL_ROOT}
)
add_library(
diff --git a/next/platform/linux/linux.cmake b/next/platform/linux/linux.cmake
index 8ff02db1ba..98787eb04a 100644
--- a/next/platform/linux/linux.cmake
+++ b/next/platform/linux/linux.cmake
@@ -106,7 +106,11 @@ add_executable(
target_link_libraries(
mbgl-benchmark-runner
- PRIVATE mbgl-compiler-options mbgl-benchmark
+ PRIVATE
+ mbgl-compiler-options
+ -Wl,--whole-archive
+ mbgl-benchmark
+ -Wl,--no-whole-archive
)
add_executable(