X-Git-Url: https://git.libre-soc.org/?p=mesa.git;a=blobdiff_plain;f=meson.build;h=c7d878cb6e8a0894dea7bb732e516bc11cb11350;hp=2b30ab014b698a9519f4ea75e8fa9e8b2cecb1e5;hb=64fb3e6def2b71df2766fabfeddadcc732155775;hpb=f67cd0bbd978a093c6802bef33099c5b83e496df diff --git a/meson.build b/meson.build index 2b30ab014b6..c7d878cb6e8 100644 --- a/meson.build +++ b/meson.build @@ -51,6 +51,7 @@ pre_args = [ with_vulkan_icd_dir = get_option('vulkan-icd-dir') with_tests = get_option('build-tests') +with_aco_tests = get_option('build-aco-tests') with_glx_read_only_text = get_option('glx-read-only-text') with_glx_direct = get_option('glx-direct') with_osmesa = get_option('osmesa') @@ -242,9 +243,9 @@ _vulkan_drivers = get_option('vulkan-drivers') if _vulkan_drivers.contains('auto') if system_has_kms_drm if host_machine.cpu_family().startswith('x86') - _vulkan_drivers = ['amd', 'intel'] + _vulkan_drivers = ['amd', 'intel', 'swrast'] elif ['arm', 'aarch64'].contains(host_machine.cpu_family()) - _vulkan_drivers = [] + _vulkan_drivers = ['swrast'] else error('Unknown architecture @0@. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.'.format( host_machine.cpu_family())) @@ -261,8 +262,12 @@ endif with_intel_vk = _vulkan_drivers.contains('intel') with_amd_vk = _vulkan_drivers.contains('amd') with_freedreno_vk = _vulkan_drivers.contains('freedreno') +with_swrast_vk = _vulkan_drivers.contains('swrast') with_any_vk = _vulkan_drivers.length() != 0 +if with_swrast_vk and not with_gallium_softpipe + error('swrast vulkan requires gallium swrast') +endif if with_dri_swrast and (with_gallium_softpipe or with_gallium_swr) error('Only one swrast provider can be built') endif @@ -275,6 +280,9 @@ endif if with_gallium_tegra and not with_gallium_nouveau error('tegra driver requires nouveau driver') endif +if with_aco_tests and not with_amd_vk + error('ACO tests require Radv') +endif if host_machine.system() == 'darwin' with_dri_platform = 'apple' @@ -385,7 +393,7 @@ elif _xlib_lease == 'false' warning('xlib_lease option "false" deprecated, please use "disabled" instead.') endif if _xlib_lease == 'auto' - with_xlib_lease = with_platform_x11 and with_gbm + with_xlib_lease = with_platform_x11 and system_has_kms_drm else with_xlib_lease = _xlib_lease == 'enabled' endif @@ -539,6 +547,10 @@ if with_gallium_zink dep_vulkan = dependency('vulkan') endif +if with_vulkan_overlay_layer or with_aco_tests + prog_glslang = find_program('glslangValidator') +endif + _xvmc = get_option('gallium-xvmc') if _xvmc == 'true' _xvmc = 'enabled' @@ -828,19 +840,29 @@ endif if with_gbm pre_args += '-DHAVE_DRM_PLATFORM' endif + +with_android_stub = get_option('android-stub') +if with_android_stub and not with_platform_android + error('`-D android-stub=true` makes no sense without `-D platforms=android`') +endif + if with_platform_android - dep_android = [ - dependency('cutils'), - dependency('hardware'), - dependency('sync'), - ] - if with_gallium - dep_android += dependency('backtrace') - endif - if get_option('platform-sdk-version') >= 26 - dep_android += dependency('nativewindow') + if not with_android_stub + dep_android = [ + dependency('cutils'), + dependency('hardware'), + dependency('sync'), + dependency('backtrace') + ] + if get_option('platform-sdk-version') >= 26 + dep_android += dependency('nativewindow') + endif endif - pre_args += '-DHAVE_ANDROID_PLATFORM' + pre_args += [ + '-DHAVE_ANDROID_PLATFORM', + '-DANDROID', + '-DANDROID_API_LEVEL=' + get_option('platform-sdk-version').to_string() + ] endif if with_platform_haiku pre_args += '-DHAVE_HAIKU_PLATFORM' @@ -962,6 +984,10 @@ if cc.get_id() == 'msvc' '/wd4146', # unary minus operator applied to unsigned type, result still unsigned '/wd4200', # nonstandard extension used: zero-sized array in struct/union '/wd4624', # destructor was implicitly defined as deleted [from LLVM] + '/wd4309', # 'initializing': truncation of constant value + '/wd4838', # conversion from 'int' to 'const char' requires a narrowing conversion + '/we4020', # Error when passing the wrong number of parameters + '/we4024', # Error when passing different type of parameter ] if cc.has_argument(a) c_args += a @@ -1491,6 +1517,7 @@ endif if with_llvm pre_args += '-DLLVM_AVAILABLE' pre_args += '-DMESA_LLVM_VERSION_STRING="@0@"'.format(dep_llvm.version()) + pre_args += '-DLLVM_IS_SHARED=@0@'.format(_shared_llvm.to_int()) # LLVM can be built without rtti, turning off rtti changes the ABI of C++ # programs, so we need to build all C++ code in mesa without rtti as well to @@ -1535,7 +1562,7 @@ endif dep_glvnd = null_dep if with_glvnd - dep_glvnd = dependency('libglvnd', version : '>= 1.2.0') + dep_glvnd = dependency('libglvnd', version : '>= 1.3.2') pre_args += '-DUSE_LIBGLVND=1' endif @@ -1627,7 +1654,7 @@ if with_osmesa != 'none' osmesa_bits = get_option('osmesa-bits') if osmesa_bits != '8' if with_dri or with_glx != 'disabled' - error('OSMesa bits must be 8 if building glx or dir based drivers') + error('OSMesa bits must be 8 if building glx or dri based drivers') endif osmesa_lib_name = osmesa_lib_name + osmesa_bits pre_args += [ @@ -1678,6 +1705,7 @@ dep_xcb_sync = null_dep dep_xcb_xfixes = null_dep dep_xshmfence = null_dep dep_xcb_xrandr = null_dep +dep_xcb_shm = null_dep dep_xlib_xrandr = null_dep if with_platform_x11 if with_glx == 'xlib' or with_glx == 'gallium-xlib' @@ -1688,8 +1716,9 @@ if with_platform_x11 dep_x11 = dependency('x11') dep_xext = dependency('xext') dep_xdamage = dependency('xdamage', version : '>= 1.1') - dep_xfixes = dependency('xfixes') + dep_xfixes = dependency('xfixes', version : '>= 2.0') dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1') + dep_xcb_shm = dependency('xcb-shm') endif if (with_any_vk or with_glx == 'dri' or with_egl or (with_gallium_vdpau or with_gallium_xvmc or with_gallium_va or @@ -1757,6 +1786,19 @@ else dep_lmsensors = null_dep endif +# If the compiler supports it, put function and data symbols in their +# own sections and GC the sections after linking. This lets drivers +# drop shared code unused by that specific driver (particularly +# relevant for Vulkan drivers). +if cc.has_link_argument('-Wl,--gc-sections') + add_project_arguments('-Wl,--gc-sections', language : ['c', 'cpp']) + foreach a: ['-ffunction-sections', '-fdata-sections'] + if cc.has_argument(a) + add_project_arguments(a, language : ['c', 'cpp']) + endif + endforeach +endif + foreach a : pre_args add_project_arguments(a, language : ['c', 'cpp']) endforeach