File: meson.build

package info (click to toggle)
cloc 2.06-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,064 kB
  • sloc: perl: 30,146; cpp: 1,219; python: 623; ansic: 334; asm: 267; makefile: 244; sh: 186; sql: 144; java: 136; ruby: 111; cs: 104; pascal: 52; lisp: 50; haskell: 35; f90: 35; cobol: 35; objc: 25; php: 22; javascript: 15; fortran: 9; ml: 8; xml: 7; tcl: 2
file content (70 lines) | stat: -rw-r--r-- 2,053 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# https://github.com/tiernemi/meson-sample-project/blob/master/meson.build
project('sample_cpp_project', 'cpp',
    version : '1.0',
    license : [ 'proprietary'],
    meson_version : '>= 0.50.0',
    default_options : [ 'warning_level=3', 'buildtype=debugoptimized', 'cpp_std=c++11' ]
)

# Variables tracking sources and libraries
library_path = []
project_sources = []
project_header_files = []
project_test_sources = []
project_benchmark_sources = []

inc = [include_directories('include')]

subdir('include')
subdir('third_party')
# This is where you should add in include directories

# This triggers the builds of sources
subdir('src')
# This links all the static libs into the main source file to form a binary

sample_cpp_project_bin_deps = [
  meson.get_compiler('cpp').find_library('fizz', required : true, dirs : library_path)
]

sample_cpp_project_bin_dep_libs = [
  foo_lib,
  bar_lib,
  baz_lib,
]

sample_cpp_project_bin = executable('sample_cpp_project_bin', 
  main_source, 
  include_directories : inc, 
  dependencies : sample_cpp_project_bin_deps,
  link_with : sample_cpp_project_bin_dep_libs)

gtest = subproject('gtest')
benchmark = subproject('benchmark')

if get_option('enable-tests')
  subdir('tests')
endif
if get_option('enable-benchmarks')
  subdir('benchmarks')
endif

subdir('docs')

# This adds the clang format file to the build directory
configure_file(input : '.clang-format',
               output : '.clang-format',
	       copy: true)
run_target('format',
  command : ['clang-format','-i','-style=file',project_sources,project_test_sources,project_benchmark_sources,project_header_files])

# This regex excludes any sources from the third_party, tests, benchmarks 
# and gtest related files.
regex = '^((?!(third_party|tests|benchmarks|gtest)).)*$'
# This adds clang tidy support
configure_file(input : '.clang-tidy',
               output : '.clang-tidy',
               copy : true)
run_target('tidy',
  command : ['run-clang-tidy.py','-fix', '-j' , '8', 'files', regex ,'-format', '-p='+ meson.build_root()])