changeset 1322:f497a72d9f71

fixes to the sample plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 13 Feb 2015 13:28:01 +0100
parents 0f9e0e808e0f
children 5a92665dee23
files Core/Toolbox.h Plugins/Include/OrthancCPlugin.h Plugins/Samples/Basic/CMakeLists.txt Plugins/Samples/GdcmDecoding/CMakeLists.txt Plugins/Samples/ServeFolders/CMakeLists.txt Plugins/Samples/ServeFolders/Plugin.cpp Plugins/Samples/ServeFolders/VersionScript.map Plugins/Samples/StorageArea/CMakeLists.txt Plugins/Samples/WebSkeleton/CMakeLists.txt
diffstat 9 files changed, 135 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Toolbox.h	Fri Feb 13 09:51:22 2015 +0100
+++ b/Core/Toolbox.h	Fri Feb 13 13:28:01 2015 +0100
@@ -37,7 +37,10 @@
 #include <stdint.h>
 #include <vector>
 #include <string>
+
+#if ORTHANC_PUGIXML_ENABLED == 1
 #include <json/json.h>
+#endif
 
 namespace Orthanc
 {
--- a/Plugins/Include/OrthancCPlugin.h	Fri Feb 13 09:51:22 2015 +0100
+++ b/Plugins/Include/OrthancCPlugin.h	Fri Feb 13 13:28:01 2015 +0100
@@ -132,9 +132,11 @@
  ** Inclusion of standard libraries.
  ********************************************************************/
 
-// For Microsoft Visual Studio, a compatibility "stdint.h" can be
-// downloaded at the following URL:
-// https://orthanc.googlecode.com/hg/Resources/ThirdParty/VisualStudio/stdint.h
+/**
+ * For Microsoft Visual Studio, a compatibility "stdint.h" can be
+ * downloaded at the following URL:
+ * https://orthanc.googlecode.com/hg/Resources/ThirdParty/VisualStudio/stdint.h
+ **/
 #include <stdint.h>
 
 #include <stdlib.h>
--- a/Plugins/Samples/Basic/CMakeLists.txt	Fri Feb 13 09:51:22 2015 +0100
+++ b/Plugins/Samples/Basic/CMakeLists.txt	Fri Feb 13 13:28:01 2015 +0100
@@ -7,7 +7,7 @@
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror")
 endif()
 
-include_directories(${CMAKE_SOURCE_DIR}/../../OrthancCPlugin/)
+include_directories(${CMAKE_SOURCE_DIR}/../../Include/)
 add_library(PluginTest SHARED Plugin.c)
 
 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
--- a/Plugins/Samples/GdcmDecoding/CMakeLists.txt	Fri Feb 13 09:51:22 2015 +0100
+++ b/Plugins/Samples/GdcmDecoding/CMakeLists.txt	Fri Feb 13 13:28:01 2015 +0100
@@ -27,7 +27,7 @@
 endif(GDCM_FOUND)
 
 include_directories(
-  ${ORTHANC_ROOT}/Plugins/OrthancCPlugin/
+  ${ORTHANC_ROOT}/Plugins/Include/
   ${ORTHANC_ROOT}/OrthancCppClient/SharedLibrary/Laaw
   )
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/Samples/ServeFolders/CMakeLists.txt	Fri Feb 13 13:28:01 2015 +0100
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(ServeFolders)
+
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+  link_libraries(uuid)
+  SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
+  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread")
+elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+  link_libraries(rpcrt4 ws2_32 secur32)
+  if (CMAKE_COMPILER_IS_GNUCXX)
+    SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
+  endif()
+endif ()
+
+if (CMAKE_COMPILER_IS_GNUCXX)
+  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/VersionScript.map -Wl,--no-undefined")
+endif()
+
+include_directories(${CMAKE_SOURCE_DIR}/../../Include/)
+add_library(PluginTest SHARED Plugin.cpp)
+
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+  # Linking with "pthread" is necessary, otherwise the software crashes
+  # http://sourceware.org/bugzilla/show_bug.cgi?id=10652#c17
+  target_link_libraries(PluginTest pthread dl)
+endif()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/Samples/ServeFolders/Plugin.cpp	Fri Feb 13 13:28:01 2015 +0100
@@ -0,0 +1,84 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ **/
+
+
+#include <OrthancCPlugin.h>
+
+#include <string.h>
+#include <stdio.h>
+
+static OrthancPluginContext* context_ = NULL;
+
+
+static int32_t Callback(OrthancPluginRestOutput* output,
+                        const char* url,
+                        const OrthancPluginHttpRequest* request)
+{
+}
+
+
+
+extern "C"
+{
+  ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context)
+  {
+    context_ = context;
+
+    /* Check the version of the Orthanc core */
+    if (OrthancPluginCheckVersion(context_) == 0)
+    {
+      char info[1024];
+      sprintf(info, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin",
+              context_->orthancVersion,
+              ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
+              ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
+              ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
+      OrthancPluginLogError(context, info);
+      return -1;
+    }
+
+    OrthancPluginSetDescription(context_, "Serve additional folders with the HTTP server of Orthanc.");
+
+    return 0;
+  }
+
+
+  ORTHANC_PLUGINS_API void OrthancPluginFinalize()
+  {
+  }
+
+
+  ORTHANC_PLUGINS_API const char* OrthancPluginGetName()
+  {
+    return "serve-folders";
+  }
+
+
+  ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion()
+  {
+    return "1.0";
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/Samples/ServeFolders/VersionScript.map	Fri Feb 13 13:28:01 2015 +0100
@@ -0,0 +1,12 @@
+# This is a version-script for Orthanc plugins
+
+{
+global:
+  OrthancPluginInitialize;
+  OrthancPluginFinalize;
+  OrthancPluginGetName;
+  OrthancPluginGetVersion;
+
+local:
+  *;
+};
--- a/Plugins/Samples/StorageArea/CMakeLists.txt	Fri Feb 13 09:51:22 2015 +0100
+++ b/Plugins/Samples/StorageArea/CMakeLists.txt	Fri Feb 13 13:28:01 2015 +0100
@@ -7,7 +7,7 @@
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror")
 endif()
 
-include_directories(${CMAKE_SOURCE_DIR}/../../OrthancCPlugin/)
+include_directories(${CMAKE_SOURCE_DIR}/../../Include/)
 add_library(PluginTest SHARED Plugin.cpp)
 
 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
--- a/Plugins/Samples/WebSkeleton/CMakeLists.txt	Fri Feb 13 09:51:22 2015 +0100
+++ b/Plugins/Samples/WebSkeleton/CMakeLists.txt	Fri Feb 13 13:28:01 2015 +0100
@@ -7,7 +7,7 @@
 
 include(Framework/Framework.cmake)
 
-include_directories(${CMAKE_SOURCE_DIR}/../../OrthancCPlugin/)
+include_directories(${CMAKE_SOURCE_DIR}/../../Include/)
 
 add_library(WebSkeleton SHARED 
   ${AUTOGENERATED_SOURCES}