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'])
22 if get_option('enable-tizen-feature-check')
23 add_project_arguments('-D__FEATURE_CHECK_SUPPORT__', language: ['c', 'cpp'])
31 '-Wformat-nonliteral',
42 '-Wmissing-declarations',
43 '-Wmissing-include-dirs',
44 '-Wmissing-prototypes',
47 '-Wold-style-definition',
48 '-Wdeclaration-after-statement',
52 foreach extra_arg : warning_flags
53 if cc.has_argument (extra_arg)
54 add_project_arguments([extra_arg], language: 'c')
56 if cxx.has_argument (extra_arg)
57 add_project_arguments([extra_arg], language: 'cpp')
61 foreach extra_arg : warning_c_flags
62 if cc.has_argument (extra_arg)
63 add_project_arguments([extra_arg], language: 'c')
68 nntrainer_prefix = get_option('prefix')
69 nntrainer_libdir = join_paths(nntrainer_prefix, get_option('libdir'))
70 nntrainer_bindir = join_paths(nntrainer_prefix, get_option('bindir'))
71 nntrainer_includedir = join_paths(nntrainer_prefix, get_option('includedir'))
72 nntrainer_inidir = get_option('sysconfdir')
73 application_install_dir = join_paths(nntrainer_bindir, 'applications')
76 # Set default configuration
77 nntrainer_conf = configuration_data()
78 nntrainer_conf.set('VERSION', meson.project_version())
79 nntrainer_conf.set('PREFIX', nntrainer_prefix)
80 nntrainer_conf.set('EXEC_PREFIX', nntrainer_bindir)
81 nntrainer_conf.set('LIB_INSTALL_DIR', nntrainer_libdir)
82 nntrainer_conf.set('INCLUDE_INSTALL_DIR', nntrainer_includedir)
84 dummy_dep = dependency('', required: false)
85 openmp_dep = dependency('openmp')
89 if get_option('enable-cublas')
90 add_project_arguments('-DUSE_CUBLAS=1', language:['c','cpp'])
93 if get_option('enable-blas')
94 add_project_arguments('-DUSE_BLAS=1', language:['c','cpp'])
95 if build_platform == 'tizen'
96 blas_dep = dependency('openblas')
98 blas_dep = dependency('blas-openblas')
102 if get_option('use_gym')
103 add_project_arguments('-DUSE_GYM=1', language:['c','cpp'])
106 if get_option('enable-logging')
107 add_project_arguments('-D__LOGGING__=1', language:['c','cpp'])
110 libm_dep = cxx.find_library('m') # cmath library
111 libdl_dep = cxx.find_library('dl') # DL library
112 thread_dep = dependency('threads') # pthread for tensorflow-lite
113 iniparser_dep = dependency('iniparser', required : false) # iniparser
114 if not iniparser_dep.found()
115 message('falling back to find libiniparser library and header files')
116 libiniparser_dep = cxx.find_library('iniparser')
117 if libiniparser_dep.found() and cxx.has_header('iniparser.h', \
118 args : '-I/usr/include/iniparser')
119 iniparser_dep = declare_dependency (dependencies : libiniparser_dep,
120 compile_args : '-I/usr/include/iniparser')
124 jsoncpp_dep = dependency('jsoncpp') # jsoncpp
125 libcurl_dep = dependency('libcurl')
126 gtest_dep = dependency('gtest', required: false)
129 configure_file(input: 'nntrainer.pc.in', output: 'nntrainer.pc',
130 install_dir: join_paths(nntrainer_libdir, 'pkgconfig'),
131 configuration: nntrainer_conf
140 if get_option('enable-app')
141 tflite_dep = dependency('tensorflow-lite', required: true)
142 subdir('Applications')
145 if get_option('enable-test')
149 if get_option('enable-nnstreamer-tensor-filter')
150 nnstreamer_dep = dependency('nnstreamer', required: true)
151 subdir('nnstreamer/tensor_filter')