Repository navigation
Expand file tree
/
Copy pathmeson.build
More file actions
117 lines (100 loc) · 2.85 KB
/
Copy pathmeson.build
File metadata and controls
117 lines (100 loc) · 2.85 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
project(
'maus',
'c',
meson_version: '>=1.1.0',
default_options: [
'c_std=c89',
'warning_level=2',
'optimization=2',
],
)
backend = get_option('window_backend')
if backend == 'auto'
if host_machine.system() == 'windows'
backend = 'windows'
elif dependency('wayland-client', required: false).found() and dependency('wayland-cursor', required: false).found() and dependency('xkbcommon', required: false).found()
backend = 'wayland'
elif dependency('x11', required: false).found() and dependency('xext', required: false).found() and dependency('xi', required: false).found()
backend = 'x11'
else
error('failed to determine window backend')
endif
endif
cc = meson.get_compiler('c')
inc = include_directories('include')
common_sources = [
'source/maus.c',
'source/maus_font.c',
'source/utils.c',
]
backend_sources = []
deps = []
c_args = []
backend_override_options = ['c_std=c89']
lib_name = 'maus_' + backend
if backend == 'x11'
c_args += ['-DBACKEND_X11']
deps += [
dependency('x11'),
dependency('xext'),
dependency('xi'),
]
backend_sources += ['source/maus_x11.c']
if host_machine.system() == 'openbsd'
c_args += ['-I/usr/X11R6/include']
endif
elif backend == 'wayland'
c_args += ['-DBACKEND_WAY']
backend_override_options = ['c_std=c99']
deps += [
dependency('wayland-client'),
dependency('wayland-cursor'),
dependency('xkbcommon'),
]
wayland = import('wayland')
backend_sources += wayland.scan_xml(wayland.find_protocol('xdg-shell'))
backend_sources += wayland.scan_xml(
wayland.find_protocol('pointer-constraints', state: 'unstable', version: 1),
)
backend_sources += wayland.scan_xml(
wayland.find_protocol('relative-pointer', state: 'unstable', version: 1),
)
backend_sources += ['source/maus_wayland.c']
elif backend == 'windows'
c_args += ['-DBACKEND_WIN']
deps += [
cc.find_library('gdi32'),
cc.find_library('user32'),
]
backend_sources += ['source/maus_windows.c']
endif
common = static_library(
'maus_common_' + backend,
common_sources,
include_directories: inc,
c_args: c_args,
override_options: ['c_std=c89'],
)
backend_lib = static_library(
'maus_backend_' + backend,
backend_sources,
include_directories: inc,
c_args: c_args,
dependencies: deps,
override_options: backend_override_options,
)
maus = static_library(
lib_name,
objects: [
common.extract_all_objects(recursive: false),
backend_lib.extract_all_objects(recursive: false),
],
dependencies: deps,
)
maus_dep = declare_dependency(
include_directories: inc,
link_with: maus,
dependencies: deps,
compile_args: c_args,
)
message('selected backend: ' + backend)