changeset 6081:36fed5f5dae9

fix build if __ORTHANC_FILE__ is not defined
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 04 Apr 2025 21:47:28 +0200 (6 weeks ago)
parents a2834b7f4027
children f09fb1c3a6bd
files OrthancFramework/Sources/DicomNetworking/Internals/DicomTls.cpp OrthancServer/Plugins/Samples/MultitenantDicom/OrthancFrameworkDependencies.cpp OrthancServer/Resources/PreventProtobufDirectoryLeaks.py OrthancServer/Sources/OrthancInitialization.cpp
diffstat 4 files changed, 34 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomNetworking/Internals/DicomTls.cpp	Fri Apr 04 18:22:01 2025 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/Internals/DicomTls.cpp	Fri Apr 04 21:47:28 2025 +0200
@@ -25,6 +25,16 @@
 #include "../../PrecompiledHeaders.h"
 #include "DicomTls.h"
 
+
+// This must be *before* the inclusion of "Logging.h"
+#if defined(__ORTHANC_FILE__)
+// Prevents the system-wide DCMTK library from leaking the
+// full path of this source file in "DCMTLS_ERROR()"
+#  undef __FILE__
+#  define __FILE__ __ORTHANC_FILE__
+#endif
+
+
 #include "../../Logging.h"
 #include "../../OrthancException.h"
 #include "../../SystemToolbox.h"
@@ -44,16 +54,6 @@
 #endif
 
 
-#if ORTHANC_ENABLE_PLUGINS == 1
-#  if defined(__ORTHANC_FILE__)
-//   Prevents the system-wide DCMTK library from leaking the
-//   full path of this source file in "DCMTLS_ERROR()"
-#    undef __FILE__
-#    define __FILE__ __ORTHANC_FILE__
-#  endif
-#endif
-
-
 namespace Orthanc
 {
   namespace Internals
--- a/OrthancServer/Plugins/Samples/MultitenantDicom/OrthancFrameworkDependencies.cpp	Fri Apr 04 18:22:01 2025 +0200
+++ b/OrthancServer/Plugins/Samples/MultitenantDicom/OrthancFrameworkDependencies.cpp	Fri Apr 04 21:47:28 2025 +0200
@@ -29,6 +29,10 @@
 #  include <winsock2.h>
 #endif
 
+// This must be the first inclusion, as it can modify __FILE__ to
+// avoid the leaking of paths for reproducible builds
+#include "../../../../OrthancFramework/Sources/DicomNetworking/Internals/DicomTls.cpp"
+
 #include "../../../../OrthancFramework/Sources/ChunkedBuffer.cpp"
 #include "../../../../OrthancFramework/Sources/Compression/DeflateBaseCompressor.cpp"
 #include "../../../../OrthancFramework/Sources/Compression/GzipCompressor.cpp"
@@ -47,7 +51,6 @@
 #include "../../../../OrthancFramework/Sources/DicomNetworking/DicomFindAnswers.cpp"
 #include "../../../../OrthancFramework/Sources/DicomNetworking/DicomServer.cpp"
 #include "../../../../OrthancFramework/Sources/DicomNetworking/Internals/CommandDispatcher.cpp"
-#include "../../../../OrthancFramework/Sources/DicomNetworking/Internals/DicomTls.cpp"
 #include "../../../../OrthancFramework/Sources/DicomNetworking/Internals/FindScp.cpp"
 #include "../../../../OrthancFramework/Sources/DicomNetworking/Internals/GetScp.cpp"
 #include "../../../../OrthancFramework/Sources/DicomNetworking/Internals/MoveScp.cpp"
--- a/OrthancServer/Resources/PreventProtobufDirectoryLeaks.py	Fri Apr 04 18:22:01 2025 +0200
+++ b/OrthancServer/Resources/PreventProtobufDirectoryLeaks.py	Fri Apr 04 21:47:28 2025 +0200
@@ -41,8 +41,10 @@
 else:
     # New version in Orthanc 1.12.5
     s = """
-#undef __FILE__
-#define __FILE__ __ORTHANC_FILE__
+#if defined(__ORTHANC_FILE__)
+#  undef __FILE__
+#  define __FILE__ __ORTHANC_FILE__
+#endif
 """ + s
 
 with open(sys.argv[1], 'w') as f:
--- a/OrthancServer/Sources/OrthancInitialization.cpp	Fri Apr 04 18:22:01 2025 +0200
+++ b/OrthancServer/Sources/OrthancInitialization.cpp	Fri Apr 04 21:47:28 2025 +0200
@@ -36,6 +36,22 @@
 #  include <malloc.h>
 #endif
 
+
+// This must be *before* the inclusion of "Logging.h"
+#if defined(__ORTHANC_FILE__)
+// Prevents the system-wide Google Protobuf library from leaking the
+// full path of this source file
+#  undef __FILE__
+#  define __FILE__ __ORTHANC_FILE__
+#endif
+
+
+#if ORTHANC_ENABLE_PLUGINS == 1
+#  include <google/protobuf/stubs/common.h>
+#  include <google/protobuf/any.h>
+#endif
+
+
 #include "OrthancInitialization.h"
 
 #include "../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h"
@@ -52,16 +68,6 @@
 
 #include <dcmtk/dcmnet/diutil.h>  // For DCM_dcmnetLogger
 
-#if ORTHANC_ENABLE_PLUGINS == 1
-#  if defined(__ORTHANC_FILE__)
-//   Prevents the system-wide Google Protobuf library from leaking the
-//   full path of this source file
-#    undef __FILE__
-#    define __FILE__ __ORTHANC_FILE__
-#  endif
-#  include <google/protobuf/stubs/common.h>
-#  include <google/protobuf/any.h>
-#endif
 
 
 static const char* const STORAGE_DIRECTORY = "StorageDirectory";