build: simplify include_directories

Define common_inc which includes both public_inc and the project root directory.
The project root directory will allow access to config.h and all the shared/
headers.

Replacing all custom '.', '..', '../..', '../shared' etc. include paths with
common_inc reduces clutter in the target definitions and enforces the common
 #include directive style, as e.g. including shared/ headers without the
subdirectory name no longer works.

Unfortunately this does not prevent one from using private libweston headers
with the usual include pattern for public headers.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2019-04-05 17:09:28 +03:00
parent c232f8d934
commit 4f5e360180
21 changed files with 51 additions and 53 deletions

View File

@ -25,7 +25,7 @@ deps_toytoolkit = [
lib_toytoolkit = static_library( lib_toytoolkit = static_library(
'toytoolkit', 'toytoolkit',
srcs_toytoolkit, srcs_toytoolkit,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: deps_toytoolkit, dependencies: deps_toytoolkit,
install: false, install: false,
) )
@ -132,7 +132,7 @@ foreach t : simple_clients
executable( executable(
t_name, t.get('sources'), t_name, t.get('sources'),
include_directories: [ include_directories('..'), public_inc ], include_directories: common_inc,
dependencies: t_deps, dependencies: t_deps,
install: true install: true
) )
@ -146,7 +146,7 @@ if simple_build_all or simple_clients_enabled.contains('im')
input_method_unstable_v1_client_protocol_h, input_method_unstable_v1_client_protocol_h,
input_method_unstable_v1_protocol_c, input_method_unstable_v1_protocol_c,
], ],
include_directories: include_directories('..'), include_directories: common_inc,
dependencies: [ dependencies: [
dep_libshared, dep_libshared,
dep_wayland_client, dep_wayland_client,
@ -211,7 +211,7 @@ foreach t : tools_list
executable( executable(
'weston-@0@'.format(t.get('name')), 'weston-@0@'.format(t.get('name')),
t.get('sources'), t.get('sources'),
include_directories: [ include_directories('..', '../shared'), public_inc ], include_directories: common_inc,
dependencies: t.get('deps', []), dependencies: t.get('deps', []),
install: true install: true
) )
@ -292,7 +292,7 @@ if get_option('demo-clients')
executable( executable(
t_name, t_srcs, t_name, t_srcs,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: t_deps, dependencies: t_deps,
install: true install: true
) )
@ -332,7 +332,7 @@ if simple_dmabuf_drm_deps.length() > 0
fullscreen_shell_unstable_v1_protocol_c, fullscreen_shell_unstable_v1_protocol_c,
linux_dmabuf_unstable_v1_client_protocol_h, linux_dmabuf_unstable_v1_client_protocol_h,
linux_dmabuf_unstable_v1_protocol_c, linux_dmabuf_unstable_v1_protocol_c,
include_directories: [ include_directories('..'), public_inc ], include_directories: common_inc,
dependencies: [ dependencies: [
dep_wayland_client, dep_wayland_client,
dep_libdrm, dep_libdrm,
@ -350,7 +350,7 @@ if get_option('shell-desktop')
text_input_unstable_v1_protocol_c, text_input_unstable_v1_protocol_c,
input_method_unstable_v1_client_protocol_h, input_method_unstable_v1_client_protocol_h,
input_method_unstable_v1_protocol_c, input_method_unstable_v1_protocol_c,
include_directories: include_directories('..'), include_directories: common_inc,
dependencies: dep_toytoolkit, dependencies: dep_toytoolkit,
install_dir: get_option('libexecdir'), install_dir: get_option('libexecdir'),
install: true install: true
@ -362,7 +362,7 @@ if get_option('shell-desktop')
'screenshot.c', 'screenshot.c',
weston_screenshooter_client_protocol_h, weston_screenshooter_client_protocol_h,
weston_screenshooter_protocol_c, weston_screenshooter_protocol_c,
include_directories: include_directories('..'), include_directories: common_inc,
dependencies: dep_toytoolkit, dependencies: dep_toytoolkit,
install_dir: get_option('bindir'), install_dir: get_option('bindir'),
install: true install: true
@ -374,7 +374,7 @@ if get_option('shell-desktop')
'desktop-shell.c', 'desktop-shell.c',
weston_desktop_shell_client_protocol_h, weston_desktop_shell_client_protocol_h,
weston_desktop_shell_protocol_c, weston_desktop_shell_protocol_c,
include_directories: include_directories('..'), include_directories: common_inc,
dependencies: dep_toytoolkit, dependencies: dep_toytoolkit,
install_dir: get_option('libexecdir'), install_dir: get_option('libexecdir'),
install: true install: true
@ -391,7 +391,7 @@ if get_option('shell-ivi')
ivi_hmi_controller_protocol_c, ivi_hmi_controller_protocol_c,
ivi_application_client_protocol_h, ivi_application_client_protocol_h,
ivi_application_protocol_c, ivi_application_protocol_c,
include_directories: include_directories('..'), include_directories: common_inc,
dependencies: dep_toytoolkit, dependencies: dep_toytoolkit,
install: true, install: true,
install_dir: get_option('libexecdir') install_dir: get_option('libexecdir')

View File

@ -29,7 +29,7 @@ endif
exe_weston = executable( exe_weston = executable(
'weston', 'weston',
srcs_weston, srcs_weston,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
link_args: [ '-Wl,-export-dynamic' ], link_args: [ '-Wl,-export-dynamic' ],
dependencies: deps_weston, dependencies: deps_weston,
install: true install: true
@ -68,7 +68,7 @@ if get_option('screenshare')
plugin_screenshare = shared_library( plugin_screenshare = shared_library(
'screen-share', 'screen-share',
srcs_screenshare, srcs_screenshare,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: deps_screenshare, dependencies: deps_screenshare,
name_prefix: '', name_prefix: '',
install: true, install: true,
@ -93,7 +93,7 @@ if get_option('color-management-lcms')
plugin_lcms = shared_library( plugin_lcms = shared_library(
'cms-static', 'cms-static',
srcs_lcms, srcs_lcms,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: [ dep_libweston, dep_lcms2 ], dependencies: [ dep_libweston, dep_lcms2 ],
name_prefix: '', name_prefix: '',
install: true, install: true,
@ -130,7 +130,7 @@ if get_option('color-management-colord')
plugin_colord = shared_library( plugin_colord = shared_library(
'cms-colord', 'cms-colord',
srcs_colord, srcs_colord,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: plugin_colord_deps, dependencies: plugin_colord_deps,
name_prefix: '', name_prefix: '',
install: true, install: true,
@ -148,7 +148,7 @@ if get_option('systemd')
plugin_systemd_notify = shared_library( plugin_systemd_notify = shared_library(
'systemd-notify', 'systemd-notify',
'systemd-notify.c', 'systemd-notify.c',
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: [ dep_libweston, dep_libsystemd ], dependencies: [ dep_libweston, dep_libsystemd ],
name_prefix: '', name_prefix: '',
install: true, install: true,

View File

@ -18,7 +18,7 @@ if get_option('shell-desktop')
plugin_shell_desktop = shared_library( plugin_shell_desktop = shared_library(
'desktop-shell', 'desktop-shell',
srcs_shell_desktop, srcs_shell_desktop,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: deps_shell_desktop, dependencies: deps_shell_desktop,
name_prefix: '', name_prefix: '',
install: true, install: true,

View File

@ -7,7 +7,7 @@ if get_option('shell-fullscreen')
shared_library( shared_library(
'fullscreen-shell', 'fullscreen-shell',
srcs_shell_fullscreen, srcs_shell_fullscreen,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: dep_libweston, dependencies: dep_libweston,
name_prefix: '', name_prefix: '',
install: true, install: true,

View File

@ -11,7 +11,7 @@ if get_option('shell-ivi')
plugin_shell_ivi = shared_library( plugin_shell_ivi = shared_library(
'ivi-shell', 'ivi-shell',
srcs_shell_ivi, srcs_shell_ivi,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: [ dep_lib_desktop, dep_libweston ], dependencies: [ dep_lib_desktop, dep_libweston ],
name_prefix: '', name_prefix: '',
install: true, install: true,
@ -29,7 +29,7 @@ if get_option('shell-ivi')
plugin_ivi_hmi = shared_library( plugin_ivi_hmi = shared_library(
'hmi-controller', 'hmi-controller',
srcs_ivi_hmi, srcs_ivi_hmi,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: [ dep_libweston, dep_libshared ], dependencies: [ dep_libweston, dep_libshared ],
name_prefix: '', name_prefix: '',
install: true, install: true,

View File

@ -15,7 +15,7 @@ srcs_libdesktop = [
lib_desktop = shared_library( lib_desktop = shared_library(
'weston-desktop-@0@'.format(libweston_major), 'weston-desktop-@0@'.format(libweston_major),
srcs_libdesktop, srcs_libdesktop,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
install: true, install: true,
version: '0.0.@0@'.format(libweston_revision), version: '0.0.@0@'.format(libweston_revision),
dependencies: dep_libweston dependencies: dep_libweston

View File

@ -9,7 +9,7 @@ lib_backlight = static_library(
dep_libdrm_headers, dep_libdrm_headers,
dependency('libudev') dependency('libudev')
], ],
include_directories: include_directories('../..'), include_directories: common_inc,
install: false install: false
) )
dep_backlight = declare_dependency( dep_backlight = declare_dependency(
@ -84,7 +84,7 @@ endif
plugin_drm = shared_library( plugin_drm = shared_library(
'drm-backend', 'drm-backend',
srcs_drm, srcs_drm,
include_directories: include_directories('../..', '../../shared'), include_directories: common_inc,
dependencies: deps_drm, dependencies: deps_drm,
name_prefix: '', name_prefix: '',
install: true, install: true,

View File

@ -19,7 +19,7 @@ deps_fbdev = [
plugin_fbdev = shared_library( plugin_fbdev = shared_library(
'fbdev-backend', 'fbdev-backend',
srcs_fbdev, srcs_fbdev,
include_directories: include_directories('../..', '../../shared'), include_directories: common_inc,
dependencies: deps_fbdev, dependencies: deps_fbdev,
name_prefix: '', name_prefix: '',
install: true, install: true,

View File

@ -11,7 +11,7 @@ srcs_headless = [
plugin_headless = shared_library( plugin_headless = shared_library(
'headless-backend', 'headless-backend',
srcs_headless, srcs_headless,
include_directories: include_directories('../..', '../../shared'), include_directories: common_inc,
dependencies: dep_libweston, dependencies: dep_libweston,
name_prefix: '', name_prefix: '',
install: true, install: true,

View File

@ -28,7 +28,7 @@ deps_rdp = [
plugin_rdp = shared_library( plugin_rdp = shared_library(
'rdp-backend', 'rdp-backend',
'rdp.c', 'rdp.c',
include_directories: include_directories('../..', '../../shared'), include_directories: common_inc,
dependencies: deps_rdp, dependencies: deps_rdp,
name_prefix: '', name_prefix: '',
install: true, install: true,

View File

@ -33,7 +33,7 @@ endif
plugin_wlwl = shared_library( plugin_wlwl = shared_library(
'wayland-backend', 'wayland-backend',
srcs_wlwl, srcs_wlwl,
include_directories: include_directories('../..', '../../shared'), include_directories: common_inc,
dependencies: deps_wlwl, dependencies: deps_wlwl,
name_prefix: '', name_prefix: '',
install: true, install: true,

View File

@ -46,7 +46,7 @@ endif
plugin_x11 = shared_library( plugin_x11 = shared_library(
'x11-backend', 'x11-backend',
srcs_x11, srcs_x11,
include_directories: include_directories('../..', '../../shared'), include_directories: common_inc,
dependencies: deps_x11, dependencies: deps_x11,
name_prefix: '', name_prefix: '',
install: true, install: true,

View File

@ -75,7 +75,7 @@ endif
lib_weston = shared_library( lib_weston = shared_library(
'weston-@0@'.format(libweston_major), 'weston-@0@'.format(libweston_major),
srcs_libweston, srcs_libweston,
include_directories: [ include_directories('..', '../shared'), public_inc ], include_directories: common_inc,
install: true, install: true,
version: '0.0.@0@'.format(libweston_revision), version: '0.0.@0@'.format(libweston_revision),
link_whole: lib_libshared, link_whole: lib_libshared,
@ -167,7 +167,7 @@ endif
lib_session_helper = static_library( lib_session_helper = static_library(
'session-helper', 'session-helper',
srcs_session_helper, srcs_session_helper,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: deps_session_helper, dependencies: deps_session_helper,
install: false install: false
) )
@ -185,7 +185,7 @@ lib_libinput_backend = static_library(
dep_libinput, dep_libinput,
dependency('libudev', version: '>= 136') dependency('libudev', version: '>= 136')
], ],
include_directories: include_directories('..'), include_directories: common_inc,
install: false install: false
) )
dep_libinput_backend = declare_dependency( dep_libinput_backend = declare_dependency(
@ -209,7 +209,7 @@ if get_option('weston-launch')
'weston-launch', 'weston-launch',
'weston-launch.c', 'weston-launch.c',
dependencies: [dep_pam, systemd_dep, dep_libdrm], dependencies: [dep_pam, systemd_dep, dep_libdrm],
include_directories: include_directories('..'), include_directories: common_inc,
install: true install: true
) )

View File

@ -29,7 +29,7 @@ endforeach
plugin_gl = shared_library( plugin_gl = shared_library(
'gl-renderer', 'gl-renderer',
srcs_renderer_gl, srcs_renderer_gl,
include_directories: include_directories('../..', '../../shared'), include_directories: common_inc,
dependencies: deps_renderer_gl, dependencies: deps_renderer_gl,
name_prefix: '', name_prefix: '',
install: true, install: true,

View File

@ -42,6 +42,7 @@ dir_man = join_paths(dir_prefix, get_option('mandir'))
dir_protocol_libweston = join_paths('libweston-@0@'.format(libweston_major), 'protocols') dir_protocol_libweston = join_paths('libweston-@0@'.format(libweston_major), 'protocols')
public_inc = include_directories('include') public_inc = include_directories('include')
common_inc = [ include_directories('.'), public_inc ]
pkgconfig = import('pkgconfig') pkgconfig = import('pkgconfig')

View File

@ -20,7 +20,7 @@ if get_option('pipewire')
plugin_pipewire = shared_library( plugin_pipewire = shared_library(
'pipewire-plugin', 'pipewire-plugin',
'pipewire-plugin.c', 'pipewire-plugin.c',
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: deps_pipewire, dependencies: deps_pipewire,
name_prefix: '', name_prefix: '',
install: true, install: true,

View File

@ -22,7 +22,7 @@ if get_option('remoting')
plugin_remoting = shared_library( plugin_remoting = shared_library(
'remoting-plugin', 'remoting-plugin',
'remoting-plugin.c', 'remoting-plugin.c',
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: deps_remoting, dependencies: deps_remoting,
name_prefix: '', name_prefix: '',
install: true, install: true,

View File

@ -10,7 +10,7 @@ deps_libshared = dep_wayland_client
lib_libshared = static_library( lib_libshared = static_library(
'shared', 'shared',
srcs_libshared, srcs_libshared,
include_directories: [ include_directories('..'), public_inc ], include_directories: common_inc,
dependencies: deps_libshared, dependencies: deps_libshared,
pic: true, pic: true,
install: false install: false
@ -68,7 +68,7 @@ endif
lib_cairo_shared = static_library( lib_cairo_shared = static_library(
'cairo-shared', 'cairo-shared',
srcs_cairo_shared, srcs_cairo_shared,
include_directories: include_directories('..'), include_directories: common_inc,
dependencies: deps_cairo_shared, dependencies: deps_cairo_shared,
install: false install: false
) )

View File

@ -1,7 +1,7 @@
plugin_test_shell_desktop = shared_library( plugin_test_shell_desktop = shared_library(
'weston-test-desktop-shell', 'weston-test-desktop-shell',
'weston-test-desktop-shell.c', 'weston-test-desktop-shell.c',
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: [ dep_lib_desktop, dep_libweston ], dependencies: [ dep_lib_desktop, dep_libweston ],
name_prefix: '', name_prefix: '',
install: false install: false
@ -11,7 +11,7 @@ env_modmap += 'weston-test-desktop-shell.so=@0@;'.format(plugin_test_shell_deskt
lib_test_runner = static_library( lib_test_runner = static_library(
'test-runner', 'test-runner',
'weston-test-runner.c', 'weston-test-runner.c',
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
install: false, install: false,
) )
dep_test_runner = declare_dependency(link_with: lib_test_runner) dep_test_runner = declare_dependency(link_with: lib_test_runner)
@ -21,7 +21,7 @@ lib_test_client = static_library(
'weston-test-client-helper.c', 'weston-test-client-helper.c',
weston_test_client_protocol_h, weston_test_client_protocol_h,
weston_test_protocol_c, weston_test_protocol_c,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: [ dependencies: [
dep_libshared, dep_libshared,
dep_wayland_client, dep_wayland_client,
@ -44,7 +44,7 @@ exe_plugin_test = shared_library(
'weston-test.c', 'weston-test.c',
weston_test_server_protocol_h, weston_test_server_protocol_h,
weston_test_protocol_c, weston_test_protocol_c,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: [ dep_libweston ], dependencies: [ dep_libweston ],
name_prefix: '', name_prefix: '',
install: false, install: false,
@ -75,7 +75,7 @@ lib_zuc = static_library(
'../tools/zunitc/src/zuc_junit_reporter.h', '../tools/zunitc/src/zuc_junit_reporter.h',
'../tools/zunitc/src/zuc_types.h', '../tools/zunitc/src/zuc_types.h',
'../tools/zunitc/src/zunitc_impl.c', '../tools/zunitc/src/zunitc_impl.c',
include_directories: include_directories('..', '../shared', '../tools/zunitc/inc'), include_directories: [ common_inc, include_directories('../tools/zunitc/inc') ],
dependencies: deps_zuc, dependencies: deps_zuc,
) )
dep_zuc = declare_dependency( dep_zuc = declare_dependency(
@ -87,7 +87,7 @@ dep_zuc = declare_dependency(
lib_zucmain = static_library( lib_zucmain = static_library(
'zunitcmain', 'zunitcmain',
'../tools/zunitc/src/main.c', '../tools/zunitc/src/main.c',
include_directories: include_directories('..', '../shared', '../tools/zunitc/inc'), include_directories: [ common_inc, include_directories('../tools/zunitc/inc') ],
dependencies: [ dep_libshared, dep_zuc ], dependencies: [ dep_libshared, dep_zuc ],
) )
dep_zucmain = declare_dependency( dep_zucmain = declare_dependency(
@ -97,7 +97,7 @@ dep_zucmain = declare_dependency(
tests_standalone = [ tests_standalone = [
['config-parser', [], [ dep_zucmain ]], ['config-parser', [], [ dep_zucmain ]],
['matrix', [], [ dep_libm, dep_libshared.partial_dependency(includes: true), dep_matrix_c ]], ['matrix', [], [ dep_libm, dep_matrix_c ]],
['string'], ['string'],
[ 'vertex-clip', [], [ dep_test_client, dep_vertex_clipping ]], [ 'vertex-clip', [], [ dep_test_client, dep_vertex_clipping ]],
['timespec', [], [ dep_zucmain ]], ['timespec', [], [ dep_zucmain ]],
@ -216,7 +216,7 @@ if get_option('shell-ivi')
weston_test_protocol_c, weston_test_protocol_c,
ivi_application_client_protocol_h, ivi_application_client_protocol_h,
ivi_application_protocol_c, ivi_application_protocol_c,
include_directories: [ include_directories('..', '../shared'), public_inc ], include_directories: common_inc,
dependencies: dep_test_client, dependencies: dep_test_client,
install: false install: false
) )
@ -256,7 +256,7 @@ foreach t : tests_standalone
srcs_t, srcs_t,
c_args: [ '-DUNIT_TEST' ], c_args: [ '-DUNIT_TEST' ],
build_by_default: true, build_by_default: true,
include_directories: [ include_directories('..', '../shared', '../libweston'), public_inc ], include_directories: common_inc,
dependencies: deps_t, dependencies: deps_t,
install: false, install: false,
) )
@ -320,10 +320,7 @@ foreach t : tests_weston
'test-@0@'.format(t.get(0)), 'test-@0@'.format(t.get(0)),
srcs_t, srcs_t,
c_args: [ '-DUNIT_TEST' ], c_args: [ '-DUNIT_TEST' ],
include_directories: [ include_directories: common_inc,
include_directories('..', '../shared'),
public_inc,
],
dependencies: deps_t, dependencies: deps_t,
install: false, install: false,
) )
@ -355,7 +352,7 @@ foreach t : tests_weston_plugin
exe_t = shared_library( exe_t = shared_library(
'test-@0@'.format(t.get(0)), 'test-@0@'.format(t.get(0)),
srcs_t, srcs_t,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: deps_t, dependencies: deps_t,
name_prefix: '', name_prefix: '',
install: false, install: false,
@ -392,7 +389,7 @@ if get_option('backend-drm')
dep_libdrm, dep_libdrm,
dependency('libudev') dependency('libudev')
], ],
include_directories: include_directories('..'), include_directories: common_inc,
install: false install: false
) )
endif endif

View File

@ -15,7 +15,7 @@ endif
executable( executable(
'wcap-decode', 'wcap-decode',
srcs_wcap, srcs_wcap,
include_directories: include_directories('..'), include_directories: common_inc,
dependencies: [ dep_libm, wcap_dep_cairo ], dependencies: [ dep_libm, wcap_dep_cairo ],
install: true install: true
) )

View File

@ -33,7 +33,7 @@ plugin_xwayland = shared_library(
'xwayland', 'xwayland',
srcs_xwayland, srcs_xwayland,
link_with: lib_cairo_shared, link_with: lib_cairo_shared,
include_directories: include_directories('..', '../shared'), include_directories: common_inc,
dependencies: deps_xwayland, dependencies: deps_xwayland,
name_prefix: '', name_prefix: '',
install: true, install: true,