weston/tests/meson.build
Daniel Stone 8011b0fa03 Add Meson build system
Meson is a build system, currently implemented in Python, with multiple
output backends, including Ninja and Make. The build file syntax is
clean and easy to read unlike autotools. In practise, configuring and
building with Meson and Ninja has been observed to be much faster than
with autotools. Also cross-building support is excellent.

More information at http://mesonbuild.com

Since moving to Meson requires some changes from users in any case, we
took this opportunity to revamp build options. Most of the build options
still exist, some have changed names or more, and a few have been
dropped. The option to choose the Cairo flavour is not implemented since
for the longest time the Cairo image backend has been the only
recommended one.

This Meson build should be fully functional and it installs everything
an all-enabled autotools build does. Installed pkg-config files have
some minor differences that should be insignificant. Building of some
developer documentation that was never installed with autotools is
missing.

It is expected that the autotools build system will be removed soon
after the next Weston release.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-09 14:50:54 +02:00

372 lines
8.1 KiB
Meson

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