[android] Implement google benchmark runner for Android platform
This commit is contained in:
@@ -96,6 +96,10 @@ android {
|
||||
targets "mbgl-test"
|
||||
}
|
||||
|
||||
if (project.hasProperty("mapbox.with_benchmark")) {
|
||||
targets "mbgl-benchmark"
|
||||
}
|
||||
|
||||
if (abi != 'all') {
|
||||
abiFilters abi.split(' ')
|
||||
} else {
|
||||
|
||||
@@ -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
|
||||
|
||||
10
platform/android/src/test/benchmark_runner.cpp
Normal file
10
platform/android/src/test/benchmark_runner.cpp
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user