meson: convert auto combos into proper features

Allows users to easily enable everything (eg. packagers), or select just
the drivers they want with something like:
    -D auto-features=disabled -D amdgpu=enabled

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Simon Ser <contact@emersion.fr>
main
Eric Engestrom 2022-08-22 17:04:52 +01:00
parent 4a7706b2a4
commit 26eb15165b
3 changed files with 36 additions and 66 deletions

View File

@ -191,22 +191,10 @@ x86_64-freebsd-container_prep:
GIT_DEPTH: 10
script:
- meson build
-D amdgpu=true
--auto-features=enabled
-D cairo-tests=true
-D etnaviv=true
-D exynos=true
-D freedreno=true
-D freedreno-kgsl=true
-D intel=true
-D man-pages=true
-D nouveau=true
-D omap=true
-D radeon=true
-D tegra=true
-D udev=true
-D valgrind=auto
-D vc4=true
-D vmwgfx=true
- ninja -C build
- ninja -C build test
- DESTDIR=$PWD/install ninja -C build install
@ -227,7 +215,7 @@ x86_64-freebsd-container_prep:
# the workspace to see details about the failed tests.
- |
set +e
/app/vmctl exec "pkg info; cd $CI_PROJECT_NAME ; meson build -D amdgpu=true -D cairo-tests=true -D intel=true -D man-pages=true -D nouveau=false -D radeon=true -D valgrind=auto && ninja -C build"
/app/vmctl exec "pkg info; cd $CI_PROJECT_NAME ; meson build --auto-features=enabled -D nouveau=disabled -D cairo-tests=true -D man-pages=true -D valgrind=false && ninja -C build"
set -ex
scp -r vm:$CI_PROJECT_NAME/build/meson-logs .
/app/vmctl exec "ninja -C $CI_PROJECT_NAME/build install"

View File

@ -85,19 +85,19 @@ config.set10('HAVE_LIB_ATOMIC_OPS', lib_atomics)
with_intel = false
_intel = get_option('intel')
if _intel != 'false'
if _intel == 'true' and not with_atomics
if not _intel.disabled()
if _intel.enabled() and not with_atomics
error('libdrm_intel requires atomics.')
else
with_intel = (_intel == 'true' or host_machine.cpu_family().startswith('x86')) and with_atomics
with_intel = (_intel.enabled() or host_machine.cpu_family().startswith('x86')) and with_atomics
endif
endif
summary('Intel', with_intel)
with_radeon = false
_radeon = get_option('radeon')
if _radeon != 'false'
if _radeon == 'true' and not with_atomics
if not _radeon.disabled()
if _radeon.enabled() and not with_atomics
error('libdrm_radeon requires atomics.')
endif
with_radeon = with_atomics
@ -106,8 +106,8 @@ summary('Radeon', with_radeon)
with_amdgpu = false
_amdgpu = get_option('amdgpu')
if _amdgpu != 'false'
if _amdgpu == 'true' and not with_atomics
if not _amdgpu.disabled()
if _amdgpu.enabled() and not with_atomics
error('libdrm_amdgpu requires atomics.')
endif
with_amdgpu = with_atomics
@ -116,8 +116,8 @@ summary('AMDGPU', with_amdgpu)
with_nouveau = false
_nouveau = get_option('nouveau')
if _nouveau != 'false'
if _nouveau == 'true' and not with_atomics
if not _nouveau.disabled()
if _nouveau.enabled() and not with_atomics
error('libdrm_nouveau requires atomics.')
endif
with_nouveau = with_atomics
@ -126,14 +126,14 @@ summary('Nouveau', with_nouveau)
with_vmwgfx = false
_vmwgfx = get_option('vmwgfx')
if _vmwgfx != 'false'
if not _vmwgfx.disabled()
with_vmwgfx = true
endif
summary('vmwgfx', with_vmwgfx)
with_omap = false
_omap = get_option('omap')
if _omap == 'true'
if _omap.enabled()
if not with_atomics
error('libdrm_omap requires atomics.')
endif
@ -143,11 +143,11 @@ summary('OMAP', with_omap)
with_freedreno = false
_freedreno = get_option('freedreno')
if _freedreno != 'false'
if _freedreno == 'true' and not with_atomics
if not _freedreno.disabled()
if _freedreno.enabled() and not with_atomics
error('libdrm_freedreno requires atomics.')
else
with_freedreno = (_freedreno == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())) and with_atomics
with_freedreno = (_freedreno.enabled() or ['arm', 'aarch64'].contains(host_machine.cpu_family())) and with_atomics
endif
endif
summary('Freedreno', with_freedreno)
@ -155,7 +155,7 @@ summary('Freedreon-kgsl', with_freedreno_kgsl)
with_tegra = false
_tegra = get_option('tegra')
if _tegra == 'true'
if _tegra.enabled()
if not with_atomics
error('libdrm_tegra requires atomics.')
endif
@ -165,7 +165,7 @@ summary('Tegra', with_tegra)
with_etnaviv = false
_etnaviv = get_option('etnaviv')
if _etnaviv == 'true'
if _etnaviv.enabled()
if not with_atomics
error('libdrm_etnaviv requires atomics.')
endif
@ -173,13 +173,13 @@ if _etnaviv == 'true'
endif
summary('Etnaviv', with_etnaviv)
with_exynos = get_option('exynos') == 'true'
with_exynos = get_option('exynos').enabled()
summary('EXYNOS', with_exynos)
with_vc4 = false
_vc4 = get_option('vc4')
if _vc4 != 'false'
with_vc4 = _vc4 == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
if not _vc4.disabled()
with_vc4 = _vc4.enabled() or ['arm', 'aarch64'].contains(host_machine.cpu_family())
endif
summary('VC4', with_vc4)

