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 GIT_DEPTH: 10
script: script:
- meson build - meson build
-D amdgpu=true --auto-features=enabled
-D cairo-tests=true -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 man-pages=true
-D nouveau=true
-D omap=true
-D radeon=true
-D tegra=true
-D udev=true -D udev=true
-D valgrind=auto
-D vc4=true
-D vmwgfx=true
- ninja -C build - ninja -C build
- ninja -C build test - ninja -C build test
- DESTDIR=$PWD/install ninja -C build install - 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. # the workspace to see details about the failed tests.
- | - |
set +e 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 set -ex
scp -r vm:$CI_PROJECT_NAME/build/meson-logs . scp -r vm:$CI_PROJECT_NAME/build/meson-logs .
/app/vmctl exec "ninja -C $CI_PROJECT_NAME/build install" /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 with_intel = false
_intel = get_option('intel') _intel = get_option('intel')
if _intel != 'false' if not _intel.disabled()
if _intel == 'true' and not with_atomics if _intel.enabled() and not with_atomics
error('libdrm_intel requires atomics.') error('libdrm_intel requires atomics.')
else 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
endif endif
summary('Intel', with_intel) summary('Intel', with_intel)
with_radeon = false with_radeon = false
_radeon = get_option('radeon') _radeon = get_option('radeon')
if _radeon != 'false' if not _radeon.disabled()
if _radeon == 'true' and not with_atomics if _radeon.enabled() and not with_atomics
error('libdrm_radeon requires atomics.') error('libdrm_radeon requires atomics.')
endif endif
with_radeon = with_atomics with_radeon = with_atomics
@ -106,8 +106,8 @@ summary('Radeon', with_radeon)
with_amdgpu = false with_amdgpu = false
_amdgpu = get_option('amdgpu') _amdgpu = get_option('amdgpu')
if _amdgpu != 'false' if not _amdgpu.disabled()
if _amdgpu == 'true' and not with_atomics if _amdgpu.enabled() and not with_atomics
error('libdrm_amdgpu requires atomics.') error('libdrm_amdgpu requires atomics.')
endif endif
with_amdgpu = with_atomics with_amdgpu = with_atomics
@ -116,8 +116,8 @@ summary('AMDGPU', with_amdgpu)
with_nouveau = false with_nouveau = false
_nouveau = get_option('nouveau') _nouveau = get_option('nouveau')
if _nouveau != 'false' if not _nouveau.disabled()
if _nouveau == 'true' and not with_atomics if _nouveau.enabled() and not with_atomics
error('libdrm_nouveau requires atomics.') error('libdrm_nouveau requires atomics.')
endif endif
with_nouveau = with_atomics with_nouveau = with_atomics
@ -126,14 +126,14 @@ summary('Nouveau', with_nouveau)
with_vmwgfx = false with_vmwgfx = false
_vmwgfx = get_option('vmwgfx') _vmwgfx = get_option('vmwgfx')
if _vmwgfx != 'false' if not _vmwgfx.disabled()
with_vmwgfx = true with_vmwgfx = true
endif endif
summary('vmwgfx', with_vmwgfx) summary('vmwgfx', with_vmwgfx)
with_omap = false with_omap = false
_omap = get_option('omap') _omap = get_option('omap')
if _omap == 'true' if _omap.enabled()
if not with_atomics if not with_atomics
error('libdrm_omap requires atomics.') error('libdrm_omap requires atomics.')
endif endif
@ -143,11 +143,11 @@ summary('OMAP', with_omap)
with_freedreno = false with_freedreno = false
_freedreno = get_option('freedreno') _freedreno = get_option('freedreno')
if _freedreno != 'false' if not _freedreno.disabled()
if _freedreno == 'true' and not with_atomics if _freedreno.enabled() and not with_atomics
error('libdrm_freedreno requires atomics.') error('libdrm_freedreno requires atomics.')
else 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
endif endif
summary('Freedreno', with_freedreno) summary('Freedreno', with_freedreno)
@ -155,7 +155,7 @@ summary('Freedreon-kgsl', with_freedreno_kgsl)
with_tegra = false with_tegra = false
_tegra = get_option('tegra') _tegra = get_option('tegra')
if _tegra == 'true' if _tegra.enabled()
if not with_atomics if not with_atomics
error('libdrm_tegra requires atomics.') error('libdrm_tegra requires atomics.')
endif endif
@ -165,7 +165,7 @@ summary('Tegra', with_tegra)
with_etnaviv = false with_etnaviv = false
_etnaviv = get_option('etnaviv') _etnaviv = get_option('etnaviv')
if _etnaviv == 'true' if _etnaviv.enabled()
if not with_atomics if not with_atomics
error('libdrm_etnaviv requires atomics.') error('libdrm_etnaviv requires atomics.')
endif endif
@ -173,13 +173,13 @@ if _etnaviv == 'true'
endif endif
summary('Etnaviv', with_etnaviv) summary('Etnaviv', with_etnaviv)
with_exynos = get_option('exynos') == 'true' with_exynos = get_option('exynos').enabled()
summary('EXYNOS', with_exynos) summary('EXYNOS', with_exynos)
with_vc4 = false with_vc4 = false
_vc4 = get_option('vc4') _vc4 = get_option('vc4')
if _vc4 != 'false' if not _vc4.disabled()
with_vc4 = _vc4 == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family()) with_vc4 = _vc4.enabled() or ['arm', 'aarch64'].contains(host_machine.cpu_family())
endif endif
summary('VC4', with_vc4) summary('VC4', with_vc4)

View File

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