diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee0512e6df..788e46d4e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,17 +36,19 @@ jobs: shell: bash run: | if [ "$RUNNER_OS" == "Windows" ]; then - cmake . -DBUILD_SHARED_LIBS=${{matrix.build-shared}} -A x64 + cmake . -DBUILD_SHARED_LIBS=${{matrix.build-shared}} -DSELF_SUFFICIENT_HEADER_CHECK=ON -A x64 cmake --build . elif [ "$RUNNER_OS" == "Linux" ]; then sudo apt-get -qq update sudo apt-get -qq install libxcb1-dev - cmake . -DBUILD_SHARED_LIBS=${{matrix.build-shared}} + cmake . -DBUILD_SHARED_LIBS=${{matrix.build-shared}} -DSELF_SUFFICIENT_HEADER_CHECK=ON make -j 3 && sudo make install elif [ "$RUNNER_OS" == "macOS" ]; then - cmake . -DBUILD_SHARED_LIBS=${{matrix.build-shared}} + cmake . -DBUILD_SHARED_LIBS=${{matrix.build-shared}} -DSELF_SUFFICIENT_HEADER_CHECK=ON make -j 4 && sudo make install else echo "$RUNNER_OS not supported" exit 1 fi + - name: Self-sufficient header check + run: cmake --build . --target all_verify_interface_header_sets diff --git a/.gitignore b/.gitignore index 06da48daac..5dabadaa9a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ src/glslang # Autogenerated files include/vsg/core/Version.h +src/vsg/vsg_verify_interface_header_sets CMakeDoxyfile.in CMakeDoxygenDefaults.cmake diff --git a/include/vsg/core/IntrusiveAllocator.h b/include/vsg/core/IntrusiveAllocator.h index e85aba5e6a..8ebf4eee6b 100644 --- a/include/vsg/core/IntrusiveAllocator.h +++ b/include/vsg/core/IntrusiveAllocator.h @@ -16,6 +16,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #include #include +#include namespace vsg { diff --git a/include/vsg/io/read_line.h b/include/vsg/io/read_line.h index a3bbf307dd..aa7aabb7f0 100644 --- a/include/vsg/io/read_line.h +++ b/include/vsg/io/read_line.h @@ -10,6 +10,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI */ +#include #include namespace vsg diff --git a/include/vsg/maths/mat2.h b/include/vsg/maths/mat2.h index 9cb1db5452..79e70caaf0 100644 --- a/include/vsg/maths/mat2.h +++ b/include/vsg/maths/mat2.h @@ -13,6 +13,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI */ #include +#include namespace vsg { diff --git a/include/vsg/threading/FrameBlock.h b/include/vsg/threading/FrameBlock.h index fc277a5935..6d7d8f10be 100644 --- a/include/vsg/threading/FrameBlock.h +++ b/include/vsg/threading/FrameBlock.h @@ -15,6 +15,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #include #include +#include + namespace vsg { diff --git a/include/vsg/utils/CoordinateSpace.h b/include/vsg/utils/CoordinateSpace.h index 2e29f08908..ed5fe94854 100644 --- a/include/vsg/utils/CoordinateSpace.h +++ b/include/vsg/utils/CoordinateSpace.h @@ -12,6 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI */ +#include #include namespace vsg diff --git a/include/vsg/utils/TracyInstrumentation.h b/include/vsg/utils/TracyInstrumentation.h index 3f9d8aff74..5baf5d4fd0 100644 --- a/include/vsg/utils/TracyInstrumentation.h +++ b/include/vsg/utils/TracyInstrumentation.h @@ -12,12 +12,16 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI */ +#ifdef TRACY_ENABLE #include #include +#endif #include +#ifdef TRACY_ENABLE using namespace tracy; +#endif namespace vsg { diff --git a/include/vsg/vk/Queue.h b/include/vsg/vk/Queue.h index e4dbc167e7..a00a44f248 100644 --- a/include/vsg/vk/Queue.h +++ b/include/vsg/vk/Queue.h @@ -12,6 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI */ +#include #include #include diff --git a/include/vsg/vk/Slots.h b/include/vsg/vk/Slots.h index 9abfd2fac5..410cfaedb9 100644 --- a/include/vsg/vk/Slots.h +++ b/include/vsg/vk/Slots.h @@ -12,6 +12,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI */ +#include + namespace vsg { diff --git a/include/vsg/vk/vk_buffer.h b/include/vsg/vk/vk_buffer.h index 5877fb71e0..eb4833022c 100644 --- a/include/vsg/vk/vk_buffer.h +++ b/include/vsg/vk/vk_buffer.h @@ -15,6 +15,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #include #include +#include #include namespace vsg diff --git a/src/vsg/CMakeLists.txt b/src/vsg/CMakeLists.txt index db7e0b93bf..082dcf5649 100644 --- a/src/vsg/CMakeLists.txt +++ b/src/vsg/CMakeLists.txt @@ -334,7 +334,13 @@ if (VSG_SUPPORTS_Windowing) endif() endif() -add_library(vsg ${HEADERS} ${SOURCES}) +add_library(vsg ${SOURCES}) +if(CMAKE_VERSION VERSION_LESS 3.23) + target_sources(vsg PRIVATE ${HEADERS}) +else() + # make VERIFY_INTERFACE_HEADER_SETS work + target_sources(vsg PUBLIC FILE_SET HEADERS BASE_DIRS ${VSG_SOURCE_DIR}/include ${VSG_BINARY_DIR}/include FILES ${HEADERS}) +endif() # add definitions to enable building VulkanSceneGraph as part of submodule add_library(vsg::vsg ALIAS vsg) @@ -405,17 +411,27 @@ ASSIGN_SOURCE_GROUPS("Header Files" "${VSG_SOURCE_DIR}/include/vsg" ${HEADERS}) set_property(TARGET vsg PROPERTY VERSION ${VSG_VERSION_MAJOR}.${VSG_VERSION_MINOR}.${VSG_VERSION_PATCH}) set_property(TARGET vsg PROPERTY SOVERSION ${VSG_SOVERSION}) set_property(TARGET vsg PROPERTY POSITION_INDEPENDENT_CODE ON) -set_property(TARGET vsg PROPERTY CXX_STANDARD 17) +target_compile_features(vsg PUBLIC cxx_std_17) if(WIN32) set_property(TARGET vsg PROPERTY RUNTIME_OUTPUT_NAME vsg-${VSG_SOVERSION}) endif() target_compile_definitions(vsg PRIVATE ${EXTRA_DEFINES}) -target_include_directories(vsg - PUBLIC - $ - $ -) + +if (CMAKE_VERSION VERSION_LESS 3.23) + target_include_directories(vsg + PUBLIC + $ + $ + ) +endif() + +if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24) + option(SELF_SUFFICIENT_HEADER_CHECK "Adds a target which compiles headers individually to ensure they include all their dependencies" OFF) + if (SELF_SUFFICIENT_HEADER_CHECK) + set_target_properties(vsg PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON) + endif() +endif() target_link_libraries(vsg ${LIBRARIES}) @@ -423,15 +439,19 @@ if (BUILD_SHARED_LIBS) target_compile_definitions(vsg INTERFACE VSG_SHARED_LIBRARY) endif() -# install headers -install(DIRECTORY ${VSG_SOURCE_DIR}/include/vsg DESTINATION include) +if (CMAKE_VERSION VERSION_LESS 3.23) + # install headers + install(DIRECTORY ${VSG_SOURCE_DIR}/include/vsg DESTINATION include) -if (NOT(${VSG_BINARY_DIR} STREQUAL ${VSG_SOURCE_DIR})) - install(DIRECTORY ${VSG_BINARY_DIR}/include/vsg DESTINATION include) -endif() + if (NOT(${VSG_BINARY_DIR} STREQUAL ${VSG_SOURCE_DIR})) + install(DIRECTORY ${VSG_BINARY_DIR}/include/vsg DESTINATION include) + endif() -# install lib -install(TARGETS vsg ${VSG_INSTALL_TARGETS_DEFAULT_FLAGS}) + # install lib + install(TARGETS vsg ${VSG_INSTALL_TARGETS_DEFAULT_FLAGS}) +else() + install(TARGETS vsg ${VSG_INSTALL_TARGETS_DEFAULT_FLAGS} FILE_SET HEADERS) +endif() # install cmake config files. install(