project( 'c8ui', 'c', version: '0.1.0', license: 'CC0-1.0', meson_version: '>=1.3.0', default_options: ['c_std=c11', 'warning_level=2', 'buildtype=debugoptimized', 'werror=false'], ) add_project_arguments( '-D_POSIX_C_SOURCE=200809L', '-DC8UI_DATADIR="@0@"'.format(get_option('prefix') / get_option('datadir')), '-Wno-unused-parameter', '-Wno-missing-field-initializers', language: 'c', ) cc = meson.get_compiler('c') cairo = dependency('cairo') pangocairo = dependency('pangocairo') glib = dependency('glib-2.0') xkbcommon = dependency('xkbcommon') pixman = dependency('pixman-1') # the press tilt's perspective: core.c math = cc.find_library('m') threads = dependency('threads') rsvg = dependency('librsvg-2.0', version: '>=2.52', required: get_option('svg')) add_project_arguments('-DC8UI_HAVE_SVG=@0@'.format(rsvg.found().to_int()), language: 'c') pkg = import('pkgconfig') includes = include_directories('include/c8ui') install_headers('include/c8ui/c8ui.h', 'include/c8ui/c8ui-wayland.h', 'include/c8ui/c8ui-charms.h', 'include/c8ui/c8ui-files.h', subdir: 'c8ui') # The core: widgets and layout, no window system. The compositor uses it # directly. core = library( 'c8ui-core', files('src/core.c', 'src/controls.c', 'src/icon.c', 'src/textedit.c', 'src/textview.c', 'src/list.c', 'src/appbar.c', 'src/forms.c', 'src/panes.c', 'src/miller.c', 'src/layout.c', 'src/pickers.c', 'src/tree.c', 'src/richtext.c', 'src/navbar.c', 'src/extras.c', 'src/transport.c', 'src/settingsflyout.c', 'src/kept.c', 'src/glyphs.c', 'src/pages.c'), include_directories: includes, dependencies: [cairo, pangocairo, glib, xkbcommon, pixman, math, threads, rsvg], version: meson.project_version(), install: true, ) core_dep = declare_dependency( link_with: core, include_directories: include_directories('include'), dependencies: [cairo, xkbcommon], ) meson.override_dependency('c8ui-core', core_dep) pkg.generate(core, name: 'c8ui-core', description: 'Metro-style widgets for the cont8nuum desktop', requires: ['cairo', 'xkbcommon'], requires_private: ['pangocairo', 'glib-2.0', 'pixman-1'] + (rsvg.found() ? ['librsvg-2.0'] : []), ) summary({'SVG icons': rsvg.found()}, bool_yn: true) # c8-base: the few things under the UI that the apps' cores, the tile # providers, the shell and PC settings' daemons all need (a JSON reader, # the clock's format, rfkill, the curl runner, the live tiles' bus). Only GLib and GIO, and # static, so each program carries its own copy as it did when every repo # had the files. base_gio = dependency('gio-2.0') install_headers('base/json.h', 'base/clock.h', 'base/rfkill.h', 'base/http.h', 'base/tiles.h', 'base/default-apps.h', 'base/power-profiles.h', 'base/stealth.h', 'base/background.h', subdir: 'c8-base') base = static_library( 'c8-base', files('base/json.c', 'base/rfkill.c', 'base/http.c', 'base/tiles.c', 'base/stealth.c', 'base/background.c'), dependencies: [glib, base_gio], pic: true, install: true, ) base_dep = declare_dependency( link_with: base, include_directories: include_directories('base'), dependencies: [glib, base_gio], ) meson.override_dependency('c8-base', base_dep) pkg.generate(base, name: 'c8-base', description: 'Shared plumbing under the cont8nuum apps', subdirs: 'c8-base', requires: ['glib-2.0', 'gio-2.0'], ) # Wayland apps wayland_client = dependency('wayland-client') wayland_protos = dependency('wayland-protocols', version: '>=1.32') gio = dependency('gio-2.0') wayland_scanner = find_program( dependency('wayland-scanner', native: true).get_variable('wayland_scanner'), native: true, ) wl_protocol_dir = wayland_protos.get_variable('pkgdatadir') client_protocols = [ 'stable/xdg-shell/xdg-shell.xml', 'stable/viewporter/viewporter.xml', 'stable/tablet/tablet-v2.xml', # cursor-shape refers to tablet tools 'staging/cursor-shape/cursor-shape-v1.xml', 'staging/fractional-scale/fractional-scale-v1.xml', 'staging/xdg-activation/xdg-activation-v1.xml', 'unstable/xdg-foreign/xdg-foreign-unstable-v2.xml', 'unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml', 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml', ] client_protos_src = [] foreach xml : client_protocols name = xml.split('/')[-1].replace('.xml', '') client_protos_src += custom_target( name + '_client_h', input: wl_protocol_dir / xml, output: '@BASENAME@-client-protocol.h', command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'], ) client_protos_src += custom_target( name + '_code', input: wl_protocol_dir / xml, output: '@BASENAME@-protocol.c', command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'], ) endforeach client = library( 'c8ui', files('src/wayland.c', 'src/charms.c', 'src/app.c', 'src/files.c', 'src/thumbnail.c'), client_protos_src, include_directories: includes, link_with: core, dependencies: [cairo, glib, gio, xkbcommon, wayland_client, math, threads], version: meson.project_version(), install: true, ) client_dep = declare_dependency( link_with: [client, core], include_directories: include_directories('include'), dependencies: [cairo, xkbcommon, wayland_client], ) meson.override_dependency('c8ui', client_dep) pkg.generate(client, name: 'c8ui', description: 'Metro-style apps for the cont8nuum desktop', requires: ['c8ui-core', 'wayland-client'], requires_private: ['gio-2.0'], ) # Built, not installed: the widgets to try by hand executable('c8ui-gallery', 'examples/gallery.c', dependencies: [client_dep], install: false, )