annotate Resources/CMake/DcmtkConfiguration.cmake @ 2750:4c271054e044 Orthanc-0.7.3

close old branch
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 17 Jul 2018 09:39:43 +0200
parents b8322fe3bdba
children 8c29c1056d45 ac8f68cbdbb6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
494
012b63028085 CMake parameter for the location of DCMTK dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 411
diff changeset
1 add_definitions(-DDCMTK_DICTIONARY_DIR="${DCMTK_DICTIONARY_DIR}")
012b63028085 CMake parameter for the location of DCMTK dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 411
diff changeset
2
626
b8322fe3bdba possibility to disable the use of system dcmtk or boost
jodogne
parents: 553
diff changeset
3 if (STATIC_BUILD OR NOT USE_SYSTEM_DCMTK)
103
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
4 SET(DCMTK_VERSION_NUMBER 360)
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
5 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0)
411
5f6d75cd4b46 md5 of third party downlaods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 382
diff changeset
6 DownloadPackage(
5f6d75cd4b46 md5 of third party downlaods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 382
diff changeset
7 "219ad631b82031806147e4abbfba4fa4"
5f6d75cd4b46 md5 of third party downlaods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 382
diff changeset
8 "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/dcmtk-3.6.0.zip"
553
27d32fc6209a simplifications to cmake, use a digest of boost 1.54.0 thanks bcp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 495
diff changeset
9 "${DCMTK_SOURCES_DIR}")
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
10
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
11 IF(CMAKE_CROSSCOMPILING)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
12 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
13 ENDIF()
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
14 SET(DCMTK_SOURCE_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
15 include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
16 include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
193
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
17
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
18 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
19 set(HAVE_SSTREAM 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
20 set(HAVE_PROTOTYPE_BZERO 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
21 set(HAVE_PROTOTYPE_GETHOSTNAME 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
22 set(HAVE_PROTOTYPE_GETSOCKOPT 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
23 set(HAVE_PROTOTYPE_SETSOCKOPT 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
24 set(HAVE_PROTOTYPE_CONNECT 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
25 set(HAVE_PROTOTYPE_BIND 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
26 set(HAVE_PROTOTYPE_ACCEPT 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
27 set(HAVE_PROTOTYPE_SETSOCKNAME 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
28 set(HAVE_PROTOTYPE_GETSOCKNAME 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
29 endif()
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
30
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
31 CONFIGURE_FILE(
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
32 ${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
33 ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
34
259
6f4591ba5051 dcmtk not for the core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 194
diff changeset
35 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmnet/libsrc DCMTK_SOURCES)
6f4591ba5051 dcmtk not for the core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 194
diff changeset
36 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmdata/libsrc DCMTK_SOURCES)
6f4591ba5051 dcmtk not for the core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 194
diff changeset
37 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/ofstd/libsrc DCMTK_SOURCES)
100
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
38
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
39 # Source for the logging facility of DCMTK
259
6f4591ba5051 dcmtk not for the core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 194
diff changeset
40 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES)
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
41 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
259
6f4591ba5051 dcmtk not for the core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 194
diff changeset
42 list(REMOVE_ITEM DCMTK_SOURCES
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
43 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
44 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
45 )
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
46 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
259
6f4591ba5051 dcmtk not for the core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 194
diff changeset
47 list(REMOVE_ITEM DCMTK_SOURCES
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
48 ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
49 )
495
5bb96a6100c0 fixes for mingw64
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 494
diff changeset
50
5bb96a6100c0 fixes for mingw64
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 494
diff changeset
51 if (${CMAKE_COMPILER_IS_GNUCXX})
5bb96a6100c0 fixes for mingw64
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 494
diff changeset
52 # This is a patch for MinGW64
5bb96a6100c0 fixes for mingw64
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 494
diff changeset
53 execute_process(
5bb96a6100c0 fixes for mingw64
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 494
diff changeset
54 COMMAND patch -p0 -i ${CMAKE_SOURCE_DIR}/Resources/Patches/dcmtk-mingw64.patch
5bb96a6100c0 fixes for mingw64
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 494
diff changeset
55 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
5bb96a6100c0 fixes for mingw64
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 494
diff changeset
56 )
5bb96a6100c0 fixes for mingw64
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 494
diff changeset
57 endif()
5bb96a6100c0 fixes for mingw64
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 494
diff changeset
58
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
59 endif()
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
60
259
6f4591ba5051 dcmtk not for the core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 194
diff changeset
61 list(REMOVE_ITEM DCMTK_SOURCES
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
62 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
63 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
64 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdictbi.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
65 )
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
66
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
67 # This fixes crashes related to the destruction of the DCMTK OFLogger
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
68 # http://support.dcmtk.org/docs-snapshot/file_macros.html
103
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
69 add_definitions(
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
70 -DLOG4CPLUS_DISABLE_FATAL=1
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
71 -DDCMTK_VERSION_NUMBER=360
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
72 )
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
73
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
74 include_directories(
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
75 #${DCMTK_SOURCES_DIR}
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
76 ${DCMTK_SOURCES_DIR}/config/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
77 ${DCMTK_SOURCES_DIR}/dcmnet/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
78 ${DCMTK_SOURCES_DIR}/ofstd/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
79 ${DCMTK_SOURCES_DIR}/oflog/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
80 ${DCMTK_SOURCES_DIR}/dcmdata/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
81 )
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
82
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
83 source_group(ThirdParty\\Dcmtk REGULAR_EXPRESSION ${DCMTK_SOURCES_DIR}/.*)
100
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
84
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
85 set(DCMTK_BUNDLES_LOG4CPLUS 1)
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
86
367
301f2831489c fix of issue 2
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 298
diff changeset
87 if (STANDALONE_BUILD)
301f2831489c fix of issue 2
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 298
diff changeset
88 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=1)
301f2831489c fix of issue 2
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 298
diff changeset
89 else()
301f2831489c fix of issue 2
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 298
diff changeset
90 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=0)
301f2831489c fix of issue 2
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 298
diff changeset
91 endif()
301f2831489c fix of issue 2
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 298
diff changeset
92
298
6c4f6229aad7 fix in embedding dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 291
diff changeset
93 set(DCMTK_DICTIONARIES
6c4f6229aad7 fix in embedding dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 291
diff changeset
94 DICTIONARY_DICOM ${DCMTK_SOURCES_DIR}/dcmdata/data/dicom.dic
6c4f6229aad7 fix in embedding dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 291
diff changeset
95 DICTIONARY_PRIVATE ${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic
6c4f6229aad7 fix in embedding dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 291
diff changeset
96 DICTIONARY_DICONDE ${DCMTK_SOURCES_DIR}/dcmdata/data/diconde.dic
6c4f6229aad7 fix in embedding dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 291
diff changeset
97 )
291
4d7469f72a0b embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 287
diff changeset
98
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
99 else()
287
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
100 # The following line allows to manually add libraries at the
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
101 # command-line, which is necessary for Ubuntu/Debian packages
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
102 set(tmp "${DCMTK_LIBRARIES}")
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
103 include(FindDCMTK)
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
104 list(APPEND DCMTK_LIBRARIES "${tmp}")
115
97d92e25c961 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 114
diff changeset
105
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
106 include_directories(${DCMTK_INCLUDE_DIR})
287
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
107 link_libraries(${DCMTK_LIBRARIES})
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
108
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
109 add_definitions(
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
110 -DHAVE_CONFIG_H=1
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
111 )
100
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
112
150
1058c115aed1 patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
113 if (EXISTS "${DCMTK_DIR}/config/cfunix.h")
1058c115aed1 patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
114 set(DCMTK_CONFIGURATION_FILE "${DCMTK_DIR}/config/cfunix.h")
1058c115aed1 patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
115 elseif (EXISTS "${DCMTK_DIR}/config/osconfig.h") # This is for Arch Linux
1058c115aed1 patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
116 set(DCMTK_CONFIGURATION_FILE "${DCMTK_DIR}/config/osconfig.h")
1058c115aed1 patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
117 else()
109
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 104
diff changeset
118 message(FATAL_ERROR "Please install libdcmtk1-dev")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 104
diff changeset
119 endif()
103
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
120
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
121 # Autodetection of the version of DCMTK
287
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
122 file(STRINGS
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
123 "${DCMTK_CONFIGURATION_FILE}"
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
124 DCMTK_VERSION_NUMBER1 REGEX
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
125 ".*PACKAGE_VERSION .*")
103
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
126
287
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
127 string(REGEX REPLACE
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
128 ".*PACKAGE_VERSION.*\"([0-9]*)\\.([0-9]*)\\.([0-9]*)\"$"
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
129 "\\1\\2\\3"
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
130 DCMTK_VERSION_NUMBER
471df5fecb1e simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 259
diff changeset
131 ${DCMTK_VERSION_NUMBER1})
291
4d7469f72a0b embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 287
diff changeset
132
298
6c4f6229aad7 fix in embedding dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 291
diff changeset
133 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=0)
6c4f6229aad7 fix in embedding dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 291
diff changeset
134
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
135 endif()
100
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
136
103
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
137 add_definitions(-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER})
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
138 message("DCMTK version: ${DCMTK_VERSION_NUMBER}")