Cleanup: sort cmake file lists
[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_ContextSDL.cpp
126                         intern/GHOST_DisplayManagerSDL.cpp
127                         intern/GHOST_SystemSDL.cpp
128                         intern/GHOST_WindowSDL.cpp
129
130                         intern/GHOST_ContextSDL.h
131                         intern/GHOST_DisplayManagerSDL.h
132                         intern/GHOST_SystemSDL.h
133                         intern/GHOST_WindowSDL.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         endif()
170
171 elseif(WITH_X11)
172         list(APPEND INC_SYS
173                 ${X11_X11_INCLUDE_PATH}
174         )
175
176         list(APPEND SRC
177                 intern/GHOST_DisplayManagerX11.cpp
178                 intern/GHOST_SystemX11.cpp
179                 intern/GHOST_TaskbarX11.cpp
180                 intern/GHOST_WindowX11.cpp
181
182                 intern/GHOST_DisplayManagerX11.h
183                 intern/GHOST_SystemX11.h
184                 intern/GHOST_TaskbarX11.h
185                 intern/GHOST_WindowX11.h
186         )
187
188         if(NOT WITH_GL_EGL)
189                 list(APPEND SRC
190                         intern/GHOST_ContextGLX.cpp
191
192                         intern/GHOST_ContextGLX.h
193                 )
194         endif()
195
196         if(WITH_GHOST_XDND)
197                 add_definitions(-DWITH_XDND)
198
199                 list(APPEND INC
200                         ../../extern/xdnd
201                 )
202
203                 list(APPEND SRC
204                         intern/GHOST_DropTargetX11.cpp
205
206                         intern/GHOST_DropTargetX11.h
207                 )
208         endif()
209
210         if(X11_XF86keysym_INCLUDE_PATH)
211                 add_definitions(-DWITH_XF86KEYSYM)
212                 list(APPEND INC_SYS
213                         ${X11_XF86keysym_INCLUDE_PATH}
214                 )
215         endif()
216
217         if(WITH_X11_XF86VMODE)
218                 add_definitions(-DWITH_X11_XF86VMODE)
219                 list(APPEND INC_SYS
220                         ${X11_xf86vmode_INCLUDE_PATH}
221                 )
222         endif()
223
224         if(WITH_X11_XFIXES)
225                 add_definitions(-DWITH_X11_XFIXES)
226                 list(APPEND INC_SYS
227                         ${X11_Xfixes_INCLUDE_PATH}
228                 )
229         endif()
230
231         if(WITH_X11_ALPHA)
232                 add_definitions(-DWITH_X11_ALPHA)
233         endif()
234
235         if(WITH_INPUT_NDOF)
236                 list(APPEND SRC
237                         intern/GHOST_NDOFManagerUnix.cpp
238
239                         intern/GHOST_NDOFManagerUnix.h
240                 )
241         endif()
242
243         if(NOT WITH_INSTALL_PORTABLE)
244                 add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
245         endif()
246
247         if(WITH_X11_XINPUT)
248                 add_definitions(-DWITH_X11_XINPUT)
249                 list(APPEND INC_SYS
250                         ${X11_Xinput_INCLUDE_PATH}
251                 )
252         endif()
253
254         add_definitions(-DWITH_X11)
255
256 elseif(WIN32)
257         ## Warnings as errors, this is too strict!
258         #if(MSVC)
259         #       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
260         #endif()
261
262         list(APPEND INC_SYS
263                 ${WINTAB_INC}
264         )
265
266         list(APPEND SRC
267                 intern/GHOST_DisplayManagerWin32.cpp
268                 intern/GHOST_DropTargetWin32.cpp
269                 intern/GHOST_SystemWin32.cpp
270                 intern/GHOST_WindowWin32.cpp
271
272                 intern/GHOST_DisplayManagerWin32.h
273                 intern/GHOST_DropTargetWin32.h
274                 intern/GHOST_SystemWin32.h
275                 intern/GHOST_TaskbarWin32.h
276                 intern/GHOST_WindowWin32.h
277         )
278
279         if(NOT WITH_GL_EGL)
280                 list(APPEND SRC
281                         intern/GHOST_ContextWGL.cpp
282
283                         intern/GHOST_ContextWGL.h
284                 )
285         endif()
286
287         if(WITH_INPUT_IME)
288                 add_definitions(-DWITH_INPUT_IME)
289
290                 list(APPEND SRC
291                         intern/GHOST_ImeWin32.cpp
292
293                         intern/GHOST_ImeWin32.h
294                 )
295         endif()
296
297         if(WITH_INPUT_NDOF)
298                 list(APPEND SRC
299                         intern/GHOST_NDOFManagerWin32.cpp
300
301                         intern/GHOST_NDOFManagerWin32.h
302                 )
303         endif()
304 endif()
305
306 if(WITH_GL_EGL AND NOT (WITH_HEADLESS OR WITH_GHOST_SDL))
307         list(APPEND SRC
308                 intern/GHOST_ContextEGL.cpp
309
310                 intern/GHOST_ContextEGL.h
311         )
312 endif()
313
314 if(APPLE)
315         list(APPEND SRC
316                 intern/GHOST_SystemPathsCocoa.h
317                 intern/GHOST_SystemPathsCocoa.mm
318         )
319
320 elseif(UNIX)
321         list(APPEND SRC
322                 intern/GHOST_SystemPathsUnix.cpp
323                 intern/GHOST_SystemPathsUnix.h
324         )
325
326         if(NOT WITH_INSTALL_PORTABLE)
327                 add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
328         endif()
329
330 elseif(WIN32)
331         list(APPEND SRC
332                 intern/GHOST_SystemPathsWin32.cpp
333                 intern/GHOST_SystemPathsWin32.h
334         )
335
336         list(APPEND INC
337                 ../utfconv
338         )
339
340 endif()
341
342 add_definitions(${GL_DEFINITIONS})
343
344 blender_add_lib(bf_intern_ghost "${SRC}" "${INC}" "${INC_SYS}")