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