Mercurial > hg > orthanc-stone
annotate Resources/CMake/PixmanConfiguration.cmake @ 254:abc1c6231947 am-2
cleanup
author | am@osimis.io |
---|---|
date | Tue, 03 Jul 2018 11:49:02 +0200 |
parents | 4cff7b1ed31d |
children | 38c795cc7c48 |
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 | |
111 elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") | |
112 ########################## | |
113 ## Emscripten (asm.js) | |
114 ########################## | |
115 | |
116 # No threading support | |
117 set(PIXMAN_DEFINITIONS "${PIXMAN_DEFINITIONS};PIXMAN_NO_TLS=1;HAVE_GCC_VECTOR_EXTENSIONS") | |
118 | |
119 elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows") | |
0 | 120 |
121 ########################## | |
122 ## Windows 32 or 64 | |
123 ########################## | |
124 | |
125 if (CMAKE_COMPILER_IS_GNUCXX) | |
126 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") | |
127 | |
128 # The option "-mstackrealign" is necessary to avoid a crash on | |
129 # Windows if enabling SSE2. As an alternative, it is possible to | |
130 # fully disable hardware acceleration. | |
131 # https://bugs.freedesktop.org/show_bug.cgi?id=68300#c4 | |
132 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -mssse3 -mstackrealign") | |
133 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 -mssse3 -mstackrealign") | |
134 endif() | |
135 | |
136 list(APPEND PIXMAN_SOURCES | |
137 ${PIXMAN_SOURCES_DIR}/pixman/pixman-sse2.c | |
138 ${PIXMAN_SOURCES_DIR}/pixman/pixman-ssse3.c | |
139 ) | |
26
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
140 |
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
141 if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "4") |
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
142 # Only enable MMX on Windows 32 |
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
143 add_definitions( |
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
144 -DUSE_X86_MMX=1 |
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
145 ) |
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
146 endif() |
99b833843ba9
fix MSVC 64bit builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
147 |
0 | 148 add_definitions( |
149 -DUSE_SSE2=1 | |
150 -DUSE_SSSE3=1 | |
151 ) | |
152 | |
153 | |
154 ########################## | |
155 ## Generic x86 processor | |
156 ########################## | |
157 | |
158 elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86" OR | |
159 CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR | |
160 CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR | |
3
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
161 CMAKE_SYSTEM_NAME STREQUAL "NaCl64" OR |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
162 CMAKE_SYSTEM_NAME STREQUAL "Darwin") |
0 | 163 |
164 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") | |
165 | |
166 if (${CMAKE_SYSTEM_NAME} STREQUAL "NaCl32" OR | |
167 ${CMAKE_SYSTEM_NAME} STREQUAL "NaCl64") | |
168 # The MMX instructions lead to "unrecognized instruction" when | |
169 # validating ".nexe" files using "ncval", disable them | |
170 else() | |
171 #add_definitions(-DUSE_X86_MMX=1) | |
172 endif() | |
173 | |
174 list(APPEND PIXMAN_SOURCES | |
175 ${PIXMAN_SOURCES_DIR}/pixman/pixman-sse2.c | |
176 ${PIXMAN_SOURCES_DIR}/pixman/pixman-ssse3.c | |
177 ) | |
178 add_definitions( | |
179 -DUSE_SSE2=1 | |
180 -DUSE_SSSE3=1 | |
181 ) | |
182 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -mssse3") | |
183 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 -mssse3") | |
184 | |
185 | |
186 ########################## | |
187 ## ARM processor | |
188 ########################## | |
189 | |
190 elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv5te" OR | |
191 CMAKE_SYSTEM_PROCESSOR STREQUAL "armv6" OR | |
192 CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a" OR | |
193 CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") | |
194 | |
195 set(PIXMAN_DEFINITIONS "${PIXMAN_DEFINITIONS};TLS=__thread") | |
196 | |
197 if (NEON) | |
198 message("Processor with NEON instructions") | |
199 list(APPEND PIXMAN_SOURCES | |
200 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm-neon.c | |
201 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm-neon-asm.S | |
202 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm-neon-asm-bilinear.S | |
203 ) | |
204 add_definitions( | |
205 -DUSE_ARM_NEON=1 | |
206 ) | |
207 elseif() | |
208 message("Processor without NEON instructions") | |
209 endif() | |
210 | |
211 add_definitions( | |
212 -DUSE_ARM_SIMD=1 | |
213 ) | |
214 list(APPEND PIXMAN_SOURCES | |
215 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm.c | |
216 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm-simd-asm.S | |
217 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm-simd-asm-scaled.S | |
218 ${PIXMAN_SOURCES_DIR}/pixman/pixman-arm-simd.c | |
219 ) | |
220 | |
221 else() | |
222 message(FATAL_ERROR "Support your platform here") | |
223 endif() | |
224 | |
225 | |
226 include_directories( | |
227 ${PIXMAN_SOURCES_DIR}/pixman | |
228 ) | |
229 | |
230 set_property( | |
231 SOURCE ${PIXMAN_SOURCES} | |
232 PROPERTY COMPILE_DEFINITIONS ${PIXMAN_DEFINITIONS} | |
233 ) | |
234 | |
235 else() | |
236 | |
237 pkg_search_module(PIXMAN REQUIRED pixman-1) | |
238 include_directories(${PIXMAN_INCLUDE_DIRS}) | |
239 link_libraries(${PIXMAN_LIBRARIES}) | |
240 | |
241 endif() |