properly defining Debug

This commit is contained in:
2026-03-13 20:43:41 +01:00
parent a98af1fe55
commit 708355f6e5

View File

@@ -4,6 +4,18 @@ cmake_minimum_required(VERSION 3.15)
# Define the workspace/project
project(SakuraVNE LANGUAGES CXX)
# ------------------------------------------------------------------------------
# Default Build Type Configuration
# ------------------------------------------------------------------------------
# If the user didn't specify a build type, default to Debug
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting default build type to 'Debug'")
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE)
# Provide dropdown options for tools like CMake GUI or IDEs
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# Enforce C++20 globally
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -38,7 +50,9 @@ add_subdirectory(libs/imgui)
add_subdirectory(libs/imgui-node-editor)
# 4. Catch2
add_subdirectory(libs/catch2)
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR NOT CMAKE_BUILD_TYPE)
add_subdirectory(libs/catch2)
endif()
# ------------------------------------------------------------------------------
@@ -81,10 +95,11 @@ target_link_libraries(SakuraVNE PRIVATE
# Tests Executable Target
# ------------------------------------------------------------------------------
# These tests can use the Catch2-provided main, plus ALL your engine source files
add_executable(tests "SakuraVNE/test/test.cpp" ${SAKURA_SRCS})
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR NOT CMAKE_BUILD_TYPE)
add_executable(tests "SakuraVNE/test/test.cpp" ${SAKURA_SRCS})
# The tests need the exact same include directories so your engine #includes work
target_include_directories(tests PRIVATE
# The tests need the exact same include directories so your engine #includes work
target_include_directories(tests PRIVATE
"SakuraVNE/src"
"libs/spdlog/include"
"libs/imgui"
@@ -92,16 +107,17 @@ target_include_directories(tests PRIVATE
"libs/imgui/backends"
"libs/imgui-node-editor"
"libs/sdl3/include"
)
)
# Link Catch2 AND the exact same dependencies your game uses
target_link_libraries(tests PRIVATE
# Link Catch2 AND the exact same dependencies your game uses
target_link_libraries(tests PRIVATE
Catch2::Catch2WithMain
ImGui
ImGuiNodeEditor
SDL3::SDL3
spdlog::spdlog
)
)
endif()
# ------------------------------------------------------------------------------
@@ -122,8 +138,10 @@ elseif(UNIX AND NOT APPLE)
target_link_libraries(SakuraVNE PRIVATE dl pthread)
# Apply to Tests
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR NOT CMAKE_BUILD_TYPE)
target_compile_definitions(tests PRIVATE PLATFORM_LINUX)
target_link_libraries(tests PRIVATE dl pthread)
endif()
endif()
# Debug vs Release definitions for Game