diff options
Diffstat (limited to 'platform/android')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/build.gradle | 4 | ||||
-rw-r--r-- | platform/android/config.cmake | 20 | ||||
-rw-r--r-- | platform/android/src/test/benchmark_runner.cpp | 10 |
3 files changed, 34 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index 2c97965866..e8f4539210 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -96,6 +96,10 @@ android { targets "mbgl-test" } + if (project.hasProperty("mapbox.with_benchmark")) { + targets "mbgl-benchmark" + } + if (abi != 'all') { abiFilters abi.split(' ') } else { diff --git a/platform/android/config.cmake b/platform/android/config.cmake index d78a6ce94b..d0d2c42eb6 100644 --- a/platform/android/config.cmake +++ b/platform/android/config.cmake @@ -108,6 +108,26 @@ macro(mbgl_platform_test) ) endmacro() +## Benchmark ## +macro(mbgl_platform_benchmark) + target_sources(mbgl-benchmark + PRIVATE platform/android/src/test/benchmark_runner.cpp + PRIVATE platform/android/src/test/runtime.cpp + ) + + set_target_properties(mbgl-benchmark + PROPERTIES + LINK_FLAGS + "-fPIE -pie \ + -Wl,--export-dynamic \ + -Wl,--version-script=${CMAKE_SOURCE_DIR}/platform/android/src/test/version-script") + + target_link_libraries(mbgl-benchmark + PRIVATE mbgl-filesource + ) +endmacro() + + ## Custom layer example ## add_library(example-custom-layer SHARED diff --git a/platform/android/src/test/benchmark_runner.cpp b/platform/android/src/test/benchmark_runner.cpp new file mode 100644 index 0000000000..321a37a028 --- /dev/null +++ b/platform/android/src/test/benchmark_runner.cpp @@ -0,0 +1,10 @@ +#include "runtime.hpp" +#include <mbgl/benchmark.hpp> + +int main(int argc, char *argv[]) { + if (!mbgl::android::initRuntime(argc, argv)) { + return 1; + } + + return mbgl::runBenchmark(argc, argv); +} |