Skip to content
Permalink
Browse files

build: support building shaderc and spirv-cross CLI from subprojects

  • Loading branch information
Akaricchi committed Nov 27, 2019
1 parent 3476903 commit 8ccc472e27057311db63607d7673bc005fef9b4b
Showing with 33 additions and 5 deletions.
  1. +7 −0 meson_options.txt
  2. +26 −5 resources/00-taisei.pkgdir/shader/meson.build
@@ -190,3 +190,10 @@ option(
type : 'combo',
description : 'Treatment of deprecation warnings'
)

option(
'force_vendored_shader_tools',
type : 'boolean',
value : false,
description : 'Build shaderc and spirv-cross CLI tools from subprojects even if system versions exist'
)
@@ -148,12 +148,23 @@ else
transpile_glsl = false
endif

force_vendored_shader_tools = get_option('force_vendored_shader_tools')

if force_vendored_shader_tools and validate_glsl != 'false'
validate_glsl = 'true'
endif

if validate_glsl != 'false'
glslc_command = find_program('glslc',
required : (validate_glsl == 'true')
)
if force_vendored_shader_tools
glslc_command = disabler()
else
glslc_command = find_program('glslc')
endif

if glslc_command.found()
if not glslc_command.found() and validate_glsl == 'true'
glslc_command = subproject('shaderc').get_variable('glslc_native')
validate_glsl = true
elif glslc_command.found()
test_result = run_command(glslc_command,
glslc_args,
glslc_frag_args,
@@ -175,11 +186,21 @@ if validate_glsl != 'false'
endif
endif
else
warning('GLSL validation or translation requested, but glslc was not found')
validate_glsl = false
endif

if validate_glsl and transpile_glsl
spvc_command = find_program('spirv-cross', required : true)
if force_vendored_shader_tools
spvc_command = disabler()
else
spvc_command = find_program('spirv-cross')
endif

if not spvc_command.found()
spvc_command = subproject('SPIRV-Cross').get_variable('spirv_cross_native')
endif

glslc_args += ['-Os', '-g']
endif
else

0 comments on commit 8ccc472

Please sign in to comment.
You can’t perform that action at this time.