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