project('npu-engine', ['c', 'cpp'],
version: '2.0.1',
license: ['Proprietary'],
- meson_version: '>=0.50.0',
+ meson_version: '>=0.47.0',
default_options: [
'werror=true',
'warning_level=1',
cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
+sysroot = run_command(
+ cpp.cmd_array() + ['-print-sysroot']
+ ).stdout().split('\n')[0]
warning_c_flags = [
'-Wmissing-prototypes',
ne_common_inc = include_directories('include/common')
ne_host_inc = include_directories('include/host')
+if not get_option('enable_npu_emul')
+ ne_kernel_hdr = get_option('kernel_hdr_dir')
+ ne_hernel_hdr_cflags = '-I' + ne_kernel_hdr
+ if cpp.has_header('misc/trinity.h', args: ne_hernel_hdr_cflags)
+ add_project_arguments(ne_hernel_hdr_cflags, language: ['c', 'cpp'])
+ else
+ if not cpp.has_header('misc/trinity.h')
+ error('Failed to find \'misc/trintiy.h\'. Try to use the -Dkernel_hdr_dir option.')
+ endif
+ endif
+endif
+
+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
+
+
libdl_dep = cc.find_library('dl') # DL library
libm_dep = cc.find_library('m') # math library
thread_dep = dependency('threads') # pthread library
if not iniparser_dep.found()
libiniparser = cpp.find_library('iniparser')
if libiniparser.found() and cpp.has_header('iniparser.h',\
- args : '-I/usr/include/iniparser')
+ args : sysroot_inc_cflags_iniparser)
iniparser_dep = declare_dependency(
- compile_args : '-I/usr/include/iniparser',
+ compile_args : sysroot_inc_cflags_iniparser,
dependencies: libiniparser,
)
else