Mercurial > hg > orthanc-webviewer
changeset 176:55f8cf4ea237
support for Linux Standard Base
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 04 Jan 2018 09:01:14 +0100 |
parents | dd1ad819ca33 |
children | 8d1b1dc6150b |
files | CMakeLists.txt Orthanc/Resources/LinuxStandardBaseToolchain.cmake Orthanc/Resources/Patches/boost-1.65.1-linux-standard-base.patch Resources/CMake/GdcmConfiguration.cmake Resources/SyncOrthancFolder.py |
diffstat | 5 files changed, 111 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Thu Jan 04 07:34:54 2018 +0100 +++ b/CMakeLists.txt Thu Jan 04 09:01:14 2018 +0100 @@ -42,8 +42,13 @@ mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE) set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR}/Orthanc) -set(ORTHANC_DISABLE_PATCH ON) # No need for the "patch" command-line tool set(ENABLE_LOCALE OFF) # Disable support for locales (notably in Boost) + +if (NOT "${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") + # The "patch" command-line tool is only needed for Boost and LSB + set(ORTHANC_DISABLE_PATCH ON) +endif() + include(CheckIncludeFile) include(CheckIncludeFiles) include(CheckIncludeFileCXX)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orthanc/Resources/LinuxStandardBaseToolchain.cmake Thu Jan 04 09:01:14 2018 +0100 @@ -0,0 +1,66 @@ +# LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/LinuxStandardBaseToolchain.cmake + +INCLUDE(CMakeForceCompiler) + +SET(LSB_PATH $ENV{LSB_PATH}) +SET(LSB_CC $ENV{LSB_CC}) +SET(LSB_CXX $ENV{LSB_CXX}) +SET(LSB_TARGET_VERSION "4.0") + +IF ("${LSB_PATH}" STREQUAL "") + SET(LSB_PATH "/opt/lsb") +ENDIF() + +IF (EXISTS ${LSB_PATH}/lib64) + SET(LSB_TARGET_PROCESSOR "x86_64") + SET(LSB_LIBPATH ${LSB_PATH}/lib64-${LSB_TARGET_VERSION}) +ELSEIF (EXISTS ${LSB_PATH}/lib) + SET(LSB_TARGET_PROCESSOR "x86") + SET(LSB_LIBPATH ${LSB_PATH}/lib-${LSB_TARGET_VERSION}) +ELSE() + MESSAGE(FATAL_ERROR "Unable to detect the target processor architecture. Check the LSB_PATH environment variable.") +ENDIF() + +SET(LSB_CPPPATH ${LSB_PATH}/include) +SET(PKG_CONFIG_PATH ${LSB_LIBPATH}/pkgconfig/) + +# the name of the target operating system +SET(CMAKE_SYSTEM_NAME Linux) +SET(CMAKE_SYSTEM_VERSION LinuxStandardBase) +SET(CMAKE_SYSTEM_PROCESSOR ${LSB_TARGET_PROCESSOR}) + +# which compilers to use for C and C++ +SET(CMAKE_C_COMPILER ${LSB_PATH}/bin/lsbcc) +CMAKE_FORCE_CXX_COMPILER(${LSB_PATH}/bin/lsbc++ GNU) + +# here is the target environment located +SET(CMAKE_FIND_ROOT_PATH ${LSB_PATH}) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) +SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) + +SET(CMAKE_CROSSCOMPILING OFF) + + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -I${LSB_PATH}/include" CACHE INTERNAL "" FORCE) +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -nostdinc++ -I${LSB_PATH}/include -I${LSB_PATH}/include/c++ -I${LSB_PATH}/include/c++/backward" CACHE INTERNAL "" FORCE) +SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE) +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE) + +if (NOT "${LSB_CXX}" STREQUAL "") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-cxx=${LSB_CXX}") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}") +endif() + +if (NOT "${LSB_CC}" STREQUAL "") + SET(CMAKE_C_FLAGS "${CMAKE_CC_FLAGS} --lsb-cc=${LSB_CC}") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-cc=${LSB_CC}") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cc=${LSB_CC}") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-cc=${LSB_CC}") +endif() +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orthanc/Resources/Patches/boost-1.65.1-linux-standard-base.patch Thu Jan 04 09:01:14 2018 +0100 @@ -0,0 +1,12 @@ +diff -urEb boost_1_65_1.orig/boost/move/adl_move_swap.hpp boost_1_65_1/boost/move/adl_move_swap.hpp +--- boost_1_65_1.orig/boost/move/adl_move_swap.hpp 2017-11-08 17:43:20.000000000 +0100 ++++ boost_1_65_1/boost/move/adl_move_swap.hpp 2018-01-02 15:34:48.829052917 +0100 +@@ -28,6 +28,8 @@ + //Try to avoid including <algorithm>, as it's quite big + #if defined(_MSC_VER) && defined(BOOST_DINKUMWARE_STDLIB) + #include <utility> //Dinkum libraries define std::swap in utility which is lighter than algorithm ++#elif defined(__LSB_VERSION__) ++# include <utility> + #elif defined(BOOST_GNU_STDLIB) + //For non-GCC compilers, where GNUC version is not very reliable, or old GCC versions + //use the good old stl_algobase header, which is quite lightweight
--- a/Resources/CMake/GdcmConfiguration.cmake Thu Jan 04 07:34:54 2018 +0100 +++ b/Resources/CMake/GdcmConfiguration.cmake Thu Jan 04 09:01:14 2018 +0100 @@ -18,11 +18,11 @@ if (STATIC_BUILD OR NOT USE_SYSTEM_GDCM) - # If using gcc, build GDCM with the "-fPIC" argument to allow its - # embedding into the shared library containing the Orthanc plugin if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") + # If using gcc, build GDCM with the "-fPIC" argument to allow its + # embedding into the shared library containing the Orthanc plugin set(AdditionalFlags "-fPIC") elseif (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") # This definition is necessary to compile @@ -47,13 +47,33 @@ list(APPEND Flags -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) endif() + if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") + # Trick to disable the compilation of socket++ by gdcm, which is + # incompatible with LSB, but fortunately only required for DICOM + # Networking + list(APPEND Flags -DGDCM_USE_SYSTEM_SOCKETXX=ON) + + # Detect the number of CPU cores + include(ProcessorCount) + ProcessorCount(N) + if (NOT N EQUAL 0) + set(MAKE_PARALLEL -j${N}) + endif() + + # For Linux Standard Base, avoid building incompatible target gdcmMEXD (*) + set(BUILD_COMMAND BUILD_COMMAND + ${CMAKE_MAKE_PROGRAM} ${MAKE_PARALLEL} + gdcmMSFF gdcmcharls gdcmDICT gdcmDSED gdcmIOD gdcmjpeg8 + gdcmjpeg12 gdcmjpeg16 gdcmopenjpeg gdcmzlib gdcmCommon gdcmexpat) + endif() + include(ExternalProject) externalproject_add(GDCM URL "http://www.orthanc-server.com/downloads/third-party/gdcm-2.6.0.tar.gz" URL_MD5 "978afe57af448b1c97c9f116790aca9c" TIMEOUT 60 CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} ${Flags} - #-DLIBRARY_OUTPUT_PATH=${CMAKE_CURRENT_BINARY_DIR} + ${BUILD_COMMAND} # Customize "make", only for Linux Standard Base (*) INSTALL_COMMAND "" # Skip the install step ) @@ -74,13 +94,13 @@ ${Prefix}gdcmjpeg8${Suffix} ${Prefix}gdcmjpeg12${Suffix} ${Prefix}gdcmjpeg16${Suffix} - ${Prefix}gdcmMEXD${Suffix} ${Prefix}gdcmopenjpeg${Suffix} ${Prefix}gdcmzlib${Suffix} - ${Prefix}socketxx${Suffix} ${Prefix}gdcmCommon${Suffix} ${Prefix}gdcmexpat${Suffix} + #${Prefix}socketxx${Suffix} + #${Prefix}gdcmMEXD${Suffix} # DICOM Networking, unneeded by Orthanc plugins #${Prefix}gdcmgetopt${Suffix} #${Prefix}gdcmuuid${Suffix} )
--- a/Resources/SyncOrthancFolder.py Thu Jan 04 07:34:54 2018 +0100 +++ b/Resources/SyncOrthancFolder.py Thu Jan 04 09:01:14 2018 +0100 @@ -80,10 +80,12 @@ 'Resources/CMake/JsonCppConfiguration.cmake', 'Resources/CMake/SQLiteConfiguration.cmake', 'Resources/CMake/UuidConfiguration.cmake', + 'Resources/Patches/boost-1.65.1-linux-standard-base.patch', 'Resources/EmbedResources.py', 'Resources/MinGW-W64-Toolchain32.cmake', 'Resources/MinGW-W64-Toolchain64.cmake', 'Resources/MinGWToolchain.cmake', + 'Resources/LinuxStandardBaseToolchain.cmake', 'Resources/ThirdParty/VisualStudio/stdint.h', 'Resources/ThirdParty/base64/base64.cpp', 'Resources/ThirdParty/base64/base64.h',