96 Commits

Author SHA1 Message Date
Andreas Süßenbach
cc01933661
Remove outdated flag VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC (#2229) 2025-07-28 17:59:43 +02:00
Andreas Süßenbach
167bb6afe0
Remove outdated flag VULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC (#2228) 2025-07-24 19:26:03 +02:00
Andreas Süßenbach
a20b4d4438
Removed unused option INCLUDE_DIRS from makefiles. (#2204) 2025-07-01 15:59:53 +02:00
btmxh
d5b553d969
Add support for vulkan_video.cppm module (#2162)
* Add support for vulkan_video.cppm module

Fix #2151

* Add a module version for the Video test

Currently this add vulkan_video.cppm to the VulkanHppModule target,
which might not be what we want (maybe guard this by an option(), or add
another target like VulkanVideoHppModule, etc.).

* Add a separate target for `vulkan_video.cppm`

* Extract common logic to `vulkan_hpp__setup_module`

* Fix several CMakeLists.txt issues

- Add `vulkan_video.cppm` to `VK_GENERATED_VULKAN_HEADERS`.
- Remove unnecessary ${ARGN} quotes.
- Move version checks out of `vulkan_hpp__setup_module`.
- Separate `FILE_SET_NAME` from `FILE_SET`.
2025-05-15 18:11:27 +02:00
Jan Kuhlmann
ca00bfad9e
Update submodule glslang to version 15.3.0 (#2156) 2025-05-06 13:40:23 +02:00
Andreas Süßenbach
3f84a60581
Define CLANG_FORMAT_EXECUTABLE only for the generators. (#2125) 2025-04-03 13:25:12 +02:00
Jan Kuhlmann
efa6cf3a25
Fix unix DL linkage (#2108) 2025-03-19 08:25:41 +01:00
Andreas Süßenbach
053eb2d62c
Adjust build files to allow test builds without sample builds (#2107) 2025-03-18 13:47:01 +01:00
Jan Kuhlmann
f9c5bfde49
CMake: Cleanup of vulkan target and cpp module test (#2105)
* cleanup of vulkan target

* fixed cpp module test

* extend ubuntu ci to compile cpp modules

* only test cpp modules on ubuntu 24.04

* fixed condition syntax

* exclude gcc <=14

* revert ci for ubuntu
2025-03-18 08:52:47 +01:00
Jan Kuhlmann
2860728579
CMake: Reintroduced #2075 (#2083)
* reintroduced vulkan C header includes

* include Vulkan C headers in sample/test func
2025-02-24 09:13:43 +01:00
Andreas Süßenbach
8ab6cb5d8b
Add some temporary debug output in CMakeLists.txt. (#2081) 2025-02-19 13:18:44 +01:00
Andreas Süßenbach
ed5993af83
Revert MR #2075 (#2080) 2025-02-18 13:32:34 +01:00
Jan Kuhlmann
74a2ce1e91
CMake: Offer multiple choices for Vulkan C headers (#2075)
* offer multiple choices for Vulkan C headers

* replaced redundant link
2025-02-18 08:15:37 +01:00
Jan Kuhlmann
7d7c25f9be
CMake: Added unified options for VulkanHpp and VulkanHppModule compile definitions (#2066)
* added compile definitions as cmake options

* use VulkanHpp dynamic dispatch setting for module

* adjusted comments

* adjusted dynamic loader tool option

* remove dynamic loader tool option

* removed non-boolean flags

* make VULKAN_HPP_DISPATCH_LOADER_DYNAMIC depend on VK_NO_PROTOTYPES

* added descriptions to options

* adjusted formatting

* fixed typo

* deprecated module-specific cmake flag VULKAN_HPP_CPP20_MODULE_DYNAMIC_DISPATCHER

* link to vulkan-1 on static dispatch loader

* typo fix

* only optionally find vulkan, warn in case it is missing
2025-02-13 07:56:23 +01:00
Andreas Süßenbach
3e53a5804a
Add support for clang_format options version 18 (#2064) 2025-02-06 17:14:29 +01:00
Andreas Süßenbach
3ec3e1c8d1
Add support for clang_format options version 17 (#2063) 2025-02-06 13:20:09 +01:00
Andreas Süßenbach
3f2fe22281
Add support for clang_format options version 16. (#2062) 2025-02-05 13:44:36 +01:00
Jan Kuhlmann
4ff2cb7c95
CMake: Adding generator dependency to VulkanHpp interface target for propagation and linking it to other targets (#2054)
* moved generator-related setup into the generator build section

* move generators and VulkanHpp* targets in front of setup functions

* make VulkanHpp potentially dependant on the generators, propagating to targets linking to it

* add local vulkan dep to VulkanHpp and propagate this and generator deps to VulkanHppModule

* link against local Vulkan::Hpp for include setup

* fix generator dep target

* fixed VULKAN_HPP_GENERATOR_BUILD option

* move warning level func in front of generators

* added build_video_hpp as a dependency for VulkanHpp
2025-01-23 13:52:14 +01:00
Jan Kuhlmann
f8704c9a4e
CMake: Alias for c++20 modules target (#2048)
* created alias for cxx module target

* renamed Vulkan-Hpp to VulkanHpp akin to VulkanHppModule

* provide vk-hpp include dir to module target via interface target

* fixed indent
2025-01-22 08:26:32 +01:00
Jan Kuhlmann
e7a8252006
CMake: Moving options below project declaration (#2047)
* move options below project declaration

* expand cmake version dep for c++20 modules

* default VULKAN_HPP_GENERATOR_BUILD to PROJECT_IS_TOP_LEVEL

* fixed format

* moved CMAKE_CXX_STANDARD

* only set cxx standard if top-level
2025-01-21 08:21:10 +01:00
Jan Kuhlmann
ce439adae2
Isolating generator targets and creating header-only interface target (#2042)
* VULKAN_HPP_GENERATOR_BUILD option for cmake targets

* Vulkan-Hpp target aliased as Vulkan::Hpp
2025-01-20 08:45:29 +01:00
Andreas Süßenbach
752778463e
Parallelize the generation of the files. (#2035) 2025-01-08 11:53:08 +01:00
Andreas Süßenbach
ab53607248
Remove building for vulkansc from VULKAN_HPP_RUN_GENERATOR (#2005) 2024-12-03 11:38:27 +01:00
Andreas Süßenbach
ab5eb71025
Use compile option -fno-strict-aliasing to prevent breaking optimizations due to using reinterpret_cast (#1985) 2024-10-31 08:24:05 +01:00
Sharadh Rajaraman
6abd3f42a8
Use import std; guarded by macro (#1932)
* Initial build and tests setup

* Enable the `CppStdModule` test

* Snippets and generator changes

* Generated files changes

* Enable std module with macro

* Unconditionally use `import std` with C++23

* Add support for external `import std` control with `VULKAN_HPP_ENABLE_STD_MODULE`

- Rewrite `includes.hpp` and `macros.hpp`
- Unconditionally set `VULKAN_HPP_ENABLE_STD_MODULE` for `vulkan.cppm` to bug-fix
- Generated necessary files again

* Top-level CMake changes

* Reorganise logic, and propagate external macro correctly

* RAII: vulkan_hpp before ifdef

* Define `VK_USE_64_BIT_PTR_DEFINES` in `vulkan_hpp_macros.hpp`

* Generate the `VK_USE_64_BIT_PTR_DEFINES` clause from the XML instead of hardcoding it

* Refactored handling for `VK_USE_64_BIT_PTR_DEFINES`

- Updated condition to positive test for `#ifndef VK_USE_64_BIT_PTR_DEFINES` in `completeMacro`

* Added `#include <string.h>` to resolve `strnlen` missing in the module

* Use only `std.compat`

* FIx after rebase
2024-09-05 08:48:19 +02:00
Bohdan Soproniuk
dceddb7e31
Update the instance extensions list for WSI (#1875)
The VK_MVK_ios_surface and VK_MVK_macos_surface extensions have been
deprecated by the VK_EXT_metal_surface extension.
The VK_KHR_mir_surface extension has been removed from the Vulkan
specification and, therefore, should not be used.
2024-06-19 09:04:07 +02:00
Andreas Süßenbach
6604f5a1d9
Make generated headers resistant to missing definition of NOMINMAX for windows builds. (#1906) 2024-06-17 14:51:12 +02:00
Andreas Süßenbach
525429d181
Add building of vulkan_video.hpp to default build process. (#1793) 2024-02-06 15:11:31 +01:00
Andreas Süßenbach
f67cfcc229
Use the actual CMAKE_CXX_STANDARD provided by the workflow. (#1750) 2023-12-13 21:56:00 +01:00
Andreas Süßenbach
c77427babb
Adjust module support handling with CMake version 3.28 and above (#1699) 2023-10-18 08:07:18 +02:00
Anton Shangareev
f9bed11716
Use add_subdirectory-friendly CMAKE variables (#1679) 2023-10-09 16:05:13 +02:00
Andreas Süßenbach
d4704cce01
Make C++20 modules work with the defaultDispatchLoaderDynamic. (#1651)
* Make C++20 modules work with the defaultDispatchLoaderDynamic.

* Add vulkan_hpp_macros.hpp to list of installed files.

* Adjust the text on module in the readme.

* Rename module from vulkan to vulkan_hpp

* Adjust some comments.

* Add a little disclaimer to vulkan.cppm.
2023-09-07 15:20:10 +02:00
Stephan Seitz
cf70eb8efb
fix: add support for C++20 modules for CMake 3.27.0/3.27.1 (#1632)
When using VULKAN_HPP_ENABLE_EXPERIMENTAL_CPP20_MODULES=ON with CMake 3.27.0 or 3.27.1,
you will get a very confusing error message:
```
CMake Error at CMakeLists.txt:346 (target_sources):
  target_sources File set TYPE may only be "HEADERS"
```

This is because the value of `CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API`
is not update to the correct value, disabling all experimental CMake
features.

This PR adds the value for 3.27.X and triggers an error for higher CMake
versions where this feature needs to be revised and
CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API if the feature is still
experimental.

The error message will look similar to this one (simulated for CMake
3.27.1)
```
CMake Error at CMakeLists.txt:30 (message):
  VULKAN_HPP_ENABLE_EXPERIMENTAL_CPP20_MODULES is currently not supported for
  CMake version 3.27.1! To add support inform yourself about the state of the
  feature at
  https://github.com/Kitware/CMake/blob/master/Help/dev/experimental.rst and
  add the corresponding value of CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API to
  Vulkan-Hpp's CMakeLists.txt
```
2023-08-07 08:56:36 +02:00
Andreas Süßenbach
069c3b875e
Introduce VideoHppGenerator. (#1618) 2023-07-11 15:39:17 +02:00
Sharadh Rajaraman
f4abba455e
Bug fixes for vulkan.cppm (#1616)
* Bug fixes for C++20 module

- Removed nested `export` keyword for `vk::raii` namespace in C++ module file
- Fixed macro in `vulkan.cppm` for `vk::DynamicLoader`: changed from `VULKAN_HPP_DYNAMIC_LOADER_TOOL` to `VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL`  
- Moved VulkanHppModule declaration before generator
- Fixed `CMakeLists.txt` for `Cpp20Modules` executable target

* Use `VULKAN_HPP_CONSTEXPR_INLINE` for constants in `vulkan.hpp`

- Added VULKAN_HPP_CONSTEXPR_INLINE macro definition
- Allow external linkage for these constants in C++17 and later
2023-07-10 08:46:50 +02:00
Sharadh Rajaraman
6c1996f068
Add C++20 module interface file and tests (#1582)
* feat: exported vk::raii types in vulkan.ixx, with a small test

* feat: *almost* complete vulkan.ixx; missing functions in vulkan_funcs.hpp and constexpr auto defines

* Exported free functions in `vulkan_funcs.hpp` in `vulkan.ixx`

* Completed vulkan.ixx

Exported all types, structs, functions; need to handle anonymous namespace and getDispatchLoaderStatic()

* Moved `vk::anon-namespace::throwResultException` to `vk::detail::throwResultException` to solve linking errors

* Made `vk::getDispatchLoaderStatic` not `static`

`static`in namespace/global scope has to do with internal/external linkage, and not lifetime

* Fixed debug assert fail in `generateCppModuleStructUsings`

* Removed references to `.cppm`

* Formatting and versioning changes

- CMake version handling simplified
- vulkan.ixx includes new structs from new versions
- vulkan.hpp and vulkan_raii.hpp reformatted with clang-format 14

* Removed extraneous includes

- std::optional -> std::string::empty
- std::filesystem was unused

* Fixed constexpr function and value generation
- 'c' prefix removed
- Constants casing fixed
- Types for constants fixed
- Constants assigned to macros
- Ordering of constants and consteval functions fixed

* Moved constexprs to `vulkan.hpp`

- Added corresponding `using` statements to `vulkan.ixx`
- Changed `consteval auto(auto)` functions into templated SFINAE `constexpr` functions

* Formatting, signposting, misc fixes

- Added newlines around macro guards
- Added signposting comments for relevant groups of `using`-statements in `vulkan.ixx`
- Guarded createInstanceUnique with macro guard
- Use m_handles.at("").commands for Funcs

* Changed module file extension to `.cppm`

- It follows the rest of the project convention; `ixx` looks really weird next to `.hpp` and `.cpp`
- CMake transparently handles any extension anyway

* Added `VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE` to `vulkan.cppm`

* Added format traits and extension inspections

- Straightforward, since everything is hard-coded

* Added documentation about Vulkan-Hpp C++ module

- Compiler requirements
- CMake compilation
- Command-line examples

* Added vulkan_hash.hpp

- No need for `using`, since all declarations are template specialisations of existing `std` objects

* Documentation and comment fixes

- Removed extraneous CMake version comments
- Documentation about default dynamic dispatcher with the module
- Comment updates in the source code

* Moved constexpr defines and using statements 

- Moved to after resultUsings in both vulkan.hpp and vulkan.cppm
- Also split up constexprDefinesAndUsings
- Used const_cast for constexprDefines()

* Used std::string instead of std::stringstream

- Some changes also in previous commit
- Also removed overly-clever ranges algorithms

* Simplified protection generation

- Removed `generateNotProtection`
- Added optional `bool` parameter to `generateProtection` for `#if !defined( ... )`

* Simplified Cpp20Modules CMakeLists

- Made C++ standard and libraries into parameters
- Removed FindVulkan call; already done

* `constexpr` generation fixed

- Made all generating functions `const`
- Removed typos and extra comments
- Extracted out filtering functionality into separate functions

* Simplified defines partition generation

- Added `DefinesPartition` struct as a member variable
- Added non-const function to write to the above in `readTypeDefines`
- Removed previous implementation that made many copies

* Added `generateUsingsAndProtection` lambda to RAII name generation

* Moved around `partitionDefines` to make more sense

- called once at the end of the constructor
- edited comments

* Updated headers to 1.3.255

* Removed std::ranges and ranges view adaptors

- CI isn't passing with them

* Fixed constexpr functions for C++11 and C++14

- Removed `enable_if_t` and `is_integral_v` 
- Changed `auto` return type into `uint32_t`

---------

Co-authored-by: Sharadh Rajaraman <r.sharadh@yahoo.com.sg>
2023-06-28 14:10:51 +02:00
Andreas Süßenbach
397ffad84a
Fix defines in workflow files to enable compilation of tests and samples in CI. (#1595) 2023-06-20 14:43:35 +02:00
Andreas Süßenbach
40e76b7c24
Cleanup in CMakeLists.txt (#1572) 2023-05-08 11:54:57 +02:00
Andreas Süßenbach
f25639bd17
Cleanup in CMakeLists.txt (#1566) 2023-04-27 16:16:10 +02:00
Andreas Süßenbach
e1d6ec8abf
Cleanup up on CMakeLists.txt (#1564) 2023-04-20 16:50:26 +02:00
Andreas Süßenbach
bf8bee64e1
Mark all projects as C++-only. (#1554) 2023-04-05 09:50:26 +02:00
Andreas Süßenbach
4befd8e643
extend workflow run to generate vulkansc*.hpp (#1525) 2023-03-07 14:07:16 +01:00
Andreas Süßenbach
68512e6702
Add options for clang-format 15. (#1480) 2023-01-16 17:38:34 +01:00
Andreas Süßenbach
40f7474120
Change the required CMake version to 3.12. (#1470) 2022-12-20 10:09:01 +01:00
Andreas Süßenbach
23a13e4707
Add support of clang_format version 13 and 14. (#1468) 2022-12-12 17:30:35 +01:00
asuessenbach
02c8049f42 Switch to C++20 for the Generator + some minor cleanup. 2022-09-06 18:22:04 +02:00
asuessenbach
d27e336ced Make the samples' precompiled headers reuse that from the utils project. 2022-09-01 08:53:55 +02:00
Stephan Seitz
4f35f16475 fix: install target 2022-08-22 10:16:25 +02:00
Stephan Seitz
1903527dd1 fix: make VULKAN_HPP_RUN_GENERATOR work again
Apparently, the statement setting ${vulkan_hpp} was removed with along
with the other generated header files the other generated header files.
2022-08-22 10:16:25 +02:00
asuessenbach
5480d192f5 Refactor the CMakeLists for all the samples; use vulkan.hpp/vulkan_raii.hpp as precompiled header. 2022-08-10 15:29:28 +02:00