diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..88e6d0a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,102 @@ +# Require a modern version of CMake +cmake_minimum_required(VERSION 3.15) + +# Define the workspace/project +project(SakuraVNE LANGUAGES CXX) + +# Enforce C++20 globally +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) # Disables compiler-specific extensions (like gnu++20) + +# ------------------------------------------------------------------------------ +# Output Directory Configuration (Mirrors your Premake setup) +# ------------------------------------------------------------------------------ +# This mimics: build/bin/{Config}-{System}-{Architecture} +set(OUTPUT_DIR_SUFFIX "$-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${OUTPUT_DIR_SUFFIX}") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${OUTPUT_DIR_SUFFIX}") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${OUTPUT_DIR_SUFFIX}") + +# ------------------------------------------------------------------------------ +# Dependencies +# ------------------------------------------------------------------------------ + +# 1. SDL3 +# Disable tests and examples before adding the subdirectory +set(SDL_TESTS OFF CACHE BOOL "Disable SDL3 tests" FORCE) +set(SDL_EXAMPLES OFF CACHE BOOL "Disable SDL3 examples" FORCE) +add_subdirectory(libs/sdl3) + +# 2. spdlog +# Force compiled mode instead of header-only, and disable extras +set(SPDLOG_BUILD_COMPILED ON CACHE BOOL "Build spdlog as a compiled library" FORCE) +set(SPDLOG_BUILD_EXAMPLE OFF CACHE BOOL "Disable spdlog examples" FORCE) +set(SPDLOG_BUILD_TESTS OFF CACHE BOOL "Disable spdlog tests" FORCE) +add_subdirectory(libs/spdlog) + +# 3. ImGui & ImGui Node Editor +# Assuming you have CMakeLists.txt inside these directories. +# If you don't, you would use add_library() to compile their .cpp files manually here. +add_subdirectory(libs/imgui) +add_subdirectory(libs/imgui-node-editor) + +# ------------------------------------------------------------------------------ +# SakuraVNE Executable Target +# ------------------------------------------------------------------------------ + +# Gather all .cpp and .h files in the src folder +file(GLOB_RECURSE SAKURA_SRCS "SakuraVNE/src/*.cpp" "SakuraVNE/src/*.h") + +# Create the ConsoleApp executable +add_executable(SakuraVNE ${SAKURA_SRCS}) + +# ------------------------------------------------------------------------------ +# Include Directories & Linking +# ------------------------------------------------------------------------------ + +# Tell the compiler where the headers are +target_include_directories(SakuraVNE PRIVATE + "SakuraVNE/src" + "libs/spdlog/include" + "libs/imgui" + "libs/imgui/misc" + "libs/imgui/backends" + "libs/imgui-node-editor" + "libs/sdl3/include" +) + +# Link the libraries. CMake handles all the libdirs automatically! +target_link_libraries(SakuraVNE PRIVATE + ImGui # (Depends on what your ImGui target is actually named) + ImGuiNodeEditor # (Depends on what your ImGuiNodeEditor target is actually named) + SDL3::SDL3 # The official SDL3 target name + spdlog::spdlog # The official spdlog target name +) + +# ------------------------------------------------------------------------------ +# Platform & Configuration Filters +# ------------------------------------------------------------------------------ + +# Windows-specific settings +if(WIN32) + target_compile_definitions(SakuraVNE PRIVATE PLATFORM_WINDOWS) + + # Ignore MSVCRT default library + target_link_options(SakuraVNE PRIVATE "/NODEFAULTLIB:MSVCRT") + +# Linux-specific settings +elseif(UNIX AND NOT APPLE) + target_compile_definitions(SakuraVNE PRIVATE PLATFORM_LINUX) + + # Link dl and pthread + target_link_libraries(SakuraVNE PRIVATE dl pthread) +endif() + +# Debug vs Release definitions +# $ is a generator expression that injects the flag based on the active build type +target_compile_definitions(SakuraVNE PRIVATE + $<$:DEBUG> + $<$:RELEASE> +) diff --git a/libs/imgui b/libs/imgui index 771beef..dca2625 160000 --- a/libs/imgui +++ b/libs/imgui @@ -1 +1 @@ -Subproject commit 771beef1e2b46de466099626d4cedde943ad02da +Subproject commit dca2625a199a350276ce75a4434a78ae2b6fda0a diff --git a/libs/imgui-node-editor b/libs/imgui-node-editor index 5668043..15cde1a 160000 --- a/libs/imgui-node-editor +++ b/libs/imgui-node-editor @@ -1 +1 @@ -Subproject commit 566804348aa64de3a37a7ccb1700e4fef6c447d9 +Subproject commit 15cde1a8febca13838e584ec70f5e129d6d0eaac