properly defining Debug
This commit is contained in:
@@ -4,6 +4,18 @@ cmake_minimum_required(VERSION 3.15)
|
|||||||
# Define the workspace/project
|
# Define the workspace/project
|
||||||
project(SakuraVNE LANGUAGES CXX)
|
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
|
# Enforce C++20 globally
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
@@ -38,7 +50,9 @@ add_subdirectory(libs/imgui)
|
|||||||
add_subdirectory(libs/imgui-node-editor)
|
add_subdirectory(libs/imgui-node-editor)
|
||||||
|
|
||||||
# 4. Catch2
|
# 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
|
# Tests Executable Target
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# These tests can use the Catch2-provided main, plus ALL your engine source files
|
# 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
|
# The tests need the exact same include directories so your engine #includes work
|
||||||
target_include_directories(tests PRIVATE
|
target_include_directories(tests PRIVATE
|
||||||
"SakuraVNE/src"
|
"SakuraVNE/src"
|
||||||
"libs/spdlog/include"
|
"libs/spdlog/include"
|
||||||
"libs/imgui"
|
"libs/imgui"
|
||||||
@@ -92,16 +107,17 @@ target_include_directories(tests PRIVATE
|
|||||||
"libs/imgui/backends"
|
"libs/imgui/backends"
|
||||||
"libs/imgui-node-editor"
|
"libs/imgui-node-editor"
|
||||||
"libs/sdl3/include"
|
"libs/sdl3/include"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Link Catch2 AND the exact same dependencies your game uses
|
# Link Catch2 AND the exact same dependencies your game uses
|
||||||
target_link_libraries(tests PRIVATE
|
target_link_libraries(tests PRIVATE
|
||||||
Catch2::Catch2WithMain
|
Catch2::Catch2WithMain
|
||||||
ImGui
|
ImGui
|
||||||
ImGuiNodeEditor
|
ImGuiNodeEditor
|
||||||
SDL3::SDL3
|
SDL3::SDL3
|
||||||
spdlog::spdlog
|
spdlog::spdlog
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
@@ -122,8 +138,10 @@ elseif(UNIX AND NOT APPLE)
|
|||||||
target_link_libraries(SakuraVNE PRIVATE dl pthread)
|
target_link_libraries(SakuraVNE PRIVATE dl pthread)
|
||||||
|
|
||||||
# Apply to Tests
|
# Apply to Tests
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR NOT CMAKE_BUILD_TYPE)
|
||||||
target_compile_definitions(tests PRIVATE PLATFORM_LINUX)
|
target_compile_definitions(tests PRIVATE PLATFORM_LINUX)
|
||||||
target_link_libraries(tests PRIVATE dl pthread)
|
target_link_libraries(tests PRIVATE dl pthread)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Debug vs Release definitions for Game
|
# Debug vs Release definitions for Game
|
||||||
|
|||||||
Reference in New Issue
Block a user