From 955eeabb4816a51e74a4f1a4de1c9fac3e80fbb6 Mon Sep 17 00:00:00 2001 From: nigelbarink Date: Sat, 22 Oct 2022 14:58:55 +0200 Subject: [PATCH] Adding / organizing the workspace into multple seperate projects --- .gitignore | 5 +-- BarinkEngine/premake5.lua | 27 +++---------- {SandboxApplication => Editor}/premake5.lua | 4 +- Editor/src/main.cpp | 8 ++++ ImGui/premake5.lua | 2 +- Runtime/premake5.lua | 39 ++++++++++++++++++ Runtime/src/main.cpp | 6 +++ .../include/GUI.h | 0 .../include/Util.h | 0 .../models/Cube.mtl | 0 .../models/Cube.obj | 0 .../models/sponza.gltf | 0 SandboxApp/premake5.lua | 40 +++++++++++++++++++ .../scripting/script.lua | 0 .../src/GUI.cpp | 0 .../src/Sandbox.cpp | 8 ++-- .../src/Util.cpp | 0 premake5.lua | 15 ++++--- 18 files changed, 116 insertions(+), 38 deletions(-) rename {SandboxApplication => Editor}/premake5.lua (89%) create mode 100644 Editor/src/main.cpp create mode 100644 Runtime/premake5.lua create mode 100644 Runtime/src/main.cpp rename {SandboxApplication => SandboxApp}/include/GUI.h (100%) rename {SandboxApplication => SandboxApp}/include/Util.h (100%) rename {SandboxApplication => SandboxApp}/models/Cube.mtl (100%) rename {SandboxApplication => SandboxApp}/models/Cube.obj (100%) rename {SandboxApplication => SandboxApp}/models/sponza.gltf (100%) create mode 100644 SandboxApp/premake5.lua rename {SandboxApplication => SandboxApp}/scripting/script.lua (100%) rename {SandboxApplication => SandboxApp}/src/GUI.cpp (100%) rename {SandboxApplication => SandboxApp}/src/Sandbox.cpp (90%) rename {SandboxApplication => SandboxApp}/src/Util.cpp (100%) diff --git a/.gitignore b/.gitignore index 83d36f4..922a975 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,11 @@ -build/ -intermediates/ +**/build/ +**/intermediates/ tools/ *.make Makefile .vscode/ libs/lua libs/glad -Debug/ *.sln *.vcxproj *.vcxproj.filters diff --git a/BarinkEngine/premake5.lua b/BarinkEngine/premake5.lua index 2e6a8f8..1a29e70 100644 --- a/BarinkEngine/premake5.lua +++ b/BarinkEngine/premake5.lua @@ -34,7 +34,7 @@ project "BarinkEngine" "assimp-vc143-mtd", "glfw3", - "ImGUI_Opengl3", + "ImGui", } @@ -55,26 +55,9 @@ project "BarinkEngine" "./src/**/*.h" } - - - filter { "system:windows"} - prebuildcommands { - -- Copy shaders - "copy src\\graphics\\shaders\\fragment.shader ..\\build\\SandboxApplication\\Debug\\test.fs", - "copy src\\graphics\\shaders\\vertex.shader ..\\build\\SandboxApplication\\Debug\\test.vs", - "copy src\\graphics\\shaders\\RenderSurfaceFrag.shader ..\\build\\SandboxApplication\\Debug\\RenderSurface.fs", - "copy src\\graphics\\shaders\\RenderSurfaceVert.shader ..\\build\\SandboxApplication\\Debug\\RenderSurface.vs" - } - - - - filter { "system:linux" } - prebuildcommands { - -- Copy shaders - "cp src/graphics/shaders/fragment.shader ../build/SandboxApplication/Debug/test.fs", - "cp src/graphics/shaders/vertex.shader ../build/SandboxApplication/Debug/test.vs", - "cp src/graphics/shaders/RenderSurfaceFrag.shader ../build/SandboxApplication/Debug/RenderSurface.fs", - "cp src/graphics/shaders/RenderSurfaceVert.shader ../build/SandboxApplication/Debug/RenderSurface.vs" - } + prebuildcommands + { + ok,err = os.copyfile("BarinkEngine/src/Graphics/shaders/*" ,"SandboxApp/build/Debug/") + } include('../ImGui') diff --git a/SandboxApplication/premake5.lua b/Editor/premake5.lua similarity index 89% rename from SandboxApplication/premake5.lua rename to Editor/premake5.lua index 0582bca..3956da6 100644 --- a/SandboxApplication/premake5.lua +++ b/Editor/premake5.lua @@ -1,7 +1,7 @@ -project "SandboxApplication" +project "Editor" kind "ConsoleApp" -buildmessage "Building Sandbox ..." +buildmessage "Building editor ..." links{ "BarinkEngine" diff --git a/Editor/src/main.cpp b/Editor/src/main.cpp new file mode 100644 index 0000000..3d876d9 --- /dev/null +++ b/Editor/src/main.cpp @@ -0,0 +1,8 @@ +#include + + +int main() +{ + std::cout << "Welcome to the Editor!" << std::endl; + +} \ No newline at end of file diff --git a/ImGui/premake5.lua b/ImGui/premake5.lua index e38530f..05936c2 100644 --- a/ImGui/premake5.lua +++ b/ImGui/premake5.lua @@ -1,4 +1,4 @@ -project "ImGUI_Opengl3" +project "ImGui" kind "StaticLib" includedirs { diff --git a/Runtime/premake5.lua b/Runtime/premake5.lua new file mode 100644 index 0000000..0b6fc49 --- /dev/null +++ b/Runtime/premake5.lua @@ -0,0 +1,39 @@ +project "Runtime" +kind "ConsoleApp" + +buildmessage "Building the runtime ..." + +links{ + "BarinkEngine" +} + +includedirs{ + "./../BarinkEngine/src", + -- I'd prefer if didn't need these.. + -- We'll figure that out some time later + "./../libs/lua/include", + "./../libs/spdlog/include", + "./../libs/glm", + "./../libs/GorillaAudio/include", + + "./../libs/assimp/include", + "./../libs/glad/include", + "./../libs/glfw/include", + "./../libs/tinygltf", + "./../libs/glew/include", + "./../libs/glm", + "./../libs/ImGui", + + + "./include" + +} + +libdirs { + './../build/BarinkEngine/Debug' +} + +files { + "./src/*.h", + "./src/*.cpp" +} \ No newline at end of file diff --git a/Runtime/src/main.cpp b/Runtime/src/main.cpp new file mode 100644 index 0000000..cabf030 --- /dev/null +++ b/Runtime/src/main.cpp @@ -0,0 +1,6 @@ +#include + +int main() +{ + std::cout << "Welcome to the runtime!" << std::endl; +} \ No newline at end of file diff --git a/SandboxApplication/include/GUI.h b/SandboxApp/include/GUI.h similarity index 100% rename from SandboxApplication/include/GUI.h rename to SandboxApp/include/GUI.h diff --git a/SandboxApplication/include/Util.h b/SandboxApp/include/Util.h similarity index 100% rename from SandboxApplication/include/Util.h rename to SandboxApp/include/Util.h diff --git a/SandboxApplication/models/Cube.mtl b/SandboxApp/models/Cube.mtl similarity index 100% rename from SandboxApplication/models/Cube.mtl rename to SandboxApp/models/Cube.mtl diff --git a/SandboxApplication/models/Cube.obj b/SandboxApp/models/Cube.obj similarity index 100% rename from SandboxApplication/models/Cube.obj rename to SandboxApp/models/Cube.obj diff --git a/SandboxApplication/models/sponza.gltf b/SandboxApp/models/sponza.gltf similarity index 100% rename from SandboxApplication/models/sponza.gltf rename to SandboxApp/models/sponza.gltf diff --git a/SandboxApp/premake5.lua b/SandboxApp/premake5.lua new file mode 100644 index 0000000..ce11d35 --- /dev/null +++ b/SandboxApp/premake5.lua @@ -0,0 +1,40 @@ +project "SandboxApp" +kind "ConsoleApp" + +buildmessage "Building SandboxApp ..." + +links{ + "BarinkEngine" +} + +includedirs{ + "./../BarinkEngine/Include", + + -- I'd prefer if didn't need these.. + -- We'll figure that out some time later + "./../libs/lua/include", + "./../libs/spdlog/include", + "./../libs/glm", + "./../libs/GorillaAudio/include", + + "./../libs/assimp/include", + "./../libs/glad/include", + "./../libs/glfw/include", + "./../libs/tinygltf", + "./../libs/glew/include", + "./../libs/glm", + "./../libs/ImGui", + + + "./include" + +} + +libdirs { + './../build/BarinkEngine/Debug' +} + +files { + "./include/*.h", + "./src/*.cpp" +} \ No newline at end of file diff --git a/SandboxApplication/scripting/script.lua b/SandboxApp/scripting/script.lua similarity index 100% rename from SandboxApplication/scripting/script.lua rename to SandboxApp/scripting/script.lua diff --git a/SandboxApplication/src/GUI.cpp b/SandboxApp/src/GUI.cpp similarity index 100% rename from SandboxApplication/src/GUI.cpp rename to SandboxApp/src/GUI.cpp diff --git a/SandboxApplication/src/Sandbox.cpp b/SandboxApp/src/Sandbox.cpp similarity index 90% rename from SandboxApplication/src/Sandbox.cpp rename to SandboxApp/src/Sandbox.cpp index ee4cb88..324a717 100644 --- a/SandboxApplication/src/Sandbox.cpp +++ b/SandboxApp/src/Sandbox.cpp @@ -3,7 +3,7 @@ #include "../../BarinkEngine/src/Scene/SceneNodeTypes.h" #include "../../BarinkEngine/src/AssetManager/ModelImporter.h" #include "../../BarinkEngine/src/Graphics/Framebuffer.h" -#include "imgui.h" +#include #include "GUI.h" #include "Util.h" @@ -14,8 +14,8 @@ Shader* shader; char* code = new char[254]; -const std::string vertexShaderSource = "../build/SandboxApplication/Debug/test.vs"; -const std::string fragmentShaderSource = "../build/SandboxApplication/Debug/test.fs"; +const std::string vertexShaderSource = "build/Debug/test.vs"; +const std::string fragmentShaderSource = "build/Debug/test.fs"; BarinkEngine::ModelImporter* MI = new BarinkEngine::ModelImporter(); Framebuffer* framebuffer; @@ -38,7 +38,7 @@ void Start() { // Create a cube node - cube = MI->Import("../build/SandboxApplication/Debug/Models/cube.obj"); + cube = MI->Import("build/Debug/Models/cube.obj"); cube->renderable->material = new Material(*shader); cube->renderable->material->Color = glm::vec3(1.0f, 0.0f, 0.0f); diff --git a/SandboxApplication/src/Util.cpp b/SandboxApp/src/Util.cpp similarity index 100% rename from SandboxApplication/src/Util.cpp rename to SandboxApp/src/Util.cpp diff --git a/premake5.lua b/premake5.lua index 88ab21e..5f9e0a5 100644 --- a/premake5.lua +++ b/premake5.lua @@ -3,12 +3,13 @@ workspace "BarinkEngine" language "C++" cppdialect "C++17" - - targetdir "./build/%{prj.name}/%{cfg.buildcfg}" - objdir "./intermediates/%{prj.name}/%{cfg.buildcfg}" - architecture "x86_64" + targetdir "./%{prj.name}/build/%{cfg.buildcfg}" + objdir "./%{prj.name}/intermediates/%{cfg.buildcfg}" + + startproject("SandboxApp") + filter "configurations:Debug" defines {"DEBUG"} symbols "On" @@ -17,6 +18,8 @@ workspace "BarinkEngine" defines {"NDEBUG"} optimize "On" -include("./SandboxApplication") - + include("./BarinkEngine") +include("./Runtime") +include ("./Editor") +include("./SandboxApp")