From 2853fdfea5586430b3f1895f2a3a733a3981b8f9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=98=A4=ED=98=95=EC=84=9D/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Fri, 27 Sep 2019 11:13:08 +0900 Subject: [PATCH] [nnfw-cmake] Revise build option setting (#7780) - Reorder correct place for default in CfgOptionFlags.cmake - Remove redundant platform specific setting - same with default - Remove redundant option setting in tizen cross build script - Remove BUILD_TOOLS option - Introduce BUILD_OPENCL_TOOL to set build option for each tool Signed-off-by: Hyeongseok Oh --- infra/nnfw/cmake/CfgOptionFlags.cmake | 34 ++++++++++++---------- .../nnfw/cmake/options/options_aarch64-linux.cmake | 3 -- .../nnfw/cmake/options/options_aarch64-tizen.cmake | 2 -- .../nnfw/cmake/options/options_arm64-android.cmake | 2 -- .../nnfw/cmake/options/options_armv7l-linux.cmake | 4 +-- .../nnfw/cmake/options/options_armv7l-tizen.cmake | 2 -- .../nnfw/cmake/options/options_x86_64-linux.cmake | 2 -- infra/scripts/docker_build_tizen_cross.sh | 2 -- tools/CMakeLists.txt | 4 --- tools/opencl_tool/CMakeLists.txt | 10 +++++-- 10 files changed, 26 insertions(+), 39 deletions(-) diff --git a/infra/nnfw/cmake/CfgOptionFlags.cmake b/infra/nnfw/cmake/CfgOptionFlags.cmake index c51138d..e608698 100644 --- a/infra/nnfw/cmake/CfgOptionFlags.cmake +++ b/infra/nnfw/cmake/CfgOptionFlags.cmake @@ -2,14 +2,16 @@ include(CMakeDependentOption) # # Platfor specific configuration -# note: this should be placed before platform common setting for option setting priority +# note: this should be placed before default setting for option setting priority # (platform specific setting have higher priority) # include("cmake/options/options_${TARGET_PLATFORM}.cmake") # -# Build configuration for project +# Default build configuration for project # +option(ENABLE_STRICT_BUILD "Treat warning as error" ON) +option(ENABLE_COVERAGE "Build for coverage test" OFF) option(BUILD_EXT_MULTITHREAD "Build external build using multi thread" ON) option(BUILD_NEURUN "Build neurun" ON) option(BUILD_LOGGING "Build logging runtime" ON) @@ -23,14 +25,15 @@ CMAKE_DEPENDENT_OPTION(BUILD_RUNTIME_NNAPI_TEST "Build Runtime NN API Generated option(BUILD_TFLITE_RUN "Build tflite-run" ON) option(BUILD_TFLITE_BENCHMARK "Build tflite benchmark" ON) option(BUILD_TFLITE_BENCHMARK_MODEL "Build tflite benchmark model" OFF) -option(BUILD_NNAPI_QUICKCHECK "Build NN API Quickcheck tools" OFF) -option(BUILD_TOOLS "Bulid nnfw projects under tools/" ON) -option(BUILD_TFLITE_ACCURACY "Build tflite accuracy tool" OFF) option(BUILD_NNPACKAGE_RUN "Build nnpackge_run" ON) option(BUILD_SRCN_KERNEL "Build srcn kernel" OFF) +option(BUILD_TFLITE_LOADER "Build TensorFlow Lite loader" ON) +option(BUILD_CIRCLE_LOADER "Build circle loader" ON) +option(BUILD_TFLITE_LOADER_TEST_TOOL "Build tflite loader testing tool" ON) # -# Build configuration for contrib +# Default build configuration for contrib # +option(BUILD_ANDROID_TFLITE "Enable android support for TensorFlow Lite" OFF) option(BUILD_BENCHMARK_ACL "Build ARM Compute Library Benchmarks" OFF) option(BUILD_DETECTION_APP "Build detection example app" OFF) option(BUILD_LABS "Build lab projects" OFF) @@ -38,12 +41,15 @@ option(BUILD_TFLITE_TEST "Build tensorflow lite test" OFF) option(BUILD_TFLITE_CLASSIFY_APP "Build tflite_classify app" OFF) option(BUILD_UBEN "Build micro-benchmark (uben) suite" OFF) option(BUILD_MLAPSE "Build mlapse benchmark toolkit" OFF) -option(BUILD_CIRCLE_LOADER "Build circle loader" ON) -option(BUILD_TFLITE_LOADER "Build TensorFlow Lite loader" ON) -option(BUILD_TFLITE_LOADER_TEST_TOOL "Build tflite loader testing tool" ON) +# +# Default build configuration for tools +# option(BUILD_KBENCHMARK "Build kernel benchmark tool" OFF) +option(BUILD_OPENCL_TOOL "Build OpenCL tool" OFF) +option(BUILD_NNAPI_QUICKCHECK "Build NN API Quickcheck tools" OFF) +option(BUILD_TFLITE_ACCURACY "Build tflite accuracy tool" OFF) # -# Download configuration +# Default external libraries source download and build configuration # option(DOWNLOAD_TENSORFLOW "Download Tensorflow source" ON) option(DOWNLOAD_ABSL "Download Absl source" ON) @@ -53,14 +59,10 @@ option(DOWNLOAD_GEMMLOWP "Download GEMM low precesion library source" ON) option(DOWNLOAD_NEON2SSE "Download NEON2SSE library source" ON) option(DOWNLOAD_NNPACK "Download NNPACK source" ON) option(DOWNLOAD_FLATBUFFERS "Download FlatBuffers source" ON) -option(BUILD_TENSORFLOW_LITE "Build TensorFlow Lite from the downloaded source" ON) option(DOWNLOAD_ARMCOMPUTE "Download ARM Compute source" ON) option(DOWNLOAD_NONIUS "Download nonius source" ON) option(DOWNLOAD_BOOST "Download boost source" OFF) option(BUILD_BOOST "Build boost source" OFF) -# -# GTest support -# +option(BUILD_TENSORFLOW_LITE "Build TensorFlow Lite from the downloaded source" ON) option(BUILD_GTEST "Download and build Google Test" ON) -option(ENABLE_STRICT_BUILD "Treat warning as error" ON) -option(ENABLE_COVERAGE "Build for coverage test" OFF) +option(BUILD_ARMCOMPUTE "Build ARM Compute from the downloaded source" ON) diff --git a/infra/nnfw/cmake/options/options_aarch64-linux.cmake b/infra/nnfw/cmake/options/options_aarch64-linux.cmake index fbe49d4..179030e 100644 --- a/infra/nnfw/cmake/options/options_aarch64-linux.cmake +++ b/infra/nnfw/cmake/options/options_aarch64-linux.cmake @@ -1,8 +1,5 @@ # # aarch64 linux cmake options # -option(BUILD_ARMCOMPUTE "Build ARM Compute from the downloaded source" ON) -option(BUILD_ANDROID_TFLITE "Enable android support for TensorFlow Lite" OFF) -option(DOWNLOAD_ARMCOMPUTE "Download ARM Compute source" ON) option(DOWNLOAD_NEON2SSE "Download NEON2SSE library source" OFF) option(BUILD_SRCN_KERNEL "Build srcn kernel" ON) diff --git a/infra/nnfw/cmake/options/options_aarch64-tizen.cmake b/infra/nnfw/cmake/options/options_aarch64-tizen.cmake index 9ef4d77..530659d 100644 --- a/infra/nnfw/cmake/options/options_aarch64-tizen.cmake +++ b/infra/nnfw/cmake/options/options_aarch64-tizen.cmake @@ -7,9 +7,7 @@ option(BUILD_TENSORFLOW_LITE "Build TensorFlow Lite from the downloaded source" option(DOWNLOAD_NEON2SSE "Download NEON2SSE library source" OFF) option(DOWNLOAD_NNPACK "Download NNPACK source" OFF) -option(BUILD_ANDROID_TFLITE "Enable android support for TensorFlow Lite" OFF) option(BUILD_LOGGING "Build logging runtime" OFF) -option(BUILD_TOOLS "Bulid nnfw projects under tools/" OFF) option(BUILD_TFLITE_RUN "Build tflite-run" OFF) option(BUILD_TFLITE_LOADER_TEST_TOOL "Build tflite loader testing tool" OFF) option(BUILD_SRCN_KERNEL "Build srcn kernel" ON) diff --git a/infra/nnfw/cmake/options/options_arm64-android.cmake b/infra/nnfw/cmake/options/options_arm64-android.cmake index 891bff9..af95103 100644 --- a/infra/nnfw/cmake/options/options_arm64-android.cmake +++ b/infra/nnfw/cmake/options/options_arm64-android.cmake @@ -1,10 +1,8 @@ # arm64 android cmake options # -option(BUILD_ARMCOMPUTE "Build ARM Compute from the downloaded source" ON) # NOTE BUILD_ANDROID_TFLITE(JNI lib) is disabled due to BuiltinOpResolver issue. # tensorflow-lite does not build BuiltinOpResolver but JNI lib need it # Related Issue : #1403 option(BUILD_ANDROID_TFLITE "Enable android support for TensorFlow Lite" OFF) -option(DOWNLOAD_ARMCOMPUTE "Download ARM Compute source" ON) option(DOWNLOAD_NEON2SSE "Download NEON2SSE library source" OFF) diff --git a/infra/nnfw/cmake/options/options_armv7l-linux.cmake b/infra/nnfw/cmake/options/options_armv7l-linux.cmake index f06f998..ec2f8d6 100644 --- a/infra/nnfw/cmake/options/options_armv7l-linux.cmake +++ b/infra/nnfw/cmake/options/options_armv7l-linux.cmake @@ -1,8 +1,6 @@ # # armv7l linux cmake options # -option(BUILD_ARMCOMPUTE "Build ARM Compute from the downloaded source" ON) -option(BUILD_ANDROID_TFLITE "Enable android support for TensorFlow Lite" OFF) -option(DOWNLOAD_ARMCOMPUTE "Download ARM Compute source" ON) option(DOWNLOAD_NEON2SSE "Download NEON2SSE library source" OFF) option(BUILD_SRCN_KERNEL "Build srcn kernel" ON) +option(BUILD_OPENCL_TOOL "Build OpenCL tool" ON) diff --git a/infra/nnfw/cmake/options/options_armv7l-tizen.cmake b/infra/nnfw/cmake/options/options_armv7l-tizen.cmake index 79b6c42..e2b8081 100644 --- a/infra/nnfw/cmake/options/options_armv7l-tizen.cmake +++ b/infra/nnfw/cmake/options/options_armv7l-tizen.cmake @@ -7,9 +7,7 @@ option(BUILD_TENSORFLOW_LITE "Build TensorFlow Lite from the downloaded source" option(DOWNLOAD_NEON2SSE "Download NEON2SSE library source" OFF) option(DOWNLOAD_NNPACK "Download NNPACK source" OFF) -option(BUILD_ANDROID_TFLITE "Enable android support for TensorFlow Lite" OFF) option(BUILD_LOGGING "Build logging runtime" OFF) -option(BUILD_TOOLS "Bulid nnfw projects under tools/" OFF) option(BUILD_TFLITE_RUN "Build tflite-run" OFF) option(BUILD_TFLITE_LOADER_TEST_TOOL "Build tflite loader testing tool" OFF) option(BUILD_SRCN_KERNEL "Build srcn kernel" ON) diff --git a/infra/nnfw/cmake/options/options_x86_64-linux.cmake b/infra/nnfw/cmake/options/options_x86_64-linux.cmake index 179e5bd..97642e6 100644 --- a/infra/nnfw/cmake/options/options_x86_64-linux.cmake +++ b/infra/nnfw/cmake/options/options_x86_64-linux.cmake @@ -2,6 +2,4 @@ # x86_64 linux cmake options # option(BUILD_ARMCOMPUTE "Build ARM Compute from the downloaded source" OFF) -option(BUILD_ANDROID_TFLITE "Enable android support for TensorFlow Lite" OFF) option(DOWNLOAD_ARMCOMPUTE "Download ARM Compute source" OFF) -option(DOWNLOAD_NEON2SSE "Download NEON2SSE library source" ON) diff --git a/infra/scripts/docker_build_tizen_cross.sh b/infra/scripts/docker_build_tizen_cross.sh index 0b27885..f6ed81d 100755 --- a/infra/scripts/docker_build_tizen_cross.sh +++ b/infra/scripts/docker_build_tizen_cross.sh @@ -30,8 +30,6 @@ DOCKER_ENV_VARS+=" -e TARGET_ARCH=armv7l" DOCKER_ENV_VARS+=" -e CROSS_BUILD=1" DOCKER_ENV_VARS+=" -e TARGET_OS=tizen" DOCKER_ENV_VARS+=" -e BUILD_TYPE=release" -# Disable arm compute build (use rootfs) -DOCKER_ENV_VARS+=" -e OPTIONS=-DBUILD_ARMCOMPUTE=OFF" # Mirror server setting if [[ -z $EXTERNAL_DOWNLOAD_SERVER ]]; then diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index ba69aaf..5ea6cda 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,5 +1 @@ -if(NOT BUILD_TOOLS) - return() -endif(NOT BUILD_TOOLS) - add_subdirectories() diff --git a/tools/opencl_tool/CMakeLists.txt b/tools/opencl_tool/CMakeLists.txt index 9e7dafe..d1bcb70 100644 --- a/tools/opencl_tool/CMakeLists.txt +++ b/tools/opencl_tool/CMakeLists.txt @@ -1,10 +1,14 @@ -if(NOT ${TARGET_ARCH_BASE} STREQUAL "arm") +if (NOT BUILD_OPENCL_TOOL) return() -endif(NOT ${TARGET_ARCH_BASE} STREQUAL "arm") +endif (NOT BUILD_OPENCL_TOOL) list(APPEND OPENCL_INFO_SOURCE "src/opencl_info.cc") -nnas_find_package(ARMCompute REQUIRED) +nnas_find_package(ARMCompute QUIET) +if(NOT ARMCompute_FOUND) + message(WARNING "Cannot find ARM Compute Library") + return() +endif(NOT ARMCompute_FOUND) add_executable(opencl_info ${OPENCL_INFO_SOURCE}) target_link_libraries(opencl_info arm_compute) -- 2.7.4