# HG changeset patch
# User Sebastien Jodogne <s.jodogne@gmail.com>
# Date 1481731041 -3600
# Node ID 3dd44baebc3667248148012e9631a79855043a0f
# Parent  61e0564d03bb385d9d25bd455fb86fb95e6c26e5
macro ORTHANC_ENABLE_LUA for orthanc-wsi

diff -r 61e0564d03bb -r 3dd44baebc36 CMakeLists.txt
--- 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
diff -r 61e0564d03bb -r 3dd44baebc36 Core/Lua/LuaContext.h
--- 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" 
diff -r 61e0564d03bb -r 3dd44baebc36 OrthancServer/FromDcmtkBridge.cpp
--- 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
 }
diff -r 61e0564d03bb -r 3dd44baebc36 OrthancServer/FromDcmtkBridge.h
--- 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
   };
 }