diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c7017b..8d87447 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,11 @@ ############################################################################### -cmake_minimum_required(VERSION 3.18.0) +cmake_minimum_required(VERSION 3.20.0) project(cruft-vulkan CXX) ############################################################################### +nc_deps(util) + find_package (Python3 REQUIRED COMPONENTS Interpreter) find_package (glfw3 REQUIRED) @@ -64,8 +66,6 @@ endif() ##----------------------------------------------------------------------------- list (APPEND VK_LOAD_SOURCES load/fwd.hpp - ${GENERATED_PREFIX}/load/vtable.hpp - ${GENERATED_PREFIX}/load/dispatch.cpp load/dispatch.hpp load/init.cpp load/ostream.cpp @@ -76,28 +76,35 @@ list (APPEND VK_LOAD_SOURCES load/vtable.cpp ) +list (TRANSFORM VK_LOAD_SOURCES PREPEND "cruft/vk/") + +list (APPEND VK_LOAD_SOURCES + "${GENERATED_PREFIX}/load/vtable.hpp" + "${GENERATED_PREFIX}/load/dispatch.cpp" +) + add_library (vulkan SHARED ${VK_LOAD_SOURCES}) set_target_properties(vulkan PROPERTIES VERSION 1.1.98) set_target_properties(vulkan PROPERTIES SOVERSION 1) -add_library (cruft-vk-load STATIC ${VK_LOAD_SOURCES}) +add_library (libcruft-vk-load STATIC ${VK_LOAD_SOURCES}) -foreach (lib vulkan cruft-vk-load) +foreach (lib vulkan libcruft-vk-load) target_include_directories (${lib} PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}" - "${GENERATED_PREFIX}" "${CMAKE_CURRENT_SOURCE_DIR}/specs/include/vulkan" + $ + $ ) - target_link_libraries (${lib} cruft-json cruft) + target_link_libraries (${lib} cruft-json cruft::util) endforeach () +add_library(cruft::vk-load ALIAS libcruft-vk-load) + ############################################################################### list (APPEND sources - "${GENERATED_PREFIX}/vk.hpp" - fwd.hpp object.cpp object.hpp @@ -155,17 +162,28 @@ list (APPEND sources ) -##----------------------------------------------------------------------------- -add_library (cruft-vk STATIC ${sources}) -target_link_libraries (cruft-vk cruft) -target_include_directories (cruft-vk -PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}" - "${GENERATED_PREFIX}" - "${CMAKE_CURRENT_SOURCE_DIR}/specs/include/vulkan" +list (TRANSFORM sources PREPEND "cruft/vk/") + +list (APPEND sources + "${GENERATED_PREFIX}/vk.hpp" ) +##----------------------------------------------------------------------------- +add_library (libcruft-vk STATIC ${sources}) +target_link_libraries (libcruft-vk cruft::util) +target_include_directories (libcruft-vk +PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/specs/include/vulkan" + $ + $ +) +target_link_libraries (libcruft-vk cruft::util) + +add_library(cruft::vk ALIAS libcruft-vk) + + + ############################################################################### list (APPEND shaders tools/hello/shader.vert @@ -205,8 +223,8 @@ foreach (t info hello) "${CMAKE_CURRENT_BINARY_DIR}/tools") endforeach () -target_link_libraries (vk_info cruft-vk cruft-vk-load) -target_link_libraries (vk_hello ${NC_CXX_STDCXXFS} cruft cruft-vk glfw vulkan) +target_link_libraries (vk_info cruft::vk cruft::vk-load) +target_link_libraries (vk_hello ${NC_CXX_STDCXXFS} cruft::util cruft::vk glfw vulkan) add_library (trace SHARED "${GENERATED_PREFIX}/tools/trace.cpp" @@ -219,7 +237,7 @@ PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/specs/include/vulkan" ) -target_link_libraries(trace cruft-vk) +target_link_libraries(trace cruft::vk) ##----------------------------------------------------------------------------- add_dependencies (vk_hello hello.vert.spv hello.frag.spv) diff --git a/buffer.cpp b/cruft/vk/buffer.cpp similarity index 100% rename from buffer.cpp rename to cruft/vk/buffer.cpp diff --git a/buffer.hpp b/cruft/vk/buffer.hpp similarity index 100% rename from buffer.hpp rename to cruft/vk/buffer.hpp diff --git a/callback.hpp b/cruft/vk/callback.hpp similarity index 100% rename from callback.hpp rename to cruft/vk/callback.hpp diff --git a/command_buffer.cpp b/cruft/vk/command_buffer.cpp similarity index 100% rename from command_buffer.cpp rename to cruft/vk/command_buffer.cpp diff --git a/command_buffer.hpp b/cruft/vk/command_buffer.hpp similarity index 100% rename from command_buffer.hpp rename to cruft/vk/command_buffer.hpp diff --git a/command_pool.cpp b/cruft/vk/command_pool.cpp similarity index 100% rename from command_pool.cpp rename to cruft/vk/command_pool.cpp diff --git a/command_pool.hpp b/cruft/vk/command_pool.hpp similarity index 100% rename from command_pool.hpp rename to cruft/vk/command_pool.hpp diff --git a/device.cpp b/cruft/vk/device.cpp similarity index 100% rename from device.cpp rename to cruft/vk/device.cpp diff --git a/device.hpp b/cruft/vk/device.hpp similarity index 100% rename from device.hpp rename to cruft/vk/device.hpp diff --git a/device_memory.cpp b/cruft/vk/device_memory.cpp similarity index 100% rename from device_memory.cpp rename to cruft/vk/device_memory.cpp diff --git a/device_memory.hpp b/cruft/vk/device_memory.hpp similarity index 100% rename from device_memory.hpp rename to cruft/vk/device_memory.hpp diff --git a/event.cpp b/cruft/vk/event.cpp similarity index 100% rename from event.cpp rename to cruft/vk/event.cpp diff --git a/event.hpp b/cruft/vk/event.hpp similarity index 100% rename from event.hpp rename to cruft/vk/event.hpp diff --git a/except.cpp b/cruft/vk/except.cpp similarity index 100% rename from except.cpp rename to cruft/vk/except.cpp diff --git a/except.hpp b/cruft/vk/except.hpp similarity index 99% rename from except.hpp rename to cruft/vk/except.hpp index 555446c..0b3570f 100644 --- a/except.hpp +++ b/cruft/vk/except.hpp @@ -10,7 +10,7 @@ #ifndef CRUFT_VK_EXCEPT_HPP #define CRUFT_VK_EXCEPT_HPP -#include "./vk.hpp" +#include #include #include diff --git a/fence.cpp b/cruft/vk/fence.cpp similarity index 100% rename from fence.cpp rename to cruft/vk/fence.cpp diff --git a/fence.hpp b/cruft/vk/fence.hpp similarity index 100% rename from fence.hpp rename to cruft/vk/fence.hpp diff --git a/framebuffer.cpp b/cruft/vk/framebuffer.cpp similarity index 100% rename from framebuffer.cpp rename to cruft/vk/framebuffer.cpp diff --git a/framebuffer.hpp b/cruft/vk/framebuffer.hpp similarity index 100% rename from framebuffer.hpp rename to cruft/vk/framebuffer.hpp diff --git a/fwd.hpp b/cruft/vk/fwd.hpp similarity index 99% rename from fwd.hpp rename to cruft/vk/fwd.hpp index 4d8ca7e..94e7886 100644 --- a/fwd.hpp +++ b/cruft/vk/fwd.hpp @@ -10,7 +10,7 @@ #ifndef CRUFT_VK_FWD_HPP #define CRUFT_VK_FWD_HPP -#include "vk.hpp" +#include #include diff --git a/image.cpp b/cruft/vk/image.cpp similarity index 100% rename from image.cpp rename to cruft/vk/image.cpp diff --git a/image.hpp b/cruft/vk/image.hpp similarity index 100% rename from image.hpp rename to cruft/vk/image.hpp diff --git a/image_view.hpp b/cruft/vk/image_view.hpp similarity index 100% rename from image_view.hpp rename to cruft/vk/image_view.hpp diff --git a/instance.cpp b/cruft/vk/instance.cpp similarity index 100% rename from instance.cpp rename to cruft/vk/instance.cpp diff --git a/instance.hpp b/cruft/vk/instance.hpp similarity index 92% rename from instance.hpp rename to cruft/vk/instance.hpp index d0fa466..5c866c0 100644 --- a/instance.hpp +++ b/cruft/vk/instance.hpp @@ -9,11 +9,11 @@ #pragma once -#include "./object.hpp" +#include -#include "./vk.hpp" -#include "./traits.hpp" -#include "./except.hpp" +#include +#include +#include #include diff --git a/load/dispatch.hpp b/cruft/vk/load/dispatch.hpp similarity index 100% rename from load/dispatch.hpp rename to cruft/vk/load/dispatch.hpp diff --git a/load/fwd.hpp b/cruft/vk/load/fwd.hpp similarity index 100% rename from load/fwd.hpp rename to cruft/vk/load/fwd.hpp diff --git a/load/init.cpp b/cruft/vk/load/init.cpp similarity index 95% rename from load/init.cpp rename to cruft/vk/load/init.cpp index 8767faf..4151d28 100644 --- a/load/init.cpp +++ b/cruft/vk/load/init.cpp @@ -7,8 +7,8 @@ */ -#include "load/vtable.hpp" -#include "load/vendor.hpp" +#include +#include #include diff --git a/load/ostream.cpp b/cruft/vk/load/ostream.cpp similarity index 100% rename from load/ostream.cpp rename to cruft/vk/load/ostream.cpp diff --git a/load/ostream.hpp b/cruft/vk/load/ostream.hpp similarity index 100% rename from load/ostream.hpp rename to cruft/vk/load/ostream.hpp diff --git a/load/vendor.cpp b/cruft/vk/load/vendor.cpp similarity index 100% rename from load/vendor.cpp rename to cruft/vk/load/vendor.cpp diff --git a/load/vendor.hpp b/cruft/vk/load/vendor.hpp similarity index 94% rename from load/vendor.hpp rename to cruft/vk/load/vendor.hpp index c72329f..633633b 100644 --- a/load/vendor.hpp +++ b/cruft/vk/load/vendor.hpp @@ -1,7 +1,7 @@ #pragma once -#include "vk.hpp" -#include "load/vtable.hpp" +#include +#include #include #include diff --git a/load/vendor_posix.cpp b/cruft/vk/load/vendor_posix.cpp similarity index 100% rename from load/vendor_posix.cpp rename to cruft/vk/load/vendor_posix.cpp diff --git a/load/vendor_win32.cpp b/cruft/vk/load/vendor_win32.cpp similarity index 100% rename from load/vendor_win32.cpp rename to cruft/vk/load/vendor_win32.cpp diff --git a/cruft/vk/load/vtable.cpp b/cruft/vk/load/vtable.cpp new file mode 100644 index 0000000..8d92d42 --- /dev/null +++ b/cruft/vk/load/vtable.cpp @@ -0,0 +1 @@ +#include diff --git a/meta/info.cpp b/cruft/vk/meta/info.cpp similarity index 79% rename from meta/info.cpp rename to cruft/vk/meta/info.cpp index e04bbe4..5e13442 100644 --- a/meta/info.cpp +++ b/cruft/vk/meta/info.cpp @@ -7,16 +7,16 @@ * 2017-2018, Danny Robson */ -#include "info.hpp" +#include "./info.hpp" -#include "load/ostream.hpp" +#include -#include "instance.hpp" -#include "physical_device.hpp" -#include "ostream.hpp" +#include +#include +#include -#include "load/vendor.hpp" -#include "load/vtable.hpp" +#include +#include #include diff --git a/meta/info.hpp b/cruft/vk/meta/info.hpp similarity index 100% rename from meta/info.hpp rename to cruft/vk/meta/info.hpp diff --git a/object.cpp b/cruft/vk/object.cpp similarity index 100% rename from object.cpp rename to cruft/vk/object.cpp diff --git a/object.hpp b/cruft/vk/object.hpp similarity index 100% rename from object.hpp rename to cruft/vk/object.hpp diff --git a/ostream.cpp b/cruft/vk/ostream.cpp similarity index 100% rename from ostream.cpp rename to cruft/vk/ostream.cpp diff --git a/ostream.hpp b/cruft/vk/ostream.hpp similarity index 96% rename from ostream.hpp rename to cruft/vk/ostream.hpp index 52b453d..a642175 100644 --- a/ostream.hpp +++ b/cruft/vk/ostream.hpp @@ -10,8 +10,8 @@ #ifndef CRUFT_VK_OSTREAM_HPP #define CRUFT_VK_OSTREAM_HPP -#include "./fwd.hpp" -#include "./vk.hpp" +#include +#include #include diff --git a/physical_device.cpp b/cruft/vk/physical_device.cpp similarity index 100% rename from physical_device.cpp rename to cruft/vk/physical_device.cpp diff --git a/physical_device.hpp b/cruft/vk/physical_device.hpp similarity index 93% rename from physical_device.hpp rename to cruft/vk/physical_device.hpp index e91b18e..862cf43 100644 --- a/physical_device.hpp +++ b/cruft/vk/physical_device.hpp @@ -10,9 +10,9 @@ #ifndef CRUFT_VK_PHYSICAL_DEVICE_HPP #define CRUFT_VK_PHYSICAL_DEVICE_HPP -#include "./object.hpp" +#include -#include "./vk.hpp" +#include #include #include diff --git a/pipeline.cpp b/cruft/vk/pipeline.cpp similarity index 100% rename from pipeline.cpp rename to cruft/vk/pipeline.cpp diff --git a/pipeline.hpp b/cruft/vk/pipeline.hpp similarity index 100% rename from pipeline.hpp rename to cruft/vk/pipeline.hpp diff --git a/pipeline_cache.cpp b/cruft/vk/pipeline_cache.cpp similarity index 100% rename from pipeline_cache.cpp rename to cruft/vk/pipeline_cache.cpp diff --git a/pipeline_cache.hpp b/cruft/vk/pipeline_cache.hpp similarity index 100% rename from pipeline_cache.hpp rename to cruft/vk/pipeline_cache.hpp diff --git a/pipeline_layout.cpp b/cruft/vk/pipeline_layout.cpp similarity index 100% rename from pipeline_layout.cpp rename to cruft/vk/pipeline_layout.cpp diff --git a/pipeline_layout.hpp b/cruft/vk/pipeline_layout.hpp similarity index 100% rename from pipeline_layout.hpp rename to cruft/vk/pipeline_layout.hpp diff --git a/queue.cpp b/cruft/vk/queue.cpp similarity index 100% rename from queue.cpp rename to cruft/vk/queue.cpp diff --git a/queue.hpp b/cruft/vk/queue.hpp similarity index 100% rename from queue.hpp rename to cruft/vk/queue.hpp diff --git a/render_pass.cpp b/cruft/vk/render_pass.cpp similarity index 100% rename from render_pass.cpp rename to cruft/vk/render_pass.cpp diff --git a/render_pass.hpp b/cruft/vk/render_pass.hpp similarity index 100% rename from render_pass.hpp rename to cruft/vk/render_pass.hpp diff --git a/semaphore.cpp b/cruft/vk/semaphore.cpp similarity index 100% rename from semaphore.cpp rename to cruft/vk/semaphore.cpp diff --git a/semaphore.hpp b/cruft/vk/semaphore.hpp similarity index 100% rename from semaphore.hpp rename to cruft/vk/semaphore.hpp diff --git a/shader_module.cpp b/cruft/vk/shader_module.cpp similarity index 100% rename from shader_module.cpp rename to cruft/vk/shader_module.cpp diff --git a/shader_module.hpp b/cruft/vk/shader_module.hpp similarity index 100% rename from shader_module.hpp rename to cruft/vk/shader_module.hpp diff --git a/surface.cpp b/cruft/vk/surface.cpp similarity index 100% rename from surface.cpp rename to cruft/vk/surface.cpp diff --git a/surface.hpp b/cruft/vk/surface.hpp similarity index 90% rename from surface.hpp rename to cruft/vk/surface.hpp index 6729cca..71e1f7d 100644 --- a/surface.hpp +++ b/cruft/vk/surface.hpp @@ -10,9 +10,9 @@ #ifndef CRUFT_VK_SURFACE_HPP #define CRUFT_VK_SURFACE_HPP -#include "./vk.hpp" -#include "./instance.hpp" -#include "./object.hpp" +#include +#include +#include namespace cruft::vk { diff --git a/swapchain.hpp b/cruft/vk/swapchain.hpp similarity index 100% rename from swapchain.hpp rename to cruft/vk/swapchain.hpp diff --git a/traits.cpp b/cruft/vk/traits.cpp similarity index 100% rename from traits.cpp rename to cruft/vk/traits.cpp diff --git a/traits.hpp b/cruft/vk/traits.hpp similarity index 99% rename from traits.hpp rename to cruft/vk/traits.hpp index 94e97c6..b3ee838 100644 --- a/traits.hpp +++ b/cruft/vk/traits.hpp @@ -10,8 +10,8 @@ #ifndef CRUFT_VK_TRAITS_HPP #define CRUFT_VK_TRAITS_HPP -#include "fwd.hpp" -#include "vk.hpp" +#include +#include #include diff --git a/load/vtable.cpp b/load/vtable.cpp deleted file mode 100644 index 2dacf82..0000000 --- a/load/vtable.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "load/vtable.hpp" diff --git a/tools/info.cpp b/tools/info.cpp index 50cd55b..b10237d 100644 --- a/tools/info.cpp +++ b/tools/info.cpp @@ -7,7 +7,7 @@ * 2019, Danny Robson */ -#include "../meta/info.hpp" +#include #include diff --git a/tools/spec.py b/tools/spec.py index 1038969..7346fb9 100644 --- a/tools/spec.py +++ b/tools/spec.py @@ -802,7 +802,7 @@ def write_load(dst: TextIO, q: List[Type], reg: Registry): dst.write(f""" #pragma once - #include "vk.hpp" + #include #include @@ -845,9 +845,9 @@ def write_load(dst: TextIO, q: List[Type], reg: Registry): # ----------------------------------------------------------------------------- def write_dispatch(dst: TextIO, q: List[Type], reg: Registry): dst.write(""" - #include "vk.hpp" - #include "load/vtable.hpp" - #include "load/dispatch.hpp" + #include + #include + #include #include #include @@ -994,9 +994,9 @@ def write_dispatch(dst: TextIO, q: List[Type], reg: Registry): def write_trace(dst: TextIO, q: List[Type], reg: Registry): dst.write(""" - #include "vk.hpp" - #include "load/vtable.hpp" - #include "ostream.hpp" + #include + #include + #include #include #include