From 05bc31a2b4ec219e2ad499aeb82a0ca1248c541d Mon Sep 17 00:00:00 2001 From: Dynamitos Date: Sat, 24 Sep 2022 21:06:25 +0200 Subject: [PATCH] Adding Editor executable --- .vscode/launch.json | 10 +++++----- CMakeLists.txt | 17 ++++++++++------- cmake/SuperBuild.cmake | 1 - external/ktx | 2 +- src/CMakeLists.txt | 2 +- src/Editor/CMakeLists.txt | 3 +++ src/{Engine => Editor}/main.cpp | 0 src/Engine/Asset/CMakeLists.txt | 2 +- src/Engine/CMakeLists.txt | 5 ++--- src/Engine/Containers/CMakeLists.txt | 2 +- src/Engine/Graphics/CMakeLists.txt | 2 +- src/Engine/Graphics/RenderPass/CMakeLists.txt | 2 +- src/Engine/Graphics/Vulkan/CMakeLists.txt | 2 +- src/Engine/Material/CMakeLists.txt | 2 +- src/Engine/Math/CMakeLists.txt | 2 +- src/Engine/Scene/Actor/CMakeLists.txt | 2 +- src/Engine/Scene/CMakeLists.txt | 2 +- src/Engine/Scene/Components/CMakeLists.txt | 5 ++--- .../Scene/Components/PrimitiveComponent.h | 6 ++++++ .../Components/PrimitiveUniformBufferLayout.h | 12 ------------ src/Engine/Scene/Scene.cpp | 1 - src/Engine/UI/CMakeLists.txt | 2 +- src/Engine/UI/Elements/CMakeLists.txt | 2 +- src/Engine/Window/CMakeLists.txt | 2 +- 24 files changed, 42 insertions(+), 46 deletions(-) create mode 100644 src/Editor/CMakeLists.txt rename src/{Engine => Editor}/main.cpp (100%) delete mode 100644 src/Engine/Scene/Components/PrimitiveUniformBufferLayout.h diff --git a/.vscode/launch.json b/.vscode/launch.json index 1a01b3b..7de2dc8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -30,14 +30,14 @@ ] }, { - "name": "Engine Debug", + "name": "Editor Debug", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceRoot}/bin/Debug/Engine.exe", + "program": "${workspaceRoot}/bin/Debug/Editor.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceRoot}/bin/Debug", - "console": "integratedTerminal", + "console": "internalConsole", "environment": [], "symbolSearchPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.25.28610\\lib\\x64", "requireExactSource": false, @@ -50,10 +50,10 @@ } }, { - "name": "Engine Release", + "name": "Editor Release", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceRoot}/bin/Release/Engine.exe", + "program": "${workspaceRoot}/bin/Release/Editor.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceRoot}/bin/Release", diff --git a/CMakeLists.txt b/CMakeLists.txt index d362ec0..5e0b936 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,8 @@ if(CMAKE_DEBUG_POSTFIX) add_compile_definitions(ENABLE_VALIDATION) add_compile_definitions(SEELE_DEBUG) endif() -add_executable(Engine "") +add_library(Engine "") +add_executable(Editor "") target_compile_definitions(Engine PUBLIC GLFW_WINDOWS) target_include_directories(Engine PUBLIC src/Engine) target_link_libraries(Engine PUBLIC Vulkan::Vulkan) @@ -70,11 +71,11 @@ target_link_libraries(Engine PUBLIC ktx) target_link_libraries(Engine PUBLIC stb) target_link_libraries(Engine PUBLIC nlohmann_json::nlohmann_json) if(UNIX) - target_link_libraries(Engine Threads::Threads) - target_link_libraries(Engine dl) +target_link_libraries(Engine Threads::Threads) +target_link_libraries(Engine dl) endif() target_precompile_headers(Engine - PRIVATE + PUBLIC @@ -91,13 +92,15 @@ target_precompile_headers(Engine ) +target_link_libraries(Editor PRIVATE Engine) + add_subdirectory(src/) if(MSVC) set(_CRT_SECURE_NO_WARNINGS) - target_compile_options(Engine PRIVATE -Zi -MP -DEBUG) + target_compile_options(Engine PUBLIC -Zi -MP -DEBUG) else() - target_compile_options(Engine PRIVATE -g -Wall -Wextra -Wno-delete-incomplete -pedantic -fcoroutines) + target_compile_options(Engine PUBLIC -g -Wall -Wextra -Wno-delete-incomplete -pedantic -fcoroutines) endif() add_executable(Seele_unit_tests "") @@ -111,5 +114,5 @@ add_custom_target(SeeleEngine ALL COMMAND ${CMAKE_COMMAND} -E copy $ $ COMMAND ${CMAKE_COMMAND} -E copy $ $ COMMAND_EXPAND_LISTS - DEPENDS Engine slang-build) + DEPENDS Editor slang-build) diff --git a/cmake/SuperBuild.cmake b/cmake/SuperBuild.cmake index dbfefc1..6c95591 100644 --- a/cmake/SuperBuild.cmake +++ b/cmake/SuperBuild.cmake @@ -18,7 +18,6 @@ endif() add_subdirectory(${BOOST_ROOT}) #-----------------KTX---------------------------- -find_program(BASH_EXECUTABLE git-bash) set(KTX_FEATURE_TESTS off) add_subdirectory(${KTX_ROOT} ${KTX_ROOT}) diff --git a/external/ktx b/external/ktx index d1a25c8..7149d4f 160000 --- a/external/ktx +++ b/external/ktx @@ -1 +1 @@ -Subproject commit d1a25c8a20607a432b2d910a7a761d663c907e8e +Subproject commit 7149d4fc08bb00c070883d174e46e102a6974a8c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 21f038b..85b3389 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,2 +1,2 @@ - +add_subdirectory(Editor/) add_subdirectory(Engine/) \ No newline at end of file diff --git a/src/Editor/CMakeLists.txt b/src/Editor/CMakeLists.txt new file mode 100644 index 0000000..a36935f --- /dev/null +++ b/src/Editor/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(Editor + PRIVATE + main.cpp) \ No newline at end of file diff --git a/src/Engine/main.cpp b/src/Editor/main.cpp similarity index 100% rename from src/Engine/main.cpp rename to src/Editor/main.cpp diff --git a/src/Engine/Asset/CMakeLists.txt b/src/Engine/Asset/CMakeLists.txt index 2e3e90a..8587ce2 100644 --- a/src/Engine/Asset/CMakeLists.txt +++ b/src/Engine/Asset/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(Engine - PRIVATE + PUBLIC Asset.h Asset.cpp AssetRegistry.h diff --git a/src/Engine/CMakeLists.txt b/src/Engine/CMakeLists.txt index 35054ff..123e9e7 100644 --- a/src/Engine/CMakeLists.txt +++ b/src/Engine/CMakeLists.txt @@ -1,9 +1,8 @@ target_sources(Engine - PRIVATE + PUBLIC EngineTypes.h MinimalEngine.h - MinimalEngine.cpp - main.cpp) + MinimalEngine.cpp) add_subdirectory(Asset/) add_subdirectory(Containers/) diff --git a/src/Engine/Containers/CMakeLists.txt b/src/Engine/Containers/CMakeLists.txt index 9e81f08..8c79012 100644 --- a/src/Engine/Containers/CMakeLists.txt +++ b/src/Engine/Containers/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(Engine - PRIVATE + PUBLIC Array.h Map.h List.h) \ No newline at end of file diff --git a/src/Engine/Graphics/CMakeLists.txt b/src/Engine/Graphics/CMakeLists.txt index 608fc3b..3f896c4 100644 --- a/src/Engine/Graphics/CMakeLists.txt +++ b/src/Engine/Graphics/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(Engine - PRIVATE + PUBLIC GraphicsResources.h GraphicsResources.cpp GraphicsInitializer.h diff --git a/src/Engine/Graphics/RenderPass/CMakeLists.txt b/src/Engine/Graphics/RenderPass/CMakeLists.txt index 83f63cc..c6172d9 100644 --- a/src/Engine/Graphics/RenderPass/CMakeLists.txt +++ b/src/Engine/Graphics/RenderPass/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(Engine - PRIVATE + PUBLIC BasePass.h BasePass.cpp DepthPrepass.h diff --git a/src/Engine/Graphics/Vulkan/CMakeLists.txt b/src/Engine/Graphics/Vulkan/CMakeLists.txt index bf2f494..f9c5e22 100644 --- a/src/Engine/Graphics/Vulkan/CMakeLists.txt +++ b/src/Engine/Graphics/Vulkan/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(Engine - PRIVATE + PUBLIC NsightAftermathGpuCrashTracker.h NsightAftermathGpuCrashTracker.cpp NsightAftermathHelpers.h diff --git a/src/Engine/Material/CMakeLists.txt b/src/Engine/Material/CMakeLists.txt index 34244ca..8c1eff2 100644 --- a/src/Engine/Material/CMakeLists.txt +++ b/src/Engine/Material/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(Engine - PRIVATE + PUBLIC BRDF.h BRDF.cpp MaterialAsset.h diff --git a/src/Engine/Math/CMakeLists.txt b/src/Engine/Math/CMakeLists.txt index 9d34470..2e79fb5 100644 --- a/src/Engine/Math/CMakeLists.txt +++ b/src/Engine/Math/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(Engine - PRIVATE + PUBLIC Math.h Matrix.h Vector.h diff --git a/src/Engine/Scene/Actor/CMakeLists.txt b/src/Engine/Scene/Actor/CMakeLists.txt index abb8a77..710a0b1 100644 --- a/src/Engine/Scene/Actor/CMakeLists.txt +++ b/src/Engine/Scene/Actor/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(Engine - PRIVATE + PUBLIC Actor.cpp Actor.h CameraActor.cpp diff --git a/src/Engine/Scene/CMakeLists.txt b/src/Engine/Scene/CMakeLists.txt index d03c311..9a3c354 100644 --- a/src/Engine/Scene/CMakeLists.txt +++ b/src/Engine/Scene/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(Engine - PRIVATE + PUBLIC Util.h Scene.cpp Scene.h) diff --git a/src/Engine/Scene/Components/CMakeLists.txt b/src/Engine/Scene/Components/CMakeLists.txt index af9b210..3053d62 100644 --- a/src/Engine/Scene/Components/CMakeLists.txt +++ b/src/Engine/Scene/Components/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(Engine - PRIVATE + PUBLIC CameraComponent.h CameraComponent.cpp Component.h @@ -9,5 +9,4 @@ target_sources(Engine MyOtherComponent.h MyOtherComponent.cpp PrimitiveComponent.cpp - PrimitiveComponent.h - PrimitiveUniformBufferLayout.h) \ No newline at end of file + PrimitiveComponent.h) \ No newline at end of file diff --git a/src/Engine/Scene/Components/PrimitiveComponent.h b/src/Engine/Scene/Components/PrimitiveComponent.h index 1e17932..54e32a7 100644 --- a/src/Engine/Scene/Components/PrimitiveComponent.h +++ b/src/Engine/Scene/Components/PrimitiveComponent.h @@ -27,4 +27,10 @@ private: friend class Scene; }; DEFINE_REF(PrimitiveComponent) +struct PrimitiveUniformBuffer +{ + Matrix4 localToWorld; + Matrix4 worldToLocal; + Vector4 actorWorldPosition; +}; } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Scene/Components/PrimitiveUniformBufferLayout.h b/src/Engine/Scene/Components/PrimitiveUniformBufferLayout.h deleted file mode 100644 index 76ff62e..0000000 --- a/src/Engine/Scene/Components/PrimitiveUniformBufferLayout.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once -#include "Graphics/GraphicsResources.h" - -namespace Seele -{ -struct PrimitiveUniformBuffer -{ - Matrix4 localToWorld; - Matrix4 worldToLocal; - Vector4 actorWorldPosition; -}; -} // namespace Seele diff --git a/src/Engine/Scene/Scene.cpp b/src/Engine/Scene/Scene.cpp index f21dbbc..124675a 100644 --- a/src/Engine/Scene/Scene.cpp +++ b/src/Engine/Scene/Scene.cpp @@ -1,6 +1,5 @@ #include "Scene.h" #include "Components/PrimitiveComponent.h" -#include "Components/PrimitiveUniformBufferLayout.h" #include "Material/MaterialAsset.h" #include "Graphics/Graphics.h" diff --git a/src/Engine/UI/CMakeLists.txt b/src/Engine/UI/CMakeLists.txt index c1bb37c..899bde4 100644 --- a/src/Engine/UI/CMakeLists.txt +++ b/src/Engine/UI/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(Engine - PRIVATE + PUBLIC HorizontalLayout.h HorizontalLayout.cpp Layout.h diff --git a/src/Engine/UI/Elements/CMakeLists.txt b/src/Engine/UI/Elements/CMakeLists.txt index 005c939..ab68032 100644 --- a/src/Engine/UI/Elements/CMakeLists.txt +++ b/src/Engine/UI/Elements/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(Engine - PRIVATE + PUBLIC Button.h Button.cpp Element.h diff --git a/src/Engine/Window/CMakeLists.txt b/src/Engine/Window/CMakeLists.txt index c45a567..96631bf 100644 --- a/src/Engine/Window/CMakeLists.txt +++ b/src/Engine/Window/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(Engine - PRIVATE + PUBLIC InspectorView.h InspectorView.cpp SceneView.h