Move source out of root and into the cruft directory

This commit is contained in:
Danny Robson 2024-07-18 09:51:48 +10:00
parent db7f691624
commit 9cdc543091
66 changed files with 74 additions and 56 deletions

View File

@ -1,9 +1,11 @@
############################################################################### ###############################################################################
cmake_minimum_required(VERSION 3.18.0) cmake_minimum_required(VERSION 3.20.0)
project(cruft-vulkan CXX) project(cruft-vulkan CXX)
############################################################################### ###############################################################################
nc_deps(util)
find_package (Python3 REQUIRED COMPONENTS Interpreter) find_package (Python3 REQUIRED COMPONENTS Interpreter)
find_package (glfw3 REQUIRED) find_package (glfw3 REQUIRED)
@ -64,8 +66,6 @@ endif()
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
list (APPEND VK_LOAD_SOURCES list (APPEND VK_LOAD_SOURCES
load/fwd.hpp load/fwd.hpp
${GENERATED_PREFIX}/load/vtable.hpp
${GENERATED_PREFIX}/load/dispatch.cpp
load/dispatch.hpp load/dispatch.hpp
load/init.cpp load/init.cpp
load/ostream.cpp load/ostream.cpp
@ -76,28 +76,35 @@ list (APPEND VK_LOAD_SOURCES
load/vtable.cpp 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}) add_library (vulkan SHARED ${VK_LOAD_SOURCES})
set_target_properties(vulkan PROPERTIES VERSION 1.1.98) set_target_properties(vulkan PROPERTIES VERSION 1.1.98)
set_target_properties(vulkan PROPERTIES SOVERSION 1) 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} target_include_directories (${lib}
PUBLIC PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
"${GENERATED_PREFIX}"
"${CMAKE_CURRENT_SOURCE_DIR}/specs/include/vulkan" "${CMAKE_CURRENT_SOURCE_DIR}/specs/include/vulkan"
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/prefix>
) )
target_link_libraries (${lib} cruft-json cruft) target_link_libraries (${lib} cruft-json cruft::util)
endforeach () endforeach ()
add_library(cruft::vk-load ALIAS libcruft-vk-load)
############################################################################### ###############################################################################
list (APPEND sources list (APPEND sources
"${GENERATED_PREFIX}/vk.hpp"
fwd.hpp fwd.hpp
object.cpp object.cpp
object.hpp object.hpp
@ -155,17 +162,28 @@ list (APPEND sources
) )
##----------------------------------------------------------------------------- list (TRANSFORM sources PREPEND "cruft/vk/")
add_library (cruft-vk STATIC ${sources})
target_link_libraries (cruft-vk cruft) list (APPEND sources
target_include_directories (cruft-vk "${GENERATED_PREFIX}/vk.hpp"
PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
"${GENERATED_PREFIX}"
"${CMAKE_CURRENT_SOURCE_DIR}/specs/include/vulkan"
) )
##-----------------------------------------------------------------------------
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"
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/prefix>
)
target_link_libraries (libcruft-vk cruft::util)
add_library(cruft::vk ALIAS libcruft-vk)
############################################################################### ###############################################################################
list (APPEND shaders list (APPEND shaders
tools/hello/shader.vert tools/hello/shader.vert
@ -205,8 +223,8 @@ foreach (t info hello)
"${CMAKE_CURRENT_BINARY_DIR}/tools") "${CMAKE_CURRENT_BINARY_DIR}/tools")
endforeach () endforeach ()
target_link_libraries (vk_info cruft-vk cruft-vk-load) 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_hello ${NC_CXX_STDCXXFS} cruft::util cruft::vk glfw vulkan)
add_library (trace SHARED add_library (trace SHARED
"${GENERATED_PREFIX}/tools/trace.cpp" "${GENERATED_PREFIX}/tools/trace.cpp"
@ -219,7 +237,7 @@ PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/specs/include/vulkan" "${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) add_dependencies (vk_hello hello.vert.spv hello.frag.spv)

View File

@ -10,7 +10,7 @@
#ifndef CRUFT_VK_EXCEPT_HPP #ifndef CRUFT_VK_EXCEPT_HPP
#define CRUFT_VK_EXCEPT_HPP #define CRUFT_VK_EXCEPT_HPP
#include "./vk.hpp" #include <cruft/vk/vk.hpp>
#include <cruft/util/debug/assert.hpp> #include <cruft/util/debug/assert.hpp>
#include <cruft/util/types/traits.hpp> #include <cruft/util/types/traits.hpp>

View File

@ -10,7 +10,7 @@
#ifndef CRUFT_VK_FWD_HPP #ifndef CRUFT_VK_FWD_HPP
#define CRUFT_VK_FWD_HPP #define CRUFT_VK_FWD_HPP
#include "vk.hpp" #include <cruft/vk/vk.hpp>
#include <cruft/util/preprocessor.hpp> #include <cruft/util/preprocessor.hpp>

View File

@ -9,11 +9,11 @@
#pragma once #pragma once
#include "./object.hpp" #include <cruft/vk/object.hpp>
#include "./vk.hpp" #include <cruft/vk/vk.hpp>
#include "./traits.hpp" #include <cruft/vk/traits.hpp>
#include "./except.hpp" #include <cruft/vk/except.hpp>
#include <cruft/util/view.hpp> #include <cruft/util/view.hpp>

View File

@ -7,8 +7,8 @@
*/ */
#include "load/vtable.hpp" #include <cruft/vk/load/vtable.hpp>
#include "load/vendor.hpp" #include <cruft/vk/load/vendor.hpp>
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "vk.hpp" #include <cruft/vk/vk.hpp>
#include "load/vtable.hpp" #include <cruft/vk/load/vtable.hpp>
#include <cruft/util/library.hpp> #include <cruft/util/library.hpp>
#include <cruft/util/std.hpp> #include <cruft/util/std.hpp>

1
cruft/vk/load/vtable.cpp Normal file
View File

@ -0,0 +1 @@
#include <cruft/vk/load/vtable.hpp>

View File

@ -7,16 +7,16 @@
* 2017-2018, Danny Robson <danny@nerdcruft.net> * 2017-2018, Danny Robson <danny@nerdcruft.net>
*/ */
#include "info.hpp" #include "./info.hpp"
#include "load/ostream.hpp" #include <cruft/vk/load/ostream.hpp>
#include "instance.hpp" #include <cruft/vk/instance.hpp>
#include "physical_device.hpp" #include <cruft/vk/physical_device.hpp>
#include "ostream.hpp" #include <cruft/vk/ostream.hpp>
#include "load/vendor.hpp" #include <cruft/vk/load/vendor.hpp>
#include "load/vtable.hpp" #include <cruft/vk/load/vtable.hpp>
#include <cruft/util/iterator/infix.hpp> #include <cruft/util/iterator/infix.hpp>

View File

@ -10,8 +10,8 @@
#ifndef CRUFT_VK_OSTREAM_HPP #ifndef CRUFT_VK_OSTREAM_HPP
#define CRUFT_VK_OSTREAM_HPP #define CRUFT_VK_OSTREAM_HPP
#include "./fwd.hpp" #include <cruft/vk/fwd.hpp>
#include "./vk.hpp" #include <cruft/vk/vk.hpp>
#include <cruft/util/preprocessor.hpp> #include <cruft/util/preprocessor.hpp>

View File

@ -10,9 +10,9 @@
#ifndef CRUFT_VK_PHYSICAL_DEVICE_HPP #ifndef CRUFT_VK_PHYSICAL_DEVICE_HPP
#define CRUFT_VK_PHYSICAL_DEVICE_HPP #define CRUFT_VK_PHYSICAL_DEVICE_HPP
#include "./object.hpp" #include <cruft/vk/object.hpp>
#include "./vk.hpp" #include <cruft/vk/vk.hpp>
#include <set> #include <set>
#include <string> #include <string>

View File

@ -10,9 +10,9 @@
#ifndef CRUFT_VK_SURFACE_HPP #ifndef CRUFT_VK_SURFACE_HPP
#define CRUFT_VK_SURFACE_HPP #define CRUFT_VK_SURFACE_HPP
#include "./vk.hpp" #include <cruft/vk/vk.hpp>
#include "./instance.hpp" #include <cruft/vk/instance.hpp>
#include "./object.hpp" #include <cruft/vk/object.hpp>
namespace cruft::vk { namespace cruft::vk {

View File

@ -10,8 +10,8 @@
#ifndef CRUFT_VK_TRAITS_HPP #ifndef CRUFT_VK_TRAITS_HPP
#define CRUFT_VK_TRAITS_HPP #define CRUFT_VK_TRAITS_HPP
#include "fwd.hpp" #include <cruft/vk/fwd.hpp>
#include "vk.hpp" #include <cruft/vk/vk.hpp>
#include <cruft/util/variadic.hpp> #include <cruft/util/variadic.hpp>

View File

@ -1 +0,0 @@
#include "load/vtable.hpp"

View File

@ -7,7 +7,7 @@
* 2019, Danny Robson <danny@nerdcruft.net> * 2019, Danny Robson <danny@nerdcruft.net>
*/ */
#include "../meta/info.hpp" #include <cruft/vk/meta/info.hpp>
#include <iostream> #include <iostream>

View File

@ -802,7 +802,7 @@ def write_load(dst: TextIO, q: List[Type], reg: Registry):
dst.write(f""" dst.write(f"""
#pragma once #pragma once
#include "vk.hpp" #include <cruft/vk/vk.hpp>
#include <cruft/util/preprocessor.hpp> #include <cruft/util/preprocessor.hpp>
@ -845,9 +845,9 @@ def write_load(dst: TextIO, q: List[Type], reg: Registry):
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
def write_dispatch(dst: TextIO, q: List[Type], reg: Registry): def write_dispatch(dst: TextIO, q: List[Type], reg: Registry):
dst.write(""" dst.write("""
#include "vk.hpp" #include <cruft/vk/vk.hpp>
#include "load/vtable.hpp" #include <cruft/vk/load/vtable.hpp>
#include "load/dispatch.hpp" #include <cruft/vk/load/dispatch.hpp>
#include <cruft/util/debug/panic.hpp> #include <cruft/util/debug/panic.hpp>
#include <cruft/util/cast.hpp> #include <cruft/util/cast.hpp>
@ -994,9 +994,9 @@ def write_dispatch(dst: TextIO, q: List[Type], reg: Registry):
def write_trace(dst: TextIO, q: List[Type], reg: Registry): def write_trace(dst: TextIO, q: List[Type], reg: Registry):
dst.write(""" dst.write("""
#include "vk.hpp" #include <cruft/vk/vk.hpp>
#include "load/vtable.hpp" #include <cruft/vk/load/vtable.hpp>
#include "ostream.hpp" #include <cruft/vk/ostream.hpp>
#include <iostream> #include <iostream>
#include <dlfcn.h> #include <dlfcn.h>