#define __NNSTREAMER_CAPI_H__
#include <stddef.h>
-#include <errno.h>
+/**
+ * Apply modify_nnstreamer_h_for_nontizen.sh if you want to use
+ * in non-Tizen Linux machines
+ */
+#include <tizen_error.h>
#ifdef __cplusplus
extern "C" {
ML_TENSOR_TYPE_UNKNOWN /**< Unknown type */
} ml_tensor_type_e;
-#include <tizen_error.h>
/**
* @brief Enumeration for the error codes of NNStreamer Pipelines.
* @since_tizen 5.5
inc = include_directories('include')
nninc = include_directories('../../gst')
-tizen_deps = [
- dependency('capi-base-common'),
- dependency('dlog')
-]
+tizen_deps = []
+
+if (get_option('enable-tizen'))
+ message('CAPI is in Tizen mode')
+ tizen_deps = [
+ dependency('capi-base-common'),
+ dependency('dlog')
+ ]
+else
+ r = run_command('./modify_nnstreamer_h_for_nontizen.sh')
+ if (r.returncode() != 0)
+ message('Non-Tizen mode support failed')
+ endif
+ message('CAPI is in non-Tizen mode')
+endif
capi_deps = [
nnstreamer_dep, glib_dep, gst_dep, gst_app_dep, tizen_deps
--- /dev/null
+#!/usr/bin/env bash
+
+sed -i "s|#include <tizen_error.h>|#include <errno.h>\n\
+#define TIZEN_ERROR_NONE (0)\n\
+#define TIZEN_ERROR_INVALID_PARAMETER (-EINVAL)\n\
+#define TIZEN_ERROR_STREAMS_PIPE (-ESTRPIPE)\n\
+#define TIZEN_ERROR_TRY_AGAIN (-EAGAIN)\n\
+#define TIZEN_ERROR_UNKNOWN (-1073741824LL)\n\
+#define TIZEN_ERROR_TIMED_OUT (TIZEN_ERROR_UNKNOWN + 1)\n\
+#define TIZEN_ERROR_NOT_SUPPORTED (TIZEN_ERROR_UNKNOWN + 2)\
+|" include/nnstreamer.h
endif
endif
+if get_option('enable-tizen')
+ add_project_arguments('-D__TIZEN__=1', language: ['c', 'cpp'])
+endif
+
# Build nnstreamer (common, plugins)
subdir('gst')
option('enable-symbolic-link', type: 'boolean', value: true)
option('enable-capi', type: 'boolean', value: false)
option('enable-python', type: 'boolean', value: true)
+option('enable-tizen', type: 'boolean', value: false)
cp %{SOURCE1002} .
%endif
-%if ! %{with tizen}
-##
-# If CAPI is built for Non Tizen platform, then below command will be executed.
-sed -i "s|#include <tizen_error.h>||" api/capi/include/nnstreamer.h
-sed -i "s|TIZEN_ERROR_NONE|0|" api/capi/include/nnstreamer.h
-sed -i "s|TIZEN_ERROR_INVALID_PARAMETER|-EINVAL|" api/capi/include/nnstreamer.h
-sed -i "s|TIZEN_ERROR_STREAMS_PIPE|-ESTRPIPE|" api/capi/include/nnstreamer.h
-sed -i "s|TIZEN_ERROR_TRY_AGAIN|-EAGAIN|" api/capi/include/nnstreamer.h
-sed -i "s|TIZEN_ERROR_UNKNOWN|(-1073741824LL)|" api/capi/include/nnstreamer.h
-sed -i "s|= TIZEN_ERROR_TIMED_OUT||" api/capi/include/nnstreamer.h
-sed -i "s|= TIZEN_ERROR_NOT_SUPPORTED||" api/capi/include/nnstreamer.h
-%endif
-
%build
%if 0%{?testcoverage}
CXXFLAGS="${CXXFLAGS} -fprofile-arcs -ftest-coverage"
%define enable_tf false
%endif
-meson --buildtype=plain --prefix=%{_prefix} --sysconfdir=%{_sysconfdir} --libdir=%{_libdir} --bindir=%{nnstexampledir} --includedir=%{_includedir} -Dinstall-example=true -Denable-tensorflow=%{enable_tf} -Denable-pytorch=false %{api} -Denable-env-var=false -Denable-symbolic-link=false -Dc_args='-D__TIZEN__' build
+meson --buildtype=plain --prefix=%{_prefix} --sysconfdir=%{_sysconfdir} --libdir=%{_libdir} --bindir=%{nnstexampledir} --includedir=%{_includedir} -Dinstall-example=true -Denable-tensorflow=%{enable_tf} -Denable-pytorch=false %{api} -Denable-env-var=false -Denable-symbolic-link=false -Denable-tizen=true build
ninja -C build %{?_smp_mflags}