comparison Resources/CMake/GdcmConfiguration.cmake @ 176:55f8cf4ea237

support for Linux Standard Base
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Jan 2018 09:01:14 +0100
parents 81f16c5667ba
children 8d1b1dc6150b
comparison
equal deleted inserted replaced
175:dd1ad819ca33 176:55f8cf4ea237
16 # You should have received a copy of the GNU Affero General Public License 16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. 17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 18
19 19
20 if (STATIC_BUILD OR NOT USE_SYSTEM_GDCM) 20 if (STATIC_BUILD OR NOT USE_SYSTEM_GDCM)
21 # If using gcc, build GDCM with the "-fPIC" argument to allow its
22 # embedding into the shared library containing the Orthanc plugin
23 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR 21 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
24 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR 22 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
25 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") 23 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
24 # If using gcc, build GDCM with the "-fPIC" argument to allow its
25 # embedding into the shared library containing the Orthanc plugin
26 set(AdditionalFlags "-fPIC") 26 set(AdditionalFlags "-fPIC")
27 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") 27 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
28 # This definition is necessary to compile 28 # This definition is necessary to compile
29 # "Source/MediaStorageAndFileFormat/gdcmFileStreamer.cxx" 29 # "Source/MediaStorageAndFileFormat/gdcmFileStreamer.cxx"
30 set(AdditionalFlags "-Doff64_t=off_t") 30 set(AdditionalFlags "-Doff64_t=off_t")
45 45
46 if (CMAKE_TOOLCHAIN_FILE) 46 if (CMAKE_TOOLCHAIN_FILE)
47 list(APPEND Flags -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) 47 list(APPEND Flags -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
48 endif() 48 endif()
49 49
50 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
51 # Trick to disable the compilation of socket++ by gdcm, which is
52 # incompatible with LSB, but fortunately only required for DICOM
53 # Networking
54 list(APPEND Flags -DGDCM_USE_SYSTEM_SOCKETXX=ON)
55
56 # Detect the number of CPU cores
57 include(ProcessorCount)
58 ProcessorCount(N)
59 if (NOT N EQUAL 0)
60 set(MAKE_PARALLEL -j${N})
61 endif()
62
63 # For Linux Standard Base, avoid building incompatible target gdcmMEXD (*)
64 set(BUILD_COMMAND BUILD_COMMAND
65 ${CMAKE_MAKE_PROGRAM} ${MAKE_PARALLEL}
66 gdcmMSFF gdcmcharls gdcmDICT gdcmDSED gdcmIOD gdcmjpeg8
67 gdcmjpeg12 gdcmjpeg16 gdcmopenjpeg gdcmzlib gdcmCommon gdcmexpat)
68 endif()
69
50 include(ExternalProject) 70 include(ExternalProject)
51 externalproject_add(GDCM 71 externalproject_add(GDCM
52 URL "http://www.orthanc-server.com/downloads/third-party/gdcm-2.6.0.tar.gz" 72 URL "http://www.orthanc-server.com/downloads/third-party/gdcm-2.6.0.tar.gz"
53 URL_MD5 "978afe57af448b1c97c9f116790aca9c" 73 URL_MD5 "978afe57af448b1c97c9f116790aca9c"
54 TIMEOUT 60 74 TIMEOUT 60
55 CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} ${Flags} 75 CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} ${Flags}
56 #-DLIBRARY_OUTPUT_PATH=${CMAKE_CURRENT_BINARY_DIR} 76 ${BUILD_COMMAND} # Customize "make", only for Linux Standard Base (*)
57 INSTALL_COMMAND "" # Skip the install step 77 INSTALL_COMMAND "" # Skip the install step
58 ) 78 )
59 79
60 if(MSVC) 80 if(MSVC)
61 set(Suffix ".lib") 81 set(Suffix ".lib")
72 ${Prefix}gdcmDSED${Suffix} 92 ${Prefix}gdcmDSED${Suffix}
73 ${Prefix}gdcmIOD${Suffix} 93 ${Prefix}gdcmIOD${Suffix}
74 ${Prefix}gdcmjpeg8${Suffix} 94 ${Prefix}gdcmjpeg8${Suffix}
75 ${Prefix}gdcmjpeg12${Suffix} 95 ${Prefix}gdcmjpeg12${Suffix}
76 ${Prefix}gdcmjpeg16${Suffix} 96 ${Prefix}gdcmjpeg16${Suffix}
77 ${Prefix}gdcmMEXD${Suffix}
78 ${Prefix}gdcmopenjpeg${Suffix} 97 ${Prefix}gdcmopenjpeg${Suffix}
79 ${Prefix}gdcmzlib${Suffix} 98 ${Prefix}gdcmzlib${Suffix}
80 ${Prefix}socketxx${Suffix}
81 ${Prefix}gdcmCommon${Suffix} 99 ${Prefix}gdcmCommon${Suffix}
82 ${Prefix}gdcmexpat${Suffix} 100 ${Prefix}gdcmexpat${Suffix}
83 101
102 #${Prefix}socketxx${Suffix}
103 #${Prefix}gdcmMEXD${Suffix} # DICOM Networking, unneeded by Orthanc plugins
84 #${Prefix}gdcmgetopt${Suffix} 104 #${Prefix}gdcmgetopt${Suffix}
85 #${Prefix}gdcmuuid${Suffix} 105 #${Prefix}gdcmuuid${Suffix}
86 ) 106 )
87 107
88 ExternalProject_Get_Property(GDCM binary_dir) 108 ExternalProject_Get_Property(GDCM binary_dir)