changeset 2232:3dd44baebc36

macro ORTHANC_ENABLE_LUA for orthanc-wsi
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 14 Dec 2016 16:57:21 +0100
parents 61e0564d03bb
children 8f5b60647654 a78d15509a1c
files CMakeLists.txt Core/Lua/LuaContext.h OrthancServer/FromDcmtkBridge.cpp OrthancServer/FromDcmtkBridge.h
diffstat 4 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Wed Dec 14 16:41:58 2016 +0100
+++ b/CMakeLists.txt	Wed Dec 14 16:57:21 2016 +0100
@@ -412,6 +412,7 @@
   -DORTHANC_BUILD_UNIT_TESTS=1
   -DORTHANC_ENABLE_BASE64=1
   -DORTHANC_ENABLE_LOGGING=1
+  -DORTHANC_ENABLE_LUA=1
   -DORTHANC_ENABLE_MD5=1
   -DORTHANC_MAXIMUM_TAG_LENGTH=256
   -DORTHANC_SANDBOXED=0
--- a/Core/Lua/LuaContext.h	Wed Dec 14 16:41:58 2016 +0100
+++ b/Core/Lua/LuaContext.h	Wed Dec 14 16:57:21 2016 +0100
@@ -32,6 +32,14 @@
 
 #pragma once
 
+#if !defined(ORTHANC_ENABLE_LUA)
+#  error The macro ORTHANC_ENABLE_LUA must be defined
+#endif
+
+#if ORTHANC_ENABLE_LUA == 0
+#  error The Lua support is disabled, cannot include this file
+#endif
+
 #include "../HttpClient.h"
 
 extern "C" 
--- a/OrthancServer/FromDcmtkBridge.cpp	Wed Dec 14 16:41:58 2016 +0100
+++ b/OrthancServer/FromDcmtkBridge.cpp	Wed Dec 14 16:57:21 2016 +0100
@@ -1977,6 +1977,7 @@
   }
 
 
+#if ORTHANC_ENABLE_LUA == 1
   void FromDcmtkBridge::ExecuteToDicom(DicomMap& target,
                                        LuaFunctionCall& call)
   {
@@ -2012,4 +2013,5 @@
       target.SetValue(tag, output[members[i]].asString(), false);
     }
   }
+#endif
 }
--- a/OrthancServer/FromDcmtkBridge.h	Wed Dec 14 16:41:58 2016 +0100
+++ b/OrthancServer/FromDcmtkBridge.h	Wed Dec 14 16:57:21 2016 +0100
@@ -36,7 +36,6 @@
 
 #include "../Core/DicomFormat/DicomElement.h"
 #include "../Core/DicomFormat/DicomMap.h"
-#include "../Core/Lua/LuaFunctionCall.h"
 
 #include <dcmtk/dcmdata/dcdatset.h>
 #include <dcmtk/dcmdata/dcmetinf.h>
@@ -44,10 +43,22 @@
 #include <dcmtk/dcmdata/dcfilefo.h>
 #include <json/json.h>
 
+#if !defined(ORTHANC_BUILD_UNIT_TESTS)
+#  error The macro ORTHANC_BUILD_UNIT_TESTS must be defined
+#endif
+
+#if !defined(ORTHANC_ENABLE_LUA)
+#  error The macro ORTHANC_ENABLE_LUA must be defined
+#endif
+
 #if ORTHANC_BUILD_UNIT_TESTS == 1
 #  include <gtest/gtest_prod.h>
 #endif
 
+#if ORTHANC_ENABLE_LUA == 1
+#  include "../Core/Lua/LuaFunctionCall.h"
+#endif
+
 
 namespace Orthanc
 {
@@ -204,7 +215,9 @@
     static bool LookupTransferSyntax(std::string& result,
                                      DcmFileFormat& dicom);
 
+#if ORTHANC_ENABLE_LUA == 1
     static void ExecuteToDicom(DicomMap& target,
                                LuaFunctionCall& call);
+#endif
   };
 }