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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@ endforeach
plugin_gl = shared_library(
'gl-renderer',
srcs_renderer_gl,
include_directories: include_directories('../..', '../../shared'),
include_directories: common_inc,
dependencies: deps_renderer_gl,
name_prefix: '',
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')
public_inc = include_directories('include')
common_inc = [ include_directories('.'), public_inc ]
pkgconfig = import('pkgconfig')

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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