From 927ae621c9a3d46dbc401b8e9ea7bbed1bf2e97b Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Sun, 11 Oct 2026 21:53:42 +0300 Subject: initial: Yet Another Surface Library (YASL) 0.1.0 A minimal, modern desktop window surface library in C. Supports Wayland on Linux and Cocoa/Metal on macOS with presentation timing, fractional scaling, IME, and CSD. --- meson.build | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 meson.build (limited to 'meson.build') diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..dc81569 --- /dev/null +++ b/meson.build @@ -0,0 +1,106 @@ +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', +) + +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(), +) + +test('basic', test_exe) -- cgit v1.2.3