This patch enables emulation mode in Tizen env.
Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
cpp.cmd_array() + ['-print-sysroot']
).stdout().split('\n')[0]
+build_platform = ''
+if get_option('enable_tizen')
+ add_project_arguments('-D__TIZEN__=1', language: ['c', 'cpp'])
+ build_platform = 'tizen'
+endif
+
warning_c_flags = [
'-Wmissing-prototypes',
'-Wmissing-declarations',
ne_inidir = get_option('sysconfdir')
ne_datadir = join_paths(ne_prefix, join_paths(get_option('datadir'), 'npu-engine'))
+add_project_arguments('-DNE_PREFIX="' + ne_prefix + '"', language: ['c', 'cpp'])
add_project_arguments('-DNE_INIDIR="' + ne_inidir + '"', language: ['c', 'cpp'])
add_project_arguments('-DNE_DATADIR="' + ne_datadir + '"', language: ['c', 'cpp'])
libdrm_dep = dependency('libdrm')
if get_option('enable_npu_emul')
- add_project_arguments('-I/opt/trinity/include', language: ['c', 'cpp'])
+ add_project_arguments('-I' + ne_prefix + '/include', language: ['c', 'cpp'])
add_project_arguments('-DENABLE_EMUL', language: ['c', 'cpp'])
endif
if get_option('enable_data_manip')
option('num_threads', type : 'string', value : '8')
option('log_dir', type : 'string', value : '/tmp/')
option('log_level', type : 'string', value : '1')
+option('enable_tizen', type : 'boolean', value : false)
option('enable_npu_emul', type : 'boolean', value : false)
option('enable_data_manip', type : 'boolean', value : false)
option('enable_buffering', type : 'boolean', value : false)
BuildRequires: pkgconfig(libdrm)
BuildRequires: pkgconfig(tinyxml2)
+BuildRequires: pkgconfig(dlog)
+
+%if 0%{?npu_emul}
+BuildRequires: libmrpsim-devel
+%define enable_npu_emul -Denable_npu_emul=true
+%else
+%define enable_npu_emul -Denable_npu_emul=false
+%endif
+
%global debug_package %{nil}
%global __debug_install_post %{nil}
meson --buildtype=plain --bindir=%{neexampledir} --prefix=%{_prefix} \
--sysconfdir=%{_sysconfdir} --libdir=%{_libdir} --includedir=%{_includedir} \
- -Denable_npu_emul=false -Denable_data_manip=true \
+ -Denable_tizen=true -Denable_data_manip=true %{enable_npu_emul} \
build
ninja -C build %{?_smp_mflags}
#define MAX_EMUL_DEVICES (3)
#define ENV_PREFIX_SHARE "NE_PREFIX_SHARE"
-#define DEFAULT_PREFIX_SHARE "/opt/trinity/share"
+#define DEFAULT_PREFIX_SHARE NE_PREFIX "/share"
#define DEFAULT_PROFILE_PATH "/tmp"
class EmulTask {
if not ne_emul_dep.found()
warning('falling back to the hardcoded dependency on "npu-engine-emul"')
ne_emul_dep = declare_dependency (
- compile_args : ['-I/opt/trinity/include/npu-engine'],
- link_args: ['-L/opt/trinity/lib', '-lmrpsim -lrt -ldl'],
+ compile_args : ['-I' + ne_prefix + '/include/npu-engine'],
+ link_args: ['-L' + ne_prefix + '/lib', '-lmrpsim -lrt -ldl'],
)
endif
'ne-conf.cc'
]
+ne_core_utils_deps = [iniparser_dep]
+
+if build_platform == 'tizen'
+ dlog_dep = dependency('dlog')
+ ne_core_utils_deps += dlog_dep
+endif
+
ne_core_utils_dep = declare_dependency (
sources : ne_core_utils_src,
- dependencies : [iniparser_dep],
+ dependencies : ne_core_utils_deps,
include_directories : ne_core_utils_inc
)
fflush (stderr);
}
+#ifdef __TIZEN__
+ if (l == LOG_ERROR)
+ ml_loge ("%s", log_msg);
+ else if (l == LOG_WARN)
+ ml_logw ("%s", log_msg);
+ else if (l == LOG_INFO)
+ ml_logi ("%s", log_msg);
+#endif
+
if (fp_ == nullptr) {
char filename[FILENAME_MAX];
* Logging utilities *
********************************************************************/
+#ifdef __TIZEN__
+#include <dlog.h>
+
+#define TAG_NAME "npu-engine"
+
+#define ml_logi(...) dlog_print (DLOG_INFO, TAG_NAME, __VA_ARGS__)
+#define ml_logw(...) dlog_print (DLOG_WARN, TAG_NAME, __VA_ARGS__)
+#define ml_loge(...) dlog_print (DLOG_ERROR, TAG_NAME, __VA_ARGS__)
+#define ml_logd(...) dlog_print (DLOG_DEBUG, TAG_NAME, __VA_ARGS__)
+#define ml_logf(...) dlog_print (DLOG_FATAL, TAG_NAME, __VA_ARGS__)
+#endif
+
typedef enum {
LOG_NONE = 0,
LOG_ERROR,