From 2f56239703a487235d3f44d7462bafeff274e982 Mon Sep 17 00:00:00 2001 From: Mark Winter <mwinter@drexel.edu> Date: Sun, 1 Mar 2020 18:00:57 +0100 Subject: [PATCH] Output to user if config is in conflict with compilation --- src/c/ScriptCmds/HydraConfig.h | 12 ++++++++++++ src/c/ScriptCmds/ScopedProcessMutex.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/c/ScriptCmds/HydraConfig.h b/src/c/ScriptCmds/HydraConfig.h index 1f1784ed..99d25ff3 100644 --- a/src/c/ScriptCmds/HydraConfig.h +++ b/src/c/ScriptCmds/HydraConfig.h @@ -7,6 +7,9 @@ #include <string> #include <algorithm> +#include "ScopedProcessMutex.h" +#include "ScriptIncludes.h" + class HydraConfig { public: @@ -48,11 +51,20 @@ private: } } + // TODO: MRW HACK - this is a pretty nasty way to get config info to user + static void checkConfig(HydraConfig* pInst) + { + if ( pInst->bUseProcessMutex && !SUPPORT_PROCESS_MUTEX() ) + Script::warnMsg("HYDRA_ENABLE_MUTEX set to TRUE but Hydra was compiled without USE_PROCESS_MUTEX flag!\n"); + } + static HydraConfig* initConfig() { HydraConfig* pInst = new HydraConfig(); HydraConfig::loadConfig(pInst); + HydraConfig::checkConfig(pInst); + return pInst; } diff --git a/src/c/ScriptCmds/ScopedProcessMutex.h b/src/c/ScriptCmds/ScopedProcessMutex.h index 2ba632f9..8992821a 100644 --- a/src/c/ScriptCmds/ScopedProcessMutex.h +++ b/src/c/ScriptCmds/ScopedProcessMutex.h @@ -1,8 +1,10 @@ #pragma once #ifdef USE_PROCESS_MUTEX + #define SUPPORT_PROCESS_MUTEX() (1) #define SCOPED_PROCESS_MUTEX(Name) ScopedProcessMutex Name##_mutex(#Name) #else + #define SUPPORT_PROCESS_MUTEX() (0) #define SCOPED_PROCESS_MUTEX(Name) #endif -- GitLab