with_gallium_i915 = false
with_gallium_svga = false
with_gallium_virgl = false
+with_gallium_swr = false
_drivers = get_option('gallium-drivers')
if _drivers == 'auto'
if not ['darwin', 'windows'].contains(host_machine.system())
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
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.')
elif with_gallium
# Even when building just gallium drivers the user probably wants dri
with_glx = 'dri'
- with_dri = true
elif with_platform_x11 and with_any_opengl and not with_any_vk
# The automatic behavior should not be to turn on xlib based glx when
# building only vulkan drivers
with_glx = 'disabled'
endif
endif
+if with_glx == 'dri'
+ if with_gallium
+ with_dri = true
+ endif
+endif
if not (with_dri or with_gallium or with_glx == 'xlib' or with_glx == 'gallium-xlib')
with_gles1 = false
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
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)
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
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
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
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
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
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
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
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
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
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
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
_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)
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.')
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(...)))')
endforeach
if host_machine.cpu_family().startswith('x86')
- pre_args += '-DHAVE_SSE41'
+ pre_args += '-DUSE_SSE41'
with_sse41 = true
sse41_args = ['-msse4.1']
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
# TODO: some of these may be conditional
dep_zlib = dependency('zlib', version : '>= 1.2.3')
+pre_args += '-DHAVE_ZLIB'
dep_thread = dependency('threads')
if dep_thread.found() and host_machine.system() != 'windows'
pre_args += '-DHAVE_PTHREAD'
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