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
117
118
|
project(
'yasl',
'c',
version: '0.1.0',
default_options: [
'c_std=c11',
'warning_level=2',
'b_lto=false',
],
)
cc = meson.get_compiler('c')
system = host_machine.system()
inc = include_directories('include', 'src')
deps = []
sources = files(
'src/common/timing.c',
'src/common/utf8.c',
'src/common/loop.c',
)
if system == 'linux'
wl_client = dependency('wayland-client')
wl_cursor = dependency('wayland-cursor')
xkbcommon = dependency('xkbcommon')
threads = dependency('threads')
m_dep = cc.find_library('m', required: false)
rt_dep = cc.find_library('rt', required: false)
deps += [wl_client, wl_cursor, xkbcommon, threads, m_dep, rt_dep]
proto_src = files(
'src/wayland/protocols/commit-timing-v1-protocol.c',
'src/wayland/protocols/cursor-shape-v1-protocol.c',
'src/wayland/protocols/fifo-v1-protocol.c',
'src/wayland/protocols/fractional-scale-v1-protocol.c',
'src/wayland/protocols/presentation-time-protocol.c',
'src/wayland/protocols/primary-selection-unstable-v1-protocol.c',
'src/wayland/protocols/tablet-v2-protocol.c',
'src/wayland/protocols/tearing-control-v1-protocol.c',
'src/wayland/protocols/text-input-unstable-v3-protocol.c',
'src/wayland/protocols/viewporter-protocol.c',
'src/wayland/protocols/xdg-decoration-protocol.c',
'src/wayland/protocols/xdg-shell-protocol.c',
'src/wayland/protocols/xdg-toplevel-drag-v1-protocol.c',
)
sources += files(
'src/wayland/buffer.c',
'src/wayland/clipboard.c',
'src/wayland/drag.c',
'src/wayland/ime.c',
'src/wayland/keyboard.c',
'src/wayland/pointer.c',
'src/wayland/popup.c',
'src/wayland/shell.c',
'src/wayland/surface.c',
) + proto_src
elif system == 'darwin'
add_languages('objc')
sources += files('src/cocoa/window.m')
deps += [
dependency('appleframeworks', modules: ['AppKit', 'Metal', 'QuartzCore']),
]
endif
yasl_lib = both_libraries(
'yasl',
sources,
include_directories: [inc, include_directories('src/wayland')],
dependencies: deps,
install: true,
)
install_headers(
'include/yasl/yasl.h',
'include/yasl/timing.h',
subdir: 'yasl',
)
pkg = import('pkgconfig')
pkg.generate(
yasl_lib.get_shared_lib(),
name: 'yasl',
description: 'Yet Another Surface Library - minimal, modern desktop window surface abstraction',
version: meson.project_version(),
subdirs: 'yasl',
)
yasl_dep = declare_dependency(
link_with: yasl_lib.get_static_lib(),
include_directories: include_directories('include'),
dependencies: deps,
)
meson.override_dependency('yasl', yasl_dep)
executable(
'yasl-example',
'examples/simple_window.c',
include_directories: inc,
link_with: yasl_lib.get_shared_lib(),
dependencies: deps,
)
test_exe = executable(
'yasl-test',
'tests/test_lifecycle.c',
include_directories: inc,
link_with: yasl_lib.get_static_lib(),
dependencies: deps,
)
add_test_setup('asan')
add_test_setup('tsan')
add_test_setup('msan')
test('basic', test_exe)
|