Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Added separate Vulkan-Hpp target alongside Vulkan-HppModule with propagating compile definitions #528

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

M2-TE
Copy link

@M2-TE M2-TE commented Feb 17, 2025

The Vulkan-Hpp headers have numerous compile definitions for configuration, which can of course be done manually, but it is much nicer to have actual support for them in CMake via option().
This is particularly true for the C++20 module, which requires compile definitions at the configure stage due to the lack of preprocessor stuff with #include.
Projects relying on Vulkan (e.g. the VulkanMemoryAllocator) can also consume these propagating compile definitions to not have to define them multiple times.

To this end, I made some changes to the CMakeLists.txt, similar to what is now in the Vulkan-Hpp repository, to provide three separate targets with consolidated naming:

  • Vulkan-Headers ALIAS Vulkan::Headers: Same as before, so it will not break anything.
  • Vulkan-Hpp ALIAS Vulkan::Hpp: Separated from Vulkan-Headers, as to provide isolated compile definitions for this C++ target, even though it shares the same interface include directory as the C target.
  • Vulkan-HppModule ALIAS Vulkan::HppModule: Consumes Vulkan-Hpp and its compile definitions. Adjusted naming to match the names of the repository and other targets. Added errors for mismatching compilers (previously warning) and CMake versions. Added ability to build the C++20 module with import std; (as this is still a very experimental feature for most compilers, I have not updated the compiler requirements for it).

Currently, the VK_NO_PROTOTYPERS and VULKAN_HPP_DISPATCH_LOADER_DYNAMIC options are separated as per their respective compile definitions, but it might make sense to consolidate both into a single option to enable the respective C/C++ flag in the two targets.

@CLAassistant
Copy link

CLAassistant commented Feb 17, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants