Mercurial > hg > orthanc
annotate OrthancFramework/Resources/CMake/LibIconvConfiguration.cmake @ 5853:4d932683049d get-scu tip
very first implementation of C-Get SCU
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 29 Oct 2024 17:25:49 +0100 |
parents | f7adfb22e20e |
children |
rev | line source |
---|---|
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
1 # Orthanc - A Lightweight, RESTful DICOM Store |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
3 # Department, University Hospital of Liege, Belgium |
5640
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium |
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
5 # Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5434
diff
changeset
|
6 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
7 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
8 # This program is free software: you can redistribute it and/or |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 # modify it under the terms of the GNU Lesser General Public License |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 # as published by the Free Software Foundation, either version 3 of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
11 # the License, or (at your option) any later version. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
12 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
13 # This program is distributed in the hope that it will be useful, but |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
14 # WITHOUT ANY WARRANTY; without even the implied warranty of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
16 # Lesser General Public License for more details. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 # You should have received a copy of the GNU Lesser General Public |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 # License along with this program. If not, see |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
20 # <http://www.gnu.org/licenses/>. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
21 |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
22 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
23 message("Using libiconv") |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
24 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
25 if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICONV) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
26 set(LIBICONV_SOURCES_DIR ${CMAKE_BINARY_DIR}/libiconv-1.15) |
5434
aa1c09fa6632
changed location of third-party downloads
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5271
diff
changeset
|
27 set(LIBICONV_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/libiconv-1.15.tar.gz") |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
28 set(LIBICONV_MD5 "ace8b5f2db42f7b3b3057585e80d9808") |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
29 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
30 DownloadPackage(${LIBICONV_MD5} ${LIBICONV_URL} "${LIBICONV_SOURCES_DIR}") |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
31 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
32 # Disable the support of libiconv that is shipped by default with |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
33 # the C standard library on Linux. Setting this macro redirects |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
34 # calls from "iconv*()" to "libiconv*()" by defining macros in the |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
35 # C headers of "libiconv-1.15". |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
36 add_definitions(-DLIBICONV_PLUG=1) |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
38 # https://groups.google.com/d/msg/android-ndk/AS1nkxnk6m4/EQm09hD1tigJ |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
39 add_definitions( |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
40 -DBUILDING_LIBICONV=1 |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
41 -DIN_LIBRARY=1 |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
42 -DLIBDIR="" |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
43 -DICONV_CONST= |
3241
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3228
diff
changeset
|
44 #-DENABLE_EXTRA=1 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
45 ) |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
46 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
47 configure_file( |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
48 ${LIBICONV_SOURCES_DIR}/srclib/localcharset.h |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
49 ${LIBICONV_SOURCES_DIR}/include |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
50 COPYONLY) |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
52 set(HAVE_VISIBILITY 0) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
53 set(ICONV_CONST ${ICONV_CONST}) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
54 set(USE_MBSTATE_T 1) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
55 set(BROKEN_WCHAR_H 0) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
56 set(EILSEQ) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
57 set(HAVE_WCHAR_T 1) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
58 configure_file( |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
59 ${LIBICONV_SOURCES_DIR}/include/iconv.h.build.in |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
60 ${LIBICONV_SOURCES_DIR}/include/iconv.h |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
61 ) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
62 unset(HAVE_VISIBILITY) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
63 unset(ICONV_CONST) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
64 unset(USE_MBSTATE_T) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
65 unset(BROKEN_WCHAR_H) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
66 unset(EILSEQ) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
67 unset(HAVE_WCHAR_T) |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
68 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
69 if (NOT EXISTS ${LIBICONV_SOURCES_DIR}/include/config.h) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
70 # Create an empty "config.h" for libiconv |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
71 file(WRITE ${LIBICONV_SOURCES_DIR}/include/config.h "") |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
72 endif() |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
73 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
74 include_directories( |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
75 ${LIBICONV_SOURCES_DIR}/include |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
76 ) |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
77 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
78 set(LIBICONV_SOURCES |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
79 ${LIBICONV_SOURCES_DIR}/lib/iconv.c |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
80 ${LIBICONV_SOURCES_DIR}/lib/relocatable.c |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
81 ${LIBICONV_SOURCES_DIR}/libcharset/lib/localcharset.c |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
82 ${LIBICONV_SOURCES_DIR}/libcharset/lib/relocatable.c |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
83 ) |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
85 source_group(ThirdParty\\libiconv REGULAR_EXPRESSION ${LIBICONV_SOURCES_DIR}/.*) |
1494 | 86 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
87 if (CMAKE_SYSTEM_NAME STREQUAL "Windows") |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
88 add_definitions(-DHAVE_WORKING_O_NOFOLLOW=0) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
89 else() |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
90 add_definitions(-DHAVE_WORKING_O_NOFOLLOW=1) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
91 endif() |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
92 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
93 else() |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
94 CHECK_INCLUDE_FILE_CXX(iconv.h HAVE_ICONV_H) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
95 if (NOT HAVE_ICONV_H) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
96 message(FATAL_ERROR "Please install the libiconv-dev package") |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
97 endif() |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
99 # Check whether the support for libiconv is bundled within the |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
100 # standard C library |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
101 CHECK_FUNCTION_EXISTS(iconv_open HAVE_ICONV_LIB) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
102 if (NOT HAVE_ICONV_LIB) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
103 # No builtin support for libiconv, try and find an external library. |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
104 # Open question: Does this make sense on any platform? |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
105 CHECK_LIBRARY_EXISTS(iconv iconv_open "" HAVE_ICONV_LIB_2) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
106 if (NOT HAVE_ICONV_LIB_2) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
107 message(FATAL_ERROR "Please install the libiconv-dev package") |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
108 else() |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
109 link_libraries(iconv) |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
110 endif() |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
111 endif() |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
112 endif() |