changeset 1198:4cc997207d8a broker

fix compatibility between SDL and DCMTK
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 28 Nov 2019 17:13:33 +0100
parents bdc6837d5917
children 54cbffabdc45
files Applications/Sdl/SdlCairoSurface.h Applications/Sdl/SdlOrthancSurface.cpp Framework/OpenGL/SdlOpenGLContext.h Framework/Viewport/SdlWindow.cpp Framework/Viewport/SdlWindow.h Resources/CMake/OrthancStoneConfiguration.cmake
diffstat 6 files changed, 61 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Sdl/SdlCairoSurface.h	Wed Nov 27 14:34:34 2019 +0100
+++ b/Applications/Sdl/SdlCairoSurface.h	Thu Nov 28 17:13:33 2019 +0100
@@ -27,6 +27,8 @@
 #include "../../Framework/Wrappers/CairoSurface.h"
 #include "../../Framework/Deprecated/Viewport/IViewport.h"
 
+#include <SDL_render.h>
+
 #include <boost/thread/mutex.hpp>
 
 namespace OrthancStone
--- a/Applications/Sdl/SdlOrthancSurface.cpp	Wed Nov 27 14:34:34 2019 +0100
+++ b/Applications/Sdl/SdlOrthancSurface.cpp	Thu Nov 28 17:13:33 2019 +0100
@@ -27,6 +27,8 @@
 #include <Core/OrthancException.h>
 #include <Core/Images/Image.h>
 
