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-blas')
90 add_project_arguments('-DUSE_BLAS=1', language:['c','cpp'])
91 if build_platform == 'tizen'
92 blas_dep = dependency('openblas')
94 blas_dep = dependency('blas-openblas')
98 if get_option('use_gym')
99 add_project_arguments('-DUSE_GYM=1', language:['c','cpp'])
102 if get_option('enable-logging')
103 add_project_arguments('-D__LOGGING__=1', language:['c','cpp'])
106 libm_dep = cxx.find_library('m') # cmath library
107 libdl_dep = cxx.find_library('dl') # DL library
108 thread_dep = dependency('threads') # pthread for tensorflow-lite
109 iniparser_dep = dependency('iniparser', required : false) # iniparser
110 if not iniparser_dep.found()
111 message('falling back to find libiniparser library and header files')
112 libiniparser_dep = cxx.find_library('iniparser')
113 if libiniparser_dep.found() and cxx.has_header('iniparser.h', \
114 args : '-I/usr/include/iniparser')
115 iniparser_dep = declare_dependency (dependencies : libiniparser_dep,
116 compile_args : '-I/usr/include/iniparser')
120 jsoncpp_dep = dependency('jsoncpp') # jsoncpp
121 libcurl_dep = dependency('libcurl')
124 configure_file(input: 'nntrainer.pc.in', output: 'nntrainer.pc',
125 install_dir: join_paths(nntrainer_libdir, 'pkgconfig'),
126 configuration: nntrainer_conf
135 if get_option('enable-app')
136 tflite_dep = dependency('tensorflow-lite', required: true)
137 subdir('Applications')
140 if get_option('enable-test')