Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-latest-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
-D VULKAN_HPP_TESTS_CTEST=ON \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_C_COMPILER=gcc \
-D CMAKE_CXX_COMPILER=g++ \
-D CMAKE_CXX_STANDARD=23 \
Expand Down
56 changes: 28 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,32 @@ jobs:
strategy:
matrix:
env: [
{ os: macos-14, cxx: clang++, c: clang, arch: x64, gen: Ninja, cxx_max: 23 },
{ os: macos-15, cxx: clang++, c: clang, arch: x64, gen: Ninja, cxx_max: 23 },
{ os: macos-26, cxx: clang++, c: clang, arch: x64, gen: Ninja, cxx_max: 23 },
# { os: macos-14, cxx: clang++, c: clang, arch: x64, gen: Ninja, cxx_max: 23 },
# { os: macos-15, cxx: clang++, c: clang, arch: x64, gen: Ninja, cxx_max: 23 },
# { os: macos-26, cxx: clang++, c: clang, arch: x64, gen: Ninja, cxx_max: 23 },

{ os: ubuntu-22.04, cxx: g++-10, c: gcc-10, arch: x64, gen: Ninja, cxx_max: 17 },
{ os: ubuntu-22.04, cxx: g++-11, c: gcc-11, arch: x64, gen: Ninja, cxx_max: 23 },
{ os: ubuntu-22.04, cxx: clang++-13, c: clang-13, arch: x64, gen: Ninja, cxx_max: 20 },
{ os: ubuntu-22.04, cxx: clang++-14, c: clang-14, arch: x64, gen: Ninja, cxx_max: 20 },
{ os: ubuntu-22.04, cxx: clang++-15, c: clang-15, arch: x64, gen: Ninja, cxx_max: 20 },

{ os: ubuntu-24.04, cxx: g++-12, c: gcc-12, arch: x64, gen: Ninja, cxx_max: 23 },
{ os: ubuntu-24.04, cxx: g++-13, c: gcc-13, arch: x64, gen: Ninja, cxx_max: 23 },
{ os: ubuntu-24.04, cxx: g++-14, c: gcc-14, arch: x64, gen: Ninja, cxx_max: 23 },
{ os: ubuntu-24.04, cxx: clang++-16, c: clang-16, arch: x64, gen: Ninja, cxx_max: 20 },
{ os: ubuntu-24.04, cxx: clang++-17, c: clang-17, arch: x64, gen: Ninja, cxx_max: 20 },
{ os: ubuntu-24.04, cxx: clang++-18, c: clang-18, arch: x64, gen: Ninja, cxx_max: 23 },

{ os: windows-2022, cxx: cl, c: cl, arch: x86, gen: Visual Studio 17 2022, cxx_max: 23 },
{ os: windows-2022, cxx: cl, c: cl, arch: x64, gen: Visual Studio 17 2022, cxx_max: 23 },
{ os: windows-2022, cxx: clang-cl, c: clang-cl, arch: x64, gen: Ninja, cxx_max: 23 },
# { os: windows-2022, cxx: c++, c: cc, arch: x64, gen: Visual Studio 17 2022, cxx_max: 23 },

{ os: windows-2025, cxx: cl, c: cl, arch: x86, gen: Visual Studio 17 2022, cxx_max: 23 },
{ os: windows-2025, cxx: cl, c: cl, arch: x64, gen: Visual Studio 17 2022, cxx_max: 23 },
{ os: windows-2025, cxx: clang-cl, c: clang-cl, arch: x64, gen: Ninja, cxx_max: 23 },
# { os: windows-2025, cxx: c++, c: cc, arch: x64, gen: Visual Studio 17 2022, cxx_max: 23 },
# { os: ubuntu-22.04, cxx: g++-10, c: gcc-10, arch: x64, gen: Ninja, cxx_max: 17 },
# { os: ubuntu-22.04, cxx: g++-11, c: gcc-11, arch: x64, gen: Ninja, cxx_max: 23 },
# { os: ubuntu-22.04, cxx: clang++-13, c: clang-13, arch: x64, gen: Ninja, cxx_max: 20 },
# { os: ubuntu-22.04, cxx: clang++-14, c: clang-14, arch: x64, gen: Ninja, cxx_max: 20 },
# { os: ubuntu-22.04, cxx: clang++-15, c: clang-15, arch: x64, gen: Ninja, cxx_max: 20 },

# { os: ubuntu-24.04, cxx: g++-12, c: gcc-12, arch: x64, gen: Ninja, cxx_max: 23 },
# { os: ubuntu-24.04, cxx: g++-13, c: gcc-13, arch: x64, gen: Ninja, cxx_max: 23 },
# { os: ubuntu-24.04, cxx: g++-14, c: gcc-14, arch: x64, gen: Ninja, cxx_max: 23 },
# { os: ubuntu-24.04, cxx: clang++-16, c: clang-16, arch: x64, gen: Ninja, cxx_max: 20 },
# { os: ubuntu-24.04, cxx: clang++-17, c: clang-17, arch: x64, gen: Ninja, cxx_max: 20 },
# { os: ubuntu-24.04, cxx: clang++-18, c: clang-18, arch: x64, gen: Ninja, cxx_max: 23 },

# { os: windows-2022, cxx: cl, c: cl, arch: x86, gen: Visual Studio 17 2022, cxx_max: 23 },
# { os: windows-2022, cxx: cl, c: cl, arch: x64, gen: Visual Studio 17 2022, cxx_max: 23 },
# { os: windows-2022, cxx: clang-cl, c: clang-cl, arch: x64, gen: Ninja, cxx_max: 23 },
# # { os: windows-2022, cxx: c++, c: cc, arch: x64, gen: Visual Studio 17 2022, cxx_max: 23 },

# { os: windows-2025, cxx: cl, c: cl, arch: x86, gen: Visual Studio 17 2022, cxx_max: 23 },
# { os: windows-2025, cxx: cl, c: cl, arch: x64, gen: Visual Studio 17 2022, cxx_max: 23 },
# { os: windows-2025, cxx: clang-cl, c: clang-cl, arch: x64, gen: Ninja, cxx_max: 23 },
# # { os: windows-2025, cxx: c++, c: cc, arch: x64, gen: Visual Studio 17 2022, cxx_max: 23 },

{ os: macos-26, cxx: /opt/homebrew/opt/llvm/bin/clang++, c: /opt/homebrew/opt/llvm/bin/clang, arch: x64, gen: Ninja, modules: true, cxx_max: 23, cxx_flags: '-I/opt/homebrew/opt/llvm/include/c++/v1 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk', linker_flags: '-L/opt/homebrew/opt/llvm/lib/c++' },
{ os: ubuntu-24.04, cxx: clang++-21, c: clang-21, arch: x64, gen: Ninja, modules: true, cxx_max: 23, cxx_flags: '-stdlib=libc++', linker_flags: '-stdlib=libc++ -lc++abi' },
Expand Down Expand Up @@ -101,12 +101,12 @@ jobs:
${{matrix.env.linker_flags && format('-D CMAKE_EXE_LINKER_FLAGS=''{0}''', matrix.env.linker_flags)}} \
-D VULKAN_HPP_GENERATOR_BUILD=ON \
-D VULKAN_HPP_RUN_GENERATOR=ON \
-D VULKAN_HPP_SAMPLES_BUILD=ON \
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
-D VULKAN_HPP_TESTS_BUILD=OFF \
-D VULKAN_HPP_TESTS_CTEST=ON \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_STANDARD=${{matrix.env.cxx_max}} \
-D CMAKE_BUILD_TYPE=$BUILD_TYPE
cmake --build build --parallel --config $BUILD_TYPE --clean-first
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
-D VULKAN_HPP_TESTS_CTEST=ON \
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
-D VULKAN_HPP_PRECOMPILE=ON \
-D VULKAN_HPP_PRECOMPILE=OFF \
-D CMAKE_CXX_STANDARD=$CXX_STANDARD \
-D CMAKE_BUILD_TYPE=$BUILD_TYPE
cmake --build build --parallel --config $BUILD_TYPE --clean-first
Expand Down
38 changes: 20 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if( NOT DEFINED CMAKE_CXX_STANDARD AND PROJECT_IS_TOP_LEVEL )
endif()

# all the options for this project
option( VULKAN_HPP_PRECOMPILE "Precompile vulkan.hpp and vulkan_raii.hpp for sample builds" ON )
option( VULKAN_HPP_PRECOMPILE "Precompile vulkan.hpp and vulkan_raii.hpp for sample builds" OFF )
option( VULKAN_HPP_RUN_GENERATOR "Run the HPP generator" OFF )
option( VULKAN_HPP_GENERATOR_BUILD "Build the HPP generator" ${PROJECT_IS_TOP_LEVEL} )
option( VULKAN_HPP_SAMPLES_BUILD "Build samples" OFF )
Expand Down Expand Up @@ -264,7 +264,7 @@ function( vulkan_hpp__setup_vulkan_targets )
target_include_directories( VulkanHpp INTERFACE "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Vulkan-Headers/include" )
else()
find_package( Vulkan REQUIRED )
target_include_directories( VulkanHpp INTERFACE "${Vulkan_INCLUDE_DIRS}" )
target_include_directories( ${TARGET_NAME} PUBLIC "${Vulkan_INCLUDE_DIRS}" )
endif()
if( VULKAN_HPP_RUN_GENERATOR )
add_dependencies( VulkanHpp build_vulkan_hpp build_video_hpp )
Expand Down Expand Up @@ -401,16 +401,8 @@ function( vulkan_hpp__setup_library )
endif()
vulkan_hpp__setup_platform( NAME ${TARGET_NAME} )
vulkan_hpp__setup_warning_level( NAME ${TARGET_NAME} )
target_link_libraries( ${TARGET_NAME} PUBLIC Vulkan::Hpp )
set_target_properties( ${TARGET_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON )
if( VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP )
# Vulkan C headers
target_include_directories( ${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Vulkan-Headers/include" )
# Vulkan C++ headers
target_include_directories( ${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_FUNCTION_LIST_DIR}" )
else()
find_package( Vulkan REQUIRED )
target_include_directories( ${TARGET_NAME} PUBLIC "${Vulkan_INCLUDE_DIRS}" )
endif()
endif()
set_target_properties( ${TARGET_NAME} PROPERTIES FOLDER ${TARGET_FOLDER} )
endfunction()
Expand All @@ -421,10 +413,18 @@ function( vulkan_hpp__setup_sample )
set( multiValueArgs HEADERS LIBS PCH SOURCES )
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )

if( NOT VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP )
find_package( Vulkan REQUIRED )
endif()

vulkan_hpp__setup_project( NAME ${TARGET_NAME} )

add_executable( ${TARGET_NAME} ${TARGET_HEADERS} ${TARGET_SOURCES} )

vulkan_hpp__setup_platform( NAME ${TARGET_NAME} )
vulkan_hpp__setup_warning_level( NAME ${TARGET_NAME} )
target_link_libraries( ${TARGET_NAME} PUBLIC Vulkan::Hpp )

set_target_properties( ${TARGET_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON )

if( TARGET_FOLDER )
Expand Down Expand Up @@ -459,9 +459,11 @@ function( vulkan_hpp__setup_sample_static )
vulkan_hpp__setup_sample(
NAME ${TARGET_NAME}
FOLDER Samples
PCH_REUSE utils_static
PCH <vulkan/vulkan.hpp>
SOURCES ${TARGET_NAME}.cpp
LIBS utils_static ${Vulkan_LIBRARIES} )
LIBS ${Vulkan_LIBRARIES} )

target_compile_definitions( ${TARGET_NAME} PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
endfunction()

function( vulkan_hpp__setup_sample_dynamic )
Expand All @@ -480,10 +482,10 @@ function( vulkan_hpp__setup_sample_dynamic )
vulkan_hpp__setup_sample(
NAME ${TARGET_NAME}
FOLDER Samples
PCH_REUSE utils_dynamic
PCH_REUSE utils
HEADERS ${TARGET_HEADERS}
SOURCES ${TARGET_SOURCES}
LIBS utils_dynamic )
LIBS utils )
endfunction()

function( vulkan_hpp__setup_sample_raii )
Expand All @@ -502,10 +504,10 @@ function( vulkan_hpp__setup_sample_raii )
vulkan_hpp__setup_sample(
NAME RAII_${TARGET_NAME}
FOLDER RAII_Samples
PCH_REUSE utils_dynamic
PCH_REUSE utils
HEADERS ${TARGET_HEADERS}
SOURCES ${TARGET_SOURCES}
LIBS utils_dynamic )
LIBS utils )
endfunction()

# set up CTest or add_subdirectory test
Expand Down Expand Up @@ -591,7 +593,7 @@ function( vulkan_hpp__setup_test_project )

vulkan_hpp__setup_project( NAME ${TARGET_NAME} )
add_executable( ${TARGET_NAME} ${CPP_FILE} )

target_link_libraries( ${TARGET_NAME} PUBLIC Vulkan::Hpp )
target_compile_definitions( ${TARGET_NAME} PUBLIC ${TARGET_COMPILE_DEFINITIONS} )

Expand Down
2 changes: 0 additions & 2 deletions RAII_Samples/utils/shaders.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#pragma once

// Copyright(c) 2019, NVIDIA CORPORATION. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion VideoHppGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ VideoHppGenerator::VideoHppGenerator( tinyxml2::XMLDocument const & document )
void VideoHppGenerator::generateCppmFile() const
{
generateFileFromTemplate(
"vulkan_video.cppm", "VideoCppmTemplate.hpp", { { "copyrightMessage", m_copyrightMessage }, { "usings", generateCppModuleUsings() } } );
"vulkan_video.cppm", "VideoCppmTemplate.hpp", { { "copyrightMessage", m_copyrightMessage }, { "includes", generateIncludes() } } );
}

void VideoHppGenerator::generateHppFile() const
Expand Down
5 changes: 2 additions & 3 deletions VulkanHppGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,9 @@ void VulkanHppGenerator::generateCppmFile() const
generateFileFromTemplate( m_api + ".cppm",
"CppmTemplate.hpp",
{ { "api", m_api },
{ "hashSpecializations", generateCppModuleHashSpecializations() },
{ "vulkan_h", ( m_api == "vulkansc" ) ? "vulkan_sc_core.h" : ( m_api + ".h" ) },
{ "licenseHeader", m_vulkanLicenseHeader },
{ "raiiUsings", generateCppModuleRaiiUsings() },
{ "usings", generateCppModuleUsings() },
{ "headerVersion", m_version },
{ "pfnCommands", generateCppModuleCommands() } } );
}

Expand Down
33 changes: 9 additions & 24 deletions samples/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,20 @@
# limitations under the License.

vulkan_hpp__setup_library(
NAME utils_static
HEADERS math.hpp shaders.hpp utils.hpp
SOURCES math.cpp shaders.cpp utils.cpp
FOLDER "Samples" )

vulkan_hpp__setup_library(
NAME utils_dynamic
NAME utils
HEADERS math.hpp shaders.hpp utils.hpp
SOURCES math.cpp shaders.cpp utils.cpp
FOLDER "Samples" )

if( VULKAN_HPP_RUN_GENERATOR )
add_dependencies( utils_static build_vulkan_hpp )
add_dependencies( utils_dynamic build_vulkan_hpp )
add_dependencies( utils build_vulkan_hpp )
endif()

target_link_libraries( utils_static PUBLIC glfw )
target_link_libraries( utils_static PUBLIC glm::glm )
target_link_libraries( utils_static PUBLIC glslang::glslang )
target_link_libraries( utils_static PUBLIC glslang::glslang-default-resource-limits )
target_link_libraries( utils_static PUBLIC glslang::SPIRV )
target_compile_definitions( utils_static PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
target_precompile_headers( utils_static PRIVATE "pch.hpp" )

target_link_libraries( utils_dynamic PUBLIC glfw )
target_link_libraries( utils_dynamic PUBLIC glm::glm )
target_link_libraries( utils_dynamic PUBLIC glslang::glslang )
target_link_libraries( utils_dynamic PUBLIC glslang::glslang-default-resource-limits )
target_link_libraries( utils_dynamic PUBLIC glslang::SPIRV )
target_compile_definitions( utils_dynamic PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 )
target_precompile_headers( utils_dynamic PRIVATE "pch.hpp" )
target_link_libraries( utils PUBLIC glm::glm )
target_link_libraries( utils PUBLIC glfw )
target_link_libraries( utils PUBLIC glslang::glslang )
target_link_libraries( utils PUBLIC glslang::glslang-default-resource-limits )
target_link_libraries( utils PUBLIC glslang::SPIRV )
target_compile_definitions( utils PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 )

target_precompile_headers( utils PRIVATE <vulkan/vulkan.hpp> )
2 changes: 0 additions & 2 deletions samples/utils/geometries.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#pragma once

// Copyright(c) 2019, NVIDIA CORPORATION. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 0 additions & 2 deletions samples/utils/math.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#pragma once

// Copyright(c) 2019, NVIDIA CORPORATION. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
26 changes: 0 additions & 26 deletions samples/utils/pch.hpp

This file was deleted.

2 changes: 0 additions & 2 deletions samples/utils/shaders.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#pragma once

// Copyright(c) 2019, NVIDIA CORPORATION. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
51 changes: 23 additions & 28 deletions snippets/CppmTemplate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ module;

#define VULKAN_HPP_CXX_MODULE 1

#include <cassert>
#include <cstring>
#include <vulkan/${vulkan_h}>
#include <vulkan/vulkan_hpp_macros.hpp>

#if !defined( VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING )
Expand All @@ -15,42 +18,34 @@ module;
VULKAN_HPP_COMPILE_WARNING( VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING )
#endif

#include <vulkan/${api}.hpp>
#include <vulkan/${api}_extension_inspection.hpp>
#include <vulkan/${api}_format_traits.hpp>
#include <vulkan/${api}_hash.hpp>
#include <vulkan/${api}_raii.hpp>
#include <vulkan/${api}_shared.hpp>

export module ${api};
export import :video;

export import std;

export namespace VULKAN_HPP_NAMESPACE
{
${usings}
VULKAN_HPP_STATIC_ASSERT( VK_HEADER_VERSION == ${headerVersion}, "Wrong VK_HEADER_VERSION!" );

#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
namespace VULKAN_HPP_RAII_NAMESPACE
{
${raiiUsings}
} // namespace VULKAN_HPP_RAII_NAMESPACE
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 5244)
#elif defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Winclude-angled-in-module-purview"
#elif defined(__GNUC__)
#endif
} // namespace VULKAN_HPP_NAMESPACE

export namespace std
{
${hashSpecializations}

//=================================================================
//=== Required exports for VULKAN_HPP_NAMESPACE::StructureChain ===
//=================================================================
#include <vulkan/${api}.hpp>
#include <vulkan/${api}_extension_inspection.hpp>
#include <vulkan/${api}_format_traits.hpp>
#include <vulkan/${api}_hash.hpp>
#include <vulkan/${api}_raii.hpp>
#include <vulkan/${api}_shared.hpp>

#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
using std::tuple_size;
using std::tuple_element;
#if defined(_MSC_VER)
# pragma warning(pop)
#elif defined(__clang__)
# pragma clang diagnostic pop
#elif defined(__GNUC__)
#endif
}

export
{
Expand Down
2 changes: 1 addition & 1 deletion snippets/EnumsHppTemplate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# include <type_traits> // for std::underlying_type
#endif

namespace VULKAN_HPP_NAMESPACE
VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
{
${Flags}

Expand Down
Loading
Loading