Skip to content

Commit

Permalink
meson: Move volk, SPIRV-Reflect to main meson.build
Browse files Browse the repository at this point in the history
  • Loading branch information
mborgerson committed Dec 31, 2024
1 parent f7119d8 commit 8375a35
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
42 changes: 30 additions & 12 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -1190,19 +1190,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')
Expand Down
15 changes: 0 additions & 15 deletions thirdparty/meson.build
Original file line number Diff line number Diff line change
@@ -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 = [
Expand All @@ -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

0 comments on commit 8375a35

Please sign in to comment.