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',
37 '-Wmissing-declarations',
38 '-Wmissing-include-dirs',
39 '-Wmissing-prototypes',
42 '-Wold-style-definition',
43 '-Wdeclaration-after-statement'
46 foreach extra_arg : warning_flags
47 if cc.has_argument (extra_arg)
48 add_project_arguments([extra_arg], language: 'c')
50 if cxx.has_argument (extra_arg)
51 add_project_arguments([extra_arg], language: 'cpp')
55 foreach extra_arg : warning_c_flags
56 if cc.has_argument (extra_arg)
57 add_project_arguments([extra_arg], language: 'c')
62 nntrainer_prefix = get_option('prefix')
63 nntrainer_libdir = join_paths(nntrainer_prefix, get_option('libdir'))
64 nntrainer_bindir = join_paths(nntrainer_prefix, get_option('bindir'))
65 nntrainer_includedir = join_paths(nntrainer_prefix, get_option('includedir'))
66 nntrainer_inidir = get_option('sysconfdir')
67 application_install_dir = join_paths(nntrainer_bindir, 'applications')
70 # Set default configuration
71 nntrainer_conf = configuration_data()
72 nntrainer_conf.set('VERSION', meson.project_version())
73 nntrainer_conf.set('PREFIX', nntrainer_prefix)
74 nntrainer_conf.set('EXEC_PREFIX', nntrainer_bindir)
75 nntrainer_conf.set('LIB_INSTALL_DIR', nntrainer_libdir)
76 nntrainer_conf.set('INCLUDE_INSTALL_DIR', nntrainer_includedir)
79 if get_option('enable-blas')
80 add_project_arguments('-DUSE_BLAS=1', language:['c','cpp'])
81 if build_platform == 'tizen'
82 blas_dep = dependency('openblas')
84 blas_dep = dependency('blas-openblas')
88 if get_option('use_gym')
89 add_project_arguments('-DUSE_GYM=1', language:['c','cpp'])
92 if get_option('enable-logging')
93 add_project_arguments('-D__LOGGING__=1', language:['c','cpp'])
96 libm_dep = cxx.find_library('m') # cmath library
97 libdl_dep = cxx.find_library('dl') # DL library
98 thread_dep = dependency('threads') # pthread for tensorflow-lite
99 iniparser_dep = dependency('iniparser', required : false) # iniparser
100 if not iniparser_dep.found()
101 message('falling back to find libiniparser library and header files')
102 libiniparser_dep = cxx.find_library('iniparser')
103 if libiniparser_dep.found() and cxx.has_header('iniparser.h', \
104 args : '-I/usr/include/iniparser')
105 iniparser_dep = declare_dependency (dependencies : libiniparser_dep,
106 compile_args : '-I/usr/include/iniparser')
110 jsoncpp_dep = dependency('jsoncpp') # jsoncpp
111 libcurl_dep = dependency('libcurl')
114 configure_file(input: 'nntrainer.pc.in', output: 'nntrainer.pc',
115 install_dir: join_paths(nntrainer_libdir, 'pkgconfig'),
116 configuration: nntrainer_conf
122 if get_option('enable-app')
123 tflite_dep = dependency('tensorflow-lite', required: true)
124 subdir('Applications')
130 if get_option('enable-test')