meson: initial build conf

Not that well tested yet, does not support plugins-as-modules
This commit is contained in:
Daniel Eklöf 2019-05-01 12:39:59 +02:00
parent a1be489293
commit 51e9d691e4
6 changed files with 218 additions and 0 deletions

48
bar/meson.build Normal file
View file

@ -0,0 +1,48 @@
bar_backends = []
# TODO: X11
if enable_x11
bar_x11 = declare_dependency(sources: ['xcb.c', 'xcb.h'],
dependencies: [xcb_stuff, cairo, cairo_ft])
bar_backends += [bar_x11]
endif
# TODO: conditional Wayland
if enable_wayland
wayland_protocols = dependency('wayland-protocols')
wayland_protocols_datadir = wayland_protocols.get_pkgconfig_variable('pkgdatadir')
wscanner = dependency('wayland-scanner', native: true)
wscanner_prog = find_program(
wscanner.get_pkgconfig_variable('wayland_scanner'), native: true)
wayland_protocol_header = generator(
wscanner_prog,
output: '@BASENAME@.h',
arguments: ['client-header', '@INPUT@', '@OUTPUT@'])
wayland_protocol_source = generator(
wscanner_prog,
output: '@BASENAME@.c',
arguments: ['private-code', '@INPUT@', '@OUTPUT@'])
generated_wayland_protocols = []
foreach prot : [
'../external/wlr-protocols/unstable/wlr-layer-shell-unstable-v1.xml',
wayland_protocols_datadir + '/stable/xdg-shell/xdg-shell.xml',
wayland_protocols_datadir + '/unstable/xdg-output/xdg-output-unstable-v1.xml']
generated_wayland_protocols += [
wayland_protocol_header.process(prot),
wayland_protocol_source.process(prot)]
endforeach
bar_wayland = declare_dependency(
sources: ['wayland.c', 'wayland.h'] + generated_wayland_protocols,
dependencies: [wayland_client, wayland_cursor, cairo, cairo_ft])
bar_backends += [bar_wayland]
endif
bar = declare_dependency(
sources: ['bar.c', 'bar.h', 'private.h', 'backend.h'],
dependencies: bar_backends + [threads])

10
decorations/meson.build Normal file
View file

@ -0,0 +1,10 @@
deco_sdk = declare_dependency(dependencies: [cairo, cairo_ft])
decorations = []
foreach deco : ['background', 'stack', 'underline']
lib = static_library(
'decoration_@0@'.format(deco), '@0@.c'.format(deco), dependencies: deco_sdk)
decorations += [declare_dependency(
link_with: lib,
compile_args: '-DHAVE_PLUGIN_@0@'.format(deco.underscorify()))]
endforeach

79
meson.build Normal file
View file

@ -0,0 +1,79 @@
project('f00bar', 'c',
license: 'MIT',
default_options: ['c_std=c11', 'warning_level=1', 'werror=true'])
add_project_arguments(
['-D_GNU_SOURCE',
#'-Wno-unused-result'],
],
language: 'c',
)
cc = meson.get_compiler('c')
dl = cc.find_library('dl', required : false)
threads = dependency('threads')
fontconfig = dependency('fontconfig')
cairo = dependency('cairo')
cairo_ft = dependency('cairo-ft')
yaml = dependency('yaml-0.1')
# TODO: X11
xcb_aux = dependency('xcb-aux', required: get_option('x11'))
xcb_cursor = dependency('xcb-cursor', required: get_option('x11'))
xcb_event = dependency('xcb-event', required: get_option('x11'))
xcb_ewmh = dependency('xcb-ewmh', required: get_option('x11'))
xcb_randr = dependency('xcb-randr', required: get_option('x11'))
xcb_render = dependency('xcb-render', required: get_option('x11'))
cairo_xcb = dependency('cairo-xcb', required: get_option('x11'))
xcb_errors = dependency('xcb-errors', required: false)
xcb_stuff = declare_dependency(
sources: ['xcb.c', 'xcb.h'],
dependencies: [xcb_aux, xcb_cursor, xcb_event, xcb_ewmh, xcb_randr,
xcb_render, cairo_xcb, xcb_errors],
compile_args: xcb_errors.found() ? '-DHAVE_XCB_ERRORS' : [])
if xcb_aux.found() and xcb_cursor.found() and xcb_event.found() and \
xcb_ewmh.found() and xcb_randr.found() and xcb_render.found() and \
cairo_xcb.found()
enable_x11 = true
add_project_arguments('-DENABLE_X11', language: 'c')
else
enable_x11 = false
endif
# TODO: conditional on Wayland
wayland_client = dependency('wayland-client', required: get_option('wayland'))
wayland_cursor = dependency('wayland-cursor', required: get_option('wayland'))
wlroots = dependency('wlroots', required: get_option('wayland'))
if wayland_client.found() and wayland_cursor.found() and wlroots.found()
enable_wayland = true
add_project_arguments('-DENABLE_WAYLAND', language: 'c')
else
enable_wayland = false
endif
subdir('bar')
subdir('decorations')
subdir('particles')
subdir('modules')
executable(
'f00bar',
'color.h',
'config-verify.c', 'config-verify.h',
'config.c', 'config.h',
'decoration.h',
'font.c', 'font.h',
'log.c', 'log.h',
'main.c',
'module.c', 'module.h',
'particle.c', 'particle.h',
'plugin.c', 'plugin.h',
'tag.c', 'tag.h',
'tllist.h',
'yml.c', 'yml.h',
dependencies: [bar, cairo, cairo_ft, fontconfig, yaml, threads, dl] +
decorations + particles + modules,
link_args: '-rdynamic')

