X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=meson.build;h=e05645cbf39b670a57686642335cfbd767b7c243;hb=322fa3e5be5cd08ce752075f4fbff15019b8d6c7;hp=636d0f913ac6d2dc9ecb598842093fcfe2b91d40;hpb=a5abb2da74d3a892427499961aaef194d9ce1edf;p=mesa.git diff --git a/meson.build b/meson.build index 636d0f913ac..e05645cbf39 100644 --- a/meson.build +++ b/meson.build @@ -29,6 +29,9 @@ project( default_options : ['buildtype=debugoptimized', 'c_std=c99', 'cpp_std=c++11'] ) +cc = meson.get_compiler('c') +cpp = meson.get_compiler('cpp') + null_dep = dependency('', required : false) system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'dragonfly', 'linux'].contains(host_machine.system()) @@ -55,11 +58,7 @@ with_osmesa = get_option('osmesa') with_swr_arches = get_option('swr-arches') with_tools = get_option('tools') if with_tools.contains('all') - with_tools = ['freedreno', 'glsl', 'intel', 'nir', 'nouveau'] -endif -if get_option('texture-float') - pre_args += '-DTEXTURE_FLOAT_ENABLED' - warning('Floating-point texture enabled. Please consult docs/patents.txt and your lawyer before building mesa.') + with_tools = ['freedreno', 'glsl', 'intel', 'nir', 'nouveau', 'xvmc'] endif dri_drivers_path = get_option('dri-drivers-path') @@ -248,6 +247,13 @@ if _platforms.length() != 0 and _platforms != [''] egl_native_platform = _platforms[0] endif +_xlib_lease = get_option('xlib-lease') +if _xlib_lease == 'auto' + with_xlib_lease = with_platform_x11 and with_platform_drm +else + with_xlib_lease = _xlib_lease == 'true' +endif + with_glx = get_option('glx') if with_glx == 'auto' if with_dri @@ -257,7 +263,6 @@ if with_glx == 'auto' 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 @@ -266,6 +271,11 @@ if with_glx == 'auto' 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 @@ -392,16 +402,17 @@ elif not (with_gallium_r300 or with_gallium_r600 or with_gallium_radeonsi or else _vdpau = 'false' endif -elif _vdpau == 'auto' - _vdpau = 'true' endif -with_gallium_vdpau = _vdpau == 'true' dep_vdpau = null_dep -if with_gallium_vdpau - dep_vdpau = dependency('vdpau', version : '>= 1.1') - dep_vdpau = declare_dependency( - compile_args : run_command(prog_pkgconfig, ['vdpau', '--cflags']).stdout().split() - ) +with_gallium_vdpau = false +if _vdpau != 'false' + dep_vdpau = dependency('vdpau', version : '>= 1.1', required : _vdpau == 'true') + if dep_vdpau.found() + dep_vdpau = declare_dependency( + compile_args : run_command(prog_pkgconfig, ['vdpau', '--cflags']).stdout().split() + ) + with_gallium_vdpau = true + endif endif if with_gallium_vdpau @@ -431,13 +442,12 @@ elif not (with_gallium_r600 or with_gallium_nouveau) else _xvmc = 'false' endif -elif _xvmc == 'auto' - _xvmc = 'true' endif -with_gallium_xvmc = _xvmc == 'true' dep_xvmc = null_dep -if with_gallium_xvmc - dep_xvmc = dependency('xvmc', version : '>= 1.0.6') +with_gallium_xvmc = false +if _xvmc != 'false' + dep_xvmc = dependency('xvmc', version : '>= 1.0.6', required : _xvmc == 'true') + with_gallium_xvmc = dep_xvmc.found() endif xvmc_drivers_path = get_option('xvmc-libs-path') @@ -553,13 +563,16 @@ elif not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau) elif _va == 'auto' _va = 'true' endif -with_gallium_va = _va == 'true' +with_gallium_va = false dep_va = null_dep -if with_gallium_va - dep_va = dependency('libva', version : '>= 0.39.0') - dep_va_headers = declare_dependency( - compile_args : run_command(prog_pkgconfig, ['libva', '--cflags']).stdout().split() - ) +if _va != 'false' + dep_va = dependency('libva', version : '>= 0.38.0', required : _va == 'true') + if dep_va.found() + dep_va_headers = declare_dependency( + compile_args : run_command(prog_pkgconfig, ['libva', '--cflags']).stdout().split() + ) + with_gallium_va = true + endif endif va_drivers_path = get_option('va-libs-path') @@ -602,13 +615,34 @@ if with_gallium_st_nine endif endif +if get_option('power8') != 'false' + if host_machine.cpu_family() == 'ppc64le' + if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.8') + error('Altivec is not supported with gcc version < 4.8.') + endif + if cc.compiles(''' + #include + int main() { + vector unsigned char r; + vector unsigned int v = vec_splat_u32 (1); + r = __builtin_vec_vgbbd ((vector unsigned char) v); + return 0; + }''', + args : '-mpower8-vector', + name : 'POWER8 intrinsics') + pre_args += ['-D_ARCH_PWR8', '-mpower8-vector'] + elif get_option('power8') == 'true' + error('POWER8 intrinsic support required but not found.') + endif + endif +endif + _opencl = get_option('gallium-opencl') if _opencl != 'disabled' if not with_gallium error('OpenCL Clover implementation requires at least one gallium driver.') endif - # TODO: alitvec? dep_clc = dependency('libclc') with_gallium_opencl = true with_opencl_icd = _opencl == 'icd' @@ -669,7 +703,6 @@ if has_mako.returncode() != 0 error('Python (2.x) mako module required to build mesa.') endif -cc = meson.get_compiler('c') if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.4.6') error('When using GCC, version 4.4.6 or later is required.') endif @@ -743,13 +776,16 @@ foreach a : ['-Wall', '-Werror=implicit-function-declaration', c_args += a endif endforeach +if cc.has_argument('-Wmissing-field-initializers') + c_args += '-Wno-missing-field-initializers' +endif + c_vis_args = [] if cc.has_argument('-fvisibility=hidden') c_vis_args += '-fvisibility=hidden' endif # Check for generic C++ arguments -cpp = meson.get_compiler('cpp') cpp_args = [] foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math', '-Qunused-arguments'] @@ -760,9 +796,12 @@ endforeach # For some reason, the test for -Wno-foo always succeeds with gcc, even if the # option is not supported. Hence, check for -Wfoo instead. -if cpp.has_argument('-Wnon-virtual-dtor') - cpp_args += '-Wno-non-virtual-dtor' -endif + +foreach a : ['non-virtual-dtor', 'missing-field-initializers'] + if cpp.has_argument('-W' + a) + cpp_args += '-Wno-' + a + endif +endforeach no_override_init_args = [] foreach a : ['override-init', 'initializer-overrides'] @@ -808,7 +847,15 @@ endif # Check for GCC style atomics dep_atomic = null_dep -if cc.compiles('int main() { int n; return __atomic_load_n(&n, __ATOMIC_ACQUIRE); }', +if cc.compiles('''#include + int main() { + struct { + uint64_t *v; + } x; + return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) & + (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL); + + }''', name : 'GCC atomic builtins') pre_args += '-DUSE_GCC_ATOMIC_BUILTINS' @@ -823,7 +870,8 @@ if cc.compiles('int main() { int n; return __atomic_load_n(&n, __ATOMIC_ACQUIRE) struct { uint64_t *v; } x; - return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE); + return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) & + (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL); }''', name : 'GCC atomic builtins required -latomic') dep_atomic = cc.find_library('atomic') @@ -838,8 +886,6 @@ if not cc.links('''#include pre_args += '-DMISSING_64_BIT_ATOMICS' endif -# TODO: endian -# TODO: powr8 # TODO: shared/static? Is this even worth doing? # When cross compiling we generally need to turn off the use of assembly, @@ -869,7 +915,6 @@ endif with_asm_arch = '' if with_asm - # TODO: SPARC and PPC if host_machine.cpu_family() == 'x86' if system_has_kms_drm with_asm_arch = 'x86' @@ -895,6 +940,16 @@ if with_asm with_asm_arch = 'aarch64' pre_args += ['-DUSE_AARCH64_ASM'] endif + elif host_machine.cpu_family() == 'sparc64' + if system_has_kms_drm + with_asm_arch = 'sparc' + pre_args += ['-DUSE_SPARC_ASM'] + endif + elif host_machine.cpu_family() == 'ppc64le' + if system_has_kms_drm + with_asm_arch = 'ppc64le' + pre_args += ['-DUSE_PPC64LE_ASM'] + endif endif endif @@ -1081,6 +1136,7 @@ if dep_libdrm.found() endif llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit'] +llvm_optional_modules = [] if with_amd_vk or with_gallium_radeonsi or with_gallium_r600 llvm_modules += ['amdgpu', 'bitreader', 'ipo'] if with_gallium_r600 @@ -1092,13 +1148,11 @@ if with_gallium_opencl 'all-targets', 'linker', 'coverage', 'instrumentation', 'ipo', 'irreader', 'lto', 'option', 'objcarcopts', 'profiledata', ] - # TODO: optional modules + llvm_optional_modules += ['coroutines', 'opencl'] endif -if with_amd_vk or with_gallium_radeonsi +if with_amd_vk or with_gallium_radeonsi or with_gallium_swr _llvm_version = '>= 5.0.0' -elif with_gallium_swr - _llvm_version = '>= 4.0.0' elif with_gallium_opencl or with_gallium_r600 _llvm_version = '>= 3.9.0' else @@ -1108,12 +1162,20 @@ endif _llvm = get_option('llvm') if _llvm == 'auto' dep_llvm = dependency( - 'llvm', version : _llvm_version, modules : llvm_modules, + 'llvm', + version : _llvm_version, + modules : llvm_modules, + optional_modules : llvm_optional_modules, required : with_amd_vk or with_gallium_radeonsi or with_gallium_swr or with_gallium_opencl, ) with_llvm = dep_llvm.found() elif _llvm == 'true' - dep_llvm = dependency('llvm', version : _llvm_version, modules : llvm_modules) + dep_llvm = dependency( + 'llvm', + version : _llvm_version, + modules : llvm_modules, + optional_modules : llvm_optional_modules, + ) with_llvm = true else dep_llvm = null_dep @@ -1179,8 +1241,6 @@ if get_option('selinux') pre_args += '-DMESA_SELINUX' endif -# TODO: llvm-prefix and llvm-shared-libs - if with_libunwind != 'false' dep_unwind = dependency('libunwind', required : with_libunwind == 'true') if dep_unwind.found() @@ -1190,8 +1250,6 @@ else dep_unwind = null_dep endif -# TODO: gallium-hud - if with_osmesa != 'none' if with_osmesa == 'classic' and not with_dri_swrast error('OSMesa classic requires dri (classic) swrast.') @@ -1220,7 +1278,9 @@ if with_platform_wayland dep_wayland_client = dependency('wayland-client', version : '>=1.11') dep_wayland_server = dependency('wayland-server', version : '>=1.11') if with_egl - dep_wayland_egl = dependency('wayland-egl', version : '>=1.15') + dep_wayland_egl = dependency('wayland-egl-backend', version : '>= 3') + dep_wayland_egl_headers = declare_dependency( + compile_args : run_command(prog_pkgconfig, ['wayland-egl-backend', '--cflags']).stdout().split()) endif wayland_dmabuf_xml = join_paths( dep_wl_protocols.get_pkgconfig_variable('pkgdatadir'), 'unstable', @@ -1252,6 +1312,8 @@ dep_xcb_present = null_dep dep_xcb_sync = null_dep dep_xcb_xfixes = null_dep dep_xshmfence = null_dep +dep_xcb_xrandr = null_dep +dep_xlib_xrandr = null_dep if with_platform_x11 if with_glx == 'xlib' or with_glx == 'gallium-xlib' dep_x11 = dependency('x11') @@ -1298,6 +1360,10 @@ if with_platform_x11 with_gallium_omx != 'disabled')) dep_xcb_xfixes = dependency('xcb-xfixes') endif + if with_xlib_lease + dep_xcb_xrandr = dependency('xcb-randr', version : '>= 1.12') + dep_xlib_xrandr = dependency('xrandr', version : '>= 1.3') + endif endif if get_option('gallium-extra-hud') @@ -1314,10 +1380,6 @@ else dep_lmsensors = null_dep endif -# TODO: various libdirs - -# TODO: gallium driver dirs - foreach a : pre_args add_project_arguments(a, language : ['c', 'cpp']) endforeach @@ -1330,18 +1392,24 @@ endforeach inc_include = include_directories('include') -gl_priv_reqs = [ - 'x11', 'xext', 'xdamage >= 1.1', 'xfixes', 'x11-xcb', 'xcb', - 'xcb-glx >= 1.8.1'] +gl_priv_reqs = [] + +if with_glx == 'xlib' or with_glx == 'gallium-xlib' + gl_priv_reqs += ['x11', 'xext', 'xcb'] +elif with_glx == 'dri' + gl_priv_reqs += [ + 'x11', 'xext', 'xdamage >= 1.1', 'xfixes', 'x11-xcb', 'xcb', + 'xcb-glx >= 1.8.1'] + if with_dri_platform == 'drm' + gl_priv_reqs += 'xcb-dri2 >= 1.8' + endif +endif if dep_libdrm.found() gl_priv_reqs += 'libdrm >= 2.4.75' endif if dep_xxf86vm.found() gl_priv_reqs += 'xxf86vm' endif -if with_dri_platform == 'drm' - gl_priv_reqs += 'xcb-dri2 >= 1.8' -endif gl_priv_libs = [] if dep_thread.found()