[med-svn] [Git][med-team/orthanc-wsi][master] 3 commits: Statically link against the Orthanc framework

Sebastien Jodogne gitlab at salsa.debian.org
Fri Feb 26 15:46:05 GMT 2021



Sebastien Jodogne pushed to branch master at Debian Med / orthanc-wsi


Commits:
687be7f0 by jodogne-guest at 2021-02-26T16:26:57+01:00
Statically link against the Orthanc framework

- - - - -
3b965f8f by jodogne-guest at 2021-02-26T16:37:38+01:00
add missing Build-Depends: libcurl-dev

- - - - -
cb1fc4d2 by jodogne-guest at 2021-02-26T16:45:31+01:00
Upload to unstable

- - - - -


5 changed files:

- debian/changelog
- debian/control
- debian/patches/series
- + debian/patches/static-framework
- debian/rules


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+orthanc-wsi (1.0-2) unstable; urgency=medium
+
+  * Statically link against the Orthanc framework
+
+ -- Sebastien Jodogne <s.jodogne at gmail.com>  Fri, 26 Feb 2021 16:01:23 +0100
+
 orthanc-wsi (1.0-1) unstable; urgency=medium
 
   * New upstream version


=====================================
debian/control
=====================================
@@ -6,11 +6,13 @@ Section: science
 Priority: optional
 Build-Depends: cmake,
                debhelper (>= 10),
+               libcurl4-openssl-dev | libcurl4-dev,
                libdcmtk-dev,
                libopenjp2-7-dev,
                liborthancframework-dev,
                libtiff5-dev,
                orthanc-dev (>= 1.1.0),
+               uuid-dev,
                yui-compressor,
                zlib1g-dev
 Standards-Version: 4.5.1


=====================================
debian/patches/series
=====================================
@@ -1 +1,2 @@
 includes
+static-framework


