From 8db065e02bd969ec7f4e671458839f4f71bd5ec9 Mon Sep 17 00:00:00 2001 From: Akos Denke Date: Tue, 18 Jun 2024 15:10:47 +0200 Subject: [PATCH] Add CMake option customization for all OpenCV benchmark builds --- scripts/benchmark/README.md | 5 ++++- scripts/benchmark/build.sh | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/benchmark/README.md b/scripts/benchmark/README.md index 275d5971a..ed58cef32 100644 --- a/scripts/benchmark/README.md +++ b/scripts/benchmark/README.md @@ -27,8 +27,11 @@ CMAKE_TOOLCHAIN_FILE=/build/cmake/android.toolchain.cmake \ ./build.sh ``` +By default, the script will produce two flavours of builds. One without KleidiCV (opencv-vanilla) and +one with it (opencv-kleidicv). Both builds can be fine tuned by the `VANILLA_EXTRA_CMAKE_OPTIONS` and the +`KLEIDICV_EXTRA_CMAKE_OPTIONS` environment variables respectively. If the `CUSTOM_CMAKE_OPTIONS` environment variable is set a third flavour is also build, next to vanilla -OpenCV and OpenCV+KleidiCV with default options. The variable specifies the extra CMake variables for this +OpenCV and OpenCV+KleidiCV. The variable specifies the extra CMake variables for this custom build and the `CUSTOM_BUILD_SUFFIX` environment variable can alter the `custom` build name suffix. (If the `CUSTOM_BUILD_SUFFIX` was defined for the build, it should be provided to the further scripts as well, like `push` and `run_*`.) diff --git a/scripts/benchmark/build.sh b/scripts/benchmark/build.sh index a913687be..40b916c90 100755 --- a/scripts/benchmark/build.sh +++ b/scripts/benchmark/build.sh @@ -7,8 +7,8 @@ # Builds the perf benchmarks for OpenCV with Android target. # # The following builds will be created: -# * opencv-vanilla: (without KleidiCV) -# * opencv-kleidicv: (with KleidiCV) +# * opencv-vanilla: (without KleidiCV, but with VANILLA_EXTRA_CMAKE_OPTIONS) +# * opencv-kleidicv: (with KleidiCV and KLEIDICV_EXTRA_CMAKE_OPTIONS) # * [opencv-kleidicv-]: (with KleidiCV and CUSTOM_CMAKE_OPTIONS, # but only if the CUSTOM_CMAKE_OPTIONS were provided) # @@ -17,8 +17,10 @@ # variables should be set as well. # # Options: -# CUSTOM_CMAKE_OPTIONS: If provided, an extra build will be created with KleidiCV. -# CUSTOM_BUILD_SUFFIX: Build name suffix for the extra build. Defaults to 'custom'. +# VANILLA_EXTRA_CMAKE_OPTIONS: Optional extra CMake options for the opencv-vanilla build. +# KLEIDICV_EXTRA_CMAKE_OPTIONS: Optional extra CMake options for the opencv-kleidicv build. +# CUSTOM_CMAKE_OPTIONS: If provided, an extra build will be created with KleidiCV. +# CUSTOM_BUILD_SUFFIX: Build name suffix for the extra build. Defaults to 'custom'. # # ------------------------------------------------------------------------------ @@ -51,6 +53,7 @@ export BUILD_ID="opencv-vanilla" export EXTRA_CMAKE_ARGS="\ ${COMMON_EXTRA_CMAKE_ARGS} \ -DWITH_KLEIDICV=OFF \ + ${VANILLA_EXTRA_CMAKE_OPTIONS:-} \ " "${SCRIPT_PATH}"/build-opencv.sh "opencv_perf_imgproc opencv_perf_core" @@ -62,6 +65,7 @@ export EXTRA_CMAKE_ARGS="\ ${COMMON_EXTRA_CMAKE_ARGS} \ -DWITH_KLEIDICV=ON \ -DKLEIDICV_SOURCE_PATH=${KLEIDICV_SOURCE_PATH} \ + ${KLEIDICV_EXTRA_CMAKE_OPTIONS:-} \ " "${SCRIPT_PATH}"/build-opencv.sh "opencv_perf_imgproc opencv_perf_core" -- GitLab