meson: initial support for building plugins as shared libraries

This commit is contained in:
Daniel Eklöf 2019-05-01 18:21:35 +02:00
parent 51e9d691e4
commit fdb9a9bc1c
5 changed files with 169 additions and 80 deletions

View file

@ -3,9 +3,8 @@ project('f00bar', 'c',
default_options: ['c_std=c11', 'warning_level=1', 'werror=true'])
add_project_arguments(
['-D_GNU_SOURCE',
#'-Wno-unused-result'],
],
['-D_GNU_SOURCE'] +
(get_option('core-plugins-as-shared-libraries') ? ['-DCORE_PLUGINS_AS_SHARED_LIBRARIES'] : []),
language: 'c',
)
@ -18,24 +17,19 @@ 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_aux = dependency('xcb-aux', required: get_option('backend-x11'))
xcb_cursor = dependency('xcb-cursor', required: get_option('backend-x11'))
xcb_event = dependency('xcb-event', required: get_option('backend-x11'))
xcb_ewmh = dependency('xcb-ewmh', required: get_option('backend-x11'))
xcb_randr = dependency('xcb-randr', required: get_option('backend-x11'))
xcb_render = dependency('xcb-render', required: get_option('backend-x11'))
cairo_xcb = dependency('cairo-xcb', required: get_option('backend-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
@ -43,9 +37,9 @@ else
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'))
wayland_client = dependency('wayland-client', required: get_option('backend-wayland'))
wayland_cursor = dependency('wayland-cursor', required: get_option('backend-wayland'))
wlroots = dependency('wlroots', required: get_option('backend-wayland'))
if wayland_client.found() and wayland_cursor.found() and wlroots.found()
enable_wayland = true
@ -54,6 +48,16 @@ else
enable_wayland = false
endif
if enable_x11
xcb_stuff_lib = static_library(
'xcb-stuff', 'xcb.c', 'xcb.h',
dependencies: [xcb_aux, xcb_cursor, xcb_event, xcb_ewmh, xcb_randr,
xcb_render, cairo_xcb, xcb_errors],
c_args: xcb_errors.found() ? '-DHAVE_XCB_ERRORS' : [],
pic: get_option('core-plugins-as-shared-libraries'))
xcb_stuff = declare_dependency(link_with: xcb_stuff_lib)
endif
subdir('bar')
subdir('decorations')
subdir('particles')
@ -76,4 +80,5 @@ executable(
'yml.c', 'yml.h',
dependencies: [bar, cairo, cairo_ft, fontconfig, yaml, threads, dl] +
decorations + particles + modules,
link_args: '-rdynamic')
build_rpath: '$ORIGIN/modules:$ORIGIN/decorations:$ORIGIN/particles',
export_dynamic: true)