-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
79 lines (62 loc) · 1.43 KB
/
meson.build
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
71
72
73
74
75
76
77
78
79
project(
'quadratic',
'cpp',
version: 'v0.1.0',
default_options: ['cpp_std=c++17']
)
project_description = 'A robust quadratic equation solver'
project_headers = [
'include/quadratic.h'
]
project_test_files = [
'tests/tests.cpp',
]
build_args = [
'-Wconversion', '-Wsign-conversion' , '-Wall', '-O2'
]
# ===================================================================
# ======
# Target
# ======
public_headers = include_directories('include')
project_target = shared_library(
meson.project_name(),
[],
install : true,
cpp_args : build_args,
gnu_symbol_visibility : 'hidden',
include_directories : public_headers,
)
# =======
# Project
# =======
# Make this library usable as a Meson subproject.
project_dep = declare_dependency(
include_directories: public_headers
)
set_variable(meson.project_name() + '_dep', project_dep)
# Make this library usable from the system's
# package manager.
install_headers(project_headers, subdir : meson.project_name())
pkg_mod = import('pkgconfig')
pkg_mod.generate(
name : meson.project_name(),
filebase : meson.project_name(),
description : project_description,
subdirs : meson.project_name(),
)
# ==========
# Unit Tests
# ==========
if not meson.is_subproject()
add_languages('cpp')
subdir('tests')
test('all_tests',
executable(
'run_tests',
files(project_test_files),
dependencies : [project_dep],
install : false
)
)
endif