[med-svn] [dwv-orthanc-plugin] 01/02: Imported Upstream version 0.3.1

Andreas Tille tille at debian.org
Sun Mar 15 19:22:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository dwv-orthanc-plugin.

commit 6466e157fbd84d1192e7663f62d969c994247a42
Author: Andreas Tille <tille at debian.org>
Date:   Sun Mar 15 20:22:34 2015 +0100

    Imported Upstream version 0.3.1
---
 .travis.yml                 |  4 +---
 CMakeLists.txt              | 24 +++++++++++++++---------
 Plugin.cpp                  |  2 +-
 Resources/EmbedResources.py | 17 ++++++++---------
 4 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 7f1ec7d..97dcb32 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,10 +5,8 @@ compiler:
 
 before_script:
   - cd ..
-  - wget http://sourceforge.net/projects/orthancserver/files/Orthanc-0.8.6.tar.gz
-  - tar -xvf Orthanc-0.8.6.tar.gz
   - mkdir build
   - cd build
-  - cmake -DORTHANC_DIR:FILEPATH=../Orthanc-0.8.6 ../dwv-orthanc-plugin
+  - cmake ../dwv-orthanc-plugin
 
 script: make
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 477c254..bb26682 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,16 +7,22 @@ if (${CMAKE_COMPILER_IS_GNUCXX})
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror")
 endif()
 
-# Orthanc dependency
-set(ORTHANC_DIR "" CACHE FILEPATH "Path of the Orthanc sources.")
-if(ORTHANC_DIR STREQUAL "")
-  message(FATAL_ERROR "Please set the ORTHANC_DIR variable.")
+# Auto generated data directory
+set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED")
+include_directories(${AUTOGENERATED_DIR})
+
+# Check that the Orthanc SDK plugin header is available or download it
+set(ORTHANC_PLUGIN_H "orthanc/OrthancCPlugin.h")
+if (NOT EXISTS "${AUTOGENERATED_DIR}/${ORTHANC_PLUGIN_H}")
+  include(CheckIncludeFileCXX)
+  check_include_file_cxx(${ORTHANC_PLUGIN_H} HAVE_ORTHANC_H)
+  if (NOT HAVE_ORTHANC_H)
+    set(ORTHANC_SDK_URL "http://orthanc.googlecode.com/hg-history/Orthanc-0.8.6")
+    file(MAKE_DIRECTORY "${AUTOGENERATED_DIR}/orthanc")
+    file(DOWNLOAD "${ORTHANC_SDK_URL}/Plugins/Include/OrthancCPlugin.h"
+      "${AUTOGENERATED_DIR}/orthanc/OrthancCPlugin.h" SHOW_PROGRESS)
+  endif()
 endif()
-# plugin definition
-include_directories(${ORTHANC_DIR}/Plugins/Include/)
-# for OrthancException used in EmbedResources
-include_directories(${ORTHANC_DIR}/Core/)
-include_directories(${ORTHANC_DIR}/OrthancCppClient/SharedLibrary/Laaw/)
 
 # create resources file
 include(${CMAKE_SOURCE_DIR}/Resources/CMake/AutoGeneratedCode.cmake)
diff --git a/Plugin.cpp b/Plugin.cpp
index 9af62bc..8fd984e 100644
--- a/Plugin.cpp
+++ b/Plugin.cpp
@@ -23,7 +23,7 @@
  **/
 
 
-#include <OrthancCPlugin.h>
+#include <orthanc/OrthancCPlugin.h>
 
 #include <string>
 #include <stdio.h>
diff --git a/Resources/EmbedResources.py b/Resources/EmbedResources.py
index b908ccd..ab33a84 100644
--- a/Resources/EmbedResources.py
+++ b/Resources/EmbedResources.py
@@ -230,8 +230,7 @@ cpp = open(TARGET_BASE_FILENAME + '.cpp', 'w')
 
 cpp.write("""
 #include "%s.h"
-#include "OrthancException.h"
-
+#include <stdexcept>
 #include <stdint.h>
 #include <string.h>
 
@@ -268,7 +267,7 @@ for name in resources:
 
 cpp.write("""
       default:
-        throw OrthancException(ErrorCode_ParameterOutOfRange);
+        throw std::runtime_error("Parameter out of range");
       }
     }
 
@@ -285,7 +284,7 @@ for name in resources:
 
 cpp.write("""
       default:
-        throw OrthancException(ErrorCode_ParameterOutOfRange);
+        throw std::runtime_error("Parameter out of range");
       }
     }
 """)
@@ -310,10 +309,10 @@ for name in resources:
         for path in resources[name]['Files']:
             cpp.write('        if (!strcmp(path, "%s"))\n' % path)
             cpp.write('          return resource%dBuffer;\n' % resources[name]['Files'][path]['Index'])
-        cpp.write('        throw OrthancException("Unknown path in a directory resource");\n\n')
+        cpp.write('        throw std::runtime_error("Unknown path in a directory resource");\n\n')
 
 cpp.write("""      default:
-        throw OrthancException(ErrorCode_ParameterOutOfRange);
+        throw std::runtime_error("Parameter out of range");
       }
     }
 
@@ -330,10 +329,10 @@ for name in resources:
         for path in resources[name]['Files']:
             cpp.write('        if (!strcmp(path, "%s"))\n' % path)
             cpp.write('          return resource%dSize;\n' % resources[name]['Files'][path]['Index'])
-        cpp.write('        throw OrthancException("Unknown path in a directory resource");\n\n')
+        cpp.write('        throw std::runtime_error("Unknown path in a directory resource");\n\n')
 
 cpp.write("""      default:
-        throw OrthancException(ErrorCode_ParameterOutOfRange);
+        throw std::runtime_error("Parameter out of range");
       }
     }
 """)
@@ -362,7 +361,7 @@ for name in resources:
         cpp.write('        break;\n\n')
 
 cpp.write("""      default:
-        throw OrthancException(ErrorCode_ParameterOutOfRange);
+        throw std::runtime_error("Parameter out of range");
       }
     }
 """)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/dwv-orthanc-plugin.git



More information about the debian-med-commit mailing list