1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
project('switcheroo-control', 'c',
version : '3.0',
license: 'GPLv3+',
default_options : [
'buildtype=debugoptimized',
'warning_level=1',
'c_std=c99',
],
meson_version : '>= 0.52.0',
)
cc = meson.get_compiler('c')
prefix = get_option('prefix')
libexecdir = prefix / get_option('libexecdir')
datadir = get_option('datadir')
gnome = import('gnome')
glib = dependency('glib-2.0', version: '>= 2.56.0')
gio = dependency('gio-2.0', version: '>= 2.56.0')
gudev = dependency('gudev-1.0', version: '>= 232')
libdrm = dependency('libdrm', version: '>= 2.4.97', required: get_option('libdrm'))
libdrm_nouveau = dependency('libdrm_nouveau', version: '>= 2.4.97', required: get_option('libdrm_nouveau'))
libdrm_amdgpu = dependency('libdrm_amdgpu', version: '>= 2.4.97', required: get_option('libdrm_amdgpu'))
drm_xe = cc.has_header('drm/xe_drm.h', include_directories: include_directories(libdrm.get_pkgconfig_variable('includedir')), dependencies: [libdrm], required: get_option('drm_xe'))
systemd_systemunitdir = get_option('systemdsystemunitdir')
if systemd_systemunitdir == ''
systemd_systemunitdir = dependency('systemd').get_pkgconfig_variable('systemdsystemunitdir')
endif
hwdb_dir = get_option('hwdbdir')
if hwdb_dir == ''
udevdir = dependency('udev').get_pkgconfig_variable('udevdir')
hwdb_dir = udevdir / 'hwdb.d'
endif
rules_dir = get_option('rulesdir')
if rules_dir == ''
udevdir = dependency('udev').get_pkgconfig_variable('udevdir')
rules_dir = udevdir / 'rules.d'
endif
# Make like license available in the build root for docs
configure_file(
input: 'COPYING',
output: 'COPYING',
copy: true,
)
subdir('data')
subdir('src')
if get_option('gtk_doc')
subdir('docs')
endif
if get_option('tests')
# Python 3 required modules
python3_required_modules = ['dbus', 'dbusmock', 'gi']
python = import('python')
python3 = python.find_installation('python3')
foreach p : python3_required_modules
# Source: https://docs.python.org/3/library/importlib.html#checking-if-a-module-can-be-imported
script = 'import importlib.util; import sys; exit(1) if importlib.util.find_spec(\''+ p +'\') is None else exit(0)'
if run_command(python3, '-c', script, check: false).returncode() != 0
error('Python3 module \'' + p + '\' required for running tests but not found')
endif
endforeach
subdir('tests')
endif
|