This repository was archived by the owner on Jul 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeson.build
More file actions
79 lines (68 loc) · 1.82 KB
/
meson.build
File metadata and controls
79 lines (68 loc) · 1.82 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
project(
'cargs', 'c',
version: '1.0.2',
license: 'MIT',
default_options: [
'warning_level=3',
'werror=true',
'c_std=gnu11',
'buildtype=debugoptimized',
],
meson_version: '>=1.0.0',
)
cc = meson.get_compiler('c')
if cc.get_id() == 'clang'
add_project_arguments('-Wno-gnu-zero-variadic-macro-arguments', language: 'c')
elif cc.get_id() == 'gcc'
add_project_arguments('-Wno-variadic-macros', language: 'c')
endif
# Include directories
inc_dirs = include_directories('includes')
# Build library
subdir('source')
# Handle regex dependency
disable_regex = get_option('disable_regex')
if disable_regex
add_project_arguments('-DCARGS_NO_REGEX', language: 'c')
pcre2_dep = dependency('', required: false)
else
pcre2_dep = dependency('libpcre2-8', required: true, version: '>=10.00')
if not pcre2_dep.found()
pcre2_dep = dependency('pcre2-8', required: true, version: '>=10.00')
endif
endif
# Create both static and shared libraries from sources
cargs_lib = both_libraries(
'cargs',
cargs_sources,
include_directories: inc_dirs,
dependencies: disable_regex ? [] : [pcre2_dep],
version: meson.project_version(),
soversion: '0',
install: true,
)
# Create dependency object for internal usage
cargs_dep = declare_dependency(
link_with: cargs_lib,
include_directories: inc_dirs,
dependencies: disable_regex ? [] : [pcre2_dep],
)
# Install headers (public API only)
install_headers('includes/cargs.h')
install_subdir(
'includes/cargs',
install_dir: get_option('includedir'),
exclude_directories: ['internal']
)
# Tests if enabled
if get_option('tests')
subdir('tests')
endif
# Examples if enabled
if get_option('examples')
subdir('examples')
endif
# Benchmarks if enabled
if get_option('benchmarks')
subdir('benchmarks')
endif