+#include <SDL_render.h>
+
 namespace OrthancStone
 {
   SdlOrthancSurface::SdlOrthancSurface(SdlWindow& window) :
--- a/Framework/OpenGL/SdlOpenGLContext.h	Wed Nov 27 14:34:34 2019 +0100
+++ b/Framework/OpenGL/SdlOpenGLContext.h	Thu Nov 28 17:13:33 2019 +0100
@@ -26,6 +26,8 @@
 #include "IOpenGLContext.h"
 #include "../Viewport/SdlWindow.h"
 
+#include <SDL_render.h>
+
 #include <Core/Enumerations.h>
 
 namespace OrthancStone
--- a/Framework/Viewport/SdlWindow.cpp	Wed Nov 27 14:34:34 2019 +0100
+++ b/Framework/Viewport/SdlWindow.cpp	Thu Nov 28 17:13:33 2019 +0100
@@ -31,6 +31,8 @@
 #endif 
 // WIN32
 
+#include <SDL_render.h>
+#include <SDL_video.h>
 #include <SDL.h>
 
 namespace OrthancStone
--- a/Framework/Viewport/SdlWindow.h	Wed Nov 27 14:34:34 2019 +0100
+++ b/Framework/Viewport/SdlWindow.h	Thu Nov 28 17:13:33 2019 +0100
@@ -23,18 +23,22 @@
 
 #if ORTHANC_ENABLE_SDL == 1
 
-#include <SDL_render.h>
-#include <SDL_video.h>
 #include <boost/noncopyable.hpp>
 
+// Forward declaration of SDL type to avoid clashes with DCMTK headers
+// on "typedef Sint8", in "StoneInitialization.cpp"
+struct SDL_Window;
+struct SDL_Renderer;
+struct SDL_Surface;
+
 namespace OrthancStone
 {
   class SdlWindow : public boost::noncopyable
   {
   private:
-    SDL_Window    *window_;
-    SDL_Renderer  *renderer_;
-    bool           maximized_;
+    struct SDL_Window   *window_;
+    struct SDL_Renderer *renderer_;
+    bool                 maximized_;
 
   public:
     SdlWindow(const char* title,
@@ -54,7 +58,7 @@
 
     unsigned int GetHeight() const;
 
-    void Render(SDL_Surface* surface);
+    void Render(struct SDL_Surface* surface);
 
     void ToggleMaximize();
 
--- a/Resources/CMake/OrthancStoneConfiguration.cmake	Wed Nov 27 14:34:34 2019 +0100
+++ b/Resources/CMake/OrthancStoneConfiguration.cmake	Thu Nov 28 17:13:33 2019 +0100
@@ -250,10 +250,6 @@
 ## All the source files required to build Stone of Orthanc
 #####################################################################
 
-set(APPLICATIONS_SOURCES
-  ${ORTHANC_STONE_ROOT}/Applications/IStoneApplication.h
-  )
-
 if (NOT ORTHANC_SANDBOXED)
   set(PLATFORM_SOURCES
     ${ORTHANC_STONE_ROOT}/Platforms/Generic/WebServiceCommandBase.cpp
@@ -265,46 +261,21 @@
     ${ORTHANC_STONE_ROOT}/Platforms/Generic/OracleDelayedCallExecutor.h
     )
 
-  if (ENABLE_STONE_DEPRECATED)
-    list(APPEND PLATFORM_SOURCES
-      ${ORTHANC_STONE_ROOT}/Platforms/Generic/OracleWebService.cpp
-      ${ORTHANC_STONE_ROOT}/Framework/Deprecated/Viewport/CairoFont.cpp
+  if (ENABLE_SDL)
+    list(APPEND ORTHANC_STONE_SOURCES
+      ${ORTHANC_STONE_ROOT}/Framework/Viewport/SdlWindow.cpp
       )
   endif()
 
   if (ENABLE_SDL OR ENABLE_QT)
-    if (ENABLE_STONE_DEPRECATED)
-      list(APPEND APPLICATIONS_SOURCES
-        ${ORTHANC_STONE_ROOT}/Applications/Generic/NativeStoneApplicationRunner.cpp
-        ${ORTHANC_STONE_ROOT}/Applications/Generic/NativeStoneApplicationContext.cpp
-        )
-    endif()
-      
-    if (ENABLE_SDL)
+    if (ENABLE_OPENGL)
       list(APPEND ORTHANC_STONE_SOURCES
-        ${ORTHANC_STONE_ROOT}/Framework/Viewport/SdlWindow.cpp
+        ${ORTHANC_STONE_ROOT}/Framework/OpenGL/SdlOpenGLContext.cpp
+        ${ORTHANC_STONE_ROOT}/Framework/Viewport/SdlViewport.cpp
         )
-
-      list(APPEND APPLICATIONS_SOURCES
-        ${ORTHANC_STONE_ROOT}/Applications/Sdl/SdlCairoSurface.cpp
-        ${ORTHANC_STONE_ROOT}/Applications/Sdl/SdlEngine.cpp
-        ${ORTHANC_STONE_ROOT}/Applications/Sdl/SdlOrthancSurface.cpp
-        ${ORTHANC_STONE_ROOT}/Applications/Sdl/SdlStoneApplicationRunner.cpp
-        )
-
-      if (ENABLE_OPENGL)
-        list(APPEND ORTHANC_STONE_SOURCES
-          ${ORTHANC_STONE_ROOT}/Framework/OpenGL/SdlOpenGLContext.cpp
-          ${ORTHANC_STONE_ROOT}/Framework/Viewport/SdlViewport.cpp
-          )
-      endif()
     endif()
   endif()
 elseif (ENABLE_WASM)
-  list(APPEND APPLICATIONS_SOURCES
-    ${ORTHANC_STONE_ROOT}/Applications/Wasm/StartupParametersBuilder.cpp
-    )
-
   set(STONE_WASM_SOURCES
     ${ORTHANC_STONE_ROOT}/Platforms/Wasm/Defaults.cpp
     ${ORTHANC_STONE_ROOT}/Platforms/Wasm/WasmDelayedCallExecutor.cpp
@@ -331,15 +302,45 @@
     DEPENDS "${ORTHANC_STONE_ROOT}/Platforms/Wasm/default-library.js")
 endif()
 
-if (ENABLE_SDL OR ENABLE_WASM)
-  list(APPEND APPLICATIONS_SOURCES
-    ${ORTHANC_STONE_ROOT}/Applications/Generic/GuiAdapter.cpp
-    ${ORTHANC_STONE_ROOT}/Applications/Generic/GuiAdapter.h
-    )
-endif()
+if (ENABLE_STONE_DEPRECATED)
+  if (NOT ORTHANC_SANDBOXED)
+    list(APPEND PLATFORM_SOURCES
+      ${ORTHANC_STONE_ROOT}/Platforms/Generic/OracleWebService.cpp
+      ${ORTHANC_STONE_ROOT}/Framework/Deprecated/Viewport/CairoFont.cpp
+      )
+  endif()
+
+  if (ENABLE_SDL OR ENABLE_WASM)
+    list(APPEND APPLICATIONS_SOURCES
+      ${ORTHANC_STONE_ROOT}/Applications/Generic/GuiAdapter.cpp
+      ${ORTHANC_STONE_ROOT}/Applications/Generic/GuiAdapter.h
+      )
+  endif()
 
-if (ENABLE_STONE_DEPRECATED)
+  if (ENABLE_SDL OR ENABLE_QT)
+    list(APPEND APPLICATIONS_SOURCES
+      ${ORTHANC_STONE_ROOT}/Applications/Generic/NativeStoneApplicationRunner.cpp
+      ${ORTHANC_STONE_ROOT}/Applications/Generic/NativeStoneApplicationContext.cpp
+      )
+  endif()
+
+  if (ENABLE_SDL)
+    list(APPEND APPLICATIONS_SOURCES
+      ${ORTHANC_STONE_ROOT}/Applications/Sdl/SdlCairoSurface.cpp
+      ${ORTHANC_STONE_ROOT}/Applications/Sdl/SdlEngine.cpp
+      ${ORTHANC_STONE_ROOT}/Applications/Sdl/SdlOrthancSurface.cpp
+      ${ORTHANC_STONE_ROOT}/Applications/Sdl/SdlStoneApplicationRunner.cpp
+      )
+  endif()
+
+  if (ENABLE_WASM)
+    list(APPEND APPLICATIONS_SOURCES
+      ${ORTHANC_STONE_ROOT}/Applications/Wasm/StartupParametersBuilder.cpp
+      )
+  endif()
+
   list(APPEND ORTHANC_STONE_SOURCES
+    ${ORTHANC_STONE_ROOT}/Applications/IStoneApplication.h
     ${ORTHANC_STONE_ROOT}/Applications/StoneApplicationContext.cpp
     ${ORTHANC_STONE_ROOT}/Framework/Deprecated/Layers/CircleMeasureTracker.cpp
     ${ORTHANC_STONE_ROOT}/Framework/Deprecated/Layers/ColorFrameRenderer.cpp