Merge pull request #159 from jcoby/enable-console-logging

Enable console logging if MONO or LOGGER is defined
This commit is contained in:
Louis Gombert
2024-04-23 18:10:45 +00:00
committed by GitHub
6 changed files with 20 additions and 13 deletions

View File

@@ -6,6 +6,8 @@ if(NOT MSVC) # GCC/clang or compatible, hopefully
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored compiler warnings/errors (GCC/Clang only; esp. useful with ninja)." OFF)
endif()
option(LOGGER "Enable logging to the terminal" OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@@ -97,6 +99,11 @@ if(WIN32)
endif()
endif()
if(LOGGER)
message("Enabling Logging")
add_definitions(-DLOGGER)
endif()
include_directories("lib" "Descent3" ${PLATFORM_INCLUDES})
# file(GLOB_RECURSE INCS "*.h")

View File

@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
@@ -1153,7 +1153,7 @@ void PreInitD3Systems() {
debugging = (FindArg("-debug") != 0);
#ifdef MONO
#ifdef LOGGER
console_output = true;
#endif
#ifndef MACINTOSH
@@ -2151,7 +2151,7 @@ void InitD3Systems1(bool editor) {
#if 0
//CD Check goes here
//#if ( defined(RELEASE) && (!defined(DEMO)) && (!defined(GAMEGAUGE)) )
if( (!FindArg("-dedicated")) )
if( (!FindArg("-dedicated")) )
PreGameCdCheck();
#endif

View File

@@ -28,14 +28,14 @@ Build steps below assume you have already cloned the repository and entered it l
Requires Visual Studio C++ Tools (cmake and nmake)
```sh
cmake --preset win
cmake --build --preset win --config [Debug/Release]
cmake --build --preset win --config [Debug/Release] -D LOGGER=[ON|OFF]
```
#### Building - MacOS
```sh
brew bundle install
cmake --preset mac
cmake --build --preset mac --config [Debug/Release]
cmake --build --preset mac --config [Debug/Release] -D LOGGER=[ON|OFF]
```
#### Building - Linux
@@ -44,7 +44,7 @@ sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y --no-install-recommends ninja-build cmake g++ libsdl1.2-dev libsdl-image1.2-dev libncurses-dev libxext6:i386
cmake --preset linux
cmake --build --preset linux --config [Debug/Release]
cmake --build --preset linux --config [Debug/Release] -D LOGGER=[ON|OFF]
```
## Contributing

View File

@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
@@ -166,7 +166,7 @@ bool Debug_ConsoleInit();
void Debug_ConsoleOpen(int n, int row, int col, int width, int height, char *title);
void Debug_ConsoleClose(int n);
void Debug_ConsolePrintf(int n, char *format, ...);
void Debug_ConsolePrintf(int n, int row, int col, char *format, ...);
void Debug_ConsolePrintfAt(int n, int row, int col, char *format, ...);
void Debug_ConsoleRedirectMessages(int virtual_window, int physical_window);
// DEBUGGING MACROS
// Break into the debugger, if this feature was enabled in Debug_init()

View File

@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
@@ -66,12 +66,12 @@
#include "debug.h"
void nw_InitTCPLogging(char *ip, unsigned short port);
void nw_TCPPrintf(int n, char *format, ...);
#if (!defined(RELEASE)) && defined(MONO)
#if (!defined(RELEASE)) && defined(LOGGER)
extern bool Debug_print_block;
// Prints a formatted string to the debug window
#define mprintf(args) Debug_ConsolePrintf args
// Prints a formatted string on window n at row, col.
#define mprintf_at(args) Debug_ConsolePrintf args
#define mprintf_at(args) Debug_ConsolePrintfAt args
#define DebugBlockPrint(args) \
do { \
if (Debug_print_block) \

View File

@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
@@ -554,7 +554,7 @@ void Debug_ConsolePrintf(int n, char *format, ...) {
}
}
void Debug_ConsolePrintf(int n, int row, int col, char *format, ...) {
void Debug_ConsolePrintfAt(int n, int row, int col, char *format, ...) {
if (!Mono_initialized)
return;