View File

@ -20,79 +20,61 @@
option(
'intel',
type : 'combo',
value : 'auto',
choices : ['true', 'false', 'auto'],
type : 'feature',
description : '''Enable support for Intel's KMS API.''',
)
option(
'radeon',
type : 'combo',
value : 'auto',
choices : ['true', 'false', 'auto'],
type : 'feature',
description : '''Enable support for radeons's KMS API.''',
)
option(
'amdgpu',
type : 'combo',
value : 'auto',
choices : ['true', 'false', 'auto'],
type : 'feature',
description : '''Enable support for amdgpu's KMS API.''',
)
option(
'nouveau',
type : 'combo',
value : 'auto',
choices : ['true', 'false', 'auto'],
type : 'feature',
description : '''Enable support for nouveau's KMS API.''',
)
option(
'vmwgfx',
type : 'combo',
value : 'true',
choices : ['true', 'false', 'auto'],
type : 'feature',
description : '''Enable support for vmgfx's KMS API.''',
)
option(
'omap',
type : 'combo',
value : 'false',
choices : ['true', 'false', 'auto'],
type : 'feature',
value : 'disabled',
description : '''Enable support for OMAP's experimental KMS API.''',
)
option(
'exynos',
type : 'combo',
value : 'false',
choices : ['true', 'false', 'auto'],
type : 'feature',
value : 'disabled',
description : '''Enable support for EXYNOS's experimental KMS API.''',
)
option(
'freedreno',
type : 'combo',
value : 'auto',
choices : ['true', 'false', 'auto'],
type : 'feature',
description : '''Enable support for freedreno's KMS API.''',
)
option(
'tegra',
type : 'combo',
value : 'false',
choices : ['true', 'false', 'auto'],
type : 'feature',
value : 'disabled',
description : '''Enable support for Tegra's experimental KMS API.''',
)
option(
'vc4',
type : 'combo',
value : 'auto',
choices : ['true', 'false', 'auto'],
type : 'feature',
description : '''Enable support for vc4's KMS API.''',
)
option(
'etnaviv',
type : 'combo',
value : 'false',
choices : ['true', 'false', 'auto'],
type : 'feature',
value : 'disabled',
description : '''Enable support for etnaviv's experimental KMS API.''',
)
option(