meson: Move volk, SPIRV-Reflect to main meson.build

This commit is contained in:
Matt Borgerson 2024-12-30 19:23:55 -07:00 committed by mborgerson
parent 209c0991a1
commit f92713def7
2 changed files with 30 additions and 27 deletions

View File

@ -1197,19 +1197,37 @@ elif targetos == 'linux'
vulkan = dependency('vulkan')
endif
if vulkan.found() and not libglslang.found()
if vulkan.found()
cmake = import('cmake')
# FIXME: Get spirv-tools to enable opt.
glslang_opts = cmake.subproject_options()
glslang_opts.add_cmake_defines({'ENABLE_OPT': false})
glslang_subpro = cmake.subproject('glslang', options: glslang_opts)
libglslang = declare_dependency(link_with: [
glslang_subpro.target('glslang'),
glslang_subpro.target('MachineIndependent'),
glslang_subpro.target('GenericCodeGen'),
glslang_subpro.target('SPIRV'),
], include_directories: ['subprojects' / 'glslang']
)
if not libglslang.found()
# FIXME: Get spirv-tools to enable opt.
glslang_opts = cmake.subproject_options()
glslang_opts.add_cmake_defines({'ENABLE_OPT': false})
glslang_subpro = cmake.subproject('glslang', options: glslang_opts)
libglslang = declare_dependency(link_with: [
glslang_subpro.target('glslang'),
glslang_subpro.target('MachineIndependent'),
glslang_subpro.target('GenericCodeGen'),
glslang_subpro.target('SPIRV'),
], include_directories: ['subprojects' / 'glslang']
)
endif
volk_opts = cmake.subproject_options()
volk_opts.add_cmake_defines({'VOLK_STATIC_DEFINES': 'VK_NO_PROTOTYPES'})
volk_subproj = cmake.subproject('volk', options: volk_opts)
volk = declare_dependency(compile_args: ['-DVK_NO_PROTOTYPES'],
include_directories: volk_subproj.include_directories('volk'),
link_with: volk_subproj.target('volk'),
dependencies: vulkan)
spirv_reflect_opts = cmake.subproject_options()
spirv_reflect_opts.add_cmake_defines({'SPIRV_REFLECT_STATIC_LIB': 'ON'})
spirv_reflect_subproj = cmake.subproject('SPIRV-Reflect', options: spirv_reflect_opts)
spirv_reflect = declare_dependency(include_directories: spirv_reflect_subproj.include_directories('spirv-reflect-static'),
link_with: spirv_reflect_subproj.target('spirv-reflect-static'),
dependencies: vulkan)
endif
subdir('thirdparty')

View File

@ -1,13 +1,5 @@
if vulkan.found()
volk_opts = cmake.subproject_options()
volk_opts.add_cmake_defines({'VOLK_STATIC_DEFINES': 'VK_NO_PROTOTYPES'})
volk_subproj = cmake.subproject('volk', options: volk_opts)
volk = declare_dependency(compile_args: ['-DVK_NO_PROTOTYPES'],
include_directories: volk_subproj.include_directories('volk'),
link_with: volk_subproj.target('volk'),
dependencies: vulkan)
debug_vma = false
vma_defns = [
@ -33,11 +25,4 @@ vma = declare_dependency(include_directories: vma_subproj.include_directories('V
link_with: libvma,
dependencies: vulkan)
spirv_reflect_opts = cmake.subproject_options()
spirv_reflect_opts.add_cmake_defines({'SPIRV_REFLECT_STATIC_LIB': 'ON'})
spirv_reflect_subproj = cmake.subproject('SPIRV-Reflect', options: spirv_reflect_opts)
spirv_reflect = declare_dependency(include_directories: spirv_reflect_subproj.include_directories('spirv-reflect-static'),
link_with: spirv_reflect_subproj.target('spirv-reflect-static'),
dependencies: vulkan)
endif