Skip to content

Commit 3527223

Browse files
committed
Initial experiment: migrate module vulkan:video to ABI-breaking style
1 parent 67ec7c9 commit 3527223

File tree

7 files changed

+854
-673
lines changed

7 files changed

+854
-673
lines changed

VideoHppGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ VideoHppGenerator::VideoHppGenerator( tinyxml2::XMLDocument const & document )
3636
void VideoHppGenerator::generateCppmFile() const
3737
{
3838
generateFileFromTemplate(
39-
"vulkan_video.cppm", "VideoCppmTemplate.hpp", { { "copyrightMessage", m_copyrightMessage }, { "usings", generateCppModuleUsings() } } );
39+
"vulkan_video.cppm", "VideoCppmTemplate.hpp", { { "copyrightMessage", m_copyrightMessage }, { "includes", generateIncludes() } } );
4040
}
4141

4242
void VideoHppGenerator::generateHppFile() const

snippets/MacrosHppTemplate.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@
9696
# define VULKAN_HPP_SUPPORT_SPAN
9797
#endif
9898

99+
#if defined( VULKAN_HPP_CXX_MODULE )
100+
# define VULKAN_HPP_EXPORT export
101+
#else
102+
# define VULKAN_HPP_EXPORT
103+
#endif
104+
99105
#if defined( VULKAN_HPP_CXX_MODULE ) && !( defined( __cpp_modules ) && defined( __cpp_lib_modules ) )
100106
VULKAN_HPP_COMPILE_WARNING( "This is a non-conforming implementation of C++ named modules and the standard library module." )
101107
#endif

snippets/VideoCppmTemplate.hpp

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,29 @@ module;
44

55
#define VULKAN_HPP_CXX_MODULE 1
66

7+
${includes}
8+
9+
// clang-format off
710
#include <vulkan/vulkan_hpp_macros.hpp>
11+
// clang-format on
12+
#include <vulkan/vulkan.hpp>
813

9-
#if !defined( VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING )
10-
# define VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING \
11-
"\n\tThe Vulkan-Hpp C++ named module is experimental. It is subject to change without prior notice.\n" \
12-
"\tTo silence this warning, define the VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING macro.\n" \
13-
"\tFor feedback, go to: https://github.com/KhronosGroup/Vulkan-Hpp/issues"
14+
export module vulkan:video;
1415

15-
VULKAN_HPP_COMPILE_WARNING( VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING )
16+
#if defined(_MSC_VER)
17+
# pragma warning(push)
18+
# pragma warning(disable : 5244)
19+
#elif defined(__clang__)
20+
# pragma clang diagnostic push
21+
# pragma clang diagnostic ignored "-Winclude-angled-in-module-purview"
22+
#elif defined(__GNUC__)
1623
#endif
1724

1825
#include <vulkan/vulkan_video.hpp>
1926

20-
export module vulkan:video;
21-
22-
export namespace VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE
23-
{
24-
${usings}
25-
} // namespace VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE
27+
#if defined(_MSC_VER)
28+
# pragma warning(pop)
29+
#elif defined(__clang__)
30+
# pragma clang diagnostic pop
31+
#elif defined(__GNUC__)
32+
#endif

snippets/VideoHppTemplate.hpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@
99
# define has_include_was_not_defined
1010
#endif
1111

12-
// clang-format off
13-
#include <vulkan/vulkan.hpp>
14-
// clang-format on
15-
12+
#if !defined( VULKAN_HPP_CXX_MODULE )
13+
# include <vulkan/vulkan.hpp>
1614
${includes}
15+
#endif
1716

1817
#if !defined( VULKAN_HPP_VIDEO_NAMESPACE )
1918
# define VULKAN_HPP_VIDEO_NAMESPACE video
2019
#endif
2120

22-
namespace VULKAN_HPP_NAMESPACE
21+
VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
2322
{
2423
namespace VULKAN_HPP_VIDEO_NAMESPACE
2524
{
@@ -34,4 +33,4 @@ namespace VULKAN_HPP_VIDEO_NAMESPACE
3433
# undef __has_include
3534
#endif
3635

37-
#endif
36+
#endif

vulkan/vulkan_hpp_macros.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@
9999
# define VULKAN_HPP_SUPPORT_SPAN
100100
#endif
101101

102+
#if defined( VULKAN_HPP_CXX_MODULE )
103+
# define VULKAN_HPP_EXPORT export
104+
#else
105+
# define VULKAN_HPP_EXPORT
106+
#endif
107+
102108
#if defined( VULKAN_HPP_CXX_MODULE ) && !( defined( __cpp_modules ) && defined( __cpp_lib_modules ) )
103109
VULKAN_HPP_COMPILE_WARNING( "This is a non-conforming implementation of C++ named modules and the standard library module." )
104110
#endif

vulkan/vulkan_video.cppm

Lines changed: 42 additions & 295 deletions
Large diffs are not rendered by default.

vulkan/vulkan_video.hpp

Lines changed: 775 additions & 359 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)