This commit removes the libnpuvision dependency for release mode.
Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
rm -rf build
override_dh_auto_configure:
- PKG_CONFIG_PATH=${NPU_TRINITY_INSTALL_PREFIX}/lib/pkgconfig meson --buildtype=plain --prefix=$(NPU_TRINITY_INSTALL_PREFIX) --sysconfdir=/etc --libdir=lib --bindir=bin --includedir=include build -Dbuild_test_only_mode=true
+ PKG_CONFIG_PATH=${NPU_TRINITY_INSTALL_PREFIX}/lib/pkgconfig meson --buildtype=plain --prefix=$(NPU_TRINITY_INSTALL_PREFIX) --sysconfdir=/etc --libdir=lib --bindir=bin --includedir=include build -Denable_npu_emul=true
override_dh_auto_build:
ninja -C build
libdrm_dep = dependency('libdrm') # libdrm library
thread_dep = dependency('threads') # pthread library
iniparser_dep = dependency('iniparser') # iniparser library
-npuvision_dep = dependency('libnpuvision') # npuvision library
-if get_option('build_test_only_mode')
+if get_option('enable_npu_emul')
+ npuvision_dep = dependency('libnpuvision') # npuvision library
+
add_project_arguments('-I/opt/trinity/include', language: 'c')
add_project_arguments('-I/opt/trinity/include', language: 'cpp')
- add_project_arguments('-DTEST_ONLY_MODE', language: 'c')
- add_project_arguments('-DTEST_ONLY_MODE', language: 'cpp')
+ add_project_arguments('-DENABLE_EMUL', language: 'c')
+ add_project_arguments('-DENABLE_EMUL', language: 'cpp')
endif
subdir('src')
ne_install_conf.set('RESV_MEM_SIZE', get_option('resv_mem_size'))
ne_install_conf.set('WORKING_DIR', get_option('working_dir'))
ne_install_conf.set('LOG_DIR', get_option('log_dir'))
-if get_option('build_test_only_mode')
+if get_option('enable_npu_emul')
ne_install_conf.set('TEST_MODE', true)
else
ne_install_conf.set('TEST_MODE', get_option('enable_test_mode'))
option('working_dir', type : 'string', value : '/tmp/')
option('log_dir', type : 'string', value : '/tmp/')
option('enable_test_mode', type : 'boolean', value : true)
-option('build_test_only_mode', type : 'boolean', value : false)
+option('enable_npu_emul', type : 'boolean', value : false)
# gtest
BuildRequires: gtest-devel
-BuildRequires: libnpuvision-devel
-
+# test coverage dependency
%if 0%{?test_coverage}
BuildRequires: lcov
BuildRequires: python
%endif
-# valgrind (used in unit tests only for x86_64)
+# NPU emulation dependency (used in unittests only)
+%if 0%{?unit_test}
+BuildRequires: libnpuvision-devel
+
+# enable valgrind only for x86_64
%ifarch x86_64
%if 0%{?use_valgrind}
BuildRequires: valgrind
%endif
%endif
+%endif
+
%global debug_package %{nil}
%global __debug_install_post %{nil}
#include <NPUemul.h>
#include <npubinfmt.h>
+#if defined(ENABLE_EMUL)
#include <TrinityCore.h>
#include <DataGen.h>
+#endif
#include <sys/mman.h>
#include <sys/ioctl.h>
#define PAGE_SIZE 4096
using namespace std;
+#if defined(ENABLE_EMUL)
using namespace trinity_vision;
/** @brief NPU Emulation using TrinityCore */
};
static NPUCoreEmul emul;
+#endif
/**
* @brief npu ioctl emulation
}
case SRNPU_IOCTL_SET_MODEL:
{
+#if defined(ENABLE_EMUL)
npu_model_config * model_config;
model_config = static_cast<npu_model_config *>(arg);
emul.set_model(model_config);
return 0;
+#endif
}
case SRNPU_IOCTL_RUN_INPUT:
{
+#if defined(ENABLE_EMUL)
npu_input_config * input_config;
input_config = static_cast<npu_input_config *>(arg);
emul.set_input(input_config);
return emul.run();
+#else
+ return 0;
+#endif
}
default:
return -EINVAL;
add_languages('cpp')
+npu_dependencies = [ne_core_utils_dep]
+if get_option('enable_npu_emul')
+ npu_dependencies += [ne_core_gem_dep, npuvision_dep]
+endif
+
ne_core_npu_inc = include_directories('.')
ne_core_npu_src = ['NPUdrvAPI.c', 'NPUemul.cpp']
ne_core_npu_dep = declare_dependency(
sources : ne_core_npu_src,
- dependencies : [ne_core_utils_dep, ne_core_gem_dep, npuvision_dep],
+ dependencies : npu_dependencies,
include_directories : [ne_common_inc, ne_core_npu_inc])