This commit is contained in:
2025-07-29 18:21:25 -05:00
parent 2c8f863706
commit 2a6c504978
2 changed files with 29 additions and 30 deletions

View File

@@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.16)
project(Onyx VERSION 0.1.0 LANGUAGES C CXX)
# Build type (for single-config generators like Make/Ninja)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the build type (Debug or Release)" FORCE)
endif()
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the build type (Debug or Release)" FORCE)
endif ()
# Language standards
set(CMAKE_CXX_STANDARD 20)
@@ -15,26 +15,14 @@ set(CMAKE_C_STANDARD 23)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
include_directories(${CMAKE_BINARY_DIR}/generated)
foreach(OUTPUTCONFIG IN ITEMS Debug Release)
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG_UPPER)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG_UPPER} ${CMAKE_BINARY_DIR}/bin/${OUTPUTCONFIG})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG_UPPER} ${CMAKE_BINARY_DIR}/lib/${OUTPUTCONFIG})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG_UPPER} ${CMAKE_BINARY_DIR}/lib/${OUTPUTCONFIG})
endforeach()
foreach (OUTPUTCONFIG IN ITEMS Debug Release)
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG_UPPER)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG_UPPER} ${CMAKE_BINARY_DIR}/bin/${OUTPUTCONFIG})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG_UPPER} ${CMAKE_BINARY_DIR}/lib/${OUTPUTCONFIG})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG_UPPER} ${CMAKE_BINARY_DIR}/lib/${OUTPUTCONFIG})
endforeach ()
# --- External Libraries ---
include(FetchContent)
@@ -47,8 +35,6 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(glfw)
# ImGui (Docking)
FetchContent_Declare(
imgui
@@ -57,6 +43,19 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(imgui)
# stb (header-only)
FetchContent_Declare(
stb
GIT_REPOSITORY https://github.com/nothings/stb.git
GIT_TAG master
)
FetchContent_MakeAvailable(stb)
# 📁 Create a virtual stb/ folder for includes like <stb/stb_image.h>
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/generated/stb")
file(COPY "${stb_SOURCE_DIR}/stb_image.h" DESTINATION "${CMAKE_BINARY_DIR}/generated/stb")
target_include_directories(Core PRIVATE "${CMAKE_BINARY_DIR}/generated")
# Required packages
find_package(yaml-cpp REQUIRED)
find_package(GLEW REQUIRED)
@@ -81,6 +80,9 @@ target_compile_definitions(ImGui PUBLIC
IMGUI_IMPL_OPENGL_LOADER_GLEW
)
include_directories("C:/msys64/mingw64/include")
link_directories("C:/msys64/mingw64/lib")
# --- Core Engine Library ---
file(GLOB_RECURSE CORE_SOURCES CONFIGURE_DEPENDS
src/core/*.cpp
@@ -112,7 +114,6 @@ add_library(Core STATIC
target_include_directories(Core PUBLIC src/core)
# Add _DEBUG define only for debug builds
target_compile_definitions(Core PRIVATE
$<$<CONFIG:Debug>:_DEBUG>
)

View File

@@ -7,15 +7,13 @@
int main()
{
using namespace OX;
// Note: You must add the layers to the Core BEFORE initializing the core.
Core core;
// You must add the layers to the Core BEFORE initializing the core.
OX::Core core;
core.AddLayer(std::make_unique<Editor>(OX_EDITOR_VERSION));
core.AddLayer(std::make_unique<OX::Editor>(OX_EDITOR_VERSION));
//core.AddLayer(std::make_unique<OX::DummyLayer>());
core.AddLayer(std::make_unique<OX::DummyLayer>());
core.Init();
core.Run();