build: use a configuration file for internal features

This avoids re-building the whole project when switching one
Meson option. This shrinks down the compiler invocation command
line, making it more readable and making it easier to inspect
which flags are passed in (the generated file can be opened).
Additionally this is more consistent with our external feature
handling, which uses <wlr/config.h> already.
Simon Ser 2 years ago committed by Alexander Orzechowski
parent afe1ae4479
commit 6c897756b6

@ -9,10 +9,6 @@
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/present.h> #include <xcb/present.h>
#if HAS_XCB_ERRORS
#include <xcb/xcb_errors.h>
#endif
#include <pixman.h> #include <pixman.h>
#include <wlr/backend/x11.h> #include <wlr/backend/x11.h>
#include <wlr/interfaces/wlr_keyboard.h> #include <wlr/interfaces/wlr_keyboard.h>
@ -21,6 +17,12 @@
#include <wlr/types/wlr_pointer.h> #include <wlr/types/wlr_pointer.h>
#include <wlr/render/drm_format_set.h> #include <wlr/render/drm_format_set.h>
#include "config.h"
#if HAS_XCB_ERRORS
#include <xcb/xcb_errors.h>
#endif
#define XCB_EVENT_RESPONSE_TYPE_MASK 0x7f #define XCB_EVENT_RESPONSE_TYPE_MASK 0x7f
struct wlr_x11_backend; struct wlr_x11_backend;

@ -30,3 +30,11 @@ install_subdir('wlr',
install_dir: get_option('includedir'), install_dir: get_option('includedir'),
exclude_files: exclude_files, exclude_files: exclude_files,
) )
foreach name, have : internal_features
internal_config.set10('HAS_' + name.underscorify().to_upper(), have)
endforeach
wlr_files += configure_file(
output: 'config.h',
configuration: internal_config,
)

@ -5,10 +5,12 @@
#include <wlr/config.h> #include <wlr/config.h>
#include <wlr/xwayland.h> #include <wlr/xwayland.h>
#include <xcb/render.h> #include <xcb/render.h>
#include "config.h"
#include "xwayland/selection.h"
#if HAS_XCB_ERRORS #if HAS_XCB_ERRORS
#include <xcb/xcb_errors.h> #include <xcb/xcb_errors.h>
#endif #endif
#include "xwayland/selection.h"
/* This is in xcb/xcb_event.h, but pulling xcb-util just for a constant /* This is in xcb/xcb_event.h, but pulling xcb-util just for a constant
* others redefine anyway is meh * others redefine anyway is meh

@ -99,6 +99,7 @@ internal_features = {
'xcb-errors': false, 'xcb-errors': false,
'egl': false, 'egl': false,
} }
internal_config = configuration_data()
wayland_project_options = ['tests=false', 'documentation=false'] wayland_project_options = ['tests=false', 'documentation=false']
wayland_server = dependency('wayland-server', wayland_server = dependency('wayland-server',
@ -158,13 +159,6 @@ subdir('xwayland')
subdir('include') subdir('include')
foreach name, have : internal_features
add_project_arguments(
'-DHAS_@0@=@1@'.format(name.underscorify().to_upper(), have.to_int()),
language: 'c',
)
endforeach
wlr_inc = include_directories('include') wlr_inc = include_directories('include')
proto_inc = include_directories('protocol') proto_inc = include_directories('protocol')

Loading…
Cancel
Save