[Mesa-dev] [PATCH v3 14/48] meson: Make shader-cache a trillean instead of boolean

Dylan Baker dylan at pnwbakers.com
Tue Aug 7 00:50:54 UTC 2018


So that it can be implicitly disabled on windows, where it doesn't
compile.

v2: - Use an auto-option rather than automagic.
    - fix shader_cache check (== -> !=)
---
 meson.build       | 16 +++++++++++++---
 meson_options.txt |  5 +++--
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/meson.build b/meson.build
index 4350e1af810..4dc76732d4a 100644
--- a/meson.build
+++ b/meson.build
@@ -722,9 +722,19 @@ if get_option('buildtype') == 'debug'
   pre_args += '-DDEBUG'
 endif
 
-if get_option('shader-cache')
-  pre_args += '-DENABLE_SHADER_CACHE'
-elif with_amd_vk
+with_shader_cache = false
+_shader_cache = get_option('shader-cache')
+if _shader_cache != 'false'
+  if host_machine.system() == 'windows'
+    if _shader_cache == 'true'
+      error('Shader Cache does not currently work on Windows')
+    endif
+  else
+    pre_args += '-DENABLE_SHADER_CACHE'
+    with_shader_cache = true
+  endif
+endif
+if with_amd_vk and not with_shader_cache
   error('Radv requires shader cache support')
 endif
 
diff --git a/meson_options.txt b/meson_options.txt
index b8df253b323..cb21a68f131 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -158,8 +158,9 @@ option(
 )
 option(
   'shader-cache',
-  type : 'boolean',
-  value : true,
+  type : 'combo',
+  value : 'auto',
+  choices : ['auto', 'true', 'false'],
   description : 'Build with on-disk shader cache support'
 )
 option(
-- 
2.18.0



More information about the mesa-dev mailing list