Fix compilation errors when logs or profiling is disabled

This commit is contained in:
Daniel Chappuis 2018-03-29 07:16:50 +02:00
parent b1e5c029f7
commit cd897f1151
3 changed files with 15 additions and 10 deletions

View File

@ -39,7 +39,7 @@ uint CollisionWorld::mNbWorlds = 0;
CollisionWorld::CollisionWorld(const WorldSettings& worldSettings, Logger* logger, Profiler* profiler)
: mConfig(worldSettings), mCollisionDetection(this, mMemoryManager), mBodies(mMemoryManager.getPoolAllocator()), mCurrentBodyId(0),
mFreeBodiesIds(mMemoryManager.getPoolAllocator()), mEventListener(nullptr), mName(worldSettings.worldName),
mProfiler(profiler), mLogger(logger), mIsProfilerCreatedByUser(profiler != nullptr),
mIsProfilerCreatedByUser(profiler != nullptr),
mIsLoggerCreatedByUser(logger != nullptr) {
// Automatically generate a name for the world
@ -57,6 +57,8 @@ CollisionWorld::CollisionWorld(const WorldSettings& worldSettings, Logger* logge
#ifdef IS_PROFILING_ACTIVE
mProfiler = profiler;
// If the user has not provided its own profiler, we create one
if (mProfiler == nullptr) {
@ -74,6 +76,8 @@ CollisionWorld::CollisionWorld(const WorldSettings& worldSettings, Logger* logge
#ifdef IS_LOGGING_ACTIVE
mLogger = logger;
// If the user has not provided its own logger, we create one
if (mLogger == nullptr) {

View File

@ -463,7 +463,7 @@ class Logger {
#else // If logger is not active
// Empty macro in case logs are not enabled
#define RP3D_LOG(logger, level, message)
#define RP3D_LOG(logger, level, category, message)
#endif

View File

@ -26,8 +26,6 @@
#ifndef REACTPHYSICS3D_PROFILER_H
#define REACTPHYSICS3D_PROFILER_H
#ifdef IS_PROFILING_ACTIVE
// Libraries
#include "configuration.h"
#include "engine/Timer.h"
@ -381,9 +379,18 @@ class ProfileSample {
}
};
#ifdef IS_PROFILING_ACTIVE
// Use this macro to start profile a block of code
#define RP3D_PROFILE(name, profiler) ProfileSample profileSample(name, profiler)
#else // If profile is not active
// Empty macro in case profiling is not active
#define RP3D_PROFILE(name, profiler)
#endif
// Return true if we are at the root of the profiler tree
inline bool ProfileNodeIterator::isRoot() {
return (mCurrentParentNode->getParentNode() == nullptr);
@ -497,11 +504,5 @@ inline void Profiler::destroy() {
}
#else // If profile is not active
// Empty macro in case profiling is not active
#define RP3D_PROFILE(name, profiler)
#endif
#endif