project('nntrainer', 'c', 'cpp',
- version: '0.3.0',
+ version: '0.4.0',
license: ['apache-2.0'],
meson_version: '>=0.50.0',
default_options: [
if get_option('platform') == 'tizen'
# Pass __TIZEN__ to the compiler
add_project_arguments('-D__TIZEN__=1', language:['c','cpp'])
+ add_project_arguments('-DTIZENVERSION=@0@'.format(get_option('tizen-version-major')), language: ['c', 'cpp'])
+ add_project_arguments('-DTIZENVERSIONMINOR=@0@'.format(get_option('tizen-version-minor')), language: ['c', 'cpp'])
if get_option('enable-tizen-feature-check')
add_project_arguments('-D__FEATURE_CHECK_SUPPORT__', language: ['c', 'cpp'])
'-Wpointer-arith',
'-Wno-error=varargs',
'-Wdefaulted-function-deleted',
- '-ftree-vectorize'
+ '-ftree-vectorize',
+ '-Wno-unused-variable'
]
warning_c_flags = [
'-Wno-error=varargs'
]
+
foreach extra_arg : warning_flags
if cc.has_argument (extra_arg)
add_project_arguments([extra_arg], language: 'c')
nntrainer_includedir = nntrainer_prefix / get_option('includedir') / 'nntrainer'
nntrainer_confdir = get_option('sysconfdir')
application_install_dir = nntrainer_bindir / 'applications'
+ nntrainer_swapdir = '/tmp'
else
nntrainer_prefix = meson.build_root() / 'android_build_result'
# @todo arch has to be option
- nntrainer_libdir = nntrainer_prefix / 'lib' / 'arm64-v8a'
+ nntrainer_libdir = nntrainer_prefix / 'lib'
nntrainer_includedir = nntrainer_prefix / 'include' / 'nntrainer'
nntrainer_bindir = nntrainer_prefix / 'bin'
nntrainer_confdir = nntrainer_prefix / 'conf'
application_install_dir = nntrainer_prefix / 'examples'
+ nntrainer_swapdir = '/data/local/tmp'
+endif
+
+# handle swap options
+if get_option('enable-memory-swap')
+ nntrainer_enable_swap = 'true'
+else
+ nntrainer_enable_swap = 'false'
+endif
+
+if get_option('memory-swap-path') != ''
+ nntrainer_swapdir = get_option('memory-swap-path')
endif
# handle resources
nntrainer_conf.set('LIB_INSTALL_DIR', nntrainer_libdir)
nntrainer_conf.set('PLUGIN_INSTALL_PREFIX', nntrainer_libdir / 'nntrainer')
nntrainer_conf.set('INCLUDE_INSTALL_DIR', nntrainer_includedir / '..')
-nntrainer_conf.set('CAPI_ML_COMMON_DEP', get_option('capi-ml-common-actual'))
+nntrainer_conf.set('MEMORY_SWAP', nntrainer_enable_swap)
+nntrainer_conf.set('MEMORY_SWAP_PATH', nntrainer_swapdir)
dummy_dep = dependency('', required: false)
found_dummy_dep = declare_dependency() # dummy dep to use if found
+# if ml-api-support is disabled, enable dummy common api interfaces and disable related dependencies.
+ml_api_common_dep = dependency(get_option('capi-ml-common-actual'), required : get_option('ml-api-support').enabled())
+nnstreamer_capi_dep = dummy_dep
+if (ml_api_common_dep.found())
+ nntrainer_conf.set('CAPI_ML_COMMON_DEP', get_option('capi-ml-common-actual'))
+ extra_defines += '-DML_API_COMMON=1'
+
+ nnstreamer_capi_dep = dependency(get_option('capi-ml-inference-actual'), required : true)
+ extra_defines += '-DNNSTREAMER_AVAILABLE=1'
+ # accessing this variable when dep_.not_found() remains hard error on purpose
+ supported_nnstreamer_capi = nnstreamer_capi_dep.version().version_compare('>=1.7.0')
+ if not supported_nnstreamer_capi
+ extra_defines += '-DUNSUPPORTED_NNSTREAMER=1'
+ warning('capi-nnstreamer version is too old, we do not know if it works with older nnstreamer version')
+ endif
+else
+ nntrainer_conf.set('CAPI_ML_COMMON_DEP', '')
+ extra_defines += '-DML_API_COMMON=0'
+endif
blas_dep = dummy_dep
# Dependencies
if get_option('enable-cublas')
if get_option('enable-blas')
extra_defines += '-DUSE_BLAS=1'
- if get_option('platform') == 'tizen' or get_option('platform') == 'yocto'
- blas_dep = dependency('openblas')
- elif get_option('platform') == 'android'
+
+ if get_option('platform') == 'android'
message('preparing blas')
run_command(meson.source_root() / 'jni' / 'prepare_openblas.sh', meson.build_root(), check: true)
blas_dep = found_dummy_dep
blas_root = meson.build_root() / 'openblas'
else
- blas_dep = dependency('blas-openblas', required:false)
- # for Ubuntu 20.04
- if not blas_dep.found()
- blas_dep = dependency('openblas')
+ blas_dep = dependency('openblas')
+ endif
+
+ if blas_dep.found()
+ if get_option('openblas-num-threads') > 0
+ extra_defines += '-DBLAS_NUM_THREADS=@0@'.format(get_option('openblas-num-threads'))
+ message('set openblas num threads=@0@'.format(get_option('openblas-num-threads')))
endif
endif
endif
+extra_defines += '-DNNTR_NUM_THREADS=@0@'.format(get_option('nntr-num-threads'))
+message('set nntrainer num threads=@0@'.format(get_option('nntr-num-threads')))
+
openmp_dep = dummy_dep
if get_option('enable-openmp')
openmp_dep = dependency('openmp')
extra_defines += '-DPROFILE=1'
endif
+if get_option('enable-trace')
+ extra_defines += '-DTRACE=1'
+endif
+
if get_option('enable-debug')
extra_defines += '-DDEBUG=1'
endif
extra_defines += '-D__LOGGING__=1'
endif
+gmock_dep = dependency('gmock', static: true, main: false, required: false)
+gtest_dep = dependency('gtest', static: true, main: false, required: false)
+gtest_main_dep = dependency('gtest', static: true, main: true, required: false)
+
+
if get_option('enable-test') # and get_option('platform') != 'android'
extra_defines += '-DENABLE_TEST=1'
+ if gtest_dep.version().version_compare('<1.10.0')
+ extra_defines += '-DGTEST_BACKPORT=1'
+ endif
endif
if get_option('reduce-tolerance')
endif
endif
-nnstreamer_capi_dep = dependency(get_option('capi-ml-inference-actual'), required:false)
-if nnstreamer_capi_dep.found()
- extra_defines += '-DNNSTREAMER_AVAILABLE=1'
- # accessing this variable when dep_.not_found() remains hard error on purpose
- supported_nnstreamer_capi = nnstreamer_capi_dep.version().version_compare('>=1.7.0')
- if not supported_nnstreamer_capi
- extra_defines += '-DUNSUPPORTED_NNSTREAMER=1'
- warning('capi-nnstreamer version is too old, we do not know if it works with older nnstreamer version')
- endif
-endif
-
-ml_api_common_dep = dummy_dep
-
-if get_option('platform') != 'android'
- ml_api_common_dep = dependency(get_option('capi-ml-common-actual'), required: true)
-else
+if get_option('platform') == 'android'
message('preparing ml api')
run_command(meson.source_root() / 'jni' / 'prepare_ml-api.sh', meson.build_root() / 'ml-api-inference', check: true)
ml_api_common_root = meson.build_root() / 'ml-api-inference'
if get_option('platform') != 'android'
tflite_dep = dependency('tensorflow2-lite', required: false)
else
- message('preparing tflite')
- run_command(meson.source_root() / 'jni' / 'prepare_tflite.sh', '2.3.0', meson.build_root(), check: true)
- tflite_root = meson.build_root() / 'tensorflow-2.3.0' / 'tensorflow-lite'
- tflite_dep = found_dummy_dep
+ if get_option('enable-tflite-backbone') or get_option('enable-tflite-interpreter')
+ message('preparing tflite, because either tflite backbone or interpreter is enabled')
+ run_command(meson.source_root() / 'jni' / 'prepare_tflite.sh', '2.3.0', meson.build_root(), check: true)
+ tflite_root = meson.build_root() / 'tensorflow-2.3.0' / 'tensorflow-lite'
+ tflite_dep = found_dummy_dep
+ endif
endif
if get_option('enable-tflite-backbone')
extra_defines += '-DENABLE_TFLITE_INTERPRETER=1'
endif
-gtest_dep = dependency('gtest', static: true, main: false, required: false)
-gtest_main_dep = dependency('gtest', static: true, main: true, required: false)
-
opencv_dep = dummy_dep
if get_option('platform') != 'android'
# Build nntrainer
subdir('nntrainer')
+enable_capi = false
+enable_ccapi = false
# Build api
subdir('api')