1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 15:02:34 +02:00

Added RW_VERBOSE_DEBUG_MESSAGES option to control verbose messages

This commit is contained in:
Timmy Sjöstedt 2016-05-24 17:31:54 +02:00
parent 72801839c4
commit 09c22150a0
2 changed files with 19 additions and 11 deletions

View File

@ -11,6 +11,8 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DRW_DEBUG=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pthread -Wextra -Wpedantic")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules")
set(RW_VERBOSE_DEBUG_MESSAGES 1 CACHE BOOL "Print verbose debugging messages")
# Optional components
option(BUILD_TESTS "Build test suite")
option(BUILD_VIEWER "Build GUI data viewer")
@ -49,6 +51,12 @@ IF(${ENABLE_SCRIPT_DEBUG})
add_definitions(-DRW_SCRIPT_DEBUG)
ENDIF()
if(${RW_VERBOSE_DEBUG_MESSAGES})
add_definitions(-DRW_VERBOSE_DEBUG_MESSAGES=1)
else()
add_definitions(-DRW_VERBOSE_DEBUG_MESSAGES=0)
endif()
# Find dependancies
IF(APPLE)
set(OPENRW_PLATFORM_LIBS iconv)

View File

@ -1,18 +1,18 @@
#ifndef _LIBRW_DEFINES_HPP_
#define _LIBRW_DEFINES_HPP_
#if RW_DEBUG
#include <iostream>
#define RW_MESSAGE(msg) \
std::cout << __FILE__ << ":"<< __LINE__ << ": " << msg << std::endl
#define RW_ERROR(msg) \
std::cout << __FILE__ << ":"<< __LINE__ << ": " << msg << std::endl
#define RW_CHECK(cond, msg) \
if(!(cond)) RW_ERROR(msg)
#if RW_DEBUG && RW_VERBOSE_DEBUG_MESSAGES
#include <iostream>
#define RW_MESSAGE(msg) \
std::cout << __FILE__ << ":"<< __LINE__ << ": " << msg << std::endl
#define RW_ERROR(msg) \
std::cout << __FILE__ << ":"<< __LINE__ << ": " << msg << std::endl
#define RW_CHECK(cond, msg) \
if(!(cond)) RW_ERROR(msg)
#else
#define RW_MESSAGE(msg)
#define RW_ERROR(msg)
#define RW_CHECK(cond, msg)
#define RW_MESSAGE(msg)
#define RW_ERROR(msg)
#define RW_CHECK(cond, msg)
#endif
#define RW_UNUSED(var) \