-
Notifications
You must be signed in to change notification settings - Fork 168
Expand file tree
/
Copy pathmeson.build
More file actions
75 lines (64 loc) · 1.71 KB
/
Copy pathmeson.build
File metadata and controls
75 lines (64 loc) · 1.71 KB
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
project(
'pystring',
'cpp',
version: '1.2.0',
license: 'BSD-3-Clause',
license_files: 'LICENSE',
meson_version: '>=1.3',
default_options: ['cpp_std=c++17,c++11', 'warning_level=3'],
)
inc = include_directories('.')
hdrs = files('pystring.h')
# --- Compiled library target ---
pystring_lib = library(
'pystring',
files('pystring.cpp'),
implicit_include_directories: false,
include_directories: inc,
version: meson.project_version(),
install: true,
)
pystring_dep = declare_dependency(
link_with: pystring_lib,
include_directories: inc,
)
install_headers(hdrs, subdir: 'pystring')
pkgconfig = import('pkgconfig')
pkgconfig.generate(
pystring_lib,
description: 'C++ functions matching the interface and behavior of python string methods with std::string',
)
# --- Header-only target ---
pystring_header_only_dep = declare_dependency(
include_directories: inc,
compile_args: ['-DPYSTRING_HEADER_ONLY'],
)
install_headers(hdrs, files('pystring_impl.h'), subdir: 'pystring')
# --- Override default dependency ---
meson.override_dependency('pystring', pystring_dep)
# --- Tests ---
test(
'PyStringTest',
executable(
'pystring_test',
'test.cpp',
dependencies: pystring_dep,
build_by_default: false,
),
)
test(
'PyStringTestHeaderOnly',
executable(
'pystring_test_header_only',
'test.cpp',
dependencies: pystring_header_only_dep,
build_by_default: false,
),
)
# Compile-time check that PYSTRING_HEADER_ONLY propagates correctly
executable(
'pystring_test_header_only_define',
'test_header_only_define.cpp',
dependencies: pystring_header_only_dep,
build_by_default: true,
)