error('nnstreamer capi dependency not found for tizen')
endif
-if get_option('enable-tizen') and get_option('enable-tizen-feature-check')
+if get_option('platform') == 'tizen' and get_option('enable-tizen-feature-check')
capi_src += meson.current_source_dir() / 'src' / 'nntrainer-capi-tizen-feature-check.cpp'
endif
capi_headers += meson.current_source_dir() / 'include' / 'nntrainer.h'
capi_headers += meson.current_source_dir() / '..' / 'nntrainer-api-common.h'
-if get_option('enable-tizen')
+if get_option('platform') == 'tizen'
capi_headers += meson.current_source_dir() / 'include' / 'nntrainer-tizen-internal.h'
endif
nnstreamer_capi_dep,
]
-if get_option('enable-tizen')
+if get_option('platform') == 'tizen'
message('CAPI is in Tizen mode')
tizen_deps = [
cc = meson.get_compiler('c')
cxx = meson.get_compiler('cpp')
-build_platform = ''
-if get_option('enable-tizen')
+if get_option('platform') == 'tizen'
# Pass __TIZEN__ to the compiler
- build_platform = 'tizen'
add_project_arguments('-D__TIZEN__=1', language:['c','cpp'])
if get_option('enable-tizen-feature-check')
if get_option('enable-blas')
add_project_arguments('-DUSE_BLAS=1', language:['c','cpp'])
- if build_platform == 'tizen'
+ if get_option('platform') == 'tizen' or get_option('platform') == 'yocto'
blas_dep = dependency('openblas')
else
blas_dep = dependency('blas-openblas', required:false)
libm_dep = cxx.find_library('m') # cmath library
libdl_dep = cxx.find_library('dl') # DL library
thread_dep = dependency('threads') # pthread for tensorflow-lite
+
iniparser_dep = dependency('iniparser', required : false, version : '>=4.1') # iniparser
if not iniparser_dep.found()
message('falling back to find libiniparser library and header files')
libiniparser_dep = cxx.find_library('iniparser')
+ sysroot = run_command(
+ cxx.cmd_array() + ['-print-sysroot']
+ ).stdout().split('\n')[0]
+
+ if sysroot.startswith('/')
+ sysroot_inc_cflags_template = '-I@0@/usr/include@1@'
+ sysroot_inc = sysroot_inc_cflags_template.format(sysroot, '')
+ add_project_arguments(sysroot_inc, language: ['c', 'cpp'])
+ sysroot_inc_cflags_iniparser = sysroot_inc_cflags_template.format(sysroot,
+ '/iniparser')
+ else
+ sysroot_inc_cflags_iniparser = '-I/usr/include/iniparser'
+ endif
+
if libiniparser_dep.found() and cxx.has_header('iniparser.h', \
- args : '-I/usr/include/iniparser')
+ args : sysroot_inc_cflags_iniparser)
iniparser_dep = declare_dependency (dependencies : libiniparser_dep,
- compile_args : '-I/usr/include/iniparser')
+ compile_args : sysroot_inc_cflags_iniparser)
+ else
+ error('Failed to resolve dependency on iniparser')
endif
endif
-option('enable-tizen', type: 'boolean', value: false)
+option('platform', type: 'combo', choices: ['none', 'tizen', 'yocto'], value: 'none')
option('enable-blas', type: 'boolean', value: true)
option('enable-cublas', type: 'boolean', value: false)
option('enable-app', type: 'boolean', value: true)
%endif #tizen
## Define build options
-%define enable_tizen -Denable-tizen=false
+%define platform -Dplatform=tizen
%define enable_tizen_feature_check -Denable-tizen-feature-check=true
%define install_app -Dinstall-app=true
%define enable_ccapi -Denable-ccapi=false
%endif
%if %{with tizen}
-%define enable_tizen -Denable-tizen=true
+%define platform -Dplatform=tizen
%if 0%{?support_ccapi}
%define enable_ccapi -Denable-ccapi=true
mkdir -p build
meson --buildtype=plain --prefix=%{_prefix} --sysconfdir=%{_sysconfdir} \
--libdir=%{_libdir} --bindir=%{nntrainerapplicationdir} \
- --includedir=%{_includedir} %{install_app} %{enable_tizen} \
+ --includedir=%{_includedir} %{install_app} %{platform} \
%{enable_tizen_feature_check} %{enable_cblas} %{enable_ccapi} \
%{enable_gym} %{enable_nnstreamer_tensor_filter} %{enable_profile} \
%{enable_nnstreamer_backbone} %{enable_tflite_backbone} \