X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=meson.build;h=bc5996992a3aee1a5520cbb9cf3248d14ad63b6f;hb=5092610f29b9e10d3835af8b4ed1ca13809657b5;hp=f3179c38062979fe0053c3438b49af7fefd5e384;hpb=3c35dad1dfd108db082a46ee45da6633e244eb92;p=mesa.git diff --git a/meson.build b/meson.build index f3179c38062..bc5996992a3 100644 --- a/meson.build +++ b/meson.build @@ -202,18 +202,20 @@ if with_dri_i915 or with_gallium_i915 dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75') endif +system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'dragonfly', 'linux'].contains(host_machine.system()) + if host_machine.system() == 'darwin' with_dri_platform = 'apple' elif ['windows', 'cygwin'].contains(host_machine.system()) with_dri_platform = 'windows' -elif host_machine.system() == 'linux' - # FIXME: This should include BSD and possibly other systems +elif system_has_kms_drm with_dri_platform = 'drm' else # FIXME: haiku doesn't use dri, and xlib doesn't use dri, probably should # assert here that one of those cases has been met. # FIXME: GNU (hurd) ends up here as well, but meson doesn't officially # support Hurd at time of writing (2017/11) + # FIXME: illumos ends up here as well with_dri_platform = 'none' endif @@ -225,7 +227,7 @@ with_platform_surfaceless = false egl_native_platform = '' _platforms = get_option('platforms') if _platforms == 'auto' - if ['linux'].contains(host_machine.system()) + if system_has_kms_drm _platforms = 'x11,wayland,drm,surfaceless' else error('Unknown OS, no platforms enabled. Patches gladly accepted to fix this.') @@ -272,10 +274,10 @@ endif with_gbm = get_option('gbm') if with_gbm == 'auto' and with_dri # TODO: or gallium - with_gbm = host_machine.system() == 'linux' + with_gbm = system_has_kms_drm elif with_gbm == 'true' - if not ['linux', 'bsd'].contains(host_machine.system()) - error('GBM only supports unix-like platforms') + if not system_has_kms_drm + error('GBM only supports DRM/KMS platforms') endif with_gbm = true else @@ -351,15 +353,9 @@ endif with_dri2 = (with_dri or with_any_vk) and with_dri_platform == 'drm' with_dri3 = get_option('dri3') if with_dri3 == 'auto' - if host_machine.system() == 'linux' and with_dri2 - with_dri3 = true - else - with_dri3 = false - endif -elif with_dri3 == 'true' - with_dri3 = true + with_dri3 = system_has_kms_drm and with_dri2 else - with_dri3 = false + with_dri3 = with_dri3 == 'true' endif if with_any_vk and (with_platform_x11 and not with_dri3) @@ -371,10 +367,12 @@ if with_dri or with_gallium endif endif +prog_pkgconfig = find_program('pkg-config') + dep_vdpau = [] _vdpau = get_option('gallium-vdpau') if _vdpau == 'auto' - if not ['linux', 'bsd'].contains(host_machine.system()) + if not system_has_kms_drm with_gallium_vdpau = false elif not with_platform_x11 with_gallium_vdpau = false @@ -386,8 +384,8 @@ if _vdpau == 'auto' with_gallium_vdpau = dep_vdpau.found() endif elif _vdpau == 'true' - if not ['linux', 'bsd'].contains(host_machine.system()) - error('VDPAU state tracker can only be build on unix-like OSes.') + if not system_has_kms_drm + error('VDPAU state tracker can only be build on DRM/KMS OSes.') elif not with_platform_x11 error('VDPAU state tracker requires X11 support.') with_gallium_vdpau = false @@ -402,7 +400,7 @@ else endif if with_gallium_vdpau dep_vdpau = declare_dependency( - compile_args : dep_vdpau.get_pkgconfig_variable('cflags').split() + compile_args : run_command(prog_pkgconfig, ['vdpau', '--cflags']).stdout().split() ) endif @@ -417,7 +415,7 @@ endif dep_xvmc = [] _xvmc = get_option('gallium-xvmc') if _xvmc == 'auto' - if not ['linux', 'bsd'].contains(host_machine.system()) + if not system_has_kms_drm with_gallium_xvmc = false elif not with_platform_x11 with_gallium_xvmc = false @@ -428,8 +426,8 @@ if _xvmc == 'auto' with_gallium_xvmc = dep_xvmc.found() endif elif _xvmc == 'true' - if not ['linux', 'bsd'].contains(host_machine.system()) - error('XVMC state tracker can only be build on unix-like OSes.') + if not system_has_kms_drm + error('XVMC state tracker can only be build on DRM/KMS OSes.') elif not with_platform_x11 error('XVMC state tracker requires X11 support.') with_gallium_xvmc = false @@ -443,7 +441,7 @@ else endif if with_gallium_xvmc dep_xvmc = declare_dependency( - compile_args : dep_xvmc.get_pkgconfig_variable('cflags').split() + compile_args : run_command(prog_pkgconfig, ['xvmc', '--cflags']).stdout().split() ) endif @@ -455,7 +453,7 @@ endif dep_omx = [] _omx = get_option('gallium-omx') if _omx == 'auto' - if not ['linux', 'bsd'].contains(host_machine.system()) + if not system_has_kms_drm with_gallium_omx = false elif not with_platform_x11 with_gallium_omx = false @@ -466,8 +464,8 @@ if _omx == 'auto' with_gallium_omx = dep_omx.found() endif elif _omx == 'true' - if not ['linux', 'bsd'].contains(host_machine.system()) - error('OMX state tracker can only be built on unix-like OSes.') + if not system_has_kms_drm + error('OMX state tracker can only be built on DRM/KMS OSes.') elif not (with_platform_x11 or with_platform_drm) error('OMX state tracker requires X11 or drm platform support.') with_gallium_omx = false @@ -506,14 +504,14 @@ if with_gallium_omx endif if with_gallium_omx dep_omx = declare_dependency( - compile_args : dep_omx.get_pkgconfig_variable('cflags').split() + compile_args : run_command(prog_pkgconfig, ['libomxil-bellagio', '--cflags']).stdout().split() ) endif dep_va = [] _va = get_option('gallium-va') if _va == 'auto' - if not ['linux', 'bsd'].contains(host_machine.system()) + if not system_has_kms_drm with_gallium_va = false elif not with_platform_x11 with_gallium_va = false @@ -524,8 +522,8 @@ if _va == 'auto' with_gallium_va = dep_va.found() endif elif _va == 'true' - if not ['linux', 'bsd'].contains(host_machine.system()) - error('VA state tracker can only be built on unix-like OSes.') + if not system_has_kms_drm + error('VA state tracker can only be built on DRM/KMS OSes.') elif not (with_platform_x11 or with_platform_drm) error('VA state tracker requires X11 or drm or wayland platform support.') with_gallium_va = false @@ -539,7 +537,7 @@ else endif if with_gallium_va dep_va = declare_dependency( - compile_args : dep_va.get_pkgconfig_variable('cflags').split() + compile_args : run_command(prog_pkgconfig, ['libva', '--cflags']).stdout().split() ) endif @@ -550,7 +548,7 @@ endif _xa = get_option('gallium-xa') if _xa == 'auto' - if not ['linux', 'bsd'].contains(host_machine.system()) + if not system_has_kms_drm with_gallium_xa = false elif not (with_gallium_nouveau or with_gallium_freedreno or with_gallium_i915 or with_gallium_svga) @@ -559,8 +557,8 @@ if _xa == 'auto' with_gallium_xa = true endif elif _xa == 'true' - if not ['linux', 'bsd'].contains(host_machine.system()) - error('XA state tracker can only be built on unix-like OSes.') + if not system_has_kms_drm + error('XA state tracker can only be built on DRM/KMS OSes.') elif not (with_gallium_nouveau or with_gallium_freedreno or with_gallium_i915 or with_gallium_svga) error('XA state tracker requires at least one of the following gallium drivers: nouveau, freedreno, i915, svga.') @@ -692,14 +690,14 @@ if cc.compiles('struct __attribute__((packed)) foo { int bar; };', endif if cc.compiles('int *foo(void) __attribute__((returns_nonnull));', name : '__attribute__((returns_nonnull))') - pre_args += '-DHAVE_FUNC_ATTRIBUTE_NONNULL' + pre_args += '-DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL' endif if cc.compiles('''int foo_def(void) __attribute__((visibility("default"))); int foo_hid(void) __attribute__((visibility("hidden"))); int foo_int(void) __attribute__((visibility("internal"))); int foo_pro(void) __attribute__((visibility("protected")));''', name : '__attribute__((visibility(...)))') - pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISBILITY' + pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISIBILITY' endif if cc.compiles('int foo(void) { return 0; } int bar(void) __attribute__((alias("foo")));', name : '__attribute__((alias(...)))') @@ -772,7 +770,7 @@ foreach a : ['-Werror=pointer-arith', '-Werror=vla'] endforeach if host_machine.cpu_family().startswith('x86') - pre_args += '-DHAVE_SSE41' + pre_args += '-DUSE_SSE41' with_sse41 = true sse41_args = ['-msse4.1'] @@ -820,23 +818,23 @@ with_asm_arch = '' if with_asm # TODO: SPARC and PPC if host_machine.cpu_family() == 'x86' - if ['linux', 'bsd'].contains(host_machine.system()) # FIXME: hurd? + if system_has_kms_drm with_asm_arch = 'x86' pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM', '-DUSE_SSE_ASM'] endif elif host_machine.cpu_family() == 'x86_64' - if host_machine.system() == 'linux' + if system_has_kms_drm with_asm_arch = 'x86_64' pre_args += ['-DUSE_X86_64_ASM'] endif elif host_machine.cpu_family() == 'arm' - if host_machine.system() == 'linux' + if system_has_kms_drm with_asm_arch = 'arm' pre_args += ['-DUSE_ARM_ASM'] endif elif host_machine.cpu_family() == 'aarch64' - if host_machine.system() == 'linux' + if system_has_kms_drm with_asm_arch = 'aarch64' pre_args += ['-DUSE_AARCH64_ASM'] endif @@ -1018,14 +1016,18 @@ else endif if with_llvm _llvm_version = dep_llvm.version().split('.') - # Development versions of LLVM have an 'svn' suffix, we don't want that for - # our version checks. + # Development versions of LLVM have an 'svn' or 'git' suffix, we don't want + # that for our version checks. + # svn suffixes are stripped by meson as of 0.43, and git suffixes are + # strippped as of 0.44, but we support older meson versions. _llvm_patch = _llvm_version[2] if _llvm_patch.endswith('svn') _llvm_patch = _llvm_patch.split('s')[0] + elif _llvm_patch.contains('git') + _llvm_patch = _llvm_patch.split('g')[0] endif pre_args += [ - '-DHAVE_LLVM=0x0@0@@1@@2@'.format(_llvm_version[0], _llvm_version[1], _llvm_patch), + '-DHAVE_LLVM=0x0@0@0@1@'.format(_llvm_version[0], _llvm_version[1]), '-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch), ] elif with_amd_vk or with_gallium_radeonsi or with_gallium_swr