Skip to content
Open
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=OFF \
-D VULKAN_HPP_PRECOMPILE=ON \
-D CMAKE_C_COMPILER=gcc \
-D CMAKE_CXX_COMPILER=g++ \
-D CMAKE_CXX_STANDARD=23 \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,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=OFF \
-D VULKAN_HPP_PRECOMPILE=ON \
-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=OFF \
-D VULKAN_HPP_PRECOMPILE=ON \
-D CMAKE_CXX_STANDARD=$CXX_STANDARD \
-D CMAKE_BUILD_TYPE=$BUILD_TYPE
cmake --build build --parallel --config $BUILD_TYPE --clean-first
Expand Down
36 changes: 17 additions & 19 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" OFF )
option( VULKAN_HPP_PRECOMPILE "Precompile vulkan.hpp and vulkan_raii.hpp for sample builds" ON )
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( ${TARGET_NAME} PUBLIC "${Vulkan_INCLUDE_DIRS}" )
target_include_directories( VulkanHpp INTERFACE "${Vulkan_INCLUDE_DIRS}" )
endif()
if( VULKAN_HPP_RUN_GENERATOR )
add_dependencies( VulkanHpp build_vulkan_hpp build_video_hpp )
Expand Down Expand Up @@ -401,8 +401,16 @@ 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 @@ -413,18 +421,10 @@ 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,11 +459,9 @@ function( vulkan_hpp__setup_sample_static )
vulkan_hpp__setup_sample(
NAME ${TARGET_NAME}
FOLDER Samples
PCH <vulkan/vulkan.hpp>
PCH_REUSE utils_static
SOURCES ${TARGET_NAME}.cpp
LIBS ${Vulkan_LIBRARIES} )

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

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

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

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

// Copyright(c) 2019, NVIDIA CORPORATION. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
33 changes: 24 additions & 9 deletions samples/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,35 @@
# limitations under the License.

vulkan_hpp__setup_library(
NAME utils
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
HEADERS math.hpp shaders.hpp utils.hpp
SOURCES math.cpp shaders.cpp utils.cpp
FOLDER "Samples" )

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

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

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

// Copyright(c) 2019, NVIDIA CORPORATION. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
26 changes: 26 additions & 0 deletions samples/utils/pch.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_raii.hpp>

#include <GLFW/glfw3.h>
#include <glslang/Public/ShaderLang.h>
#include <glslang/SPIRV/GlslangToSpv.h>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/glm.hpp>
#include <glm/gtx/rotate_vector.hpp>
#include <glm/gtc/matrix_inverse.hpp>
#include <glm/gtc/matrix_transform.hpp>

#include <map>
#include <memory>
#include <string>
#include <thread>
#include <limits>
#include <vector>
#include <numeric>
#include <sstream>
#include <iostream>

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

// Copyright(c) 2019, NVIDIA CORPORATION. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ vulkan_hpp__setup_library(
NAME DispatchLoaderDynamicSharedLibrary
SOURCES DispatchLoaderDynamicSharedLibrary.cpp
FOLDER "Tests" )
target_compile_definitions( DispatchLoaderDynamicSharedLibrary PUBLIC VULKAN_HPP_STORAGE_SHARED )
target_compile_definitions( DispatchLoaderDynamicSharedLibrary PUBLIC VULKAN_HPP_STORAGE_SHARED VULKAN_HPP_DISPATCH_LOADER_DYNAMIC )
target_compile_definitions( DispatchLoaderDynamicSharedLibrary PRIVATE VULKAN_HPP_STORAGE_SHARED_EXPORT )

vulkan_hpp__setup_test_project()
Expand Down