summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>2019-10-17 00:21:57 (GMT)
committerChunseok Lee <chunseok.lee@samsung.com>2019-10-17 02:19:27 (GMT)
commite319168b917504a6a43b8e95c9da20325753520a (patch)
tree9d90c09c887b5111389dbedf924f59206411cd5a
parent2b291df9e211eaef2b7e35a3eaeed021782fa60f (diff)
downloadnnfw-tizen_5.5.zip
nnfw-tizen_5.5.tar.gz
nnfw-tizen_5.5.tar.bz2
- 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.cmake1
-rw-r--r--infra/nnfw/cmake/options/options_aarch64-tizen.cmake1
-rw-r--r--infra/nnfw/cmake/options/options_armv7l-tizen.cmake1
-rw-r--r--packaging/nnfw.spec8
-rw-r--r--runtimes/neurun/core/CMakeLists.txt4
-rw-r--r--runtimes/neurun/core/src/util/ConfigSource.cc5
6 files changed, 19 insertions, 1 deletions
diff --git a/infra/nnfw/cmake/CfgOptionFlags.cmake b/infra/nnfw/cmake/CfgOptionFlags.cmake
index 3917ee8..d431f30 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 039eade..66ee342 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 a1d6cd0..3ba48f3 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 c5b0044..475fb2e 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 56f1134..d5449a9 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 7cb9667..f84e955 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();
}