-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmeson.build
More file actions
85 lines (71 loc) · 2.02 KB
/
meson.build
File metadata and controls
85 lines (71 loc) · 2.02 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
76
77
78
79
80
81
82
83
84
85
project(
'deckhandler',
'c',
version: '0.0.1',
meson_version: '>= 0.56.0',
default_options: ['warning_level=3', 'c_std=c99'],
)
cc = meson.get_compiler('c')
if cc.get_id() != 'msvc'
extra_flags = [
'-fno-common',
'-fstack-protector-strong',
'-Wformat-security',
'-Wshadow',
'-Wstrict-overflow=5',
'-Werror=odr',
'-Werror=strict-aliasing',
]
add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c')
endif
# Parse version components
version_components = meson.project_version().split('.')
major_version = version_components[0]
minor_version = version_components[1]
patch_version = version_components[2]
conf = configuration_data()
conf.set('DH_VERSION_MAJOR', major_version)
conf.set('DH_VERSION_MINOR', minor_version)
conf.set('DH_VERSION_PATCH', patch_version)
config_h = configure_file(output : 'config.h', configuration : conf)
src = files('deckhandler.c')
pcg = subproject('pcg')
pcg_dep = pcg.get_variable('pcg_dep')
buildtarget = library(
meson.project_name(),
src,
c_args: '-DDECKHANDLER_BUILD',
dependencies: pcg_dep,
version: meson.project_version(),
install: not meson.is_subproject(),
)
# How to use in a superproject and other info
# https://mesonbuild.com/Subprojects.html
_compile_args = get_option('default_library') == 'static' ? ['-DDECKHANDLER_STATIC'] : []
deckhandler_dep = declare_dependency(
link_with: buildtarget,
compile_args: _compile_args,
dependencies: pcg_dep,
include_directories: '.',
)
if not meson.is_subproject()
pkg = import('pkgconfig')
pkg.generate(buildtarget, description: 'Library to handle a deck of cards')
install_headers('deckhandler.h')
subdir('test')
# install_subdir(
# join_paths('docs'),
# install_dir : join_paths(get_option('docdir'), 'html'),
# strip_directory : true
# )
# install_data(files(
# 'LICENSE',
# 'README.md',
# 'SWIG_INTERFACE.md'
# ),
# install_dir : get_option('docdir'))
endif
swig_lang = get_option('swig_lang')
if swig_lang != ''
subdir('swig')
endif