patch [#37188] Remove filename entry specified twice
[blender.git] / intern / ghost / CMakeLists.txt
1 # ***** BEGIN GPL LICENSE BLOCK *****
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # The Original Code is Copyright (C) 2006, Blender Foundation
18 # All rights reserved.
19 #
20 # The Original Code is: all of this file.
21 #
22 # Contributor(s): Jacques Beaurain.
23 #
24 # ***** END GPL LICENSE BLOCK *****
25
26 set(INC
27         .
28         ../string
29         ../../source/blender/imbuf
30         ../../source/blender/makesdna
31 )
32
33 set(INC_SYS
34         ${GLEW_INCLUDE_PATH}
35 )
36
37 set(SRC
38         intern/GHOST_Buttons.cpp
39         intern/GHOST_C-api.cpp
40         intern/GHOST_CallbackEventConsumer.cpp
41         intern/GHOST_DisplayManager.cpp
42         intern/GHOST_EventManager.cpp
43         intern/GHOST_ISystem.cpp
44         intern/GHOST_ISystemPaths.cpp
45         intern/GHOST_ModifierKeys.cpp
46         intern/GHOST_Path-api.cpp
47         intern/GHOST_Rect.cpp
48         intern/GHOST_System.cpp
49         intern/GHOST_TimerManager.cpp
50         intern/GHOST_Window.cpp
51         intern/GHOST_WindowManager.cpp
52
53         GHOST_C-api.h
54         GHOST_IEvent.h
55         GHOST_IEventConsumer.h
56         GHOST_ISystem.h
57         GHOST_ISystemPaths.h
58         GHOST_ITimerTask.h
59         GHOST_IWindow.h
60         GHOST_Path-api.h
61         GHOST_Rect.h
62         GHOST_Types.h
63
64         intern/GHOST_Buttons.h
65         intern/GHOST_CallbackEventConsumer.h
66         intern/GHOST_Debug.h
67         intern/GHOST_DisplayManager.h
68         intern/GHOST_Event.h
69         intern/GHOST_EventButton.h
70         intern/GHOST_EventCursor.h
71         intern/GHOST_EventDragnDrop.h
72         intern/GHOST_EventKey.h
73         intern/GHOST_EventManager.h
74         intern/GHOST_EventString.h
75         intern/GHOST_EventTrackpad.h
76         intern/GHOST_EventWheel.h
77         intern/GHOST_ModifierKeys.h
78         intern/GHOST_System.h
79         intern/GHOST_SystemPaths.h
80         intern/GHOST_TimerManager.h
81         intern/GHOST_TimerTask.h
82         intern/GHOST_Window.h
83         intern/GHOST_WindowManager.h
84 )
85
86 if(WITH_GHOST_DEBUG)
87         list(APPEND SRC
88                 intern/GHOST_EventPrinter.cpp
89
90                 intern/GHOST_EventPrinter.h
91         )
92         add_definitions(-DWITH_GHOST_DEBUG)
93 endif()
94
95 if(WITH_INPUT_NDOF)
96         add_definitions(-DWITH_INPUT_NDOF)
97
98         list(APPEND SRC
99                 intern/GHOST_NDOFManager.cpp
100
101                 intern/GHOST_EventNDOF.h
102                 intern/GHOST_NDOFManager.h
103         )
104
105         list(APPEND INC_SYS
106                 ${NDOF_INCLUDE_DIRS}
107         )
108 endif()
109
110 if(WITH_HEADLESS OR WITH_GHOST_SDL)
111         if(WITH_HEADLESS)
112                 list(APPEND SRC
113                         intern/GHOST_DisplayManagerNULL.h
114                         intern/GHOST_SystemNULL.h
115                         intern/GHOST_WindowNULL.h
116                 )
117                 add_definitions(-DWITH_HEADLESS)
118         else()
119                 list(APPEND SRC
120                         intern/GHOST_DisplayManagerSDL.cpp
121                         intern/GHOST_SystemSDL.cpp
122                         intern/GHOST_WindowSDL.cpp
123
124                         intern/GHOST_DisplayManagerSDL.h
125                         intern/GHOST_SystemSDL.h
126                         intern/GHOST_WindowSDL.h
127                 )
128                 add_definitions(-DWITH_GHOST_SDL)
129         endif()
130
131
132         # ack, this is still system dependant
133         if(APPLE)
134                 if(WITH_COCOA)
135                         list(APPEND SRC
136                                 intern/GHOST_SystemPathsCocoa.mm
137                                 intern/GHOST_SystemPathsCocoa.h
138                         )
139                 else()
140                         list(APPEND SRC
141                                 intern/GHOST_SystemPathsCarbon.cpp
142                                 intern/GHOST_SystemPathsCarbon.h
143                         )
144                 endif()
145
146         elseif(UNIX)
147                 list(APPEND SRC
148                         intern/GHOST_SystemPathsX11.cpp
149                         intern/GHOST_SystemPathsX11.h
150                 )
151
152                 if(NOT WITH_INSTALL_PORTABLE)
153                         add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
154                 endif()
155
156         elseif(WIN32)
157                 list(APPEND SRC
158                         intern/GHOST_SystemPathsWin32.cpp
159
160                         intern/GHOST_SystemPathsWin32.h
161                 )
162
163                 list(APPEND INC
164                         ../utfconv
165                 )
166         endif()
167
168         if(NOT WITH_HEADLESS)
169                 list(APPEND INC_SYS
170                         ${SDL_INCLUDE_DIR}
171                 )
172         endif()
173
174 elseif(APPLE)
175         if(WITH_COCOA)
176                 list(APPEND SRC
177                         intern/GHOST_DisplayManagerCocoa.mm
178                         intern/GHOST_SystemCocoa.mm
179                         intern/GHOST_SystemPathsCocoa.mm
180                         intern/GHOST_WindowCocoa.mm
181
182                         intern/GHOST_DisplayManagerCocoa.h
183                         intern/GHOST_SystemCocoa.h
184                         intern/GHOST_SystemPathsCocoa.h
185                         intern/GHOST_WindowCocoa.h
186                 )
187
188                 if(WITH_INPUT_NDOF)
189                         list(APPEND SRC
190                                 intern/GHOST_NDOFManagerCocoa.mm
191                                 intern/GHOST_NDOFManagerCocoa.h
192                         )
193                         list(APPEND SRC_NDOF3DCONNEXION
194                                 intern/GHOST_NDOFManager3Dconnexion.c
195                                 intern/GHOST_NDOFManager3Dconnexion.h
196                         )
197                 endif()
198
199         else()
200                 list(APPEND SRC
201                         intern/GHOST_DisplayManagerCarbon.cpp
202                         intern/GHOST_SystemCarbon.cpp
203                         intern/GHOST_SystemPathsCarbon.cpp
204                         intern/GHOST_WindowCarbon.cpp
205
206                         intern/GHOST_DisplayManagerCarbon.h
207                         intern/GHOST_SystemCarbon.h
208                         intern/GHOST_SystemPathsCarbon.h
209                         intern/GHOST_WindowCarbon.h
210                 )
211         endif()
212
213         if(WITH_CODEC_QUICKTIME)
214                 add_definitions(-DWITH_QUICKTIME)
215         endif()
216
217 elseif(UNIX)
218
219         list(APPEND INC_SYS
220                 ${X11_X11_INCLUDE_PATH}
221         )
222
223         list(APPEND SRC
224                 intern/GHOST_DisplayManagerX11.cpp
225                 intern/GHOST_SystemX11.cpp
226                 intern/GHOST_SystemPathsX11.cpp
227                 intern/GHOST_WindowX11.cpp
228
229                 intern/GHOST_DisplayManagerX11.h
230                 intern/GHOST_SystemX11.h
231                 intern/GHOST_SystemPathsX11.h
232                 intern/GHOST_WindowX11.h
233         )
234
235         if(WITH_GHOST_XDND)
236                 add_definitions(-DWITH_XDND)
237
238                 list(APPEND INC
239                         ../../extern/xdnd
240                 )
241
242                 list(APPEND SRC
243                         intern/GHOST_DropTargetX11.cpp
244
245                         intern/GHOST_DropTargetX11.h
246                 )
247         endif()
248
249         if(X11_XF86keysym_INCLUDE_PATH)
250                 add_definitions(-DWITH_XF86KEYSYM)
251                 list(APPEND INC_SYS
252                         ${X11_XF86keysym_INCLUDE_PATH}
253                 )
254         endif()
255
256         if(WITH_X11_XF86VMODE)
257                 add_definitions(-DWITH_X11_XF86VMODE)
258                 list(APPEND INC_SYS
259                         ${X11_xf86vmode_INCLUDE_PATH}
260                 )
261         endif()
262
263         if(WITH_INPUT_NDOF)
264                 list(APPEND SRC
265                         intern/GHOST_NDOFManagerX11.cpp
266
267                         intern/GHOST_NDOFManagerX11.h
268                 )
269         endif()
270
271         if(NOT WITH_INSTALL_PORTABLE)
272                 add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
273         endif()
274
275         if(WITH_X11_XINPUT)
276                 add_definitions(-DWITH_X11_XINPUT)
277                 list(APPEND INC_SYS
278                         ${X11_Xinput_INCLUDE_PATH}
279                 )
280         endif()
281
282 elseif(WIN32)
283         ## Warnings as errors, this is too strict!
284         #if(MSVC)
285         #       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
286         #endif()
287
288         list(APPEND INC_SYS
289                 ${WINTAB_INC}
290         )
291
292         list(APPEND INC
293                 ../utfconv
294         )
295
296         list(APPEND SRC
297                 intern/GHOST_DisplayManagerWin32.cpp
298                 intern/GHOST_SystemWin32.cpp
299                 intern/GHOST_SystemPathsWin32.cpp
300                 intern/GHOST_WindowWin32.cpp
301                 intern/GHOST_DropTargetWin32.cpp
302
303                 intern/GHOST_DisplayManagerWin32.h
304                 intern/GHOST_DropTargetWin32.h
305                 intern/GHOST_SystemWin32.h
306                 intern/GHOST_SystemPathsWin32.h
307                 intern/GHOST_WindowWin32.h
308                 intern/GHOST_TaskbarWin32.h
309         )
310
311         if(WITH_INPUT_NDOF)
312                 list(APPEND SRC
313                         intern/GHOST_NDOFManagerWin32.cpp
314
315                         intern/GHOST_NDOFManagerWin32.h
316                 )
317         endif()
318
319 endif()
320
321 add_definitions(-DGLEW_STATIC)
322
323 blender_add_lib(bf_intern_ghost "${SRC}" "${INC}" "${INC_SYS}")
324
325 # workaround for apple clang mangling extern "C" symbols
326 if(WITH_INPUT_NDOF AND WITH_COCOA)
327         blender_add_lib(bf_intern_ghostndof3dconnexion "${SRC_NDOF3DCONNEXION}" "${INC}" "${INC_SYS}")
328 endif()