Ghost Context Refactor
[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         ../glew-mx
29         ../string
30         ../../source/blender/imbuf
31         ../../source/blender/makesdna
32 )
33
34 set(INC_SYS
35         ${GLEW_INCLUDE_PATH}
36 )
37
38 set(SRC
39         intern/GHOST_Buttons.cpp
40         intern/GHOST_C-api.cpp
41         intern/GHOST_CallbackEventConsumer.cpp
42         intern/GHOST_Context.cpp
43         intern/GHOST_ContextNone.cpp
44         intern/GHOST_DisplayManager.cpp
45         intern/GHOST_EventManager.cpp
46         intern/GHOST_ISystem.cpp
47         intern/GHOST_ISystemPaths.cpp
48         intern/GHOST_ModifierKeys.cpp
49         intern/GHOST_Path-api.cpp
50         intern/GHOST_Rect.cpp
51         intern/GHOST_System.cpp
52         intern/GHOST_TimerManager.cpp
53         intern/GHOST_Window.cpp
54         intern/GHOST_WindowManager.cpp
55
56         GHOST_C-api.h
57         GHOST_IEvent.h
58         GHOST_IEventConsumer.h
59         GHOST_ISystem.h
60         GHOST_ISystemPaths.h
61         GHOST_ITimerTask.h
62         GHOST_IWindow.h
63         GHOST_Path-api.h
64         GHOST_Rect.h
65         GHOST_Types.h
66
67         intern/GHOST_Buttons.h
68         intern/GHOST_CallbackEventConsumer.h
69         intern/GHOST_Context.h
70         intern/GHOST_ContextNone.h
71         intern/GHOST_Debug.h
72         intern/GHOST_DisplayManager.h
73         intern/GHOST_Event.h
74         intern/GHOST_EventButton.h
75         intern/GHOST_EventCursor.h
76         intern/GHOST_EventDragnDrop.h
77         intern/GHOST_EventKey.h
78         intern/GHOST_EventManager.h
79         intern/GHOST_EventString.h
80         intern/GHOST_EventTrackpad.h
81         intern/GHOST_EventWheel.h
82         intern/GHOST_ModifierKeys.h
83         intern/GHOST_System.h
84         intern/GHOST_SystemPaths.h
85         intern/GHOST_TimerManager.h
86         intern/GHOST_TimerTask.h
87         intern/GHOST_Window.h
88         intern/GHOST_WindowManager.h
89 )
90
91 if(WITH_GHOST_DEBUG)
92         list(APPEND SRC
93                 intern/GHOST_EventPrinter.cpp
94
95                 intern/GHOST_EventPrinter.h
96         )
97         add_definitions(-DWITH_GHOST_DEBUG)
98 endif()
99
100 if(WITH_INPUT_NDOF)
101         add_definitions(-DWITH_INPUT_NDOF)
102
103         list(APPEND SRC
104                 intern/GHOST_NDOFManager.cpp
105
106                 intern/GHOST_EventNDOF.h
107                 intern/GHOST_NDOFManager.h
108         )
109
110         list(APPEND INC_SYS
111                 ${NDOF_INCLUDE_DIRS}
112         )
113 endif()
114
115 if(WITH_HEADLESS OR WITH_GHOST_SDL)
116         if(WITH_HEADLESS)
117                 list(APPEND SRC
118                         intern/GHOST_DisplayManagerNULL.h
119                         intern/GHOST_SystemNULL.h
120                         intern/GHOST_WindowNULL.h
121                 )
122                 add_definitions(-DWITH_HEADLESS)
123         else()
124                 list(APPEND SRC
125                         intern/GHOST_DisplayManagerSDL.cpp
126                         intern/GHOST_SystemSDL.cpp
127                         intern/GHOST_WindowSDL.cpp
128                         intern/GHOST_ContextSDL.cpp
129
130                         intern/GHOST_DisplayManagerSDL.h
131                         intern/GHOST_SystemSDL.h
132                         intern/GHOST_WindowSDL.h
133                         intern/GHOST_ContextSDL.h
134                 )
135                 add_definitions(-DWITH_GHOST_SDL)
136         endif()
137
138         if(NOT WITH_HEADLESS)
139                 list(APPEND INC_SYS
140                         ${SDL_INCLUDE_DIR}
141                 )
142         endif()
143
144 elseif(APPLE AND NOT WITH_X11)
145         list(APPEND SRC
146                 intern/GHOST_DisplayManagerCocoa.mm
147                 intern/GHOST_SystemCocoa.mm
148                 intern/GHOST_WindowCocoa.mm
149
150                 intern/GHOST_DisplayManagerCocoa.h
151                 intern/GHOST_SystemCocoa.h
152                 intern/GHOST_WindowCocoa.h
153         )
154
155         if (NOT WITH_GL_EGL)
156                 list(APPEND SRC
157                         intern/GHOST_ContextCGL.mm
158
159                         intern/GHOST_ContextCGL.h
160                 )
161         endif()
162
163         if(WITH_INPUT_NDOF)
164                 list(APPEND SRC
165                         intern/GHOST_NDOFManagerCocoa.mm
166
167                         intern/GHOST_NDOFManagerCocoa.h
168                 )
169
170                 list(APPEND SRC_NDOF3DCONNEXION
171                         intern/GHOST_NDOFManager3Dconnexion.c
172                         intern/GHOST_NDOFManager3Dconnexion.h
173                 )
174         endif()
175
176         if(WITH_CODEC_QUICKTIME)
177                 add_definitions(-DWITH_QUICKTIME)
178         endif()
179
180 elseif(WITH_X11)
181         list(APPEND INC_SYS
182                 ${X11_X11_INCLUDE_PATH}
183         )
184
185         list(APPEND SRC
186                 intern/GHOST_DisplayManagerX11.cpp
187                 intern/GHOST_SystemX11.cpp
188                 intern/GHOST_WindowX11.cpp
189
190                 intern/GHOST_DisplayManagerX11.h
191                 intern/GHOST_SystemX11.h
192                 intern/GHOST_WindowX11.h
193         )
194
195         if (NOT WITH_GL_EGL)
196                 list(APPEND SRC
197                         intern/GHOST_ContextGLX.cpp
198
199                         intern/GHOST_ContextGLX.h
200                 )
201         endif()
202
203         if(WITH_GHOST_XDND)
204                 add_definitions(-DWITH_XDND)
205
206                 list(APPEND INC
207                         ../../extern/xdnd
208                 )
209
210                 list(APPEND SRC
211                         intern/GHOST_DropTargetX11.cpp
212
213                         intern/GHOST_DropTargetX11.h
214                 )
215         endif()
216
217         if(X11_XF86keysym_INCLUDE_PATH)
218                 add_definitions(-DWITH_XF86KEYSYM)
219                 list(APPEND INC_SYS
220                         ${X11_XF86keysym_INCLUDE_PATH}
221                 )
222         endif()
223
224         if(WITH_X11_XF86VMODE)
225                 add_definitions(-DWITH_X11_XF86VMODE)
226                 list(APPEND INC_SYS
227                         ${X11_xf86vmode_INCLUDE_PATH}
228                 )
229         endif()
230
231         if(WITH_INPUT_NDOF)
232                 list(APPEND SRC
233                         intern/GHOST_NDOFManagerX11.cpp
234
235                         intern/GHOST_NDOFManagerX11.h
236                 )
237         endif()
238
239         if(NOT WITH_INSTALL_PORTABLE)
240                 add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
241         endif()
242
243         if(WITH_X11_XINPUT)
244                 add_definitions(-DWITH_X11_XINPUT)
245                 list(APPEND INC_SYS
246                         ${X11_Xinput_INCLUDE_PATH}
247                 )
248         endif()
249
250         add_definitions(-DWITH_X11)
251
252 elseif(WIN32)
253         ## Warnings as errors, this is too strict!
254         #if(MSVC)
255         #       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
256         #endif()
257
258         list(APPEND INC_SYS
259                 ${WINTAB_INC}
260         )
261
262         list(APPEND SRC
263                 intern/GHOST_DisplayManagerWin32.cpp
264                 intern/GHOST_SystemWin32.cpp
265                 intern/GHOST_WindowWin32.cpp
266                 intern/GHOST_DropTargetWin32.cpp
267
268                 intern/GHOST_DisplayManagerWin32.h
269                 intern/GHOST_DropTargetWin32.h
270                 intern/GHOST_SystemWin32.h
271                 intern/GHOST_WindowWin32.h
272                 intern/GHOST_TaskbarWin32.h
273         )
274
275         if (NOT WITH_GL_EGL)
276                 list(APPEND SRC
277                         intern/GHOST_ContextWGL.cpp
278                                 
279                         intern/GHOST_ContextWGL.h
280                 )
281         endif()
282
283         if(WITH_INPUT_NDOF)
284                 list(APPEND SRC
285                         intern/GHOST_NDOFManagerWin32.cpp
286
287                         intern/GHOST_NDOFManagerWin32.h
288                 )
289         endif()
290
291         list(APPEND INC
292                 ../utfconv
293         )
294
295 endif()
296
297 if(WITH_GL_EGL AND NOT (WITH_HEADLESS OR WITH_GHOST_SDL))
298         list(APPEND SRC
299                 intern/GHOST_ContextEGL.cpp
300                         
301                 intern/GHOST_ContextEGL.h
302         )
303 endif()
304
305 if(APPLE)
306         list(APPEND SRC
307                 intern/GHOST_SystemPathsCocoa.mm
308                 intern/GHOST_SystemPathsCocoa.h
309         )
310
311 elseif(UNIX)
312         list(APPEND SRC
313                 intern/GHOST_SystemPathsX11.cpp
314                 intern/GHOST_SystemPathsX11.h
315         )
316
317         if(NOT WITH_INSTALL_PORTABLE)
318                 add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
319         endif()
320
321 elseif(WIN32)
322         list(APPEND SRC
323                 intern/GHOST_SystemPathsWin32.cpp
324                 intern/GHOST_SystemPathsWin32.h
325         )
326
327 endif()
328
329 add_definitions(${GL_DEFINITIONS})
330
331 blender_add_lib(bf_intern_ghost "${SRC}" "${INC}" "${INC_SYS}")
332
333 # workaround for apple clang mangling extern "C" symbols
334 if(WITH_INPUT_NDOF AND APPLE)
335         blender_add_lib(bf_intern_ghostndof3dconnexion "${SRC_NDOF3DCONNEXION}" "${INC}" "${INC_SYS}")
336 endif()