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 # ***** END GPL LICENSE BLOCK *****
20
21 set(INC
22         .
23         ../glew-mx
24         ../string
25         ../../source/blender/imbuf
26         ../../source/blender/makesdna
27 )
28
29 set(INC_SYS
30         ${GLEW_INCLUDE_PATH}
31 )
32
33 set(SRC
34         intern/GHOST_Buttons.cpp
35         intern/GHOST_C-api.cpp
36         intern/GHOST_CallbackEventConsumer.cpp
37         intern/GHOST_Context.cpp
38         intern/GHOST_ContextNone.cpp
39         intern/GHOST_DisplayManager.cpp
40         intern/GHOST_EventManager.cpp
41         intern/GHOST_ISystem.cpp
42         intern/GHOST_ISystemPaths.cpp
43         intern/GHOST_ModifierKeys.cpp
44         intern/GHOST_Path-api.cpp
45         intern/GHOST_Rect.cpp
46         intern/GHOST_System.cpp
47         intern/GHOST_TimerManager.cpp
48         intern/GHOST_Window.cpp
49         intern/GHOST_WindowManager.cpp
50
51         GHOST_C-api.h
52         GHOST_IContext.h
53         GHOST_IEvent.h
54         GHOST_IEventConsumer.h
55         GHOST_ISystem.h
56         GHOST_ISystemPaths.h
57         GHOST_ITimerTask.h
58         GHOST_IWindow.h
59         GHOST_Path-api.h
60         GHOST_Rect.h
61         GHOST_Types.h
62
63         intern/GHOST_Buttons.h
64         intern/GHOST_CallbackEventConsumer.h
65         intern/GHOST_Context.h
66         intern/GHOST_ContextNone.h
67         intern/GHOST_Debug.h
68         intern/GHOST_DisplayManager.h
69         intern/GHOST_Event.h
70         intern/GHOST_EventButton.h
71         intern/GHOST_EventCursor.h
72         intern/GHOST_EventDragnDrop.h
73         intern/GHOST_EventKey.h
74         intern/GHOST_EventManager.h
75         intern/GHOST_EventString.h
76         intern/GHOST_EventTrackpad.h
77         intern/GHOST_EventWheel.h
78         intern/GHOST_ModifierKeys.h
79         intern/GHOST_System.h
80         intern/GHOST_SystemPaths.h
81         intern/GHOST_TimerManager.h
82         intern/GHOST_TimerTask.h
83         intern/GHOST_Window.h
84         intern/GHOST_WindowManager.h
85 )
86
87 if(WITH_GHOST_DEBUG)
88         list(APPEND SRC
89                 intern/GHOST_EventPrinter.cpp
90
91                 intern/GHOST_EventPrinter.h
92         )
93         add_definitions(-DWITH_GHOST_DEBUG)
94 endif()
95
96 if(WITH_INPUT_NDOF)
97         add_definitions(-DWITH_INPUT_NDOF)
98
99         list(APPEND SRC
100                 intern/GHOST_NDOFManager.cpp
101
102                 intern/GHOST_EventNDOF.h
103                 intern/GHOST_NDOFManager.h
104         )
105
106         list(APPEND INC_SYS
107                 ${NDOF_INCLUDE_DIRS}
108         )
109 endif()
110
111 if(WITH_HEADLESS OR WITH_GHOST_SDL)
112         if(WITH_HEADLESS)
113                 list(APPEND SRC
114                         intern/GHOST_DisplayManagerNULL.h
115                         intern/GHOST_SystemNULL.h
116                         intern/GHOST_WindowNULL.h
117                 )
118                 add_definitions(-DWITH_HEADLESS)
119         else()
120                 list(APPEND SRC
121                         intern/GHOST_ContextSDL.cpp
122                         intern/GHOST_DisplayManagerSDL.cpp
123                         intern/GHOST_SystemSDL.cpp
124                         intern/GHOST_WindowSDL.cpp
125
126                         intern/GHOST_ContextSDL.h
127                         intern/GHOST_DisplayManagerSDL.h
128                         intern/GHOST_SystemSDL.h
129                         intern/GHOST_WindowSDL.h
130                 )
131                 add_definitions(-DWITH_GHOST_SDL)
132         endif()
133
134         if(NOT WITH_HEADLESS)
135                 list(APPEND INC_SYS
136                         ${SDL_INCLUDE_DIR}
137                 )
138         endif()
139
140 elseif(APPLE AND NOT WITH_X11)
141         list(APPEND SRC
142                 intern/GHOST_DisplayManagerCocoa.mm
143                 intern/GHOST_SystemCocoa.mm
144                 intern/GHOST_WindowCocoa.mm
145
146                 intern/GHOST_DisplayManagerCocoa.h
147                 intern/GHOST_SystemCocoa.h
148                 intern/GHOST_WindowCocoa.h
149         )
150
151         if(NOT WITH_GL_EGL)
152                 list(APPEND SRC
153                         intern/GHOST_ContextCGL.mm
154
155                         intern/GHOST_ContextCGL.h
156                 )
157         endif()
158
159         if(WITH_INPUT_NDOF)
160                 list(APPEND SRC
161                         intern/GHOST_NDOFManagerCocoa.mm
162
163                         intern/GHOST_NDOFManagerCocoa.h
164                 )
165         endif()
166
167 elseif(WITH_X11)
168         list(APPEND INC_SYS
169                 ${X11_X11_INCLUDE_PATH}
170         )
171
172         list(APPEND SRC
173                 intern/GHOST_DisplayManagerX11.cpp
174                 intern/GHOST_SystemX11.cpp
175                 intern/GHOST_TaskbarX11.cpp
176                 intern/GHOST_WindowX11.cpp
177
178                 intern/GHOST_DisplayManagerX11.h
179                 intern/GHOST_SystemX11.h
180                 intern/GHOST_TaskbarX11.h
181                 intern/GHOST_WindowX11.h
182         )
183
184         if(NOT WITH_GL_EGL)
185                 list(APPEND SRC
186                         intern/GHOST_ContextGLX.cpp
187
188                         intern/GHOST_ContextGLX.h
189                 )
190         endif()
191
192         if(WITH_GHOST_XDND)
193                 add_definitions(-DWITH_XDND)
194
195                 list(APPEND INC
196                         ../../extern/xdnd
197                 )
198
199                 list(APPEND SRC
200                         intern/GHOST_DropTargetX11.cpp
201
202                         intern/GHOST_DropTargetX11.h
203                 )
204         endif()
205
206         if(X11_XF86keysym_INCLUDE_PATH)
207                 add_definitions(-DWITH_XF86KEYSYM)
208                 list(APPEND INC_SYS
209                         ${X11_XF86keysym_INCLUDE_PATH}
210                 )
211         endif()
212
213         if(WITH_X11_XF86VMODE)
214                 add_definitions(-DWITH_X11_XF86VMODE)
215                 list(APPEND INC_SYS
216                         ${X11_xf86vmode_INCLUDE_PATH}
217                 )
218         endif()
219
220         if(WITH_X11_XFIXES)
221                 add_definitions(-DWITH_X11_XFIXES)
222                 list(APPEND INC_SYS
223                         ${X11_Xfixes_INCLUDE_PATH}
224                 )
225         endif()
226
227         if(WITH_X11_ALPHA)
228                 add_definitions(-DWITH_X11_ALPHA)
229         endif()
230
231         if(WITH_INPUT_NDOF)
232                 list(APPEND SRC
233                         intern/GHOST_NDOFManagerUnix.cpp
234
235                         intern/GHOST_NDOFManagerUnix.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_DropTargetWin32.cpp
265                 intern/GHOST_SystemWin32.cpp
266                 intern/GHOST_WindowWin32.cpp
267
268                 intern/GHOST_DisplayManagerWin32.h
269                 intern/GHOST_DropTargetWin32.h
270                 intern/GHOST_SystemWin32.h
271                 intern/GHOST_TaskbarWin32.h
272                 intern/GHOST_WindowWin32.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_IME)
284                 add_definitions(-DWITH_INPUT_IME)
285
286                 list(APPEND SRC
287                         intern/GHOST_ImeWin32.cpp
288
289                         intern/GHOST_ImeWin32.h
290                 )
291         endif()
292
293         if(WITH_INPUT_NDOF)
294                 list(APPEND SRC
295                         intern/GHOST_NDOFManagerWin32.cpp
296
297                         intern/GHOST_NDOFManagerWin32.h
298                 )
299         endif()
300 endif()
301
302 if(WITH_GL_EGL AND NOT (WITH_HEADLESS OR WITH_GHOST_SDL))
303         list(APPEND SRC
304                 intern/GHOST_ContextEGL.cpp
305
306                 intern/GHOST_ContextEGL.h
307         )
308 endif()
309
310 if(APPLE)
311         list(APPEND SRC
312                 intern/GHOST_SystemPathsCocoa.h
313                 intern/GHOST_SystemPathsCocoa.mm
314         )
315
316 elseif(UNIX)
317         list(APPEND SRC
318                 intern/GHOST_SystemPathsUnix.cpp
319                 intern/GHOST_SystemPathsUnix.h
320         )
321
322         if(NOT WITH_INSTALL_PORTABLE)
323                 add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
324         endif()
325
326 elseif(WIN32)
327         list(APPEND SRC
328                 intern/GHOST_SystemPathsWin32.cpp
329                 intern/GHOST_SystemPathsWin32.h
330         )
331
332         list(APPEND INC
333                 ../utfconv
334         )
335
336 endif()
337
338 add_definitions(${GL_DEFINITIONS})
339
340 blender_add_lib(bf_intern_ghost "${SRC}" "${INC}" "${INC_SYS}")