[transferlearning] Add output verification with gtest
[platform/core/ml/nntrainer.git] / meson.build
1 project('nntrainer', 'c', 'cpp',
2   version: '0.0.1',
3   license: ['apache-2.0'],
4   meson_version: '>=0.50.0',
5   default_options: [
6     'werror=true',
7     'warning_level=1',
8     'c_std=gnu89',
9     'cpp_std=c++14'
10   ]
11 )
12
13 cc = meson.get_compiler('c')
14 cxx = meson.get_compiler('cpp')
15 build_platform = ''
16
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'])
21
22   if get_option('enable-tizen-feature-check')
23     add_project_arguments('-D__FEATURE_CHECK_SUPPORT__', language: ['c', 'cpp'])
24   endif
25 endif
26
27 warning_flags = [
28   '-Wredundant-decls',
29   '-Wwrite-strings',
30   '-Wformat',
31   '-Wformat-nonliteral',
32   '-Wformat-security',
33   '-Winit-self',
34   '-Waddress',
35   '-Wno-multichar',
36   '-Wvla',
37   '-Wpointer-arith',
38   '-Wno-error=varargs'
39 ]
40
41 warning_c_flags = [
42   '-Wmissing-declarations',
43   '-Wmissing-include-dirs',
44   '-Wmissing-prototypes',
45   '-Wnested-externs',
46   '-Waggregate-return',
47   '-Wold-style-definition',
48   '-Wdeclaration-after-statement',
49   '-Wno-error=varargs'
50 ]
51
52 foreach extra_arg : warning_flags
53   if cc.has_argument (extra_arg)
54     add_project_arguments([extra_arg], language: 'c')
55   endif
56   if cxx.has_argument (extra_arg)
57     add_project_arguments([extra_arg], language: 'cpp')
58   endif
59 endforeach
60
61 foreach extra_arg : warning_c_flags
62   if cc.has_argument (extra_arg)
63     add_project_arguments([extra_arg], language: 'c')
64   endif
65 endforeach
66
67 # Set install path
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')
74
75
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)
83
84 dummy_dep = dependency('', required: false)
85 openmp_dep = dependency('openmp')
86
87 blas_dep = dummy_dep
88 # Dependencies
89 if get_option('enable-cublas')
90    add_project_arguments('-DUSE_CUBLAS=1', language:['c','cpp'])
91 endif
92
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')
97   else
98     blas_dep = dependency('blas-openblas')
99   endif
100 endif
101
102 if get_option('use_gym')
103    add_project_arguments('-DUSE_GYM=1', language:['c','cpp'])
104 endif
105
106 if get_option('enable-logging')
107    add_project_arguments('-D__LOGGING__=1', language:['c','cpp'])
108 endif
109
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')
121   endif
122 endif
123
124 jsoncpp_dep = dependency('jsoncpp') # jsoncpp
125 libcurl_dep = dependency('libcurl')
126 gtest_dep = dependency('gtest', required: false)
127
128 # Install .pc
129 configure_file(input: 'nntrainer.pc.in', output: 'nntrainer.pc',
130   install_dir: join_paths(nntrainer_libdir, 'pkgconfig'),
131   configuration: nntrainer_conf
132 )
133
134 # Build nntrainer
135 subdir('nntrainer')
136
137 # Build api
138 subdir('api')
139
140 if get_option('enable-app')
141   tflite_dep = dependency('tensorflow-lite', required: true)
142   subdir('Applications')
143 endif
144
145 if get_option('enable-test')
146    subdir('test')
147 endif
148
149 if get_option('enable-nnstreamer-tensor-filter')
150    nnstreamer_dep = dependency('nnstreamer', required: true)
151    subdir('nnstreamer/tensor_filter')
152 endif