1 project('nntrainer', 'c', 'cpp',
3 license: ['apache-2.0'],
4 meson_version: '>=0.50.0',
13 cc = meson.get_compiler('c')
14 cxx = meson.get_compiler('cpp')
17 if get_option('enable-tizen')
18 # Pass __TIZEN__ to the compiler
19 build_platform = 'tizen'
20 add_project_arguments('-D__TIZEN__=1', language:['c','cpp'])
27 '-Wformat-nonliteral',
38 '-Wmissing-declarations',
39 '-Wmissing-include-dirs',
40 '-Wmissing-prototypes',
43 '-Wold-style-definition',
44 '-Wdeclaration-after-statement',
48 foreach extra_arg : warning_flags
49 if cc.has_argument (extra_arg)
50 add_project_arguments([extra_arg], language: 'c')
52 if cxx.has_argument (extra_arg)
53 add_project_arguments([extra_arg], language: 'cpp')
57 foreach extra_arg : warning_c_flags
58 if cc.has_argument (extra_arg)
59 add_project_arguments([extra_arg], language: 'c')
64 nntrainer_prefix = get_option('prefix')
65 nntrainer_libdir = join_paths(nntrainer_prefix, get_option('libdir'))
66 nntrainer_bindir = join_paths(nntrainer_prefix, get_option('bindir'))
67 nntrainer_includedir = join_paths(nntrainer_prefix, get_option('includedir'))
68 nntrainer_inidir = get_option('sysconfdir')
69 application_install_dir = join_paths(nntrainer_bindir, 'applications')
72 # Set default configuration
73 nntrainer_conf = configuration_data()
74 nntrainer_conf.set('VERSION', meson.project_version())
75 nntrainer_conf.set('PREFIX', nntrainer_prefix)
76 nntrainer_conf.set('EXEC_PREFIX', nntrainer_bindir)
77 nntrainer_conf.set('LIB_INSTALL_DIR', nntrainer_libdir)
78 nntrainer_conf.set('INCLUDE_INSTALL_DIR', nntrainer_includedir)
81 if get_option('enable-blas')
82 add_project_arguments('-DUSE_BLAS=1', language:['c','cpp'])
83 if build_platform == 'tizen'
84 blas_dep = dependency('openblas')
86 blas_dep = dependency('blas-openblas')
90 if get_option('use_gym')
91 add_project_arguments('-DUSE_GYM=1', language:['c','cpp'])
94 if get_option('enable-logging')
95 add_project_arguments('-D__LOGGING__=1', language:['c','cpp'])
98 libm_dep = cxx.find_library('m') # cmath library
99 libdl_dep = cxx.find_library('dl') # DL library
100 thread_dep = dependency('threads') # pthread for tensorflow-lite
101 iniparser_dep = dependency('iniparser', required : false) # iniparser
102 if not iniparser_dep.found()
103 message('falling back to find libiniparser library and header files')
104 libiniparser_dep = cxx.find_library('iniparser')
105 if libiniparser_dep.found() and cxx.has_header('iniparser.h', \
106 args : '-I/usr/include/iniparser')
107 iniparser_dep = declare_dependency (dependencies : libiniparser_dep,
108 compile_args : '-I/usr/include/iniparser')
112 jsoncpp_dep = dependency('jsoncpp') # jsoncpp
113 libcurl_dep = dependency('libcurl')
116 configure_file(input: 'nntrainer.pc.in', output: 'nntrainer.pc',
117 install_dir: join_paths(nntrainer_libdir, 'pkgconfig'),
118 configuration: nntrainer_conf
127 if get_option('enable-app')
128 tflite_dep = dependency('tensorflow-lite', required: true)
129 subdir('Applications')
132 if get_option('enable-test')