Skip to content

Use system SPIRV and Vulkan headers if new enough #3322

@smcv

Description

@smcv

When packaging a library like DXVK Native, Linux distributions generally prefer to use system dependencies rather than vendoring a copy into dependent projects, so that if there's a bug in the dependency, it can be fixed in one place. This would also make it easier to build from the source tarballs provided by Github, which don't include git submodules, or from a simple git clone without submodules.

Would it be possible to use something like this (slightly pseudocode, I haven't tested this):

vulkan_dep = dependency('vulkan', '>=1.3.239', required: false)

if vulkan_dep.found()
  vulkan_headers = vulkan_dep.partial_dependency(includes: true)
else
  vulkan_headers = declare_dependency(include_directories: ['./include/vulkan/include'])
endif

spirv_dep = dependency('SPIRV-Headers', '>=1.5.5', required: false)

if not spirv_dep.found()
  spirv_dep = declare_dependency(include_directories: ['./include/spirv/include'])
endif

and then use vulkan_headers and spirv_dep in the dependencies of each target, instead of adding these two directories to dxvk_include_dirs?

If that seems like an OK approach, I'll prepare a merge request.

(Unfortunately, checking for SPIRV-Headers newer than 1.5.5 doesn't currently work, as a result of KhronosGroup/SPIRV-Headers#334.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions