diff --git a/meson.build b/meson.build index 23ab29c7e3c..3340042eb01 100644 --- a/meson.build +++ b/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 diff --git a/meson_options.txt b/meson_options.txt index 0b9282cccd6..ea3f54126b3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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).' +) diff --git a/src/asahi/clc/meson.build b/src/asahi/clc/meson.build index 7dadcc623bd..90a5f84575c 100644 --- a/src/asahi/clc/meson.build +++ b/src/asahi/clc/meson.build @@ -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 diff --git a/src/intel/compiler/meson.build b/src/intel/compiler/meson.build index 252f4fa8762..8a9549d54db 100644 --- a/src/intel/compiler/meson.build +++ b/src/intel/compiler/meson.build @@ -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