diff options
author | 오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com> | 2019-10-17 09:21:57 +0900 |
---|---|---|
committer | Chunseok Lee <chunseok.lee@samsung.com> | 2019-10-17 11:19:27 +0900 |
commit | e319168b917504a6a43b8e95c9da20325753520a (patch) | |
tree | 9d90c09c887b5111389dbedf924f59206411cd5a | |
parent | 2b291df9e211eaef2b7e35a3eaeed021782fa60f (diff) | |
download | nnfw-accepted/tizen/5.5/unified/20191031.024450.tar.gz nnfw-accepted/tizen/5.5/unified/20191031.024450.tar.bz2 nnfw-accepted/tizen/5.5/unified/20191031.024450.zip |
[m2/neurun] Introduce build option for default config (#8206)tizen_5.5.m2_releasesubmit/tizen_5.5_mobile_hotfix/20201026.185103submit/tizen_5.5/20191031.000003submit/tizen/20191017.022054accepted/tizen/unified/20191017.105749accepted/tizen/5.5/unified/mobile/hotfix/20201027.084341accepted/tizen/5.5/unified/20191031.024450
- Introduce ENVVAR_NEURUN_CONFIG option: use default neurun config using environment (default: on)
- Default off on tizen, and introduce gbs build option "test_build" to enable environment variable setting
Change-Id: Ief8be67a56c0128b709d52580b9a2720b98bd428
Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
Signed-off-by: Chunseok Lee <chunseok.lee@samsung.com>
-rw-r--r-- | infra/nnfw/cmake/CfgOptionFlags.cmake | 1 | ||||
-rw-r--r-- | infra/nnfw/cmake/options/options_aarch64-tizen.cmake | 1 | ||||
-rw-r--r-- | infra/nnfw/cmake/options/options_armv7l-tizen.cmake | 1 | ||||
-rw-r--r-- | packaging/nnfw.spec | 8 | ||||
-rw-r--r-- | runtimes/neurun/core/CMakeLists.txt | 4 | ||||
-rw-r--r-- | runtimes/neurun/core/src/util/ConfigSource.cc | 5 |
6 files changed, 19 insertions, 1 deletions
diff --git a/infra/nnfw/cmake/CfgOptionFlags.cmake b/infra/nnfw/cmake/CfgOptionFlags.cmake index 3917ee885..d431f30a7 100644 --- a/infra/nnfw/cmake/CfgOptionFlags.cmake +++ b/infra/nnfw/cmake/CfgOptionFlags.cmake @@ -27,6 +27,7 @@ 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(ENVVAR_NEURUN_CONFIG "Use environment variable for neurun configuration" ON) # # Build configuration for contrib # diff --git a/infra/nnfw/cmake/options/options_aarch64-tizen.cmake b/infra/nnfw/cmake/options/options_aarch64-tizen.cmake index 039eadec3..66ee34284 100644 --- a/infra/nnfw/cmake/options/options_aarch64-tizen.cmake +++ b/infra/nnfw/cmake/options/options_aarch64-tizen.cmake @@ -7,3 +7,4 @@ option(DOWNLOAD_ARMCOMPUTE "Download ARM Compute source" ON) option(DOWNLOAD_NEON2SSE "Download NEON2SSE library source" OFF) option(DOWNLOAD_NNPACK "Download NNPACK library source" OFF) option(BUILD_SRCN_KERNEL "Build srcn kernel" ON) +option(ENVVAR_NEURUN_CONFIG "Use environment variable for neurun configuration" OFF) diff --git a/infra/nnfw/cmake/options/options_armv7l-tizen.cmake b/infra/nnfw/cmake/options/options_armv7l-tizen.cmake index a1d6cd0e0..3ba48f332 100644 --- a/infra/nnfw/cmake/options/options_armv7l-tizen.cmake +++ b/infra/nnfw/cmake/options/options_armv7l-tizen.cmake @@ -9,3 +9,4 @@ option(DOWNLOAD_NNPACK "Download NNPACK library source" OFF) option(BUILD_TFLITE_LOADER "Build tensorflow lite file loader" ON) option(BUILD_TFLITE_LOADER_TEST_TOOL "Build tflite loader testing tool" OFF) option(BUILD_SRCN_KERNEL "Build srcn kernel" ON) +option(ENVVAR_NEURUN_CONFIG "Use environment variable for neurun configuration" OFF) diff --git a/packaging/nnfw.spec b/packaging/nnfw.spec index c5b004477..475fb2e81 100644 --- a/packaging/nnfw.spec +++ b/packaging/nnfw.spec @@ -54,12 +54,18 @@ NNFW test rpm. It does not depends on nnfw rpm since it contains nnfw runtime. %define target_arch aarch64 %endif +# Execute gbs with --define "test_build 1" in case that you need to test with environment variable +%{!?test_build: %define test_build 0} %{!?coverage_build: %define coverage_build 0} %if %{coverage_build} == 1 -%define build_options COVERAGE_BUILD=1 OBS_BUILD=1 BUILD_TYPE=Debug TARGET_ARCH=%{target_arch} TARGET_OS=tizen TFLITE_MAJOR_VER=1 TFLITE_MINOR_VER=13 +%define build_options COVERAGE_BUILD=1 OBS_BUILD=1 BUILD_TYPE=Debug TARGET_ARCH=%{target_arch} TARGET_OS=tizen TFLITE_MAJOR_VER=1 TFLITE_MINOR_VER=13 OPTIONS=-DENVVAR_NEURUN_CONFIG=ON +%else +%if %{test_build} == 1 +%define build_options OBS_BUILD=1 BUILD_TYPE=%{build_type} INSTALL_PATH=%{buildroot}%{_prefix} TARGET_ARCH=%{target_arch} TARGET_OS=tizen TFLITE_MAJOR_VER=1 TFLITE_MINOR_VER=13 OPTIONS=-DENVVAR_NEURUN_CONFIG=ON %else %define build_options OBS_BUILD=1 BUILD_TYPE=%{build_type} INSTALL_PATH=%{buildroot}%{_prefix} TARGET_ARCH=%{target_arch} TARGET_OS=tizen TFLITE_MAJOR_VER=1 TFLITE_MINOR_VER=13 %endif +%endif %prep %setup -q diff --git a/runtimes/neurun/core/CMakeLists.txt b/runtimes/neurun/core/CMakeLists.txt index 56f1134bd..d5449a987 100644 --- a/runtimes/neurun/core/CMakeLists.txt +++ b/runtimes/neurun/core/CMakeLists.txt @@ -11,4 +11,8 @@ target_link_libraries(neurun_core PRIVATE nnfw_common) target_link_libraries(neurun_core PRIVATE nnfw_coverage) target_link_libraries(neurun_core PRIVATE dl) +if(ENVVAR_NEURUN_CONFIG) + target_compile_definitions(neurun_core PRIVATE ENVVAR_FOR_DEFAULT_CONFIG) +endif(ENVVAR_NEURUN_CONFIG) + target_link_libraries(neurun_core PUBLIC nnfw-header) # To be removed later diff --git a/runtimes/neurun/core/src/util/ConfigSource.cc b/runtimes/neurun/core/src/util/ConfigSource.cc index 7cb966784..f84e95566 100644 --- a/runtimes/neurun/core/src/util/ConfigSource.cc +++ b/runtimes/neurun/core/src/util/ConfigSource.cc @@ -15,6 +15,7 @@ */ #include "util/ConfigSource.h" +#include "util/GeneralConfigSource.h" #include <algorithm> #include <cassert> @@ -35,8 +36,12 @@ static IConfigSource *config_source() { if (!_source) { +#ifdef ENVVAR_FOR_DEFAULT_CONFIG // Default ConfigSource is EnvConfigSource _source = nnfw::cpp14::make_unique<EnvConfigSource>(); +#else + _source = nnfw::cpp14::make_unique<GeneralConfigSource>(); +#endif // ENVVAR_FOR_DEFAULT_CONFIG } return _source.get(); } |