mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-03 12:31:15 +00:00
Allow disabling isleapp debugging by configuring with -DISLE_DEBUG=OFF
This commit is contained in:
parent
7c0c45d630
commit
d5f9ffff01
@ -22,6 +22,7 @@ option(ISLE_BUILD_APP "Build isle application" ON)
|
||||
option(ISLE_ASAN "Enable Address Sanitizer" OFF)
|
||||
option(ISLE_UBSAN "Enable Undefined Behavior Sanitizer" OFF)
|
||||
option(ISLE_WERROR "Treat warnings as errors" OFF)
|
||||
option(ISLE_DEBUG "Enable imgui debug" ON)
|
||||
cmake_dependent_option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" "${NOT_MINGW}" "WIN32;CMAKE_SIZEOF_VOID_P EQUAL 4" OFF)
|
||||
cmake_dependent_option(ISLE_MINIWIN "Use miniwin and minimfc" ON "NOT ISLE_USE_DX5" OFF)
|
||||
cmake_dependent_option(ISLE_BUILD_CONFIG "Build CONFIG.EXE application" ON "MSVC OR ISLE_MINIWIN" OFF)
|
||||
@ -34,6 +35,7 @@ message(STATUS "Isle app: ${ISLE_BUILD_APP}")
|
||||
message(STATUS "Config app: ${ISLE_BUILD_CONFIG}")
|
||||
message(STATUS "Internal DirectX5 SDK: ${ISLE_USE_DX5}")
|
||||
message(STATUS "Internal miniwin: ${ISLE_MINIWIN}")
|
||||
message(STATUS "Isle debugging: ${ISLE_DEBUG}")
|
||||
|
||||
if (DOWNLOAD_DEPENDENCIES)
|
||||
# FetchContent downloads and configures dependencies
|
||||
@ -468,7 +470,6 @@ if (ISLE_BUILD_APP)
|
||||
add_executable(isle WIN32
|
||||
ISLE/res/isle.rc
|
||||
ISLE/isleapp.cpp
|
||||
ISLE/isledebug.cpp
|
||||
)
|
||||
list(APPEND isle_targets isle)
|
||||
if (WIN32)
|
||||
@ -492,7 +493,13 @@ if (ISLE_BUILD_APP)
|
||||
endif()
|
||||
# Link LEGO1
|
||||
target_link_libraries(isle PRIVATE lego1)
|
||||
target_link_libraries(isle PRIVATE imgui)
|
||||
if(ISLE_DEBUG)
|
||||
target_sources(isle PRIVATE
|
||||
ISLE/isledebug.cpp
|
||||
)
|
||||
target_compile_definitions(isle PRIVATE ISLE_DEBUG)
|
||||
target_link_libraries(isle PRIVATE imgui)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (ISLE_BUILD_CONFIG)
|
||||
|
||||
@ -843,10 +843,12 @@ MxResult IsleApp::ParseArguments(int argc, char** argv)
|
||||
m_iniPath = argv[i + 1];
|
||||
consumed = 2;
|
||||
}
|
||||
#ifdef ISLE_DEBUG
|
||||
else if (strcmp(argv[i], "--debug") == 0) {
|
||||
g_debugEnabled = true;
|
||||
consumed = 1;
|
||||
}
|
||||
#endif
|
||||
if (consumed <= 0) {
|
||||
SDL_Log("Invalid argument(s): %s", argv[i]);
|
||||
return FAILURE;
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
#ifndef ISLEDEBUG_H
|
||||
#define ISLEDEBUG_H
|
||||
|
||||
#if defined(ISLE_DEBUG)
|
||||
|
||||
extern bool g_debugEnabled;
|
||||
|
||||
typedef union SDL_Event SDL_Event;
|
||||
@ -11,4 +13,16 @@ extern bool IsleDebug_Event(SDL_Event* event);
|
||||
|
||||
extern void IsleDebug_Render();
|
||||
|
||||
#else
|
||||
|
||||
#define IsleDebug_Init() do {} while (0)
|
||||
|
||||
#define IsleDebug_Event(EVENT) false
|
||||
|
||||
#define IsleDebug_Render() do {} while (0)
|
||||
|
||||
#define g_debugEnabled false
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user