[android] Implement google benchmark runner for Android platform

This commit is contained in:
Alexander Shalamov
2018-12-20 10:22:00 +02:00
parent 6a31c9987b
commit 2da9d483ac
8 changed files with 69 additions and 5 deletions

View File

@@ -96,6 +96,10 @@ android {
targets "mbgl-test"
}
if (project.hasProperty("mapbox.with_benchmark")) {
targets "mbgl-benchmark"
}
if (abi != 'all') {
abiFilters abi.split(' ')
} else {

View File

@@ -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

View File

@@ -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);
}