From 0d9d8ff96f1c92a15f10659b353b0e2dd13bd576 Mon Sep 17 00:00:00 2001 From: shweet Date: Sat, 28 Feb 2026 22:30:53 -0500 Subject: [PATCH] let's try this? --- CMakeLists.txt | 28 ++++++++++++++++++++++------ CMakePresets.json | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66ef0f6..63b22fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,13 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(BUILD_SHARED_LIBS OFF) if(NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + if(NOT CMAKE_CONFIGURATION_TYPES) + if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE) + endif() + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release) + endif() + if(MSVC) set(CMAKE_C_FLAGS_DEBUG "/Od /Zi" CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS_DEBUG "/W4 /permissive- /Od /Zi" CACHE STRING "" FORCE) @@ -108,12 +115,21 @@ file(GLOB PROJECT_SRC CONFIGURE_DEPENDS src/util/imgui/*.cpp ) -add_executable(${PROJECT_NAME} - ${PROJECT_SRC} - ${IMGUI_SOURCES} - ${TINYXML2_SOURCES} - ${CMAKE_CURRENT_SOURCE_DIR}/include/glad/glad.cpp -) +if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + add_executable(${PROJECT_NAME} WIN32 + ${PROJECT_SRC} + ${IMGUI_SOURCES} + ${TINYXML2_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/include/glad/glad.cpp + ) +else() + add_executable(${PROJECT_NAME} + ${PROJECT_SRC} + ${IMGUI_SOURCES} + ${TINYXML2_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/include/glad/glad.cpp + ) +endif() target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external/SDL/include diff --git a/CMakePresets.json b/CMakePresets.json index 052e003..099f24f 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -6,6 +6,38 @@ "patch": 0 }, "configurePresets": [ + { + "name": "linux-debug", + "displayName": "Linux Debug", + "description": "Ninja Debug (Linux, native)", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/linux-debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/linux-debug" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-release", + "displayName": "Linux Release", + "description": "Ninja Release (Linux, native)", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/linux-release", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/linux-release" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, { "name": "x64-Debug", "displayName": "x64 Debug", @@ -40,6 +72,14 @@ } ], "buildPresets": [ + { + "name": "linux-debug", + "configurePreset": "linux-debug" + }, + { + "name": "linux-release", + "configurePreset": "linux-release" + }, { "name": "x64-Debug", "configurePreset": "x64-Debug",