diff --git a/clients/meson.build b/clients/meson.build new file mode 100644 index 00000000..42590e1e --- /dev/null +++ b/clients/meson.build @@ -0,0 +1,367 @@ +if get_option('resize-pool') + config_h.set('USE_RESIZE_POOL', '1') +endif + +srcs_toytoolkit = [ + 'window.c', + xdg_shell_unstable_v6_client_protocol_h, + xdg_shell_unstable_v6_protocol_c, + text_cursor_position_client_protocol_h, + text_cursor_position_protocol_c, + relative_pointer_unstable_v1_client_protocol_h, + relative_pointer_unstable_v1_protocol_c, + pointer_constraints_unstable_v1_client_protocol_h, + pointer_constraints_unstable_v1_protocol_c, + ivi_application_client_protocol_h, + ivi_application_protocol_c, +] +deps_toytoolkit = [ + dep_wayland_client, + dep_lib_cairo_shared, + dep_xkbcommon, + dependency('wayland-cursor'), + cc.find_library('util'), +] +lib_toytoolkit = static_library( + 'toytoolkit', + srcs_toytoolkit, + include_directories: include_directories('..', '../shared'), + dependencies: deps_toytoolkit, + install: false, +) +dep_toytoolkit = declare_dependency( + link_with: lib_toytoolkit, + dependencies: deps_toytoolkit, +) + +simple_clients = [ + { + 'name': 'damage', + 'sources': [ + 'simple-damage.c', + viewporter_client_protocol_h, + viewporter_protocol_c, + xdg_shell_unstable_v6_client_protocol_h, + xdg_shell_unstable_v6_protocol_c, + fullscreen_shell_unstable_v1_client_protocol_h, + fullscreen_shell_unstable_v1_protocol_c, + ], + 'dep_objs': [ dep_wayland_client, dep_libshared ] + }, + { + 'name': 'dmabuf-v4l', + 'sources': [ + 'simple-dmabuf-v4l.c', + linux_dmabuf_unstable_v1_client_protocol_h, + linux_dmabuf_unstable_v1_protocol_c, + xdg_shell_unstable_v6_client_protocol_h, + xdg_shell_unstable_v6_protocol_c, + fullscreen_shell_unstable_v1_client_protocol_h, + fullscreen_shell_unstable_v1_protocol_c, + ], + 'dep_objs': [ dep_wayland_client, dep_libdrm_headers ] + }, + { + 'name': 'egl', + 'sources': [ + 'simple-egl.c', + xdg_shell_unstable_v6_client_protocol_h, + xdg_shell_unstable_v6_protocol_c, + ivi_application_client_protocol_h, + ivi_application_protocol_c, + ], + 'dep_objs': [ dep_wayland_client, dep_libshared, dep_libm ], + 'deps': [ 'egl', 'wayland-egl', 'glesv2', 'wayland-cursor' ] + }, + # weston-simple-im is handled specially separately due to install_dir and odd window.h usage + { + 'name': 'shm', + 'sources': [ + 'simple-shm.c', + xdg_shell_unstable_v6_client_protocol_h, + xdg_shell_unstable_v6_protocol_c, + fullscreen_shell_unstable_v1_client_protocol_h, + fullscreen_shell_unstable_v1_protocol_c, + ivi_application_client_protocol_h, + ivi_application_protocol_c, + ], + 'dep_objs': [ dep_wayland_client, dep_libshared ] + }, + { + 'name': 'touch', + 'sources': [ + 'simple-touch.c', + ], + 'dep_objs': [ dep_wayland_client, dep_libshared ] + }, +] + +simple_clients_enabled = get_option('simple-clients') +simple_build_all = simple_clients_enabled.contains('all') +foreach t : simple_clients + if simple_build_all or simple_clients_enabled.contains(t.get('name')) + t_name = 'weston-simple-' + t.get('name') + t_deps = t.get('dep_objs', []) + foreach depname : t.get('deps', []) + dep = dependency(depname, required: false) + if not dep.found() + error('@0@ requires @1@ which was not found. If you rather not build this, drop "@2@" from simple-clients option.'.format(t_name, depname, t.get('name'))) + endif + t_deps += dep + endforeach + + executable( + t_name, t.get('sources'), + include_directories: include_directories('..'), + dependencies: t_deps, + install: true + ) + endif +endforeach + +if simple_build_all or simple_clients_enabled.contains('im') + executable( + 'weston-simple-im', [ + 'simple-im.c', + input_method_unstable_v1_client_protocol_h, + input_method_unstable_v1_protocol_c, + ], + include_directories: include_directories('..'), + dependencies: [ + dep_libshared, + dep_wayland_client, + dep_xkbcommon, + dependency('wayland-cursor'), + dependency('cairo') + ], + install: true, + install_dir: dir_libexec + ) +endif + +tools_enabled = get_option('tools') +tools_list = [ + { + 'name': 'calibrator', + 'sources': [ + 'calibrator.c', + '../shared/matrix.c', + ], + 'deps': [ dep_toytoolkit ], + }, + { + 'name': 'debug', + 'sources': [ + 'weston-debug.c', + weston_debug_client_protocol_h, + weston_debug_protocol_c, + ], + 'deps': [ dep_wayland_client ] + }, + { + 'name': 'info', + 'sources': [ + 'weston-info.c', + presentation_time_client_protocol_h, + presentation_time_protocol_c, + linux_dmabuf_unstable_v1_client_protocol_h, + linux_dmabuf_unstable_v1_protocol_c, + tablet_unstable_v2_client_protocol_h, + tablet_unstable_v2_protocol_c, + xdg_output_unstable_v1_client_protocol_h, + xdg_output_unstable_v1_protocol_c, + ], + 'deps': [ dep_wayland_client, dep_libshared ] + }, + { + 'name': 'terminal', + 'sources': [ 'terminal.c' ], + 'deps': [ dep_toytoolkit ], + }, + { + 'name': 'touch-calibrator', + 'sources': [ + 'touch-calibrator.c', + '../shared/matrix.c', + weston_touch_calibration_client_protocol_h, + weston_touch_calibration_protocol_c, + ], + 'deps': [ dep_toytoolkit ], + }, +] + +foreach t : tools_list + if tools_enabled.contains(t.get('name')) + executable( + 'weston-@0@'.format(t.get('name')), + t.get('sources'), + include_directories: include_directories('..', '../shared'), + dependencies: t.get('deps', []), + install: true + ) + endif +endforeach + +demo_clients = [ + { 'basename': 'clickdot' }, + { + 'basename': 'cliptest', + 'add_sources': [ '../libweston/vertex-clipping.c' ] + }, + { 'basename': 'confine' }, + { 'basename': 'dnd' }, + { + 'basename': 'editor', + 'add_sources': [ + text_input_unstable_v1_client_protocol_h, + text_input_unstable_v1_protocol_c, + ], + 'add_deps': [ dependency('pangocairo') ] + }, + { 'basename': 'eventdemo' }, + { 'basename': 'flower' }, + { + 'basename': 'fullscreen', + 'add_sources': [ + fullscreen_shell_unstable_v1_client_protocol_h, + fullscreen_shell_unstable_v1_protocol_c, + ] + }, + { 'basename': 'image' }, + { 'basename': 'multi-resource' }, + { + 'basename': 'presentation-shm', + 'add_sources': [ + presentation_time_client_protocol_h, + presentation_time_protocol_c, + ] + }, + { 'basename': 'resizor' }, + { + 'basename': 'scaler', + 'add_sources': [ + viewporter_client_protocol_h, + viewporter_protocol_c, + ] + }, + { 'basename': 'smoke' }, + { 'basename': 'stacking' }, + { + 'basename': 'subsurfaces', + 'add_deps': [ dep_egl, dep_glesv2, dep_wl_egl ] + }, + { 'basename': 'transformed' }, +] + +if get_option('demo-clients') + foreach t : demo_clients + t_name = 'weston-' + t.get('basename') + t_srcs = [ t.get('basename') + '.c' ] + t.get('add_sources', []) + t_deps = [ dep_toytoolkit ] + t.get('add_deps', []) + + executable( + t_name, t_srcs, + include_directories: include_directories('..', '../shared'), + dependencies: t_deps, + install: true + ) + endforeach +endif + +simple_dmabuf_drm_opts = get_option('simple-dmabuf-drm') +simple_dmabuf_drm_deps = [] +foreach driver : [ 'etnaviv', 'intel', 'freedreno' ] + if simple_dmabuf_drm_opts.contains(driver) + required = true + enabled = true + elif simple_dmabuf_drm_opts.contains('auto') + required = get_option('auto_features').enabled() + enabled = not get_option('auto_features').disabled() + else + enabled = false + endif + + if enabled + dep = dependency('libdrm_' + driver, required: required) + if dep.found() + simple_dmabuf_drm_deps += dep + config_h.set('HAVE_LIBDRM_' + driver.to_upper(), 1) + endif + endif +endforeach +if simple_dmabuf_drm_deps.length() > 0 + executable( + 'weston-simple-dmabuf-drm', + 'simple-dmabuf-drm.c', + xdg_shell_unstable_v6_client_protocol_h, + xdg_shell_unstable_v6_protocol_c, + fullscreen_shell_unstable_v1_client_protocol_h, + fullscreen_shell_unstable_v1_protocol_c, + linux_dmabuf_unstable_v1_client_protocol_h, + linux_dmabuf_unstable_v1_protocol_c, + include_directories: include_directories('..'), + dependencies: [ + dep_wayland_client, + dep_libdrm, + simple_dmabuf_drm_deps + ], + install: true + ) +endif + +if get_option('shell-desktop') + exe_keyboard = executable( + 'weston-keyboard', + 'keyboard.c', + text_input_unstable_v1_client_protocol_h, + text_input_unstable_v1_protocol_c, + input_method_unstable_v1_client_protocol_h, + input_method_unstable_v1_protocol_c, + include_directories: include_directories('..'), + dependencies: dep_toytoolkit, + install_dir: get_option('libexecdir'), + install: true + ) + env_modmap += 'weston-keyboard=@0@;'.format(exe_keyboard.full_path()) + + exe_shooter = executable( + 'weston-screenshooter', + 'screenshot.c', + weston_screenshooter_client_protocol_h, + weston_screenshooter_protocol_c, + include_directories: include_directories('..'), + dependencies: dep_toytoolkit, + install_dir: get_option('libexecdir'), + install: true + ) + env_modmap += 'weston-screenshooter=@0@;'.format(exe_shooter.full_path()) + + exe_shell_desktop = executable( + 'weston-desktop-shell', + 'desktop-shell.c', + weston_desktop_shell_client_protocol_h, + weston_desktop_shell_protocol_c, + include_directories: include_directories('..'), + dependencies: dep_toytoolkit, + install_dir: get_option('libexecdir'), + install: true + ) + env_modmap += 'weston-desktop-shell=@0@;'.format(exe_shell_desktop.full_path()) +endif + + +if get_option('shell-ivi') + exe_shell_ivi_ui = executable( + 'weston-ivi-shell-user-interface', + 'ivi-shell-user-interface.c', + ivi_hmi_controller_client_protocol_h, + ivi_hmi_controller_protocol_c, + ivi_application_client_protocol_h, + ivi_application_protocol_c, + include_directories: include_directories('..'), + dependencies: dep_toytoolkit, + install: true, + install_dir: get_option('libexecdir') + ) + env_modmap += 'weston-ivi-shell-user-interface=@0@;'.format(exe_shell_ivi_ui.full_path()) +endif diff --git a/compositor/meson.build b/compositor/meson.build new file mode 100644 index 00000000..0cacae52 --- /dev/null +++ b/compositor/meson.build @@ -0,0 +1,146 @@ +srcs_weston = [ + git_version_h, + 'main.c', + 'text-backend.c', + 'weston-screenshooter.c', + text_input_unstable_v1_server_protocol_h, + text_input_unstable_v1_protocol_c, + input_method_unstable_v1_server_protocol_h, + input_method_unstable_v1_protocol_c, + weston_screenshooter_server_protocol_h, + weston_screenshooter_protocol_c, +] +deps_weston = [ + dep_libshared, + dep_libweston, + dep_libinput, + dep_libdl, + dep_threads, +] + +if get_option('xwayland') + srcs_weston += 'xwayland.c' + config_h.set_quoted('XSERVER_PATH', get_option('xwayland-path')) +endif + +exe_weston = executable( + 'weston', + srcs_weston, + include_directories: include_directories('..', '../shared'), + link_args: [ '-export-dynamic' ], + dependencies: deps_weston, + install: true +) +install_headers('weston.h', subdir: 'weston') + +pkgconfig.generate( + filebase: 'weston', + name: 'Weston Plugin API', + version: version_weston, + description: 'Header files for Weston plugin development', + requires_private: [ lib_weston ], + variables: [ + 'libexecdir=' + join_paths('${prefix}', get_option('libexecdir')), + 'pkglibexecdir=${libexecdir}/weston' + ], + subdirs: 'weston' +) + +install_data( + 'weston.desktop', + install_dir: join_paths(dir_data, 'wayland-sessions') +) + +if get_option('screenshare') + srcs_screenshare = [ + 'screen-share.c', + fullscreen_shell_unstable_v1_client_protocol_h, + fullscreen_shell_unstable_v1_protocol_c, + ] + deps_screenshare = [ + dep_libweston, + dep_wayland_client, + ] + plugin_screenshare = shared_library( + 'screen-share', + srcs_screenshare, + include_directories: include_directories('..', '../shared'), + dependencies: deps_screenshare, + name_prefix: '', + install: true, + install_dir: dir_module_weston + ) + env_modmap += 'screen-share.so=@0@;'.format(plugin_screenshare.full_path()) +endif + +if get_option('color-management-lcms') + config_h.set('HAVE_LCMS', '1') + + srcs_lcms = [ + 'cms-static.c', + 'cms-helper.c', + ] + deps_lcms = [ + dep_libweston, + dependency('lcms2'), + ] + plugin_lcms = shared_library( + 'cms-static', + srcs_lcms, + include_directories: include_directories('..', '../shared'), + dependencies: deps_lcms, + name_prefix: '', + install: true, + install_dir: dir_module_weston + ) + env_modmap += 'cms-static.so=@0@;'.format(plugin_lcms.full_path()) +endif + +if get_option('color-management-colord') + if not get_option('color-management-lcms') + error('LCMS must be enabled to support colord') + endif + + srcs_colord = [ + 'cms-colord.c', + 'cms-helper.c', + ] + deps_colord = [ + dep_libweston, + dependency('colord', version: '>= 0.1.27') + ] + plugin_colord = shared_library( + 'cms-colord', + srcs_colord, + include_directories: include_directories('..', '../shared'), + dependencies: deps_colord, + name_prefix: '', + install: true, + install_dir: dir_module_weston + ) + env_modmap += 'cms-colord.so=@0@;'.format(plugin_colord.full_path()) +endif + +if get_option('systemd') + plugin_systemd_notify = shared_library( + 'systemd-notify', + 'systemd-notify.c', + include_directories: include_directories('..', '../shared'), + dependencies: [ dep_libweston, dependency('libsystemd') ], + name_prefix: '', + install: true, + install_dir: dir_module_weston + ) + env_modmap += 'systemd-notify.so=@0@;'.format(plugin_systemd_notify.full_path()) +endif + +weston_ini_config = configuration_data() +weston_ini_config.set('bindir', dir_bin) +weston_ini_config.set('libexecdir', dir_libexec) +weston_ini_config.set('abs_top_srcdir', meson.source_root()) +weston_ini_config.set('abs_top_builddir', meson.build_root()) +configure_file( + input: '../weston.ini.in', + output: 'weston.ini', + configuration: weston_ini_config +) diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 00000000..16f172fe --- /dev/null +++ b/data/meson.build @@ -0,0 +1,29 @@ +install_data( + [ + 'background.png', + 'border.png', + 'fullscreen.png', + 'home.png', + 'icon_editor.png', + 'icon_flower.png', + 'icon_ivi_clickdot.png', + 'icon_ivi_flower.png', + 'icon_ivi_simple-egl.png', + 'icon_ivi_simple-shm.png', + 'icon_ivi_smoke.png', + 'icon_terminal.png', + 'icon_window.png', + 'panel.png', + 'pattern.png', + 'random.png', + 'sidebyside.png', + 'sign_close.png', + 'sign_maximize.png', + 'sign_minimize.png', + 'terminal.png', + 'tiling.png', + 'wayland.png', + 'wayland.svg', + ], + install_dir: join_paths(dir_data, 'weston') +) diff --git a/desktop-shell/meson.build b/desktop-shell/meson.build new file mode 100644 index 00000000..07013437 --- /dev/null +++ b/desktop-shell/meson.build @@ -0,0 +1,29 @@ +if get_option('shell-desktop') + config_h.set_quoted('WESTON_SHELL_CLIENT', get_option('desktop-shell-client-default')) + + srcs_shell_desktop = [ + 'shell.c', + 'exposay.c', + 'input-panel.c', + '../shared/matrix.c', + weston_desktop_shell_server_protocol_h, + weston_desktop_shell_protocol_c, + input_method_unstable_v1_server_protocol_h, + input_method_unstable_v1_protocol_c, + ] + deps_shell_desktop = [ + dep_libshared, + dep_lib_desktop, + dep_libweston, + ] + plugin_shell_desktop = shared_library( + 'desktop-shell', + srcs_shell_desktop, + include_directories: include_directories('..', '../shared'), + dependencies: deps_shell_desktop, + name_prefix: '', + install: true, + install_dir: dir_module_weston + ) + env_modmap += 'desktop-shell.so=@0@;'.format(plugin_shell_desktop.full_path()) +endif diff --git a/fullscreen-shell/meson.build b/fullscreen-shell/meson.build new file mode 100644 index 00000000..c9ca781a --- /dev/null +++ b/fullscreen-shell/meson.build @@ -0,0 +1,17 @@ +if get_option('shell-fullscreen') + srcs_shell_fullscreen = [ + 'fullscreen-shell.c', + '../shared/matrix.c', + fullscreen_shell_unstable_v1_server_protocol_h, + fullscreen_shell_unstable_v1_protocol_c, + ] + shared_library( + 'fullscreen-shell', + srcs_shell_fullscreen, + include_directories: include_directories('..', '../shared'), + dependencies: dep_libweston, + name_prefix: '', + install: true, + install_dir: dir_module_weston + ) +endif diff --git a/ivi-shell/meson.build b/ivi-shell/meson.build new file mode 100644 index 00000000..057e3973 --- /dev/null +++ b/ivi-shell/meson.build @@ -0,0 +1,53 @@ +if get_option('shell-ivi') + srcs_shell_ivi = [ + 'ivi-shell.c', + 'ivi-layout.c', + 'ivi-layout-transition.c', + ivi_application_server_protocol_h, + ivi_application_protocol_c, + input_method_unstable_v1_server_protocol_h, + input_method_unstable_v1_protocol_c, + ] + plugin_shell_ivi = shared_library( + 'ivi-shell', + srcs_shell_ivi, + include_directories: include_directories('..', '../shared'), + dependencies: dep_libweston, + name_prefix: '', + install: true, + install_dir: dir_module_weston + ) + env_modmap += 'ivi-shell.so=@0@;'.format(plugin_shell_ivi.full_path()) + + install_headers('ivi-layout-export.h', subdir: 'weston') + + srcs_ivi_hmi = [ + 'hmi-controller.c', + ivi_hmi_controller_server_protocol_h, + ivi_hmi_controller_protocol_c, + ] + plugin_ivi_hmi = shared_library( + 'hmi-controller', + srcs_ivi_hmi, + include_directories: include_directories('..', '../shared'), + dependencies: dep_libweston, + name_prefix: '', + install: true, + install_dir: dir_module_weston + ) + env_modmap += 'hmi-controller.so=@0@;'.format(plugin_ivi_hmi.full_path()) + + ivi_test_config = configuration_data() + ivi_test_config.set('bindir', dir_bin) + ivi_test_config.set('libexecdir', dir_libexec) + ivi_test_config.set('abs_top_srcdir', meson.current_source_dir()) + ivi_test_config.set('abs_top_builddir', meson.current_build_dir()) + ivi_test_config.set('plugin_prefix', meson.current_build_dir()) + ivi_test_config.set('westondatadir', join_paths(dir_data, 'weston')) + ivi_test_ini = configure_file( + input: '../ivi-shell/weston.ini.in', + output: 'weston-ivi-test.ini', + install: false, + configuration: ivi_test_config + ) +endif diff --git a/libweston-desktop/meson.build b/libweston-desktop/meson.build new file mode 100644 index 00000000..81bd64e2 --- /dev/null +++ b/libweston-desktop/meson.build @@ -0,0 +1,35 @@ +srcs_libdesktop = [ + 'libweston-desktop.c', + 'client.c', + 'seat.c', + 'surface.c', + 'xwayland.c', + 'wl-shell.c', + 'xdg-shell-v6.c', + xdg_shell_unstable_v6_server_protocol_h, + xdg_shell_unstable_v6_protocol_c, +] +lib_desktop = shared_library( + 'weston-desktop-@0@'.format(libweston_major), + srcs_libdesktop, + include_directories: include_directories('..', '../shared'), + install: true, + version: '0.0.@0@'.format(libweston_revision), + dependencies: dep_libweston +) +dep_lib_desktop = declare_dependency( + link_with: lib_desktop, + dependencies: dep_libweston +) + +install_headers('libweston-desktop.h', subdir: dir_include_libweston) + +pkgconfig.generate( + filebase: 'libweston-desktop-@0@'.format(libweston_major), + name: 'libweston-desktop', + version: version_weston, + description: 'Desktop shells abstraction library for libweston compositors', + libraries: lib_desktop, + requires_private: [ lib_weston, dep_wayland_server ], + subdirs: dir_include_libweston +) diff --git a/libweston/git-version.h.meson b/libweston/git-version.h.meson new file mode 100644 index 00000000..d91f19c4 --- /dev/null +++ b/libweston/git-version.h.meson @@ -0,0 +1 @@ +#define BUILD_ID "@VCS_TAG@" diff --git a/libweston/meson.build b/libweston/meson.build new file mode 100644 index 00000000..6c87552e --- /dev/null +++ b/libweston/meson.build @@ -0,0 +1,438 @@ +deps_libweston = [ + dep_wayland_server, + dep_pixman, + dep_libm, + dep_libdl, + dep_libdrm_headers, + dep_libshared, + dep_xkbcommon, +] +srcs_libweston = [ + git_version_h, + 'animation.c', + 'bindings.c', + 'clipboard.c', + 'compositor.c', + 'data-device.c', + 'input.c', + 'linux-dmabuf.c', + 'log.c', + 'noop-renderer.c', + 'pixel-formats.c', + 'pixman-renderer.c', + 'plugin-registry.c', + 'screenshooter.c', + 'timeline.c', + 'touch-calibration.c', + 'weston-debug.c', + 'zoom.c', + '../shared/matrix.c', + linux_dmabuf_unstable_v1_protocol_c, + linux_dmabuf_unstable_v1_server_protocol_h, + input_method_unstable_v1_protocol_c, + input_method_unstable_v1_server_protocol_h, + input_timestamps_unstable_v1_protocol_c, + input_timestamps_unstable_v1_server_protocol_h, + presentation_time_protocol_c, + presentation_time_server_protocol_h, + pointer_constraints_unstable_v1_protocol_c, + pointer_constraints_unstable_v1_server_protocol_h, + relative_pointer_unstable_v1_protocol_c, + relative_pointer_unstable_v1_server_protocol_h, + weston_screenshooter_protocol_c, + weston_screenshooter_server_protocol_h, + text_cursor_position_protocol_c, + text_cursor_position_server_protocol_h, + text_input_unstable_v1_protocol_c, + text_input_unstable_v1_server_protocol_h, + weston_touch_calibration_protocol_c, + weston_touch_calibration_server_protocol_h, + viewporter_protocol_c, + viewporter_server_protocol_h, + weston_debug_protocol_c, + weston_debug_server_protocol_h, +] + +install_headers( + 'compositor.h', + 'plugin-registry.h', + 'timeline-object.h', + 'windowed-output-api.h', + '../shared/config-parser.h', + '../shared/matrix.h', + '../shared/zalloc.h', + subdir: dir_include_libweston +) + +lib_weston = shared_library( + 'weston-@0@'.format(libweston_major), + srcs_libweston, + include_directories: include_directories('..', '../shared'), + link_args: [ '-export-dynamic' ], + install: true, + version: '0.0.@0@'.format(libweston_revision), + dependencies: deps_libweston +) + +dep_libweston = declare_dependency( + link_with: lib_weston, + include_directories: include_directories('.'), + dependencies: deps_libweston +) + +pkgconfig.generate( + filebase: 'libweston-@0@'.format(libweston_major), + name: 'libweston API', + version: version_weston, + description: 'Header files for libweston compositors development', + libraries: lib_weston, + requires_private: [ dep_wayland_server, dep_pixman, dep_xkbcommon ], + subdirs: dir_include_libweston +) + +pkgconfig.generate( + filebase: 'libweston-@0@-protocols'.format(libweston_major), + name: 'libWeston Protocols', + version: version_weston, + description: 'libWeston protocol files', + variables: [ + 'datarootdir=' + join_paths('${prefix}', get_option('datadir')), + 'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', dir_protocol_libweston) + ], + install_dir: dir_data_pc +) + +srcs_session_helper = [ + 'launcher-direct.c', + 'launcher-util.c', + 'launcher-weston-launch.c', +] +deps_session_helper = [ + # for compositor.h needing pixman.h + dep_pixman.partial_dependency(compile_args: true) +] + +if get_option('backend-drm') + deps_session_helper += dep_libdrm +endif + +systemd_dep = dependency('', required: false) +if get_option('launcher-logind') + systemd_dep = dependency('libsystemd', version: '>= 209', required: false) + if systemd_dep.found() + config_h.set('HAVE_SYSTEMD_LOGIN_209', '1') + else + systemd_dep = dependency('libsystemd-login', version: '>= 198') + endif + config_h.set('HAVE_DBUS', '1') + config_h.set('HAVE_SYSTEMD_LOGIN', '1') + + srcs_session_helper += [ + 'dbus.c', + 'launcher-logind.c', + ] + deps_session_helper += [ + dependency('dbus-1', version: '>= 1.6'), + systemd_dep, + ] +endif + +lib_session_helper = static_library( + 'session-helper', + srcs_session_helper, + include_directories: include_directories('..', '../shared'), + dependencies: deps_session_helper, + install: false +) +dep_session_helper = declare_dependency(link_with: lib_session_helper) + + +if get_option('backend-drm') + config_h.set('BUILD_DRM_COMPOSITOR', '1') + + srcs_drm = [ + 'compositor-drm.c', + 'libbacklight.c', + 'libinput-device.c', + 'libinput-seat.c', + linux_dmabuf_unstable_v1_protocol_c, + linux_dmabuf_unstable_v1_server_protocol_h, + presentation_time_server_protocol_h, + ] + + deps_drm = [ + dep_libweston, + dep_session_helper, + dep_libdrm, + dep_libinput, + dependency('libudev', version: '>= 136'), + ] + + if get_option('renderer-gl') + dep_gbm = dependency('gbm') + if dep_gbm.version().version_compare('>= 17.1') + config_h.set('HAVE_GBM_MODIFIERS', '1') + endif + if dep_gbm.version().version_compare('>= 17.2') + config_h.set('HAVE_GBM_FD_IMPORT', '1') + endif + deps_drm += dep_gbm + endif + + if get_option('backend-drm-screencast-vaapi') + srcs_drm += 'vaapi-recorder.c' + deps_drm += [ + dependency('libva', version: '>= 0.34.0'), + dependency('libva-drm', version: '>= 0.34.0'), + dependency('threads'), + ] + config_h.set('BUILD_VAAPI_RECORDER', '1') + endif + + if dep_libdrm.version().version_compare('>= 2.4.71') + config_h.set('HAVE_DRM_ADDFB2_MODIFIERS', '1') + endif + + if dep_libdrm.version().version_compare('>= 2.4.78') + config_h.set('HAVE_DRM_ATOMIC', '1') + endif + + if dep_libdrm.version().version_compare('>= 2.4.83') + config_h.set('HAVE_DRM_FORMATS_BLOB', '1') + endif + + plugin_drm = shared_library( + 'drm-backend', + srcs_drm, + include_directories: include_directories('..', '../shared'), + dependencies: deps_drm, + name_prefix: '', + install: true, + install_dir: dir_module_libweston + ) + env_modmap += 'drm-backend.so=@0@;'.format(plugin_drm.full_path()) + + install_headers('compositor-drm.h', subdir: dir_include_libweston) +endif + + +if get_option('backend-headless') + config_h.set('BUILD_HEADLESS_COMPOSITOR', '1') + + srcs_headless = [ + 'compositor-headless.c', + presentation_time_server_protocol_h, + ] + plugin_headless = shared_library( + 'headless-backend', + srcs_headless, + include_directories: include_directories('..', '../shared'), + dependencies: dep_libweston, + name_prefix: '', + install: true, + install_dir: dir_module_libweston, + ) + env_modmap += 'headless-backend.so=@0@;'.format(plugin_headless.full_path()) + install_headers('compositor-headless.h', subdir: dir_include_libweston) +endif + + +if get_option('backend-rdp') + config_h.set('BUILD_RDP_COMPOSITOR', '1') + + dep_frdp = dependency('freerdp2', version: '>= 2.0.0', required: false) + if not dep_frdp.found() + dep_frdp = dependency('freerdp', version: '>= 1.1.0') + endif + + if cc.has_header('freerdp/version.h', dependencies: dep_frdp) + config_h.set('HAVE_FREERDP_VERSION_H', '1') + endif + + if cc.has_member( + 'SURFACE_BITS_COMMAND', 'bmp', + dependencies : dep_frdp, + prefix : '#include ' + ) + config_h.set('HAVE_SURFACE_BITS_BMP', '1') + endif + + deps_rdp = [ + dep_libweston, + dep_frdp, + ] + plugin_rdp = shared_library( + 'rdp-backend', + 'compositor-rdp.c', + include_directories: include_directories('..', '../shared'), + dependencies: deps_rdp, + name_prefix: '', + install: true, + install_dir: dir_module_libweston + ) + env_modmap += 'rdp-backend.so=@0@;'.format(plugin_rdp.full_path()) + install_headers('compositor-rdp.h', subdir: dir_include_libweston) +endif + + +if get_option('backend-wayland') + config_h.set('BUILD_WAYLAND_COMPOSITOR', '1') + + srcs_wlwl = [ + 'compositor-wayland.c', + fullscreen_shell_unstable_v1_client_protocol_h, + fullscreen_shell_unstable_v1_protocol_c, + presentation_time_protocol_c, + presentation_time_server_protocol_h, + xdg_shell_unstable_v6_client_protocol_h, + xdg_shell_unstable_v6_protocol_c, + ] + + deps_wlwl = [ + dependency('wayland-client'), + dependency('wayland-cursor'), + dep_pixman, + dep_libweston, + dep_lib_cairo_shared, + ] + + if get_option('renderer-gl') + deps_wlwl += dep_wl_egl + endif + + plugin_wlwl = shared_library( + 'wayland-backend', + srcs_wlwl, + include_directories: include_directories('..', '../shared'), + dependencies: deps_wlwl, + name_prefix: '', + install: true, + install_dir: dir_module_libweston + ) + env_modmap += 'wayland-backend.so=@0@;'.format(plugin_wlwl.full_path()) + install_headers('compositor-wayland.h', subdir: dir_include_libweston) +endif + + +if get_option('backend-x11') + config_h.set('BUILD_X11_COMPOSITOR', '1') + + srcs_x11 = [ + 'compositor-x11.c', + presentation_time_server_protocol_h, + ] + + deps_x11 = [ + dependency('xcb', version: '>= 1.8'), + dependency('xcb-shm'), + dependency('x11'), + dependency('x11-xcb'), + dep_lib_cairo_shared, + dep_pixman, + ] + + dep_xcb_xkb = dependency('xcb-xkb', version: '>= 1.9', required: false) + if dep_xcb_xkb.found() + deps_x11 += dep_xcb_xkb + config_h.set('HAVE_XCB_XKB', '1') + endif + + if get_option('renderer-gl') + deps_x11 += dependency('egl') + endif + + plugin_x11 = shared_library( + 'x11-backend', + srcs_x11, + include_directories: include_directories('..', '../shared'), + dependencies: deps_x11, + name_prefix: '', + install: true, + install_dir: dir_module_libweston + ) + env_modmap += 'x11-backend.so=@0@;'.format(plugin_x11.full_path()) + + install_headers('compositor-x11.h', subdir: dir_include_libweston) +endif + + +if get_option('backend-fbdev') + config_h.set('BUILD_FBDEV_COMPOSITOR', '1') + + srcs_fbdev = [ + 'compositor-fbdev.c', + 'libinput-device.c', + 'libinput-seat.c', + presentation_time_server_protocol_h, + ] + + deps_fbdev = [ + dep_libweston, + dep_session_helper, + dep_libinput, + dependency('libudev', version: '>= 136'), + ] + + plugin_fbdev = shared_library( + 'fbdev-backend', + srcs_fbdev, + include_directories: include_directories('..', '../shared'), + dependencies: deps_fbdev, + name_prefix: '', + install: true, + install_dir: dir_module_libweston + ) + env_modmap += 'fbdev-backend.so=@0@;'.format(plugin_fbdev.full_path()) + + install_headers('compositor-fbdev.h', subdir: dir_include_libweston) +endif + + +if get_option('renderer-gl') + config_h.set('ENABLE_EGL', '1') + + if not dep_egl.found() or not dep_glesv2.found() + error('gl-renderer enabled but EGL/GLESv2 not found') + endif + + srcs_renderer_gl = [ + 'gl-renderer.c', + 'vertex-clipping.c', + '../shared/matrix.c', + linux_dmabuf_unstable_v1_protocol_c, + linux_dmabuf_unstable_v1_server_protocol_h, + ] + deps_renderer_gl = [ + dep_egl, + dep_glesv2, + dep_pixman, + dep_libweston, + dep_libdrm_headers, + ] + plugin_gl = shared_library( + 'gl-renderer', + srcs_renderer_gl, + include_directories: include_directories('..', '../shared'), + dependencies: deps_renderer_gl, + name_prefix: '', + install: true, + install_dir: dir_module_libweston + ) + env_modmap += 'gl-renderer.so=@0@;'.format(plugin_gl.full_path()) +endif + +if get_option('weston-launch') + dep_pam = cc.find_library('pam') + + if not cc.has_function('pam_open_session', dependencies: dep_pam) + error('pam_open_session not found for weston-launch') + endif + + executable( + 'weston-launch', + 'weston-launch.c', + dependencies: [dep_pam, systemd_dep, dep_libdrm], + include_directories: include_directories('..'), + install: true + ) +endif diff --git a/man/meson.build b/man/meson.build new file mode 100644 index 00000000..ced56944 --- /dev/null +++ b/man/meson.build @@ -0,0 +1,53 @@ +man_conf = configuration_data() +man_conf.set('weston_native_backend', opt_backend_native) +man_conf.set('weston_modules_dir', dir_module_weston) +man_conf.set('libweston_modules_dir', dir_module_libweston) +man_conf.set('weston_shell_client', get_option('desktop-shell-client-default')) +man_conf.set('weston_libexecdir', dir_libexec) +man_conf.set('weston_bindir', dir_bin) +man_conf.set('xserver_path', get_option('xwayland-path')) +man_conf.set('version', version_weston) + +configure_file( + input: 'weston.man', + output: 'weston.1', + install: true, + install_dir: join_paths(dir_man, 'man1'), + configuration: man_conf +) + +configure_file( + input: 'weston-debug.man', + output: 'weston-debug.1', + install: true, + install_dir: join_paths(dir_man, 'man1'), + configuration: man_conf +) + +configure_file( + input: 'weston.ini.man', + output: 'weston.ini.5', + install: true, + install_dir: join_paths(dir_man, 'man5'), + configuration: man_conf +) + +if get_option('backend-drm') + configure_file( + input: 'weston-drm.man', + output: 'weston-drm.7', + install: true, + install_dir: join_paths(dir_man, 'man7'), + configuration: man_conf + ) +endif + +if get_option('backend-rdp') + configure_file( + input: 'weston-rdp.man', + output: 'weston-rdp.7', + install: true, + install_dir: join_paths(dir_man, 'man7'), + configuration: man_conf + ) +endif diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..a5dcb766 --- /dev/null +++ b/meson.build @@ -0,0 +1,174 @@ +project('weston', + 'c', + version: '5.0.90', + default_options: [ + 'warning_level=2', + 'c_std=gnu99', + 'b_lundef=false', + ], + meson_version: '>= 0.47', + license: 'MIT/Expat', +) + +libweston_major = 5 + +# libweston_revision is manufactured to follow the autotools build's +# library file naming, thanks to libtool +version_weston = meson.project_version() +version_weston_arr = version_weston.split('.') +if libweston_major > version_weston_arr[0].to_int() + if libweston_major > version_weston_arr[0].to_int() + 1 + error('Bad versions in meson.build: libweston_major is too high') + endif + libweston_revision = 0 +elif libweston_major == version_weston_arr[0].to_int() + libweston_revision = version_weston_arr[2].to_int() +else + error('Bad versions in meson.build: libweston_major is too low') +endif + +dir_prefix = get_option('prefix') +dir_bin = join_paths(dir_prefix, get_option('bindir')) +dir_data = join_paths(dir_prefix, get_option('datadir')) +dir_include = join_paths(dir_prefix, get_option('includedir')) +dir_include_libweston = 'libweston-@0@'.format(libweston_major) +dir_lib = join_paths(dir_prefix, get_option('libdir')) +dir_libexec = join_paths(dir_prefix, get_option('libexecdir')) +dir_module_weston = join_paths(dir_lib, 'weston') +dir_module_libweston = join_paths(dir_lib, 'libweston-@0@'.format(libweston_major)) +dir_data_pc = join_paths(dir_data, 'pkgconfig') +dir_lib_pc = join_paths(dir_lib, 'pkgconfig') +dir_man = join_paths(dir_prefix, get_option('mandir')) +dir_protocol_libweston = 'weston/protocols' # XXX: this should be 'libweston' + +pkgconfig = import('pkgconfig') + +libweston_version_h = configuration_data() +libweston_version_h.set('WESTON_VERSION_MAJOR', version_weston_arr[0]) +libweston_version_h.set('WESTON_VERSION_MINOR', version_weston_arr[1]) +libweston_version_h.set('WESTON_VERSION_MICRO', version_weston_arr[2]) +libweston_version_h.set('WESTON_VERSION', version_weston) +version_h = configure_file( + input: 'libweston/version.h.in', + output: 'version.h', + configuration: libweston_version_h +) +install_headers(version_h, subdir: dir_include_libweston) +git_version_h = vcs_tag( + input: 'libweston/git-version.h.meson', + output: 'git-version.h', + fallback: version_weston +) + +config_h = configuration_data() + +cc = meson.get_compiler('c') + +global_args = [] +global_args_maybe = [ + '-Wno-unused-parameter', + '-Wno-shift-negative-value', # required due to Pixman + '-Wno-missing-field-initializers', + '-fvisibility=hidden', + '-DIN_WESTON', +] +foreach a : global_args_maybe + if cc.has_argument(a) + global_args += a + endif +endforeach +add_global_arguments(global_args, language: 'c') + +if cc.has_header_symbol('sys/sysmacros.h', 'major') + config_h.set('MAJOR_IN_SYSMACROS', 1) +elif cc.has_header_symbol('sys/mkdev.h', 'major') + config_h.set('MAJOR_IN_MKDEV', 1) +endif + +optional_libc_funcs = [ + 'mkostemp', 'strchrnul', 'initgroups', 'posix_fallocate' +] +foreach func : optional_libc_funcs + if cc.has_function(func) + config_h.set('HAVE_' + func.to_upper(), 1) + endif +endforeach + +optional_system_headers = [ + 'linux/sync_file.h' +] +foreach hdr : optional_system_headers + if cc.has_header(hdr) + config_h.set('HAVE_' + hdr.underscorify().to_upper(), 1) + endif +endforeach + +env_modmap = '' + +config_h.set('_GNU_SOURCE', '1') +config_h.set('_ALL_SOURCE', '1') + +config_h.set_quoted('PACKAGE_STRING', 'weston @0@'.format(version_weston)) +config_h.set_quoted('PACKAGE_VERSION', version_weston) +config_h.set_quoted('VERSION', version_weston) +config_h.set_quoted('PACKAGE_URL', 'https://wayland.freedesktop.org') +config_h.set_quoted('PACKAGE_BUGREPORT', 'https://gitlab.freedesktop.org/wayland/weston/issues/') + +config_h.set_quoted('BINDIR', dir_bin) +config_h.set_quoted('DATADIR', dir_data) +config_h.set_quoted('LIBEXECDIR', dir_libexec) +config_h.set_quoted('MODULEDIR', dir_module_weston) +config_h.set_quoted('LIBWESTON_MODULEDIR', dir_module_libweston) + +backend_default = get_option('backend-default') +if backend_default == 'auto' + foreach b : [ 'headless', 'fbdev', 'x11', 'wayland', 'drm' ] + if get_option('backend-' + b) + backend_default = b + endif + endforeach +endif +opt_backend_native = backend_default + '-backend.so' +config_h.set_quoted('WESTON_NATIVE_BACKEND', opt_backend_native) +message('The default backend is ' + backend_default) +if not get_option('backend-' + backend_default) + error('Backend @0@ was chosen as native but is not being built.'.format(backend_default)) +endif + +dep_xkbcommon = dependency('xkbcommon', version: '>= 0.3.0') +if dep_xkbcommon.version().version_compare('>= 0.5.0') + config_h.set('HAVE_XKBCOMMON_COMPOSE', '1') +endif + +dep_wayland_server = dependency('wayland-server', version: '>= 1.12.0') +dep_wayland_client = dependency('wayland-client', version: '>= 1.12.0') +dep_pixman = dependency('pixman-1', version: '>= 0.25.2') +dep_libinput = dependency('libinput', version: '>= 0.8.0') +dep_libm = cc.find_library('m') +dep_libdl = cc.find_library('dl') +dep_libdrm = dependency('libdrm', version: '>= 2.4.68') +dep_libdrm_headers = dep_libdrm.partial_dependency(compile_args: true) +dep_egl = dependency('egl', required: false) +dep_wl_egl = dependency('wayland-egl') +dep_glesv2 = dependency('glesv2', required: false) +dep_threads = dependency('threads') + +subdir('protocol') +subdir('shared') +subdir('libweston') +subdir('libweston-desktop') +subdir('xwayland') +subdir('compositor') +subdir('desktop-shell') +subdir('fullscreen-shell') +subdir('ivi-shell') +subdir('remoting') +subdir('clients') +subdir('wcap') +subdir('tests') +subdir('data') +subdir('man') + +configure_file(output: 'config.h', install: false, configuration: config_h) + +# TODO: process doc/doxygen/*.doxygen.in diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000..31362ba4 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,206 @@ +# This option is not implemented: +# --with-cairo=[image|gl|glesv2] Which Cairo renderer to use for the clients +# It is hardcoded to cairo-image for now. + +option( + 'backend-drm', + type: 'boolean', + value: true, + description: 'Weston backend: DRM/KMS' +) +option( + 'backend-drm-screencast-vaapi', + type: 'boolean', + value: true, + description: 'DRM/KMS backend support for VA-API screencasting' +) +option( + 'backend-headless', + type: 'boolean', + value: true, + description: 'Weston backend: headless (testing)' +) +option( + 'backend-rdp', + type: 'boolean', + value: true, + description: 'Weston backend: RDP remote screensharing' +) +option( + 'screenshare', + type: 'boolean', + value: true, + description: 'Compositor: RDP screen-sharing support' +) +option( + 'backend-wayland', + type: 'boolean', + value: true, + description: 'Weston backend: Wayland (nested)' +) +option( + 'backend-x11', + type: 'boolean', + value: true, + description: 'Weston backend: X11 (nested)' +) +option( + 'backend-fbdev', + type: 'boolean', + value: true, + description: 'Weston backend: fbdev' +) +option( + 'backend-default', + type: 'combo', + choices: [ 'auto', 'drm', 'wayland', 'x11', 'fbdev', 'headless' ], + value: 'drm', + description: 'Default backend when no parent display server detected' +) + +option( + 'renderer-gl', + type: 'boolean', + value: true, + description: 'Weston renderer: EGL / OpenGL ES 2.x' +) + +option( + 'weston-launch', + type: 'boolean', + value: true, + description: 'Weston launcher for systems without logind' +) + +option( + 'xwayland', + type: 'boolean', + value: true, + description: 'Xwayland: support for X11 clients inside Weston' +) +option( + 'xwayland-path', + type: 'string', + value: '/usr/bin/Xwayland', + description: 'Xwayland: path to installed Xwayland binary' +) + +option( + 'systemd', + type: 'boolean', + value: true, + description: 'systemd service plugin: state notify, watchdog, socket activation' +) + +option( + 'remoting', + type: 'boolean', + value: true, + description: 'Virtual remote output with GStreamer on DRM backend' +) + +option( + 'shell-desktop', + type: 'boolean', + value: true, + description: 'Weston shell UI: traditional desktop' +) +option( + 'shell-fullscreen', + type: 'boolean', + value: true, + description: 'Weston shell UI: fullscreen/kiosk' +) +option( + 'shell-ivi', + type: 'boolean', + value: true, + description: 'Weston shell UI: IVI (automotive)' +) + +option( + 'desktop-shell-client-default', + type: 'string', + value: 'weston-desktop-shell', + description: 'Weston desktop shell: default helper client selection' +) + +option( + 'color-management-lcms', + type: 'boolean', + value: true, + description: 'Compositor color management: lcms' +) +option( + 'color-management-colord', + type: 'boolean', + value: true, + description: 'Compositor color management: colord (requires lcms)' +) + +option( + 'launcher-logind', + type: 'boolean', + value: true, + description: 'Compositor: support systemd-logind D-Bus protocol' +) + +option( + 'image-jpeg', + type: 'boolean', + value: true, + description: 'JPEG loading support' +) +option( + 'image-webp', + type: 'boolean', + value: true, + description: 'WebP loading support' +) + +option( + 'tools', + type: 'array', + choices: [ 'calibrator', 'debug', 'info', 'terminal', 'touch-calibrator' ], + description: 'List of accessory clients to build and install' +) +option( + 'simple-dmabuf-drm', + type: 'array', + choices: [ 'auto', 'intel', 'freedreno', 'etnaviv' ], + value: [ 'intel', 'freedreno', 'etnaviv' ], + description: 'List of DRM drivers to be supported by weston-simple-dmabuf-drm' +) +option( + 'demo-clients', + type: 'boolean', + value: true, + description: 'Sample clients: toytoolkit demo programs' +) +option( + 'simple-clients', + type: 'array', + choices: [ 'all', 'damage', 'im', 'egl', 'shm', 'touch', 'dmabuf-v4l' ], + value: [ 'all' ], + description: 'Sample clients: simple test programs' +) + +option( + 'resize-pool', + type: 'boolean', + value: true, + description: 'Sample clients: optimize window resize performance' +) +option( + 'wcap-decode', + type: 'boolean', + value: true, + description: 'Tools: screen recording decoder tool' +) + +option( + 'test-junit-xml', + type: 'boolean', + value: true, + description: 'Tests: output JUnit XML results' +) diff --git a/protocol/meson.build b/protocol/meson.build new file mode 100644 index 00000000..a947eeab --- /dev/null +++ b/protocol/meson.build @@ -0,0 +1,72 @@ +dep_scanner = dependency('wayland-scanner', native: true) +prog_scanner = find_program(dep_scanner.get_pkgconfig_variable('wayland_scanner')) + +dep_wp = dependency('wayland-protocols', version: '>= 1.14') +dir_wp_base = dep_wp.get_pkgconfig_variable('pkgdatadir') + +install_data( + [ + 'weston-debug.xml', + ], + install_dir: join_paths(dir_data, dir_protocol_libweston) +) + +generated_protocols = [ + [ 'input-method', 'v1' ], + [ 'input-timestamps', 'v1' ], + [ 'ivi-application', 'internal' ], + [ 'ivi-hmi-controller', 'internal' ], + [ 'fullscreen-shell', 'v1' ], + [ 'linux-dmabuf', 'v1' ], + [ 'presentation-time', 'stable' ], + [ 'pointer-constraints', 'v1' ], + [ 'relative-pointer', 'v1' ], + [ 'tablet', 'v2' ], + [ 'text-cursor-position', 'internal' ], + [ 'text-input', 'v1' ], + [ 'viewporter', 'stable' ], + [ 'weston-debug', 'internal' ], + [ 'weston-desktop-shell', 'internal' ], + [ 'weston-screenshooter', 'internal' ], + [ 'weston-test', 'internal' ], + [ 'weston-touch-calibration', 'internal' ], + [ 'xdg-output', 'v1' ], + [ 'xdg-shell', 'v6' ], +] + +foreach proto: generated_protocols + proto_name = proto[0] + if proto[1] == 'internal' + base_file = proto_name + xml_path = '@0@.xml'.format(proto_name) + elif proto[1] == 'stable' + base_file = proto_name + xml_path = '@0@/stable/@1@/@1@.xml'.format(dir_wp_base, base_file) + else + base_file = '@0@-unstable-@1@'.format(proto_name, proto[1]) + xml_path = '@0@/unstable/@1@/@2@.xml'.format(dir_wp_base, proto_name, base_file) + endif + + foreach output_type: [ 'client-header', 'server-header', 'private-code' ] + if output_type == 'client-header' + output_file = '@0@-client-protocol.h'.format(base_file) + elif output_type == 'server-header' + output_file = '@0@-server-protocol.h'.format(base_file) + else + output_file = '@0@-protocol.c'.format(base_file) + if dep_scanner.version().version_compare('< 1.14.91') + output_type = 'code' + endif + endif + + var_name = output_file.underscorify() + target = custom_target( + '@0@ @1@'.format(base_file, output_type), + command: [ prog_scanner, output_type, '@INPUT@', '@OUTPUT@' ], + input: xml_path, + output: output_file, + ) + + set_variable(var_name, target) + endforeach +endforeach diff --git a/remoting/meson.build b/remoting/meson.build new file mode 100644 index 00000000..224e8cd9 --- /dev/null +++ b/remoting/meson.build @@ -0,0 +1,31 @@ +if get_option('remoting') + user_hint = 'If you rather not build this, set "remoting=false".' + + if not get_option('backend-drm') + error('Attempting to build the remoting plugin without the required DRM backend. ' + user_hint) + endif + + depnames = [ + 'gstreamer-1.0', 'gstreamer-allocators-1.0', + 'gstreamer-app-1.0', 'gstreamer-video-1.0' + ] + deps_remoting = [ dep_libweston ] + foreach depname : depnames + dep = dependency(depname, required: false) + if not dep.found() + error('Remoting plugin requires @0@ which was not found. '.format(depname) + user_hint) + endif + deps_remoting += dep + endforeach + + plugin_remoting = shared_library( + 'remoting-plugin', + 'remoting-plugin.c', + include_directories: include_directories('..', '../shared'), + dependencies: deps_remoting, + name_prefix: '', + install: true, + install_dir: dir_module_libweston + ) + env_modmap += 'remoting-plugin.so=@0@;'.format(plugin_remoting.full_path()) +endif diff --git a/shared/meson.build b/shared/meson.build new file mode 100644 index 00000000..979debb7 --- /dev/null +++ b/shared/meson.build @@ -0,0 +1,65 @@ +srcs_libshared = [ + 'config-parser.c', + 'option-parser.c', + 'file-util.c', + 'os-compatibility.c', + 'xalloc.c', +] +deps_libshared = dep_wayland_client + +lib_libshared = static_library( + 'shared', + srcs_libshared, + include_directories: include_directories('..'), + dependencies: deps_libshared, + install: false +) +dep_libshared = declare_dependency( + link_with: lib_libshared, + dependencies: deps_libshared +) + +srcs_cairo_shared = [ + 'image-loader.c', + 'cairo-util.c', + 'frame.c', +] + +deps_cairo_shared = [ + dep_libshared, + dependency('cairo'), + dependency('libpng'), + dep_pixman, + dep_libm, +] + +dep_pango = dependency('pango', required: false) +dep_pangocairo = dependency('pangocairo', required: false) +dep_glib = dependency('glib-2.0', version: '>= 2.36', required: false) + +if dep_pango.found() and dep_pangocairo.found() and dep_glib.found() + deps_cairo_shared += [ dep_pango, dep_pangocairo, dep_glib ] + config_h.set('HAVE_PANGO', '1') +endif + +if get_option('image-jpeg') + deps_cairo_shared += cc.find_library('jpeg') + config_h.set('HAVE_JPEG', '1') +endif + +if get_option('image-webp') + deps_cairo_shared += dependency('libwebp') + config_h.set('HAVE_WEBP', '1') +endif + +lib_cairo_shared = static_library( + 'cairo-shared', + srcs_cairo_shared, + include_directories: include_directories('..'), + dependencies: deps_cairo_shared, + install: false +) +dep_lib_cairo_shared = declare_dependency( + link_with: lib_cairo_shared, + dependencies: deps_cairo_shared +) diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 00000000..2d681909 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,371 @@ +plugin_test_shell_desktop = shared_library( + 'weston-test-desktop-shell', + 'weston-test-desktop-shell.c', + include_directories: include_directories('..', '../shared'), + dependencies: [ dep_lib_desktop, dep_libweston ], + name_prefix: '', + install: false +) +env_modmap += 'weston-test-desktop-shell.so=@0@;'.format(plugin_test_shell_desktop.full_path()) + +lib_test_runner = static_library( + 'test-runner', + 'weston-test-runner.c', + include_directories: include_directories('..', '../shared'), + install: false, +) +dep_test_runner = declare_dependency(link_with: lib_test_runner) + +lib_test_client = static_library( + 'test-client', + 'weston-test-client-helper.c', + weston_test_client_protocol_h, + weston_test_protocol_c, + include_directories: include_directories('..', '../shared'), + dependencies: [ + dep_libshared, + dep_wayland_client, + dep_pixman, + dependency('cairo'), + ], + install: false, +) +dep_test_client = declare_dependency( + link_with: lib_test_client, + dependencies: [ + dep_test_runner, + dep_pixman, + ] +) + +exe_plugin_test = shared_library( + 'test-plugin', + 'weston-test.c', + weston_test_server_protocol_h, + weston_test_protocol_c, + include_directories: include_directories('..', '../shared'), + dependencies: [ + dep_libweston, + dependency('egl'), + ], + name_prefix: '', + install: false, +) + +deps_zuc = [ dep_libshared ] +if get_option('test-junit-xml') + deps_zuc += [ dependency('libxml-2.0', version: '>= 2.6') ] + config_h.set('ENABLE_JUNIT_XML', '1') +endif + +lib_zuc = static_library( + 'zunitc', + '../tools/zunitc/inc/zunitc/zunitc.h', + '../tools/zunitc/inc/zunitc/zunitc_impl.h', + '../tools/zunitc/src/zuc_base_logger.c', + '../tools/zunitc/src/zuc_base_logger.h', + '../tools/zunitc/src/zuc_collector.c', + '../tools/zunitc/src/zuc_collector.h', + '../tools/zunitc/src/zuc_context.h', + '../tools/zunitc/src/zuc_event.h', + '../tools/zunitc/src/zuc_event_listener.h', + '../tools/zunitc/src/zuc_junit_reporter.c', + '../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'), + dependencies: deps_zuc, +) +dep_zuc = declare_dependency( + link_with: lib_zuc, + dependencies: dep_libshared, + include_directories: include_directories('../tools/zunitc/inc') +) + +lib_zucmain = static_library( + 'zunitcmain', + '../tools/zunitc/src/main.c', + include_directories: include_directories('..', '../shared', '../tools/zunitc/inc'), + dependencies: [ dep_libshared, dep_zuc ], +) +dep_zucmain = declare_dependency( + link_with: lib_zucmain, + dependencies: dep_zuc +) + +tests_standalone = [ + ['config-parser', [], [ dep_zucmain ]], + ['matrix', [ '../shared/matrix.c' ], [ dep_libm ]], + ['string'], + [ + 'vertex-clip', + [ + '../libweston/vertex-clipping.c' + ] + ], + ['timespec', [], [ dep_zucmain ]], + ['zuc', + [ + '../tools/zunitc/test/fixtures_test.c', + '../tools/zunitc/test/zunitc_test.c' + ], + [ dep_zucmain ] + ], +] + +tests_weston = [ + ['bad-buffer'], + ['devices'], + ['event'], + [ + 'keyboard', + [ + 'input-timestamps-helper.c', + input_timestamps_unstable_v1_client_protocol_h, + input_timestamps_unstable_v1_protocol_c, + ] + ], + ['internal-screenshot'], + [ + 'presentation', + [ + presentation_time_client_protocol_h, + presentation_time_protocol_c, + ] + ], + [ + 'pointer', + [ + 'input-timestamps-helper.c', + input_timestamps_unstable_v1_client_protocol_h, + input_timestamps_unstable_v1_protocol_c, + ] + ], + ['roles'], + ['subsurface'], + ['subsurface-shot'], + [ + 'text', + [ + text_input_unstable_v1_client_protocol_h, + text_input_unstable_v1_protocol_c, + ] + ], + [ + 'touch', + [ + 'input-timestamps-helper.c', + input_timestamps_unstable_v1_client_protocol_h, + input_timestamps_unstable_v1_protocol_c, + ] + ], + [ + 'viewporter', + [ + viewporter_client_protocol_h, + viewporter_protocol_c, + ] + ], +] + +if get_option('xwayland') + tests_weston += [ [ 'xwayland', [], dependency('x11') ] ] +endif + +tests_weston_plugin = [ + ['plugin-registry'], + ['surface'], + ['surface-global'], + ['surface-screenshot'], +] + +if get_option('shell-ivi') + tests_weston += [ + [ + 'ivi-shell-app', + [ + ivi_application_client_protocol_h, + ivi_application_protocol_c, + ] + ] + ] + tests_weston_plugin += [ + ['ivi-layout-internal'], + [ + 'ivi-layout', + [ + 'ivi-layout-test-plugin.c', + weston_test_server_protocol_h, + weston_test_protocol_c, + ] + ], + ] + + exe_ivi_layout_client = executable( + 'ivi-layout-test-client', + 'ivi-layout-test-client.c', + weston_test_client_protocol_h, + weston_test_protocol_c, + ivi_application_client_protocol_h, + ivi_application_protocol_c, + include_directories: include_directories('..', '../shared'), + dependencies: dep_test_client, + install: false + ) + + env_modmap += 'ivi-layout-test-client.ivi=@0@;'.format(exe_ivi_layout_client.full_path()) +endif + +env_test_weston = [ + 'WESTON_TEST_REFERENCE_PATH=@0@/reference'.format(meson.current_source_dir()), + 'WESTON_MODULE_MAP=@0@'.format(env_modmap), +] + +# FIXME: the multiple loops is lame. rethink this. +foreach t : tests_standalone + if t[0] != 'zuc' + srcs_t = [ + '@0@-test.c'.format(t.get(0)), + weston_test_client_protocol_h, + ] + else + srcs_t = [] + endif + + if t.length() > 1 + srcs_t += t.get(1) + endif + + if t.length() > 2 + deps_t = t[2] + else + deps_t = [ dep_test_client ] + endif + + exe_t = executable( + 'test-@0@'.format(t.get(0)), + srcs_t, + c_args: [ '-DUNIT_TEST' ], + build_by_default: true, + include_directories: include_directories('..', '../shared', '../libweston'), + dependencies: deps_t, + install: false, + ) + + # matrix-test is a manual test + if t[0] != 'matrix' + test(t.get(0), exe_t) + endif +endforeach + +foreach t : tests_weston + srcs_t = [ + '@0@-test.c'.format(t.get(0)), + weston_test_client_protocol_h, + ] + if t.length() > 1 + srcs_t += t.get(1) + endif + + deps_t = [ + dep_test_client + ] + if t.length() > 2 + deps_t += t.get(2) + endif + + args_t = [ + '--backend=headless-backend.so', + '--socket=test-@0@'.format(t.get(0)), + '--modules=@0@'.format(exe_plugin_test.full_path()), + '--width=320', + '--height=240', + ] + + if t.get(0) == 'xwayland' + args_t += '--xwayland' + endif + + # FIXME: Get this from the array ... ? + if t.get(0) == 'internal-screenshot' + args_t += [ '--config=@0@/internal-screenshot.ini'.format(meson.current_source_dir()) ] + args_t += [ '--use-pixman' ] + args_t += [ '--shell=desktop-shell.so' ] + elif t[0] == 'subsurface-shot' + args_t += [ '--no-config' ] + args_t += [ '--use-pixman' ] + args_t += [ '--width=320' ] + args_t += [ '--height=240' ] + args_t += [ '--shell=weston-test-desktop-shell.so' ] + elif t.get(0).startswith('ivi-') + args_t += [ '--config=@0@/../ivi-shell/weston-ivi-test.ini'.format(meson.current_build_dir()) ] + args_t += [ '--shell=ivi-shell.so' ] + else + args_t += [ '--no-config' ] + args_t += [ '--shell=desktop-shell.so' ] + endif + + exe_t = executable( + 'test-@0@'.format(t.get(0)), + srcs_t, + c_args: [ '-DUNIT_TEST' ], + include_directories: + include_directories('..', '../shared'), + dependencies: deps_t, + install: false, + ) + + env_t = [ + 'WESTON_TEST_CLIENT_PATH=@0@'.format(exe_t.full_path()) + ] + env_t += env_test_weston + + test(t.get(0), exe_weston, env: env_t, args: args_t) +endforeach + +foreach t : tests_weston_plugin + srcs_t = [] + + if t.length() > 1 + srcs_t += t.get(1) + else + srcs_t += '@0@-test.c'.format(t.get(0)) + endif + + deps_t = [ + dep_libweston, + ] + if t.length() > 2 + deps_t += t.get(2) + endif + + exe_t = shared_library( + 'test-@0@'.format(t.get(0)), + srcs_t, + include_directories: include_directories('..', '../shared'), + dependencies: deps_t, + name_prefix: '', + install: false, + ) + + args_t = [ + '--backend=headless-backend.so', + '--socket=test-@0@'.format(t.get(0)), + ] + + # FIXME: Get this from the array ... ? + if t.get(0).startswith('ivi-') + args_t += [ '--config=@0@/../ivi-shell/weston-ivi-test.ini'.format(meson.current_build_dir()) ] + args_t += [ '--modules=@1@,@0@'.format(exe_plugin_test.full_path(),exe_t.full_path()) ] + args_t += [ '--shell=ivi-shell.so' ] + else + args_t += [ '--no-config' ] + args_t += [ '--shell=desktop-shell.so' ] + args_t += [ '--modules=@0@'.format(exe_t.full_path()) ] + endif + + # surface-screenshot is a manual test + if t[0] != 'surface-screenshot' + test(t.get(0), exe_weston, env: env_test_weston, args: args_t) + endif +endforeach diff --git a/wcap/meson.build b/wcap/meson.build new file mode 100644 index 00000000..9a47cdb5 --- /dev/null +++ b/wcap/meson.build @@ -0,0 +1,21 @@ +if not get_option('wcap-decode') + subdir_done() +endif + +srcs_wcap = [ + 'main.c', + 'wcap-decode.c', +] + +deps_wcap = [ + dep_libm, + dependency('cairo'), +] + +executable( + 'wcap-decode', + srcs_wcap, + include_directories: include_directories('..'), + dependencies: deps_wcap, + install: true +) diff --git a/xwayland/meson.build b/xwayland/meson.build new file mode 100644 index 00000000..6a406452 --- /dev/null +++ b/xwayland/meson.build @@ -0,0 +1,31 @@ +if get_option('xwayland') + srcs_xwayland = [ + 'launcher.c', + 'window-manager.c', + 'selection.c', + 'dnd.c', + 'hash.c', + ] + deps_xwayland = [ + dependency('xcb'), + dependency('xcb-composite'), + dependency('xcb-shape'), + dependency('xcb-xfixes'), + dependency('xcursor'), + dependency('cairo-xcb'), + dep_libweston, + ] + plugin_xwayland = shared_library( + 'xwayland', + srcs_xwayland, + link_with: lib_cairo_shared, + include_directories: include_directories('..', '../shared'), + dependencies: deps_xwayland, + name_prefix: '', + install: true, + install_dir: dir_module_libweston + ) + env_modmap += 'xwayland.so=@0@;'.format(plugin_xwayland.full_path()) + + install_headers('xwayland-api.h', subdir: dir_include_libweston) +endif