2
meson_options.txt Normal file
View file

@ -0,0 +1,2 @@
option('x11', type: 'feature', value: 'enabled', description: 'XCB (X11) backend')
option('wayland', type: 'feature', value: 'enabled', description: 'Wayland backend')

64
modules/meson.build Normal file
View file

@ -0,0 +1,64 @@
module_sdk = declare_dependency(dependencies: [cairo, cairo_ft, threads])
modules = []
alsa_mod = static_library(
'module_alsa', 'alsa.c', dependencies: [module_sdk, dependency('alsa')])
modules += [declare_dependency(
link_with: alsa_mod, compile_args: '-DHAVE_PLUGIN_alsa')]
udev = dependency('libudev')
backlight_mod = static_library(
'module_backlight', 'backlight.c', dependencies: [module_sdk, udev])
modules += [declare_dependency(
link_with: backlight_mod, compile_args: '-DHAVE_PLUGIN_backlight')]
battery_mod = static_library(
'module_battery', 'battery.c', dependencies: [module_sdk, udev])
modules += [declare_dependency(
link_with: battery_mod, compile_args: '-DHAVE_PLUGIN_battery')]
clock_mod = static_library(
'module_clock', 'clock.c', dependencies: [module_sdk])
modules += [declare_dependency(
link_with: clock_mod, compile_args: '-DHAVE_PLUGIN_clock')]
json = dependency('json-c')
i3_mod = static_library(
'module_i3', 'i3.c', 'i3-common.c', 'i3-common.h',
dependencies: [module_sdk, json, dynlist])
modules += [declare_dependency(
link_with: i3_mod, compile_args: '-DHAVE_PLUGIN_i3')]
label_mod = static_library(
'module_label', 'label.c', dependencies: [module_sdk])
modules += [declare_dependency(
link_with: label_mod, compile_args: '-DHAVE_PLUGIN_label')]
mpd = dependency('libmpdclient')
mpd_mod = static_library(
'module_mpd', 'mpd.c', dependencies: [module_sdk, mpd])
modules += [declare_dependency(
link_with: mpd_mod, compile_args: '-DHAVE_PLUGIN_mpd')]
network_mod = static_library(
'module_network', 'network.c', dependencies: [module_sdk])
modules += [declare_dependency(
link_with: network_mod, compile_args: '-DHAVE_PLUGIN_network')]
removables_mod = static_library(
'module_removables', 'removables.c', dependencies: [module_sdk, udev, dynlist])
modules += [declare_dependency(
link_with: removables_mod, compile_args: '-DHAVE_PLUGIN_removables')]
if enable_x11
xcb_xkb = dependency('xcb-xkb')
xkb_mod = static_library(
'module_xkb', 'xkb.c', dependencies: [module_sdk, xcb_stuff, xcb_xkb])
modules += [declare_dependency(
link_with: xkb_mod, compile_args: '-DHAVE_PLUGIN_xkb')]
xwindow_mod = static_library(
'module_xwindow', 'xwindow.c', dependencies: [module_sdk, xcb_stuff])
modules += [declare_dependency(
link_with: xwindow_mod, compile_args: '-DHAVE_MODULE_xwindow')]
endif

15
particles/meson.build Normal file
View file

@ -0,0 +1,15 @@
particle_sdk = declare_dependency(dependencies: [cairo, cairo_ft])
particles = []
foreach particle : ['empty', 'list', 'map', 'progress-bar', 'ramp', 'string']
lib = static_library(
'particle_@0@'.format(particle), '@0@.c'.format(particle),
dependencies: particle_sdk)
particles += [declare_dependency(
link_with: lib,
compile_args: '-DHAVE_PLUGIN_@0@'.format(particle.underscorify()))]
endforeach
dynlist_lib = static_library(
'dynlist', 'dynlist.c', 'dynlist.h', dependencies: particle_sdk)
dynlist = declare_dependency(link_with: dynlist_lib)