meson: Add precomp-compiler and install-precomp-compiler options
As Asahi, Intel and soon Panfrost requires an offline compiler for their respective internal shaders, this commit adds generic new options to workaround meson current limitations around cross-compillation. Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32719>
This commit is contained in:

committed by
Marge Bot

parent
13fe5a597b
commit
5ddeea9a62
11
meson.build
11
meson.build
@@ -303,9 +303,10 @@ with_any_broadcom = [
|
||||
with_broadcom_vk,
|
||||
].contains(true)
|
||||
|
||||
if get_option('intel-clc') != 'system'
|
||||
if get_option('intel-clc') != 'system' and get_option('precomp-compiler') != 'system'
|
||||
# Require intel-clc with Anv & Iris (for internal shaders)
|
||||
with_intel_clc = get_option('intel-clc') == 'enabled' or \
|
||||
get_option('precomp-compiler') == 'enabled' or \
|
||||
with_intel_vk or with_gallium_iris
|
||||
else
|
||||
with_intel_clc = false
|
||||
@@ -811,7 +812,13 @@ if with_gallium_rusticl or with_nouveau_vk or with_tools.contains('etnaviv')
|
||||
endif
|
||||
endif
|
||||
|
||||
with_clc = get_option('mesa-clc') != 'auto' or with_microsoft_clc or with_intel_clc or with_gallium_asahi or with_asahi_vk or with_gallium_rusticl
|
||||
if get_option('precomp-compiler') != 'system'
|
||||
with_drivers_clc = get_option('precomp-compiler') == 'enabled'
|
||||
else
|
||||
with_drivers_clc = false
|
||||
endif
|
||||
|
||||
with_clc = get_option('mesa-clc') != 'auto' or with_microsoft_clc or with_intel_clc or with_drivers_clc or with_gallium_asahi or with_asahi_vk or with_gallium_rusticl
|
||||
|
||||
dep_clc = null_dep
|
||||
if with_gallium_clover or with_clc
|
||||
|
@@ -760,3 +760,20 @@ option(
|
||||
value : false,
|
||||
description : 'Install the mesa-clc compiler (if needed for cross builds).'
|
||||
)
|
||||
|
||||
option(
|
||||
'precomp-compiler',
|
||||
type : 'combo',
|
||||
value : 'auto',
|
||||
choices : [
|
||||
'enabled', 'system', 'auto'
|
||||
],
|
||||
description : 'Build drivers internal shader compilers or use a system version'
|
||||
)
|
||||
|
||||
option(
|
||||
'install-precomp-compiler',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
description : 'Install the drivers internal shader compilers (if needed for cross builds).'
|
||||
)
|
||||
|
@@ -1,16 +1,21 @@
|
||||
# Copyright 2017 Intel Corporation
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
prog_asahi_clc = executable(
|
||||
'asahi_clc',
|
||||
['asahi_clc.c'],
|
||||
link_with : [libasahi_compiler],
|
||||
include_directories : [inc_include, inc_src],
|
||||
c_args : [pre_args, no_override_init_args],
|
||||
link_args : [ld_args_build_id],
|
||||
dependencies : [idep_mesaclc, dep_llvm, dep_spirv_tools, idep_nir, idep_mesautil],
|
||||
# If we can run host binaries directly, just build asahi_clc for the host.
|
||||
# Most commonly this happens when doing a cross compile from an x86_64 build
|
||||
# machine to an x86 host
|
||||
native : not meson.can_run_host_binaries(),
|
||||
)
|
||||
if get_option('precomp-compiler') == 'system'
|
||||
prog_asahi_clc = find_program('asahi_clc', native : true)
|
||||
else
|
||||
prog_asahi_clc = executable(
|
||||
'asahi_clc',
|
||||
['asahi_clc.c'],
|
||||
link_with : [libasahi_compiler],
|
||||
include_directories : [inc_include, inc_src],
|
||||
c_args : [pre_args, no_override_init_args],
|
||||
link_args : [ld_args_build_id],
|
||||
dependencies : [idep_mesaclc, dep_llvm, dep_spirv_tools, idep_nir, idep_mesautil],
|
||||
# If we can run host binaries directly, just build asahi_clc for the host.
|
||||
# Most commonly this happens when doing a cross compile from an x86_64 build
|
||||
# machine to an x86 host
|
||||
native : not meson.can_run_host_binaries(),
|
||||
install : get_option('install-precomp-compiler'),
|
||||
)
|
||||
endif
|
||||
|
@@ -161,7 +161,7 @@ idep_intel_compiler_brw = declare_dependency(
|
||||
)
|
||||
|
||||
# For now this tool is only going to be used by Anv
|
||||
if get_option('intel-clc') == 'system'
|
||||
if get_option('intel-clc') == 'system' or get_option('precomp-compiler') == 'system'
|
||||
prog_intel_clc = find_program('intel_clc', native : true)
|
||||
dep_prog_intel_clc = []
|
||||
elif with_intel_clc
|
||||
@@ -185,7 +185,7 @@ elif with_intel_clc
|
||||
# Most commonly this happens when doing a cross compile from an x86_64 build
|
||||
# machine to an x86 host
|
||||
native : not meson.can_run_host_binaries(),
|
||||
install : get_option('install-intel-clc'),
|
||||
install : get_option('install-intel-clc') or get_option('install-precomp-compiler'),
|
||||
)
|
||||
dep_prog_intel_clc = [prog_intel_clc]
|
||||
endif
|
||||
|
Reference in New Issue
Block a user