Mercurial > hg > orthanc-stone
annotate OrthancStone/Resources/CMake/PixmanConfiguration.cmake @ 1795:39673d351ef2
fix build
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 18 May 2021 09:57:14 +0200 |
parents | 9ac2a65d4172 |
children | 3889ae96d2e9 |
rev | line source |
---|---|
47 | 1 # Stone of Orthanc |
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
3 # Department, University Hospital of Liege, Belgium | |
1739
9ac2a65d4172
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
4 # Copyright (C) 2017-2021 Osimis S.A., Belgium |
47 | 5 # |
6 # This program is free software: you can redistribute it and/or | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
7 # modify it under the terms of the GNU Lesser General Public License |
47 | 8 # as published by the Free Software Foundation, either version 3 of |
9 # the License, or (at your option) any later version. | |
10 # | |
11 # This program is distributed in the hope that it will be useful, but | |
12 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
14 # Lesser General Public License for more details. |
1597
f9e3a9c21c0f
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
15 # |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
16 # You should have received a copy of the GNU Lesser General Public |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
17 # License along with this program. If not, see |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
18 # <http://www.gnu.org/licenses/>. |
47 | 19 |
20 | |
0 | 21 if (STATIC_BUILD OR NOT USE_SYSTEM_PIXMAN) |
22 SET(PIXMAN_SOURCES_DIR ${CMAKE_BINARY_DIR}/pixman-0.34.0) | |
449
bb658baeb967
moving third-party dependencies to another server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
23 SET(PIXMAN_URL "http://orthanc.osimis.io/ThirdPartyDownloads/pixman-0.34.0.tar.gz") |
0 | 24 SET(PIXMAN_MD5 "e80ebae4da01e77f68744319f01d52a3") |
25 | |
26 if (IS_DIRECTORY "${PIXMAN_SOURCES_DIR}") | |
27 set(FirstRun OFF) | |
28 else() | |
29 set(FirstRun ON) | |
30 endif() | |
31 | |
32 DownloadPackage(${PIXMAN_MD5} ${PIXMAN_URL} "${PIXMAN_SOURCES_DIR}") | |
33 | |
34 # Apply a patch for NaCl32: This bypasses the custom implementation of | |
35 # "cpuid" that makes use of assembly code leading to "unrecognized | |
36 # instruction" when validating ".nexe" files using "ncval" | |
37 execute_process( | |
38 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${CMAKE_CURRENT_LIST_DIR}/PixmanConfiguration.patch | |
39 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
40 RESULT_VARIABLE Failure | |
41 ) | |
42 | |
43 if (Failure AND FirstRun) | |
44 message(FATAL_ERROR "Error while patching a file") | |
45 endif() | |
46 | |
47 set(PIXMAN_VERSION_MAJOR 0) | |
48 set(PIXMAN_VERSION_MINOR 34) | |
49 set(PIXMAN_VERSION_MICRO 0) | |
50 configure_file( | |
51 ${PIXMAN_SOURCES_DIR}/pixman/pixman-version.h.in | |
52 ${PIXMAN_SOURCES_DIR}/pixman/pixman-version.h) | |
53 | |
54 list(APPEND PIXMAN_SOURCES | |
55 ${PIXMAN_SOURCES_DIR}/pixman/pixman-access-accessors.c | |
56 ${PIXMAN_SOURCES_DIR}/pixman/pixman-access.c | |
57 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm.c | |
58 #${PIXMAN_SOURCES_DIR}/pixman/pixman-arm-neon.c | |
59 #${PIXMAN_SOURCES_DIR}/pixman/pixman-arm-simd.c | |
60 ${PIXMAN_SOURCES_DIR}/pixman/pixman-bits-image.c | |
61 ${PIXMAN_SOURCES_DIR}/pixman/pixman.c | |
62 ${PIXMAN_SOURCES_DIR}/pixman/pixman-combine32.c | |
63 ${PIXMAN_SOURCES_DIR}/pixman/pixman-combine-float.c | |
64 ${PIXMAN_SOURCES_DIR}/pixman/pixman-conical-gradient.c | |
65 ${PIXMAN_SOURCES_DIR}/pixman/pixman-edge-accessors.c | |
66 ${PIXMAN_SOURCES_DIR}/pixman/pixman-edge.c | |
67 ${PIXMAN_SOURCES_DIR}/pixman/pixman-fast-path.c | |
68 ${PIXMAN_SOURCES_DIR}/pixman/pixman-filter.c | |
69 ${PIXMAN_SOURCES_DIR}/pixman/pixman-general.c | |
70 ${PIXMAN_SOURCES_DIR}/pixman/pixman-glyph.c | |
71 ${PIXMAN_SOURCES_DIR}/pixman/pixman-gradient-walker.c | |
72 ${PIXMAN_SOURCES_DIR}/pixman/pixman-image.c | |
73 ${PIXMAN_SOURCES_DIR}/pixman/pixman-implementation.c | |
74 ${PIXMAN_SOURCES_DIR}/pixman/pixman-linear-gradient.c | |
75 ${PIXMAN_SOURCES_DIR}/pixman/pixman-matrix.c | |
76 ${PIXMAN_SOURCES_DIR}/pixman/pixman-mips.c | |
77 #${PIXMAN_SOURCES_DIR}/pixman/pixman-mips-dspr2.c | |
78 ${PIXMAN_SOURCES_DIR}/pixman/pixman-mmx.c | |
79 ${PIXMAN_SOURCES_DIR}/pixman/pixman-noop.c | |
80 ${PIXMAN_SOURCES_DIR}/pixman/pixman-ppc.c | |
81 ${PIXMAN_SOURCES_DIR}/pixman/pixman-radial-gradient.c | |
82 ${PIXMAN_SOURCES_DIR}/pixman/pixman-region16.c | |
83 ${PIXMAN_SOURCES_DIR}/pixman/pixman-region32.c | |
84 #${PIXMAN_SOURCES_DIR}/pixman/pixman-region.c | |
85 ${PIXMAN_SOURCES_DIR}/pixman/pixman-solid-fill.c | |
86 #${PIXMAN_SOURCES_DIR}/pixman/pixman-sse2.c | |
87 #${PIXMAN_SOURCES_DIR}/pixman/pixman-ssse3.c | |
88 ${PIXMAN_SOURCES_DIR}/pixman/pixman-timer.c | |
89 ${PIXMAN_SOURCES_DIR}/pixman/pixman-trap.c | |
90 ${PIXMAN_SOURCES_DIR}/pixman/pixman-utils.c | |
91 #${PIXMAN_SOURCES_DIR}/pixman/pixman-vmx.c | |
92 ${PIXMAN_SOURCES_DIR}/pixman/pixman-x86.c | |
93 ) | |
94 | |
95 set(PIXMAN_DEFINITIONS "PACKAGE=\"pixman\"") | |
96 | |
97 if (CMAKE_SYSTEM_PROCESSOR) | |
98 message("Processor: ${CMAKE_SYSTEM_PROCESSOR}") | |
99 else() | |
100 message("Processor: Not applicable") | |
101 endif() | |
102 | |
103 | |
39 | 104 ########################## |
105 ## Portable Google NaCl | |
106 ########################## | |
107 | |
108 if (CMAKE_SYSTEM_NAME STREQUAL "PNaCl") | |
109 # No hardware acceleration | |
110 set(PIXMAN_DEFINITIONS "${PIXMAN_DEFINITIONS};TLS=__thread") | |
111 | |
263
38c795cc7c48
primitives for android ndk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
134
diff
changeset
|
112 elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR |
38c795cc7c48
primitives for android ndk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
134
diff
changeset
|
113 CMAKE_SYSTEM_NAME STREQUAL "Android") |
39 | 114 ########################## |
115 ## Emscripten (asm.js) | |
116 ########################## | |
117 | |
118 # No threading support | |
119 set(PIXMAN_DEFINITIONS "${PIXMAN_DEFINITIONS};PIXMAN_NO_TLS=1;HAVE_GCC_VECTOR_EXTENSIONS") | |
120 | |
121 elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows") | |
0 | 122 |
123 ########################## | |
124 ## Windows 32 or 64 | |
125 ########################## | |
126 | |
127 if (CMAKE_COMPILER_IS_GNUCXX) | |
128 set(PIXMAN_DEFINITIONS "${PIXMAN_DEFINITIONS};TLS=__thread;HAVE_GCC_VECTOR_EXTENSIONS;HAVE_BUILTIN_CLZ;HAVE_FEDIVBYZERO=1;HAVE_FENV_H=1;HAVE_MPROTECT=1;HAVE_FLOAT128;HAVE_POSIX_MEMALIGN;USE_GCC_INLINE_ASM=1;HAVE_GETPAGESIZE=1") | |
129 | |
130 # The option "-mstackrealign" is necessary to avoid a crash on | |
131 # Windows if enabling SSE2. As an alternative, it is possible to | |
132 # fully disable hardware acceleration. | |
133 # https://bugs.freedesktop.org/show_bug.cgi?id=68300#c4 | |
134 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -mssse3 -mstackrealign") | |
135 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 -mssse3 -mstackrealign") | |
136 endif() | |
137 | |
138 list(APPEND PIXMAN_SOURCES | |
139 ${PIXMAN_SOURCES_DIR}/pixman/pixman-sse2.c | |
140 ${PIXMAN_SOURCES_DIR}/pixman/pixman-ssse3.c | |
141 ) | |
26
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
142 |
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
143 if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "4") |
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
144 # Only enable MMX on Windows 32 |
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
145 add_definitions( |
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
146 -DUSE_X86_MMX=1 |
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
147 ) |
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
148 endif() |
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
149 |
0 | 150 add_definitions( |
151 -DUSE_SSE2=1 | |
152 -DUSE_SSSE3=1 | |
153 ) | |
154 | |
155 | |
156 ########################## | |
157 ## Generic x86 processor | |
158 ########################## | |
159 | |
160 elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86" OR | |
161 CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR | |
162 CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR | |
3
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
163 CMAKE_SYSTEM_NAME STREQUAL "NaCl64" OR |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
164 CMAKE_SYSTEM_NAME STREQUAL "Darwin") |
0 | 165 |
166 set(PIXMAN_DEFINITIONS "${PIXMAN_DEFINITIONS};TLS=__thread;HAVE_GCC_VECTOR_EXTENSIONS;HAVE_BUILTIN_CLZ;HAVE_MPROTECT=1;HAVE_FLOAT128;HAVE_POSIX_MEMALIGN;USE_GCC_INLINE_ASM;HAVE_GETPAGESIZE=1") | |
167 | |
168 if (${CMAKE_SYSTEM_NAME} STREQUAL "NaCl32" OR | |
169 ${CMAKE_SYSTEM_NAME} STREQUAL "NaCl64") | |
170 # The MMX instructions lead to "unrecognized instruction" when | |
171 # validating ".nexe" files using "ncval", disable them | |
172 else() | |
173 #add_definitions(-DUSE_X86_MMX=1) | |
174 endif() | |
175 | |
176 list(APPEND PIXMAN_SOURCES | |
177 ${PIXMAN_SOURCES_DIR}/pixman/pixman-sse2.c | |
178 ${PIXMAN_SOURCES_DIR}/pixman/pixman-ssse3.c | |
179 ) | |
180 add_definitions( | |
181 -DUSE_SSE2=1 | |
182 -DUSE_SSSE3=1 | |
183 ) | |
184 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -mssse3") | |
185 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 -mssse3") | |
186 | |
187 | |
188 ########################## | |
189 ## ARM processor | |
190 ########################## | |
191 | |
192 elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv5te" OR | |
193 CMAKE_SYSTEM_PROCESSOR STREQUAL "armv6" OR | |
283 | 194 CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l" OR |
0 | 195 CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a" OR |
196 CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") | |
197 | |
198 set(PIXMAN_DEFINITIONS "${PIXMAN_DEFINITIONS};TLS=__thread") | |
199 | |
200 if (NEON) | |
201 message("Processor with NEON instructions") | |
202 list(APPEND PIXMAN_SOURCES | |
203 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm-neon.c | |
204 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm-neon-asm.S | |
205 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm-neon-asm-bilinear.S | |
206 ) | |
207 add_definitions( | |
208 -DUSE_ARM_NEON=1 | |
209 ) | |
210 elseif() | |
211 message("Processor without NEON instructions") | |
212 endif() | |
213 | |
214 add_definitions( | |
215 -DUSE_ARM_SIMD=1 | |
216 ) | |
217 list(APPEND PIXMAN_SOURCES | |
218 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm.c | |
219 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm-simd-asm.S | |
220 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm-simd-asm-scaled.S | |
221 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm-simd.c | |
222 ) | |
223 | |
224 else() | |
225 message(FATAL_ERROR "Support your platform here") | |
226 endif() | |
227 | |
228 | |
229 include_directories( | |
230 ${PIXMAN_SOURCES_DIR}/pixman | |
231 ) | |
232 | |
233 set_property( | |
234 SOURCE ${PIXMAN_SOURCES} | |
235 PROPERTY COMPILE_DEFINITIONS ${PIXMAN_DEFINITIONS} | |
236 ) | |
237 | |
238 else() | |
239 | |
240 pkg_search_module(PIXMAN REQUIRED pixman-1) | |
241 include_directories(${PIXMAN_INCLUDE_DIRS}) | |
242 link_libraries(${PIXMAN_LIBRARIES}) | |
243 | |
244 endif() |