Debian Codegraph @

tests/inputs/meson.build

raw
1 # https://github.com/tiernemi/meson-sample-project/blob/master/meson.build
2 project('sample_cpp_project', 'cpp',
3 version : '1.0',
4 license : [ 'proprietary'],
5 meson_version : '>= 0.50.0',
6 default_options : [ 'warning_level=3', 'buildtype=debugoptimized', 'cpp_std=c++11' ]
7 )
8
9 # Variables tracking sources and libraries
10 library_path = []
11 project_sources = []
12 project_header_files = []
13 project_test_sources = []
14 project_benchmark_sources = []
15
16 inc = [include_directories('include')]
17
18 subdir('include')
19 subdir('third_party')
20 # This is where you should add in include directories
21
22 # This triggers the builds of sources
23 subdir('src')
24 # This links all the static libs into the main source file to form a binary
25
26 sample_cpp_project_bin_deps = [
27 meson.get_compiler('cpp').find_library('fizz', required : true, dirs : library_path)
28 ]
29
30 sample_cpp_project_bin_dep_libs = [
31 foo_lib,
32 bar_lib,
33 baz_lib,
34 ]
35
36 sample_cpp_project_bin = executable('sample_cpp_project_bin',
37 main_source,
38 include_directories : inc,
39 dependencies : sample_cpp_project_bin_deps,
40 link_with : sample_cpp_project_bin_dep_libs)
41
42 gtest = subproject('gtest')
43 benchmark = subproject('benchmark')
44
45 if get_option('enable-tests')
46 subdir('tests')
47 endif
48 if get_option('enable-benchmarks')
49 subdir('benchmarks')
50 endif
51
52 subdir('docs')
53
54 # This adds the clang format file to the build directory
55 configure_file(input : '.clang-format',
56 output : '.clang-format',
57 copy: true)
58 run_target('format',
59 command : ['clang-format','-i','-style=file',project_sources,project_test_sources,project_benchmark_sources,project_header_files])
60
61 # This regex excludes any sources from the third_party, tests, benchmarks
62 # and gtest related files.
63 regex = '^((?!(third_party|tests|benchmarks|gtest)).)*$'
64 # This adds clang tidy support
65 configure_file(input : '.clang-tidy',
66 output : '.clang-tidy',
67 copy : true)
68 run_target('tidy',
69 command : ['run-clang-tidy.py','-fix', '-j' , '8', 'files', regex ,'-format', '-p='+ meson.build_root()])
70