diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2018-12-20 10:22:00 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-01-11 09:49:36 +0200 |
commit | 2da9d483ac8bce5bfa7523f9113e1bc4ef2cbfb5 (patch) | |
tree | afe1d90ec2179547f10452a8840b2dbadce91538 /platform/android | |
parent | 6a31c9987bc8b8f67c20dea8d437d72d109d6be1 (diff) | |
download | qtlocation-mapboxgl-2da9d483ac8bce5bfa7523f9113e1bc4ef2cbfb5.tar.gz |
[android] Implement google benchmark runner for Android platform
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); +} |