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