Mercurial > hg > orthanc-stone
annotate Resources/CMake/SdlConfiguration.cmake @ 981:c20dbaab360c
Ability to cope with empty "Referenced SOP Instance UID" (dicom path (3006,0039)[i] / (0x3006, 0x0040)[0] / (0x3006, 0x0016)[0] / (0x0008, 0x1155)) + better logs + code formating
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 06 Sep 2019 09:38:18 +0200 |
parents | 412a2d01a189 |
children | 2d8ab34c8c91 |
rev | line source |
---|---|
47 | 1 # Stone of Orthanc |
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
3 # Department, University Hospital of Liege, Belgium | |
439 | 4 # Copyright (C) 2017-2019 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_SDL) |
21 SET(SDL_SOURCES_DIR ${CMAKE_BINARY_DIR}/SDL2-2.0.4) | |
449
bb658baeb967
moving third-party dependencies to another server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
22 SET(SDL_URL "http://orthanc.osimis.io/ThirdPartyDownloads/SDL2-2.0.4.tar.gz") |
0 | 23 SET(SDL_MD5 "44fc4a023349933e7f5d7a582f7b886e") |
607
f4b37a991dac
using glew to build on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
449
diff
changeset
|
24 DownloadPackage(${SDL_MD5} ${SDL_URL} "${SDL_SOURCES_DIR}") |
0 | 25 |
26 include_directories(${SDL_SOURCES_DIR}/include) | |
27 | |
28 set(TMP "${SDL_SOURCES_DIR}/include/SDL_config_premake.h") | |
29 if (NOT EXISTS "${TMP}") | |
30 file(WRITE "${TMP}" " | |
31 #include \"SDL_platform.h\" | |
32 #define HAVE_STDARG_H 1 | |
33 #define HAVE_STDDEF_H 1 | |
34 #define HAVE_STDINT_H 1 | |
35 ") | |
36 endif() | |
37 | |
38 # General source files | |
39 file(GLOB SDL_SOURCES | |
40 ${SDL_SOURCES_DIR}/src/*.c | |
41 ${SDL_SOURCES_DIR}/src/atomic/*.c | |
42 ${SDL_SOURCES_DIR}/src/audio/*.c | |
43 ${SDL_SOURCES_DIR}/src/cpuinfo/*.c | |
44 ${SDL_SOURCES_DIR}/src/dynapi/*.c | |
45 ${SDL_SOURCES_DIR}/src/events/*.c | |
46 ${SDL_SOURCES_DIR}/src/file/*.c | |
47 ${SDL_SOURCES_DIR}/src/haptic/*.c | |
48 ${SDL_SOURCES_DIR}/src/joystick/*.c | |
49 ${SDL_SOURCES_DIR}/src/libm/*.c | |
50 ${SDL_SOURCES_DIR}/src/power/*.c | |
51 ${SDL_SOURCES_DIR}/src/render/*.c | |
52 ${SDL_SOURCES_DIR}/src/stdlib/*.c | |
53 ${SDL_SOURCES_DIR}/src/thread/*.c | |
54 ${SDL_SOURCES_DIR}/src/timer/*.c | |
55 ${SDL_SOURCES_DIR}/src/video/*.c | |
56 | |
57 ${SDL_SOURCES_DIR}/src/loadso/dummy/*.c | |
58 #${SDL_SOURCES_DIR}/src/timer/dummy/*.c | |
59 ${SDL_SOURCES_DIR}/src/audio/dummy/*.c | |
60 ${SDL_SOURCES_DIR}/src/filesystem/dummy/*.c | |
61 ${SDL_SOURCES_DIR}/src/haptic/dummy/*.c | |
62 ${SDL_SOURCES_DIR}/src/joystick/dummy/*.c | |
63 #${SDL_SOURCES_DIR}/src/main/dummy/*.c | |
64 ${SDL_SOURCES_DIR}/src/video/dummy/*.c | |
65 ) | |
66 | |
67 add_definitions( | |
68 -DUSING_PREMAKE_CONFIG_H=1 | |
69 | |
70 -DSDL_AUDIO_DISABLED=1 | |
71 -DSDL_AUDIO_DRIVER_DUMMY=1 | |
72 -DSDL_FILESYSTEM_DISABLED=1 | |
73 -DSDL_FILESYSTEM_DUMMY=1 | |
74 -DSDL_FILE_DISABLED=1 | |
75 -DSDL_HAPTIC_DISABLED=1 | |
76 -DSDL_JOYSTICK_DISABLED=1 | |
77 | |
78 #-DSDL_THREADS_DISABLED=1 | |
79 ) | |
80 | |
3
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
81 if (CMAKE_SYSTEM_NAME STREQUAL "Linux") |
0 | 82 file(GLOB TMP |
83 ${SDL_SOURCES_DIR}/src/core/linux/*.c | |
84 ${SDL_SOURCES_DIR}/src/loadso/dlopen/*.c | |
85 ${SDL_SOURCES_DIR}/src/render/software/*.c | |
86 ${SDL_SOURCES_DIR}/src/thread/pthread/*.c | |
87 ${SDL_SOURCES_DIR}/src/timer/unix/*.c | |
88 ${SDL_SOURCES_DIR}/src/video/x11/*.c | |
89 ) | |
90 | |
91 list(APPEND SDL_SOURCES ${TMP}) | |
92 | |
93 add_definitions( | |
94 -DSDL_LOADSO_DLOPEN=1 | |
95 -DSDL_THREAD_PTHREAD=1 | |
96 -DSDL_TIMER_UNIX=1 | |
97 -DSDL_POWER_DISABLED=1 | |
98 | |
99 -DSDL_VIDEO_DRIVER_X11=1 | |
308 | 100 |
0 | 101 -DSDL_ASSEMBLY_ROUTINES=1 |
102 -DSDL_THREAD_PTHREAD_RECURSIVE_MUTEX=1 | |
103 -DSDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS=1 | |
104 -DHAVE_GCC_SYNC_LOCK_TEST_AND_SET=1 | |
105 ) | |
106 | |
107 link_libraries(X11 Xext) | |
108 | |
308 | 109 if (NOT CMAKE_SYSTEM_VERSION STREQUAL "Raspberry") |
110 # Raspberry Pi has no support for OpenGL | |
111 file(GLOB TMP | |
112 ${SDL_SOURCES_DIR}/src/render/opengl/*.c | |
113 ${SDL_SOURCES_DIR}/src/render/opengles2/*.c | |
114 ) | |
115 | |
116 list(APPEND SDL_SOURCES ${TMP}) | |
117 | |
118 add_definitions( | |
119 -DSDL_VIDEO_OPENGL=1 | |
120 -DSDL_VIDEO_OPENGL_ES2=1 | |
121 -DSDL_VIDEO_RENDER_OGL=1 | |
122 -DSDL_VIDEO_RENDER_OGL_ES2=1 | |
123 -DSDL_VIDEO_OPENGL_GLX=1 | |
124 -DSDL_VIDEO_OPENGL_EGL=1 | |
125 ) | |
126 endif() | |
127 | |
3
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
128 elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows") |
0 | 129 file(GLOB TMP |
130 ${SDL_SOURCES_DIR}/src/audio/directsound/*.c | |
131 ${SDL_SOURCES_DIR}/src/audio/disk/*.c | |
132 ${SDL_SOURCES_DIR}/src/audio/winmm/*.c | |
133 ${SDL_SOURCES_DIR}/src/joystick/windows/*.c | |
134 ${SDL_SOURCES_DIR}/src/haptic/windows/*.c | |
135 ${SDL_SOURCES_DIR}/src/power/windows/*.c | |
136 | |
137 ${SDL_SOURCES_DIR}/src/main/windows/*.c | |
138 ${SDL_SOURCES_DIR}/src/core/windows/*.c | |
139 ${SDL_SOURCES_DIR}/src/loadso/windows/*.c | |
140 ${SDL_SOURCES_DIR}/src/render/direct3d/*.c | |
141 ${SDL_SOURCES_DIR}/src/render/direct3d11/*.c | |
142 ${SDL_SOURCES_DIR}/src/render/opengl/*.c | |
143 ${SDL_SOURCES_DIR}/src/render/psp/*.c | |
144 ${SDL_SOURCES_DIR}/src/render/opengles/*.c | |
145 ${SDL_SOURCES_DIR}/src/render/opengles2/*.c | |
146 ${SDL_SOURCES_DIR}/src/render/software/*.c | |
147 ${SDL_SOURCES_DIR}/src/thread/generic/SDL_syscond.c # Don't include more files from "thread/generic/*.c"! | |
148 ${SDL_SOURCES_DIR}/src/thread/windows/*.c | |
149 ${SDL_SOURCES_DIR}/src/timer/windows/*.c | |
150 ${SDL_SOURCES_DIR}/src/video/windows/*.c | |
151 ${SDL_SOURCES_DIR}/src/windows/dlopen/*.c | |
152 ) | |
153 | |
154 list(APPEND SDL_SOURCES ${TMP}) | |
155 | |
156 # NB: OpenGL ES headers are not available in MinGW-W64 | |
157 add_definitions( | |
158 -DSDL_LOADSO_WINDOWS=1 | |
159 -DSDL_THREAD_WINDOWS=1 | |
160 -DSDL_TIMER_WINDOWS=1 | |
161 -DSDL_POWER_WINDOWS=1 | |
162 | |
163 -DSDL_VIDEO_OPENGL=1 | |
164 -DSDL_VIDEO_OPENGL_WGL=1 | |
165 -DSDL_VIDEO_RENDER_D3D=1 | |
166 -DSDL_VIDEO_RENDER_OGL=1 | |
167 -DSDL_VIDEO_DRIVER_WINDOWS=1 | |
168 ) | |
169 | |
170 if (MSVC) | |
171 add_definitions( | |
172 -D__FLTUSED__ | |
173 -DHAVE_LIBC=1 | |
174 ) | |
175 else() | |
176 add_definitions( | |
177 -DHAVE_GCC_ATOMICS=1 | |
178 -DSDL_ASSEMBLY_ROUTINES=1 | |
179 ) | |
180 endif() | |
181 | |
182 link_libraries(imm32 winmm version) | |
3
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
183 |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
184 elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin") |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
185 file(GLOB TMP |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
186 ${SDL_SOURCES_DIR}/src/loadso/dlopen/*.c |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
187 ${SDL_SOURCES_DIR}/src/render/opengl/*.c |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
188 ${SDL_SOURCES_DIR}/src/render/opengles2/*.c |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
189 ${SDL_SOURCES_DIR}/src/render/software/*.c |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
190 ${SDL_SOURCES_DIR}/src/thread/pthread/*.c |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
191 ${SDL_SOURCES_DIR}/src/timer/unix/*.c |
5
d9452f5a5346
fix build on Mac OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
192 ${SDL_SOURCES_DIR}/src/video/cocoa/*.m |
3
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
193 ) |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
194 |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
195 list(APPEND SDL_SOURCES ${TMP}) |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
196 |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
197 add_definitions( |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
198 -DSDL_LOADSO_DLOPEN=1 |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
199 -DSDL_THREAD_PTHREAD=1 |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
200 -DSDL_TIMER_UNIX=1 |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
201 -DSDL_POWER_DISABLED=1 |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
202 |
5
d9452f5a5346
fix build on Mac OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
203 -DSDL_VIDEO_DRIVER_COCOA=1 |
3
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
204 -DSDL_VIDEO_OPENGL=1 |
5
d9452f5a5346
fix build on Mac OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
205 -DSDL_VIDEO_OPENGL_CGL=1 |
3
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
206 -DSDL_VIDEO_RENDER_OGL=1 |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
207 |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
208 -DSDL_ASSEMBLY_ROUTINES=1 |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
209 -DSDL_THREAD_PTHREAD_RECURSIVE_MUTEX=1 |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
210 ) |
490347621f42
attempt to build for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
211 |
5
d9452f5a5346
fix build on Mac OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
212 find_library(CARBON_LIBRARY Carbon) |
d9452f5a5346
fix build on Mac OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
213 find_library(COCOA_LIBRARY Cocoa) |
d9452f5a5346
fix build on Mac OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
214 find_library(IOKIT_LIBRARY IOKit) |
d9452f5a5346
fix build on Mac OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
215 find_library(QUARTZ_LIBRARY QuartzCore) |
d9452f5a5346
fix build on Mac OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
216 link_libraries(${CARBON_LIBRARY} ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${QUARTZ_LIBRARY}) |
d9452f5a5346
fix build on Mac OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3
diff
changeset
|
217 |
0 | 218 endif() |
219 | |
220 else() | |
221 pkg_search_module(SDL2 REQUIRED sdl2) | |
222 include_directories(${SDL2_INCLUDE_DIRS}) | |
223 link_libraries(${SDL2_LIBRARIES}) | |
224 endif() |