Skip to content

Commit

Permalink
Unconditionally use import std with C++23
Browse files Browse the repository at this point in the history
  • Loading branch information
sharadhr committed Aug 14, 2024
1 parent 50d2f57 commit b9dd8a2
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 22 deletions.
9 changes: 0 additions & 9 deletions VulkanHppGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,15 +806,6 @@ void VulkanHppGenerator::generateCppModuleFile() const

module;

// clang-format off
#include <vulkan/vulkan_hpp_macros.hpp>
// clang-format on

#if defined( VULKAN_HPP_STD_MODULE )
import VULKAN_HPP_STD_MODULE;
import VULKAN_HPP_STD_COMPAT_MODULE;
#endif

#include <vulkan/${api}.hpp>
#include <vulkan/${api}_extension_inspection.hpp>
#include <vulkan/${api}_format_traits.hpp>
Expand Down
3 changes: 3 additions & 0 deletions snippets/includes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
# include <string.h> // strnlen
# include <string> // std::string
# include <utility> // std::exchange
#else
import VULKAN_HPP_STD_MODULE;
import VULKAN_HPP_STD_COMPAT_MODULE;
#endif
#include <vulkan/${vulkan_h}>

Expand Down
2 changes: 1 addition & 1 deletion snippets/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
# 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 )
#if ( 23 <= VULKAN_HPP_CPP_VERSION ) && defined( __cpp_lib_modules ) && !defined( VULKAN_HPP_STD_MODULE )
# define VULKAN_HPP_STD_MODULE std
# define VULKAN_HPP_STD_COMPAT_MODULE std.compat
#endif
Expand Down
2 changes: 0 additions & 2 deletions tests/CppStdModule/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
cmake_minimum_required( VERSION 3.30 )

set(CMAKE_CXX_MODULE_STD ON)

target_compile_features( VulkanHppModule PUBLIC cxx_std_23 )
target_compile_definitions( VulkanHppModule PUBLIC VULKAN_HPP_ENABLE_STD_MODULE )

Expand Down
9 changes: 0 additions & 9 deletions vulkan/vulkan.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@

module;

// clang-format off
#include <vulkan/vulkan_hpp_macros.hpp>
// clang-format on

#if defined( VULKAN_HPP_STD_MODULE )
import VULKAN_HPP_STD_MODULE;
import VULKAN_HPP_STD_COMPAT_MODULE;
#endif

#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_extension_inspection.hpp>
#include <vulkan/vulkan_format_traits.hpp>
Expand Down
3 changes: 3 additions & 0 deletions vulkan/vulkan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
# include <string.h> // strnlen
# include <string> // std::string
# include <utility> // std::exchange
#else
import VULKAN_HPP_STD_MODULE;
import VULKAN_HPP_STD_COMPAT_MODULE;
#endif
#include <vulkan/vulkan.h>

Expand Down
2 changes: 1 addition & 1 deletion vulkan/vulkan_hpp_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
# 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 )
#if ( 23 <= VULKAN_HPP_CPP_VERSION ) && defined( __cpp_lib_modules ) && !defined( VULKAN_HPP_STD_MODULE )
# define VULKAN_HPP_STD_MODULE std
# define VULKAN_HPP_STD_COMPAT_MODULE std.compat
#endif
Expand Down

0 comments on commit b9dd8a2

Please sign in to comment.