diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a8ac4f..91f0595 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,4 @@ +# Set minimum CMake version cmake_minimum_required(VERSION 3.22) # Declare project @@ -10,7 +11,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # Define variables of directory paths set(THIRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty) -# Add thirdparty libraries +# Add third party libraries add_subdirectory(${THIRDPARTY_DIR}/glad) add_subdirectory(${THIRDPARTY_DIR}/glfw) add_subdirectory(${THIRDPARTY_DIR}/glm) diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index ef50fdc..389d57a 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -1,19 +1,45 @@ +# Set minimum CMake version +cmake_minimum_required(VERSION 3.22) + +# Declare project project(engine) -set(ENGINE_SOURCE_DIR src) -set(ENGINE_INCLUDE_DIR include) +# Define variables of source files and include directories +set(CORE_INCLUDES core) +set(INPUT_INCLUDES core/input) +file(GLOB_RECURSE CORE_SOURCES "${CORE_INCLUDES}/*.cpp") +file(GLOB_RECURSE INPUT_SOURCES "${INPUT_INCLUDES}/*.cpp") -file(GLOB_RECURSE ENGINE_SOURCES ${ENGINE_SOURCE_DIR}/*.cpp) +set(RENDERING_INCLUDES rendering) +file(GLOB_RECURSE RENDERING_SOURCES "${RENDERING_INCLUDES}/*.cpp") +set(SCENE_INCLUDES scene) +set(COMPONENTS_INCLUDES scene/components) +file(GLOB SCENE_SOURCES "${SCENE_INCLUDES}/*.cpp") +file(GLOB COMPONENTS_SOURCES "${COMPONENTS_INCLUDES}/*.cpp") + +set(UI_INCLUDES ui) +file(GLOB UI_SOURCES "${UI_INCLUDES}/*.cpp") + +# Build engine as library add_library(${PROJECT_NAME}) +# Add resources folder if(CMAKE_BUILD_TYPE STREQUAL "Release") target_compile_definitions(${PROJECT_NAME} PUBLIC RESOURCES_PATH="./resources/") else() target_compile_definitions(${PROJECT_NAME} PUBLIC RESOURCES_PATH="${CMAKE_SOURCE_DIR}/editor/resources/") endif() -target_sources(${PROJECT_NAME} PRIVATE ${ENGINE_SOURCES}) -target_include_directories(${PROJECT_NAME} PUBLIC ${ENGINE_INCLUDE_DIR}) - +# Link sources, include directories, and third party libraries +target_include_directories(${PROJECT_NAME} PUBLIC + ${CORE_INCLUDES} ${INPUT_INCLUDES} + ${RENDERING_INCLUDES} + ${SCENE_INCLUDES} ${COMPONENTS_INCLUDES} + ${UI_INCLUDES}) +target_sources(${PROJECT_NAME} PRIVATE + ${CORE_SOURCES} ${INPUT_SOURCES} + ${RENDERING_SOURCES} + ${SCENE_SOURCES} ${COMPONENTS_SOURCES} + ${UI_SOURCES}) target_link_libraries(${PROJECT_NAME} glfw glad glm imgui stb) diff --git a/engine/src/Engine.cpp b/engine/core/Engine.cpp similarity index 100% rename from engine/src/Engine.cpp rename to engine/core/Engine.cpp diff --git a/engine/include/Engine.h b/engine/core/Engine.h similarity index 100% rename from engine/include/Engine.h rename to engine/core/Engine.h diff --git a/engine/src/Window.cpp b/engine/core/Window.cpp similarity index 100% rename from engine/src/Window.cpp rename to engine/core/Window.cpp diff --git a/engine/include/Window.h b/engine/core/Window.h similarity index 100% rename from engine/include/Window.h rename to engine/core/Window.h diff --git a/engine/src/Input.cpp b/engine/core/input/Input.cpp similarity index 100% rename from engine/src/Input.cpp rename to engine/core/input/Input.cpp diff --git a/engine/include/Input.h b/engine/core/input/Input.h similarity index 100% rename from engine/include/Input.h rename to engine/core/input/Input.h diff --git a/engine/include/KeyCodes.h b/engine/core/input/KeyCodes.h similarity index 100% rename from engine/include/KeyCodes.h rename to engine/core/input/KeyCodes.h diff --git a/engine/include/MouseCodes.h b/engine/core/input/MouseCodes.h similarity index 100% rename from engine/include/MouseCodes.h rename to engine/core/input/MouseCodes.h diff --git a/engine/src/FrameBuffer.cpp b/engine/rendering/FrameBuffer.cpp similarity index 100% rename from engine/src/FrameBuffer.cpp rename to engine/rendering/FrameBuffer.cpp diff --git a/engine/include/FrameBuffer.h b/engine/rendering/FrameBuffer.h similarity index 100% rename from engine/include/FrameBuffer.h rename to engine/rendering/FrameBuffer.h diff --git a/engine/src/IndexBuffer.cpp b/engine/rendering/IndexBuffer.cpp similarity index 100% rename from engine/src/IndexBuffer.cpp rename to engine/rendering/IndexBuffer.cpp diff --git a/engine/include/IndexBuffer.h b/engine/rendering/IndexBuffer.h similarity index 100% rename from engine/include/IndexBuffer.h rename to engine/rendering/IndexBuffer.h diff --git a/engine/src/Renderer.cpp b/engine/rendering/Renderer.cpp similarity index 100% rename from engine/src/Renderer.cpp rename to engine/rendering/Renderer.cpp diff --git a/engine/include/Renderer.h b/engine/rendering/Renderer.h similarity index 100% rename from engine/include/Renderer.h rename to engine/rendering/Renderer.h diff --git a/engine/src/Shader.cpp b/engine/rendering/Shader.cpp similarity index 100% rename from engine/src/Shader.cpp rename to engine/rendering/Shader.cpp diff --git a/engine/include/Shader.h b/engine/rendering/Shader.h similarity index 100% rename from engine/include/Shader.h rename to engine/rendering/Shader.h diff --git a/engine/src/Texture.cpp b/engine/rendering/Texture.cpp similarity index 100% rename from engine/src/Texture.cpp rename to engine/rendering/Texture.cpp diff --git a/engine/include/Texture.h b/engine/rendering/Texture.h similarity index 100% rename from engine/include/Texture.h rename to engine/rendering/Texture.h diff --git a/engine/src/VertexArray.cpp b/engine/rendering/VertexArray.cpp similarity index 100% rename from engine/src/VertexArray.cpp rename to engine/rendering/VertexArray.cpp diff --git a/engine/include/VertexArray.h b/engine/rendering/VertexArray.h similarity index 100% rename from engine/include/VertexArray.h rename to engine/rendering/VertexArray.h diff --git a/engine/src/VertexBuffer.cpp b/engine/rendering/VertexBuffer.cpp similarity index 100% rename from engine/src/VertexBuffer.cpp rename to engine/rendering/VertexBuffer.cpp diff --git a/engine/include/VertexBuffer.h b/engine/rendering/VertexBuffer.h similarity index 100% rename from engine/include/VertexBuffer.h rename to engine/rendering/VertexBuffer.h diff --git a/engine/src/Camera.cpp b/engine/scene/components/Camera.cpp similarity index 100% rename from engine/src/Camera.cpp rename to engine/scene/components/Camera.cpp diff --git a/engine/include/Camera.h b/engine/scene/components/Camera.h similarity index 100% rename from engine/include/Camera.h rename to engine/scene/components/Camera.h diff --git a/engine/include/IconsFontAwesome6.h b/engine/ui/IconsFontAwesome6.h similarity index 100% rename from engine/include/IconsFontAwesome6.h rename to engine/ui/IconsFontAwesome6.h diff --git a/engine/src/UI.cpp b/engine/ui/UI.cpp similarity index 100% rename from engine/src/UI.cpp rename to engine/ui/UI.cpp diff --git a/engine/include/UI.h b/engine/ui/UI.h similarity index 100% rename from engine/include/UI.h rename to engine/ui/UI.h