=====================================
debian/patches/static-framework
=====================================
@@ -0,0 +1,239 @@
+Description: Statically link against the Orthanc framework
+Author: Sebastien Jodogne <s.jodogne at orthanc-labs.com>
+Forwarded: yes
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: OrthancWSI-1.0/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake
+===================================================================
+--- OrthancWSI-1.0.orig/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake
++++ OrthancWSI-1.0/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake
+@@ -122,6 +122,10 @@ if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "h
+         set(ORTHANC_FRAMEWORK_MD5 "db094f96399cbe8b9bbdbce34884c220")
+       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.8.2")
+         set(ORTHANC_FRAMEWORK_MD5 "8bfa10e66c9931e74111be0bfb1f4548")
++      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.0")
++        set(ORTHANC_FRAMEWORK_MD5 "cea0b02ce184671eaf1bd668beefbf28")
++      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.1")
++        set(ORTHANC_FRAMEWORK_MD5 "08eebc66ef93c3b40115c38501db5fbd")
+ 
+       # Below this point are development snapshots that were used to
+       # release some plugin, before an official release of the Orthanc
+@@ -426,6 +430,8 @@ endif()
+ 
+ if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
+   set(ORTHANC_FRAMEWORK_LIBDIR "" CACHE PATH "")
++  set(ORTHANC_FRAMEWORK_USE_SHARED ON CACHE BOOL "Whether to use the shared library or the static library")
++  set(ORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES "" CACHE STRING "Additional libraries to link against, separated by whitespaces, typically needed if using the static library (a common minimal value is \"boost_filesystem boost_iostreams boost_locale boost_regex boost_thread jsoncpp pugixml uuid\")")
+ 
+   if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND
+       CMAKE_COMPILER_IS_GNUCXX) # MinGW
+@@ -442,113 +448,75 @@ if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "s
+   include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake)
+   set(EMBED_RESOURCES_PYTHON ${CMAKE_CURRENT_LIST_DIR}/EmbedResources.py)
+ 
+-  if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR
+-      ORTHANC_FRAMEWORK_STATIC)
+-    include_directories(${ORTHANC_FRAMEWORK_ROOT}/..)
++  if (ORTHANC_FRAMEWORK_USE_SHARED)
++    list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
++    list(GET CMAKE_FIND_LIBRARY_SUFFIXES 0 Suffix)
++  else()
++    list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
++    list(GET CMAKE_FIND_LIBRARY_SUFFIXES 1 Suffix)
++  endif()
++
++  # The "OrthancFramework" library must be the first one to be included
++  if ("${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "")
++    set(ORTHANC_FRAMEWORK_LIBRARIES ${Prefix}OrthancFramework${Suffix})
++  else ()
++    set(ORTHANC_FRAMEWORK_LIBRARIES ${ORTHANC_FRAMEWORK_LIBDIR}/${Prefix}OrthancFramework${Suffix})
++  endif()
++
++  if (NOT ORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES STREQUAL "")
++    # https://stackoverflow.com/a/5272993/881731
++    string(REPLACE " " ";" tmp ${ORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES})
++    list(APPEND ORTHANC_FRAMEWORK_LIBRARIES ${tmp})
++  endif()
++
++  # Look for the version of the mandatory dependency JsonCpp (cf. JsonCppConfiguration.cmake)
++  if (CMAKE_CROSSCOMPILING)
++    set(JSONCPP_INCLUDE_DIR ${ORTHANC_FRAMEWORK_ROOT}/..)
+   else()
+-    # Look for mandatory dependency JsonCpp (cf. JsonCppConfiguration.cmake)
+     find_path(JSONCPP_INCLUDE_DIR json/reader.h
++      ${ORTHANC_FRAMEWORK_ROOT}/..
+       /usr/include/jsoncpp
+       /usr/local/include/jsoncpp
+       )
++  endif()
+ 
+-    message("JsonCpp include dir: ${JSONCPP_INCLUDE_DIR}")
+-    include_directories(${JSONCPP_INCLUDE_DIR})
+-    link_libraries(jsoncpp)
+-
+-    CHECK_INCLUDE_FILE_CXX(${JSONCPP_INCLUDE_DIR}/json/reader.h HAVE_JSONCPP_H)
+-    if (NOT HAVE_JSONCPP_H)
+-      message(FATAL_ERROR "Please install the libjsoncpp-dev package")
+-    endif()
+-
+-    # Switch to the C++11 standard if the version of JsonCpp is 1.y.z
+-    # (same as variable JSONCPP_CXX11 in the source code of Orthanc)
+-    if (EXISTS ${JSONCPP_INCLUDE_DIR}/json/version.h)
+-      file(STRINGS
+-        "${JSONCPP_INCLUDE_DIR}/json/version.h" 
+-        JSONCPP_VERSION_MAJOR1 REGEX
+-        ".*define JSONCPP_VERSION_MAJOR.*")
+-
+-      if (NOT JSONCPP_VERSION_MAJOR1)
+-        message(FATAL_ERROR "Unable to extract the major version of JsonCpp")
+-      endif()
+-      
+-      string(REGEX REPLACE
+-        ".*JSONCPP_VERSION_MAJOR.*([0-9]+)$" "\\1" 
+-        JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1})
+-      message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}")
+-
+-      if (JSONCPP_VERSION_MAJOR GREATER 0)
+-        message("Switching to C++11 standard, as version of JsonCpp is >= 1.0.0")
+-        if (CMAKE_COMPILER_IS_GNUCXX)
+-          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
+-        elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+-          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+-        endif()
+-      endif()
+-    else()
+-      message("Unable to detect the major version of JsonCpp, assuming < 1.0.0")
+-    endif()
++  message("JsonCpp include dir: ${JSONCPP_INCLUDE_DIR}")
++  include_directories(${JSONCPP_INCLUDE_DIR})
+ 
+-    # Look for mandatory dependency Boost (cf. BoostConfiguration.cmake)
+-    include(FindBoost)
+-    find_package(Boost COMPONENTS filesystem thread system date_time regex ${ORTHANC_BOOST_COMPONENTS})
++  CHECK_INCLUDE_FILE_CXX(${JSONCPP_INCLUDE_DIR}/json/reader.h HAVE_JSONCPP_H)
++  if (NOT HAVE_JSONCPP_H)
++    message(FATAL_ERROR "Please install the libjsoncpp-dev package")
++  endif()
++
++  # Switch to the C++11 standard if the version of JsonCpp is 1.y.z
++  # (same as variable JSONCPP_CXX11 in the source code of Orthanc)
++  if (EXISTS ${JSONCPP_INCLUDE_DIR}/json/version.h)
++    file(STRINGS
++      "${JSONCPP_INCLUDE_DIR}/json/version.h" 
++      JSONCPP_VERSION_MAJOR1 REGEX
++      ".*define JSONCPP_VERSION_MAJOR.*")
+ 
+-    if (NOT Boost_FOUND)
+-      message(FATAL_ERROR "Unable to locate Boost on this system")
++    if (NOT JSONCPP_VERSION_MAJOR1)
++      message(FATAL_ERROR "Unable to extract the major version of JsonCpp")
+     endif()
+     
+-    include_directories(${Boost_INCLUDE_DIRS})
+-    link_libraries(${Boost_LIBRARIES})
+-
+-    # Optional component - Lua
+-    if (ENABLE_LUA)
+-      include(FindLua)
+-
+-      if (NOT LUA_FOUND)
+-        message(FATAL_ERROR "Please install the liblua-dev package")
+-      endif()
+-
+-      include_directories(${LUA_INCLUDE_DIR})
+-      link_libraries(${LUA_LIBRARIES})
+-    endif()
+-
+-    # Optional component - SQLite
+-    if (ENABLE_SQLITE)    
+-      CHECK_INCLUDE_FILE(sqlite3.h HAVE_SQLITE_H)
+-      if (NOT HAVE_SQLITE_H)
+-        message(FATAL_ERROR "Please install the libsqlite3-dev package")
+-      endif()
+-      link_libraries(sqlite3)
+-    endif()
+-
+-    # Optional component - Pugixml
+-    if (ENABLE_PUGIXML)
+-      CHECK_INCLUDE_FILE_CXX(pugixml.hpp HAVE_PUGIXML_H)
+-      if (NOT HAVE_PUGIXML_H)
+-        message(FATAL_ERROR "Please install the libpugixml-dev package")
+-      endif()      
+-      link_libraries(pugixml)
+-    endif()
+-
+-    # Optional component - DCMTK
+-    if (ENABLE_DCMTK)
+-      include(FindDCMTK)
+-      include_directories(${DCMTK_INCLUDE_DIRS})
+-      link_libraries(${DCMTK_LIBRARIES})
+-    endif()
+-
+-    # Optional component - OpenSSL
+-    if (ENABLE_SSL)
+-      include(FindOpenSSL)
+-      if (NOT ${OPENSSL_FOUND})
+-        message(FATAL_ERROR "Unable to find OpenSSL")
++    string(REGEX REPLACE
++      ".*JSONCPP_VERSION_MAJOR.*([0-9]+)$" "\\1" 
++      JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1})
++    message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}")
++
++    if (JSONCPP_VERSION_MAJOR GREATER 0)
++      message("Switching to C++11 standard, as version of JsonCpp is >= 1.0.0")
++      if (CMAKE_COMPILER_IS_GNUCXX)
++        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
++      elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
++        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+       endif()
+-      include_directories(${OPENSSL_INCLUDE_DIR})
+-      link_libraries(${OPENSSL_LIBRARIES})
+     endif()
++  else()
++    message("Unable to detect the major version of JsonCpp, assuming < 1.0.0")
+   endif()
+-
++  
+   # Look for Orthanc framework shared library
+   include(CheckCXXSymbolExists)
+ 
+@@ -568,28 +536,17 @@ if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "s
+   
+   message("Orthanc framework include dir: ${ORTHANC_FRAMEWORK_INCLUDE_DIR}")
+   include_directories(${ORTHANC_FRAMEWORK_INCLUDE_DIR})
+-  
+-  if ("${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "")
+-    set(ORTHANC_FRAMEWORK_LIBRARIES OrthancFramework)
+-  else()
+-    if (MSVC)
+-      set(Suffix ".lib")
+-      set(Prefix "")
+-    else()
+-      list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
+-      list(GET CMAKE_FIND_LIBRARY_SUFFIXES 0 Suffix)
+-    endif()
+-    set(ORTHANC_FRAMEWORK_LIBRARIES ${ORTHANC_FRAMEWORK_LIBDIR}/${Prefix}OrthancFramework${Suffix})
+-  endif()
+ 
+-  set(CMAKE_REQUIRED_INCLUDES "${ORTHANC_FRAMEWORK_INCLUDE_DIR}")
+-  set(CMAKE_REQUIRED_LIBRARIES "${ORTHANC_FRAMEWORK_LIBRARIES}")
+-  
+-  check_cxx_symbol_exists("Orthanc::InitializeFramework" "OrthancFramework.h" HAVE_ORTHANC_FRAMEWORK)
+-  if (NOT HAVE_ORTHANC_FRAMEWORK)
+-    message(FATAL_ERROR "Cannot find the Orthanc framework")
++  if (ORTHANC_FRAMEWORK_USE_SHARED)
++    set(CMAKE_REQUIRED_INCLUDES "${ORTHANC_FRAMEWORK_INCLUDE_DIR}")
++    set(CMAKE_REQUIRED_LIBRARIES "${ORTHANC_FRAMEWORK_LIBRARIES}")
++    
++    check_cxx_symbol_exists("Orthanc::InitializeFramework" "OrthancFramework.h" HAVE_ORTHANC_FRAMEWORK)
++    if (NOT HAVE_ORTHANC_FRAMEWORK)
++      message(FATAL_ERROR "Cannot find the Orthanc framework")
++    endif()
++    
++    unset(CMAKE_REQUIRED_INCLUDES)
++    unset(CMAKE_REQUIRED_LIBRARIES)
+   endif()
+-
+-  unset(CMAKE_REQUIRED_INCLUDES)
+-  unset(CMAKE_REQUIRED_LIBRARIES)
+ endif()


=====================================
debian/rules
=====================================
@@ -14,14 +14,20 @@ export DEB_CXXFLAGS_MAINT_APPEND=-DNDEBUG
 %:
 	dh $@
 
+ORTHANC_FRAMEWORK_LIBRARIES="boost_filesystem boost_iostreams boost_locale boost_regex boost_thread jsoncpp pugixml uuid  dcmdata ofstd jpeg png curl boost_program_options dcmjpeg dcmjpls dcmimage dl"
+
 CMAKE_APPLICATIONS_EXTRA_FLAGS += \
 	-DCMAKE_SKIP_RPATH:BOOL=ON \
 	-DORTHANC_FRAMEWORK_SOURCE=system \
+        -DORTHANC_FRAMEWORK_USE_SHARED:BOOL=OFF \
+        -DORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES=${ORTHANC_FRAMEWORK_LIBRARIES} \
 	-DCMAKE_BUILD_TYPE=None   # The build type must be set to None, see #711515
 
 CMAKE_VIEWER_EXTRA_FLAGS += \
 	-DCMAKE_SKIP_RPATH:BOOL=ON \
 	-DORTHANC_FRAMEWORK_SOURCE=system \
+        -DORTHANC_FRAMEWORK_USE_SHARED:BOOL=OFF \
+        -DORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES=${ORTHANC_FRAMEWORK_LIBRARIES} \
 	-DUSE_SYSTEM_OPENLAYERS:BOOL=ON \
 	-DOPENLAYERS_CSS=$(CURDIR)/BuildViewer/ol.min.css \
 	-DOPENLAYERS_JS=$(CURDIR)/BuildViewer/ol.min.js \



View it on GitLab: https://salsa.debian.org/med-team/orthanc-wsi/-/compare/6810cfa247fea2db43f212520931eab8bbc67846...cb1fc4d2cf1aed4ae372dc7dfbfa0d3ea8b25c10

-- 
View it on GitLab: https://salsa.debian.org/med-team/orthanc-wsi/-/compare/6810cfa247fea2db43f212520931eab8bbc67846...cb1fc4d2cf1aed4ae372dc7dfbfa0d3ea8b25c10
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210226/524bc848/attachment-0001.htm>


More information about the debian-med-commit mailing list