diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index ecaf9fa75..abec5c16e 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -127,11 +127,13 @@ void VulkanHppGenerator::generateExtensionInspectionFile() const #ifndef VULKAN_EXTENSION_INSPECTION_HPP # define VULKAN_EXTENSION_INSPECTION_HPP -#include -#include -#include -#include -#include +#if !defined( VULKAN_HPP_STD_MODULE ) +# include +# include +# include +# include +# include +#endif namespace VULKAN_HPP_NAMESPACE { @@ -583,8 +585,10 @@ void VulkanHppGenerator::generateRAIIHppFile() const #ifndef VULKAN_RAII_HPP #define VULKAN_RAII_HPP -#include // std::unique_ptr -#include // std::forward +#if !defined( VULKAN_HPP_STD_MODULE ) +# include // std::unique_ptr +# include // std::forward +#endif #include #if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) @@ -659,8 +663,10 @@ void VulkanHppGenerator::generateSharedHppFile() const #define VULKAN_SHARED_HPP #include -#include // std::atomic_size_t +#if !defined( VULKAN_HPP_STD_MODULE ) +#include // std::atomic_size_t +#endif namespace VULKAN_HPP_NAMESPACE { @@ -748,10 +754,15 @@ void VulkanHppGenerator::generateToStringHppFile() const #include -#if __cpp_lib_format -# include // std::format +#if !defined( VULKAN_HPP_STD_MODULE ) +# if __cpp_lib_format +# include // std::format +# else +# include // std::stringstream +# endif #else -# include // std::stringstream +import VULKAN_HPP_STD_MODULE; +import VULKAN_HPP_STD_COMPAT_MODULE; #endif namespace VULKAN_HPP_NAMESPACE @@ -783,6 +794,15 @@ void VulkanHppGenerator::generateCppModuleFile() const module; +// clang-format off +#include +// clang-format on + +#if defined( VULKAN_HPP_STD_MODULE ) +import VULKAN_HPP_STD_MODULE; +import VULKAN_HPP_STD_COMPAT_MODULE; +#endif + #include #include #include diff --git a/snippets/includes.hpp b/snippets/includes.hpp index 3433ad0b6..34d43ec26 100644 --- a/snippets/includes.hpp +++ b/snippets/includes.hpp @@ -1,21 +1,24 @@ -#include -#include // ArrayWrapperND -#include // strnlen -#include // std::string -#include // std::exchange -#include #include -#if 17 <= VULKAN_HPP_CPP_VERSION +#if !defined( VULKAN_HPP_STD_MODULE ) +# include +# include // ArrayWrapperND +# include // strnlen +# include // std::string +# include // std::exchange +#endif +#include + +#if 17 <= VULKAN_HPP_CPP_VERSION && !defined( VULKAN_HPP_STD_MODULE ) # include #endif -#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) +#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) && !defined( VULKAN_HPP_STD_MODULE ) # include // std::tie # include // std::vector #endif -#if !defined( VULKAN_HPP_NO_EXCEPTIONS ) +#if !defined( VULKAN_HPP_NO_EXCEPTIONS ) && !defined( VULKAN_HPP_STD_MODULE ) # include // std::is_error_code_enum #endif @@ -39,10 +42,10 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h # endif #endif -#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR ) +#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR ) && !defined( VULKAN_HPP_STD_MODULE ) # include #endif -#if defined( VULKAN_HPP_SUPPORT_SPAN ) +#if defined( VULKAN_HPP_SUPPORT_SPAN ) && !defined( VULKAN_HPP_STD_MODULE ) # include #endif diff --git a/snippets/macros.hpp b/snippets/macros.hpp index ee109032a..2c9d4604b 100644 --- a/snippets/macros.hpp +++ b/snippets/macros.hpp @@ -77,6 +77,11 @@ # define VULKAN_HPP_SUPPORT_SPAN #endif +#if !defined( VULKAN_HPP_STD_MODULE ) && ( 23 <= VULKAN_HPP_CPP_VERSION ) && defined( __cpp_lib_modules ) && defined( VULKAN_HPP_ENABLE_STD_MODULE ) +# define VULKAN_HPP_STD_MODULE std +# define VULKAN_HPP_STD_COMPAT_MODULE std.compat +#endif + // 32-bit vulkan is not typesafe for non-dispatchable handles, so don't allow copy constructors on this platform by default. // To enable this feature on 32-bit platforms please #define VULKAN_HPP_TYPESAFE_CONVERSION 1 // To disable this feature on 64-bit platforms please #define VULKAN_HPP_TYPESAFE_CONVERSION 0 @@ -86,7 +91,6 @@ # endif #endif - #if defined( __GNUC__ ) # define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ ) #endif @@ -270,7 +274,9 @@ namespace VULKAN_HPP_NAMESPACE #endif #if !defined( VULKAN_HPP_EXPECTED ) && ( 23 <= VULKAN_HPP_CPP_VERSION ) && defined( __cpp_lib_expected ) -# include +# if !defined( VULKAN_HPP_STD_MODULE ) +# include +# endif # define VULKAN_HPP_EXPECTED std::expected # define VULKAN_HPP_UNEXPECTED std::unexpected #endif