Mercurial > hg > orthanc
annotate Resources/CMake/DcmtkConfiguration.cmake @ 734:8c29c1056d45
automatic search of the dicom dictionaries in CMake
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 28 Feb 2014 16:55:09 +0100 |
parents | b8322fe3bdba |
children | ee0d5abf7958 |
rev | line source |
---|---|
734
8c29c1056d45
automatic search of the dicom dictionaries in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
626
diff
changeset
|
1 # Lookup for DICOM dictionaries, if none is specified by the user |
8c29c1056d45
automatic search of the dicom dictionaries in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
626
diff
changeset
|
2 if (DCMTK_DICTIONARY_DIR STREQUAL "") |
8c29c1056d45
automatic search of the dicom dictionaries in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
626
diff
changeset
|
3 find_path(DCMTK_DICTIONARY_DIR_AUTO dicom.dic |
8c29c1056d45
automatic search of the dicom dictionaries in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
626
diff
changeset
|
4 /usr/share/dcmtk |
8c29c1056d45
automatic search of the dicom dictionaries in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
626
diff
changeset
|
5 /usr/share/libdcmtk2 |
8c29c1056d45
automatic search of the dicom dictionaries in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
626
diff
changeset
|
6 ) |
8c29c1056d45
automatic search of the dicom dictionaries in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
626
diff
changeset
|
7 |
8c29c1056d45
automatic search of the dicom dictionaries in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
626
diff
changeset
|
8 message("Autodetected path to the DICOM dictionaries: ${DCMTK_DICTIONARY_DIR_AUTO}") |
8c29c1056d45
automatic search of the dicom dictionaries in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
626
diff
changeset
|
9 add_definitions(-DDCMTK_DICTIONARY_DIR="${DCMTK_DICTIONARY_DIR_AUTO}") |
8c29c1056d45
automatic search of the dicom dictionaries in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
626
diff
changeset
|
10 else() |
8c29c1056d45
automatic search of the dicom dictionaries in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
626
diff
changeset
|
11 add_definitions(-DDCMTK_DICTIONARY_DIR="${DCMTK_DICTIONARY_DIR}") |
8c29c1056d45
automatic search of the dicom dictionaries in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
626
diff
changeset
|
12 endif() |
8c29c1056d45
automatic search of the dicom dictionaries in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
626
diff
changeset
|
13 |
8c29c1056d45
automatic search of the dicom dictionaries in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
626
diff
changeset
|
14 |
494
012b63028085
CMake parameter for the location of DCMTK dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
411
diff
changeset
|
15 |
626
b8322fe3bdba
possibility to disable the use of system dcmtk or boost
jodogne
parents:
553
diff
changeset
|
16 if (STATIC_BUILD OR NOT USE_SYSTEM_DCMTK) |
103
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
17 SET(DCMTK_VERSION_NUMBER 360) |
8 | 18 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
|
19 DownloadPackage( |
5f6d75cd4b46
md5 of third party downlaods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
20 "219ad631b82031806147e4abbfba4fa4" |
5f6d75cd4b46
md5 of third party downlaods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
21 "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
|
22 "${DCMTK_SOURCES_DIR}") |
8 | 23 |
24 IF(CMAKE_CROSSCOMPILING) | |
25 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") | |
26 ENDIF() | |
27 SET(DCMTK_SOURCE_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0) | |
28 include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake) | |
29 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
|
30 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
31 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
|
32 set(HAVE_SSTREAM 1) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
33 set(HAVE_PROTOTYPE_BZERO 1) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
34 set(HAVE_PROTOTYPE_GETHOSTNAME 1) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
35 set(HAVE_PROTOTYPE_GETSOCKOPT 1) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
36 set(HAVE_PROTOTYPE_SETSOCKOPT 1) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
37 set(HAVE_PROTOTYPE_CONNECT 1) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
38 set(HAVE_PROTOTYPE_BIND 1) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
39 set(HAVE_PROTOTYPE_ACCEPT 1) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
40 set(HAVE_PROTOTYPE_SETSOCKNAME 1) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
41 set(HAVE_PROTOTYPE_GETSOCKNAME 1) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
42 endif() |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
43 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
44 CONFIGURE_FILE( |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
45 ${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in |
8 | 46 ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h) |
47 | |
259
6f4591ba5051
dcmtk not for the core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
194
diff
changeset
|
48 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
|
49 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
|
50 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
|
51 |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
52 # Source for the logging facility of DCMTK |
259
6f4591ba5051
dcmtk not for the core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
194
diff
changeset
|
53 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES) |
8 | 54 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") |
259
6f4591ba5051
dcmtk not for the core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
194
diff
changeset
|
55 list(REMOVE_ITEM DCMTK_SOURCES |
8 | 56 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc |
57 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc | |
58 ) | |
59 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
259
6f4591ba5051
dcmtk not for the core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
194
diff
changeset
|
60 list(REMOVE_ITEM DCMTK_SOURCES |
8 | 61 ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc |
62 ) | |
495 | 63 |
64 if (${CMAKE_COMPILER_IS_GNUCXX}) | |
65 # This is a patch for MinGW64 | |
66 execute_process( | |
67 COMMAND patch -p0 -i ${CMAKE_SOURCE_DIR}/Resources/Patches/dcmtk-mingw64.patch | |
68 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
69 ) | |
70 endif() | |
71 | |
8 | 72 endif() |
73 | |
259
6f4591ba5051
dcmtk not for the core
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
194
diff
changeset
|
74 list(REMOVE_ITEM DCMTK_SOURCES |
8 | 75 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc |
76 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc | |
77 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdictbi.cc | |
78 ) | |
79 | |
80 # This fixes crashes related to the destruction of the DCMTK OFLogger | |
81 # 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
|
82 add_definitions( |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
83 -DLOG4CPLUS_DISABLE_FATAL=1 |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
84 -DDCMTK_VERSION_NUMBER=360 |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
85 ) |
8 | 86 |
87 include_directories( | |
88 #${DCMTK_SOURCES_DIR} | |
89 ${DCMTK_SOURCES_DIR}/config/include | |
90 ${DCMTK_SOURCES_DIR}/dcmnet/include | |
91 ${DCMTK_SOURCES_DIR}/ofstd/include | |
92 ${DCMTK_SOURCES_DIR}/oflog/include | |
93 ${DCMTK_SOURCES_DIR}/dcmdata/include | |
94 ) | |
95 | |
96 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
|
97 |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
98 set(DCMTK_BUNDLES_LOG4CPLUS 1) |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
99 |
367 | 100 if (STANDALONE_BUILD) |
101 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=1) | |
102 else() | |
103 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=0) | |
104 endif() | |
105 | |
298
6c4f6229aad7
fix in embedding dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
106 set(DCMTK_DICTIONARIES |
6c4f6229aad7
fix in embedding dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
107 DICTIONARY_DICOM ${DCMTK_SOURCES_DIR}/dcmdata/data/dicom.dic |
6c4f6229aad7
fix in embedding dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
108 DICTIONARY_PRIVATE ${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic |
6c4f6229aad7
fix in embedding dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
109 DICTIONARY_DICONDE ${DCMTK_SOURCES_DIR}/dcmdata/data/diconde.dic |
6c4f6229aad7
fix in embedding dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
110 ) |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
287
diff
changeset
|
111 |
8 | 112 else() |
287
471df5fecb1e
simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
259
diff
changeset
|
113 # 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
|
114 # 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
|
115 set(tmp "${DCMTK_LIBRARIES}") |
471df5fecb1e
simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
259
diff
changeset
|
116 include(FindDCMTK) |
471df5fecb1e
simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
259
diff
changeset
|
117 list(APPEND DCMTK_LIBRARIES "${tmp}") |
115 | 118 |
8 | 119 include_directories(${DCMTK_INCLUDE_DIR}) |
287
471df5fecb1e
simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
259
diff
changeset
|
120 link_libraries(${DCMTK_LIBRARIES}) |
8 | 121 |
122 add_definitions( | |
123 -DHAVE_CONFIG_H=1 | |
124 ) | |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
125 |
150
1058c115aed1
patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
126 if (EXISTS "${DCMTK_DIR}/config/cfunix.h") |
1058c115aed1
patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
127 set(DCMTK_CONFIGURATION_FILE "${DCMTK_DIR}/config/cfunix.h") |
1058c115aed1
patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
128 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
|
129 set(DCMTK_CONFIGURATION_FILE "${DCMTK_DIR}/config/osconfig.h") |
1058c115aed1
patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
130 else() |
109 | 131 message(FATAL_ERROR "Please install libdcmtk1-dev") |
132 endif() | |
103
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
133 |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
134 # Autodetection of the version of DCMTK |
287
471df5fecb1e
simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
259
diff
changeset
|
135 file(STRINGS |
471df5fecb1e
simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
259
diff
changeset
|
136 "${DCMTK_CONFIGURATION_FILE}" |
471df5fecb1e
simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
259
diff
changeset
|
137 DCMTK_VERSION_NUMBER1 REGEX |
471df5fecb1e
simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
259
diff
changeset
|
138 ".*PACKAGE_VERSION .*") |
103
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
139 |
287
471df5fecb1e
simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
259
diff
changeset
|
140 string(REGEX REPLACE |
471df5fecb1e
simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
259
diff
changeset
|
141 ".*PACKAGE_VERSION.*\"([0-9]*)\\.([0-9]*)\\.([0-9]*)\"$" |
471df5fecb1e
simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
259
diff
changeset
|
142 "\\1\\2\\3" |
471df5fecb1e
simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
259
diff
changeset
|
143 DCMTK_VERSION_NUMBER |
471df5fecb1e
simplification to cmake for dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
259
diff
changeset
|
144 ${DCMTK_VERSION_NUMBER1}) |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
287
diff
changeset
|
145 |
298
6c4f6229aad7
fix in embedding dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
146 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=0) |
6c4f6229aad7
fix in embedding dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
147 |
8 | 148 endif() |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
149 |
103
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
150 add_definitions(-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER}) |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
151 message("DCMTK version: ${DCMTK_VERSION_NUMBER}") |