diff --git a/CMakeLists.txt b/CMakeLists.txt index 2546ec1..743ce65 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,55 +1,69 @@ -cmake_minimum_required(VERSION 3.0.0) +cmake_minimum_required(VERSION 3.13) set(CMAKE_TOOLCHAIN_FILE "C:\\vcpkg\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake" ) -project(Cadera VERSION 0.0.1) +project(Cadera VERSION 0.1.0) include(CTest) enable_testing() +#========================================= +# Targets +#========================================= +add_executable(CaderaApp src/Cadera.cpp + src/Selection.cpp + src/Callbacks.cpp + src/Model.cpp + src/Main.cpp + +) + +add_subdirectory(src/render) +add_subdirectory(src/sketch) +add_subdirectory(src/ux) -add_executable(Cadera src/Cadera.cpp - src/CADRender.cpp - src/TextRender.cpp - src/RenderUtil.cpp - src/Selection.cpp - src/Camera.cpp - src/Callbacks.cpp - src/gui.cpp - src/Sketch.cpp - src/Sketcher.cpp - src/SketchSolver.cpp - src/Point.cpp - src/Model.cpp - src/Feature.cpp - src/Relation.cpp - src/grid.cpp - src/Main.cpp - - +set_target_properties(CaderaApp PROPERTIES + OUTPUT_NAME CaderaApp + EXPORT_NAME CaderaApp ) - -add_executable(tester test/tester.cpp) -add_test(tester tester) +target_compile_definitions(CaderaApp PUBLIC) -target_precompile_headers(Cadera PRIVATE include/pch.hpp) -target_include_directories(Cadera PRIVATE include/) +#========================================= +# Precompiled Headers / Include Directories +#========================================= +target_precompile_headers(CaderaApp PRIVATE src/pch.hpp) +target_include_directories(CaderaApp PRIVATE src/) + +#========================================= +# Libraries +#========================================= find_package(Vulkan REQUIRED) -target_link_libraries(Cadera PRIVATE Vulkan::Vulkan) +target_link_libraries(CaderaApp PRIVATE Vulkan::Vulkan) find_package(glfw3 CONFIG REQUIRED) -target_link_libraries(Cadera PRIVATE glfw) +target_link_libraries(CaderaApp PRIVATE glfw) find_package(Stb REQUIRED) -target_include_directories(Cadera PRIVATE ${Stb_INCLUDE_DIR}) +target_include_directories(CaderaApp PRIVATE ${Stb_INCLUDE_DIR}) find_package(Microsoft.GSL CONFIG REQUIRED) -target_link_libraries(Cadera PRIVATE Microsoft.GSL::GSL) +target_link_libraries(CaderaApp PRIVATE Microsoft.GSL::GSL) find_package(imgui CONFIG REQUIRED) -target_link_libraries(Cadera PRIVATE imgui::imgui) +target_link_libraries(CaderaApp PRIVATE imgui::imgui) + + +#========================================= +# Testing +#========================================= +include_directories(test) + + +#========================================= +# Packaging +#========================================= set(CPACK_PROJECT_NAME ${PROJECT_NAME}) set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) include(CPack) diff --git a/include/Canvas.hpp b/include/Canvas.hpp deleted file mode 100644 index c698686..0000000 --- a/include/Canvas.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - - - -namespace CADERA_APP_NAMESPACE { - - - class Canvas { - - protected: - - - - public: - - bool frameBufferResized; - - - - - - std::vector mFramebuffers; - - - - void destroy(const vk::Device& Device); - - bool checkFormat(vk::Format Format); - - - bool hasStencilComponent(vk::Format format); - - - }; - -} \ No newline at end of file diff --git a/include/Cadera.hpp b/src/Cadera.hpp similarity index 97% rename from include/Cadera.hpp rename to src/Cadera.hpp index 429534f..9fc0548 100644 --- a/include/Cadera.hpp +++ b/src/Cadera.hpp @@ -1,5 +1,5 @@ #pragma once -#include "gui.hpp" +#include "ux/gui.hpp" diff --git a/src/Canvas.cpp b/src/Canvas.cpp deleted file mode 100644 index afc92cb..0000000 --- a/src/Canvas.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "pch.hpp" -#include "Canvas.hpp" - -namespace CADERA_APP_NAMESPACE { - - - void Canvas::destroy(const vk::Device& Device) { - - - - } - - bool Canvas::checkFormat(vk::Format Format) - { - return mFormat == Format; - } - - - - - - - - - - bool Canvas::hasStencilComponent(vk::Format format) { - - return format == vk::Format::eD32Sfloat || format == vk::Format::eD24UnormS8Uint; - } - - - - - -} diff --git a/src/Main.cpp b/src/Main.cpp index 3e81470..94ab76b 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1,7 +1,7 @@ #include "pch.hpp" #include "Cadera.hpp" #include -#include + VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE diff --git a/include/Model.hpp b/src/Model.hpp similarity index 91% rename from include/Model.hpp rename to src/Model.hpp index 359ca7b..58556eb 100644 --- a/include/Model.hpp +++ b/src/Model.hpp @@ -1,6 +1,6 @@ #pragma once -#include "TextRender.hpp" -#include "grid.hpp" +#include "render/TextRender.hpp" +#include "render/grid.hpp" namespace CADERA_APP_NAMESPACE { diff --git a/include/Selection.hpp b/src/Selection.hpp similarity index 98% rename from include/Selection.hpp rename to src/Selection.hpp index a060908..308dc4e 100644 --- a/include/Selection.hpp +++ b/src/Selection.hpp @@ -1,5 +1,5 @@ #pragma once -#include "Sketch.hpp" +#include "sketch/SketchSolver.hpp" namespace CADERA_APP_NAMESPACE { diff --git a/include/callbacks.hpp b/src/callbacks.hpp similarity index 100% rename from include/callbacks.hpp rename to src/callbacks.hpp diff --git a/include/pch.hpp b/src/pch.hpp similarity index 100% rename from include/pch.hpp rename to src/pch.hpp diff --git a/src/CADRender.cpp b/src/render/CADRender.cpp similarity index 100% rename from src/CADRender.cpp rename to src/render/CADRender.cpp diff --git a/include/CADRender.hpp b/src/render/CADRender.hpp similarity index 99% rename from include/CADRender.hpp rename to src/render/CADRender.hpp index f638a4a..469e879 100644 --- a/include/CADRender.hpp +++ b/src/render/CADRender.hpp @@ -2,7 +2,7 @@ #include "callbacks.hpp" #include "Camera.hpp" -#include "SketchSolver.hpp" + diff --git a/src/render/CMakeLists.txt b/src/render/CMakeLists.txt new file mode 100644 index 0000000..3bae893 --- /dev/null +++ b/src/render/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.13) + + + +target_sources(CaderaApp PRIVATE ${CMAKE_CURRENT_LIST_DIR}/CADRender.cpp + ${CMAKE_CURRENT_LIST_DIR}/Camera.cpp + ${CMAKE_CURRENT_LIST_DIR}/RenderUtil.cpp + ${CMAKE_CURRENT_LIST_DIR}/TextRender.cpp + ${CMAKE_CURRENT_LIST_DIR}/Grid.cpp + ) + diff --git a/src/Camera.cpp b/src/render/Camera.cpp similarity index 100% rename from src/Camera.cpp rename to src/render/Camera.cpp diff --git a/include/Camera.hpp b/src/render/Camera.hpp similarity index 100% rename from include/Camera.hpp rename to src/render/Camera.hpp diff --git a/src/RenderUtil.cpp b/src/render/RenderUtil.cpp similarity index 100% rename from src/RenderUtil.cpp rename to src/render/RenderUtil.cpp diff --git a/include/RenderUtil.hpp b/src/render/RenderUtil.hpp similarity index 100% rename from include/RenderUtil.hpp rename to src/render/RenderUtil.hpp diff --git a/src/TextRender.cpp b/src/render/TextRender.cpp similarity index 100% rename from src/TextRender.cpp rename to src/render/TextRender.cpp diff --git a/include/TextRender.hpp b/src/render/TextRender.hpp similarity index 100% rename from include/TextRender.hpp rename to src/render/TextRender.hpp diff --git a/src/grid.cpp b/src/render/grid.cpp similarity index 100% rename from src/grid.cpp rename to src/render/grid.cpp diff --git a/include/grid.hpp b/src/render/grid.hpp similarity index 96% rename from include/grid.hpp rename to src/render/grid.hpp index 886cafd..fa3f1b8 100644 --- a/include/grid.hpp +++ b/src/render/grid.hpp @@ -1,5 +1,5 @@ #pragma once -#include "RenderUtil.hpp" +#include "render/RenderUtil.hpp" namespace CADERA_APP_NAMESPACE { diff --git a/src/sketch/CMakeLists.txt b/src/sketch/CMakeLists.txt new file mode 100644 index 0000000..64fcd3d --- /dev/null +++ b/src/sketch/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.13) + + + +target_sources(CaderaApp PRIVATE ${CMAKE_CURRENT_LIST_DIR}/Relation.cpp + ${CMAKE_CURRENT_LIST_DIR}/Feature.cpp + ${CMAKE_CURRENT_LIST_DIR}/Sketch.cpp + ${CMAKE_CURRENT_LIST_DIR}/Sketcher.cpp + ${CMAKE_CURRENT_LIST_DIR}/SketchSolver.cpp + ${CMAKE_CURRENT_LIST_DIR}/Point.cpp + ) + diff --git a/src/Feature.cpp b/src/sketch/Feature.cpp similarity index 100% rename from src/Feature.cpp rename to src/sketch/Feature.cpp diff --git a/include/Feature.hpp b/src/sketch/Feature.hpp similarity index 100% rename from include/Feature.hpp rename to src/sketch/Feature.hpp diff --git a/src/Point.cpp b/src/sketch/Point.cpp similarity index 100% rename from src/Point.cpp rename to src/sketch/Point.cpp diff --git a/include/Point.hpp b/src/sketch/Point.hpp similarity index 100% rename from include/Point.hpp rename to src/sketch/Point.hpp diff --git a/src/Relation.cpp b/src/sketch/Relation.cpp similarity index 100% rename from src/Relation.cpp rename to src/sketch/Relation.cpp diff --git a/include/Relation.hpp b/src/sketch/Relation.hpp similarity index 100% rename from include/Relation.hpp rename to src/sketch/Relation.hpp diff --git a/src/Sketch.cpp b/src/sketch/Sketch.cpp similarity index 100% rename from src/Sketch.cpp rename to src/sketch/Sketch.cpp diff --git a/include/Sketch.hpp b/src/sketch/Sketch.hpp similarity index 100% rename from include/Sketch.hpp rename to src/sketch/Sketch.hpp diff --git a/src/SketchSolver.cpp b/src/sketch/SketchSolver.cpp similarity index 100% rename from src/SketchSolver.cpp rename to src/sketch/SketchSolver.cpp diff --git a/include/SketchSolver.hpp b/src/sketch/SketchSolver.hpp similarity index 100% rename from include/SketchSolver.hpp rename to src/sketch/SketchSolver.hpp diff --git a/src/Sketcher.cpp b/src/sketch/Sketcher.cpp similarity index 100% rename from src/Sketcher.cpp rename to src/sketch/Sketcher.cpp diff --git a/include/Sketcher.hpp b/src/sketch/Sketcher.hpp similarity index 100% rename from include/Sketcher.hpp rename to src/sketch/Sketcher.hpp diff --git a/src/sketch/pch.hpp b/src/sketch/pch.hpp new file mode 100644 index 0000000..f4bef1f --- /dev/null +++ b/src/sketch/pch.hpp @@ -0,0 +1,9 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/src/ux/CMakeLists.txt b/src/ux/CMakeLists.txt new file mode 100644 index 0000000..1522344 --- /dev/null +++ b/src/ux/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.13) + + +target_sources(CaderaApp PRIVATE ${CMAKE_CURRENT_LIST_DIR}/gui.cpp + + ) \ No newline at end of file diff --git a/src/gui.cpp b/src/ux/gui.cpp similarity index 99% rename from src/gui.cpp rename to src/ux/gui.cpp index 8fc1cca..e17e4e3 100644 --- a/src/gui.cpp +++ b/src/ux/gui.cpp @@ -1,4 +1,4 @@ -#include "pch.hpp" +#include "../pch.hpp" #include "gui.hpp" namespace CADERA_APP_NAMESPACE { diff --git a/include/gui.hpp b/src/ux/gui.hpp similarity index 96% rename from include/gui.hpp rename to src/ux/gui.hpp index ca40892..8401675 100644 --- a/include/gui.hpp +++ b/src/ux/gui.hpp @@ -1,6 +1,6 @@ #pragma once -#include "CADRender.hpp" +#include "../render/CADRender.hpp" namespace CADERA_APP_NAMESPACE { namespace gui { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..6a3c6cb --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.13) + + +add_executable(tester test/tester.cpp) +add_test(tester tester) +