RNA Armature: Improve the description of AxisRollFromMatrix
[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   ../../source/blender/imbuf
25   ../../source/blender/makesdna
26 )
27
28 set(INC_SYS
29   ${GLEW_INCLUDE_PATH}
30 )
31
32 set(SRC
33   intern/GHOST_Buttons.cpp
34   intern/GHOST_C-api.cpp
35   intern/GHOST_CallbackEventConsumer.cpp
36   intern/GHOST_Context.cpp
37   intern/GHOST_ContextNone.cpp
38   intern/GHOST_DisplayManager.cpp
39   intern/GHOST_EventManager.cpp
40   intern/GHOST_ISystem.cpp
41   intern/GHOST_ISystemPaths.cpp
42   intern/GHOST_ModifierKeys.cpp
43   intern/GHOST_Path-api.cpp
44   intern/GHOST_Rect.cpp
45   intern/GHOST_System.cpp
46   intern/GHOST_TimerManager.cpp
47   intern/GHOST_Window.cpp
48   intern/GHOST_WindowManager.cpp
49
50   GHOST_C-api.h
51   GHOST_IContext.h
52   GHOST_IEvent.h
53   GHOST_IEventConsumer.h
54   GHOST_ISystem.h
55   GHOST_ISystemPaths.h
56   GHOST_ITimerTask.h
57   GHOST_IWindow.h
58   GHOST_Path-api.h
59   GHOST_Rect.h
60   GHOST_Types.h
61
62   intern/GHOST_Buttons.h
63   intern/GHOST_CallbackEventConsumer.h
64   intern/GHOST_Context.h
65   intern/GHOST_ContextNone.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 set(LIB
87   bf_intern_glew_mx
88   ${GLEW_LIBRARY}
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   list(APPEND LIB
114     ${NDOF_LIBRARIES}
115   )
116 endif()
117
118 if(WITH_HEADLESS OR WITH_GHOST_SDL)
119   if(WITH_HEADLESS)
120     list(APPEND SRC
121       intern/GHOST_DisplayManagerNULL.h
122       intern/GHOST_SystemNULL.h
123       intern/GHOST_WindowNULL.h
124     )
125     add_definitions(-DWITH_HEADLESS)
126   else()
127     list(APPEND SRC
128       intern/GHOST_ContextSDL.cpp
129       intern/GHOST_DisplayManagerSDL.cpp
130       intern/GHOST_SystemSDL.cpp
131       intern/GHOST_WindowSDL.cpp
132
133       intern/GHOST_ContextSDL.h
134       intern/GHOST_DisplayManagerSDL.h
135       intern/GHOST_SystemSDL.h
136       intern/GHOST_WindowSDL.h
137     )
138     add_definitions(-DWITH_GHOST_SDL)
139   endif()
140
141   if(NOT WITH_HEADLESS)
142     list(APPEND INC_SYS
143       ${SDL_INCLUDE_DIR}
144     )
145     if(NOT WITH_SDL_DYNLOAD)
146       list(APPEND LIB
147         ${SDL_LIBRARY}
148       )
149     endif()
150   endif()
151
152 elseif(APPLE AND NOT WITH_GHOST_X11)
153   list(APPEND SRC
154     intern/GHOST_DisplayManagerCocoa.mm
155     intern/GHOST_SystemCocoa.mm
156     intern/GHOST_WindowCocoa.mm
157
158     intern/GHOST_DisplayManagerCocoa.h
159     intern/GHOST_SystemCocoa.h
160     intern/GHOST_WindowCocoa.h
161     intern/GHOST_WindowViewCocoa.h
162   )
163
164   if(NOT WITH_GL_EGL)
165     list(APPEND SRC
166       intern/GHOST_ContextCGL.mm
167
168       intern/GHOST_ContextCGL.h
169     )
170   endif()
171
172   if(WITH_INPUT_NDOF)
173     list(APPEND SRC
174       intern/GHOST_NDOFManagerCocoa.mm
175
176       intern/GHOST_NDOFManagerCocoa.h
177     )
178   endif()
179
180 elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
181   if(WITH_GHOST_X11)
182     list(APPEND INC_SYS
183       ${X11_X11_INCLUDE_PATH}
184     )
185
186     list(APPEND SRC
187       intern/GHOST_DisplayManagerX11.cpp
188       intern/GHOST_SystemX11.cpp
189       intern/GHOST_TaskbarX11.cpp
190       intern/GHOST_WindowX11.cpp
191
192       intern/GHOST_DisplayManagerX11.h
193       intern/GHOST_IconX11.h
194       intern/GHOST_SystemX11.h
195       intern/GHOST_TaskbarX11.h
196       intern/GHOST_WindowX11.h
197     )
198
199     if(NOT WITH_GL_EGL)
200       list(APPEND SRC
201         intern/GHOST_ContextGLX.cpp
202
203         intern/GHOST_ContextGLX.h
204       )
205     endif()
206
207     if(WITH_GHOST_XDND)
208       add_definitions(-DWITH_XDND)
209
210       list(APPEND LIB
211         extern_xdnd
212       )
213
214       list(APPEND INC
215         ../../extern/xdnd
216       )
217
218       list(APPEND SRC
219         intern/GHOST_DropTargetX11.cpp
220
221         intern/GHOST_DropTargetX11.h
222       )
223     endif()
224
225     if(X11_XF86keysym_INCLUDE_PATH)
226       add_definitions(-DWITH_XF86KEYSYM)
227       list(APPEND INC_SYS
228         ${X11_XF86keysym_INCLUDE_PATH}
229       )
230     endif()
231
232     if(WITH_X11_XF86VMODE)
233       add_definitions(-DWITH_X11_XF86VMODE)
234       list(APPEND INC_SYS
235         ${X11_xf86vmode_INCLUDE_PATH}
236       )
237     endif()
238
239     if(WITH_X11_XFIXES)
240       add_definitions(-DWITH_X11_XFIXES)
241       list(APPEND INC_SYS
242         ${X11_Xfixes_INCLUDE_PATH}
243       )
244     endif()
245
246     if(WITH_X11_ALPHA)
247       add_definitions(-DWITH_X11_ALPHA)
248     endif()
249
250     if(WITH_X11_XINPUT)
251       add_definitions(-DWITH_X11_XINPUT)
252       list(APPEND INC_SYS
253         ${X11_Xinput_INCLUDE_PATH}
254       )
255     endif()
256
257     add_definitions(-DWITH_GHOST_X11)
258   endif()
259
260   if(WITH_GHOST_WAYLAND)
261     list(APPEND INC_SYS
262       ${wayland-client_INCLUDE_DIRS}
263       ${wayland-egl_INCLUDE_DIRS}
264       ${xkbcommon_INCLUDE_DIRS}
265       ${wayland-cursor_INCLUDE_DIRS}
266     )
267
268     list(APPEND SRC
269       intern/GHOST_SystemWayland.cpp
270       intern/GHOST_WindowWayland.cpp
271
272       intern/GHOST_SystemWayland.h
273       intern/GHOST_WindowWayland.h
274     )
275
276     pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
277     pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
278
279     # Generate protocols bindings.
280     macro(generate_protocol_bindings NAME PROT_DEF)
281       add_custom_command(
282         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}-client-protocol.h
283         COMMAND ${WAYLAND_SCANNER} client-header ${PROT_DEF} ${NAME}-client-protocol.h
284       )
285       add_custom_command(
286         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}-client-protocol.c
287         COMMAND ${WAYLAND_SCANNER} private-code ${PROT_DEF} ${NAME}-client-protocol.c
288         DEPENDS ${NAME}-client-protocol.h
289       )
290       list(APPEND SRC
291         ${CMAKE_CURRENT_BINARY_DIR}/${NAME}-client-protocol.c
292         ${CMAKE_CURRENT_BINARY_DIR}/${NAME}-client-protocol.h
293       )
294     endmacro()
295
296     list(APPEND INC_SYS
297       ${CMAKE_CURRENT_BINARY_DIR}
298     )
299
300     # xdg-shell.
301     generate_protocol_bindings(
302       xdg-shell
303       "${WAYLAND_PROTOCOLS_DIR}/stable/xdg-shell/xdg-shell.xml"
304     )
305     # Pointer-constraints.
306     generate_protocol_bindings(
307       pointer-constraints
308       "${WAYLAND_PROTOCOLS_DIR}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml"
309     )
310     # Relative-pointer.
311     generate_protocol_bindings(
312       relative-pointer
313       "${WAYLAND_PROTOCOLS_DIR}/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
314     )
315
316     add_definitions(-DWITH_GHOST_WAYLAND)
317   endif()
318
319   if(WITH_INPUT_NDOF)
320     list(APPEND SRC
321       intern/GHOST_NDOFManagerUnix.cpp
322
323       intern/GHOST_NDOFManagerUnix.h
324     )
325   endif()
326
327   if(NOT WITH_INSTALL_PORTABLE)
328     add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
329   endif()
330
331
332 elseif(WIN32)
333   # # Warnings as errors, this is too strict!
334   # if(MSVC)
335   #   string(APPEND CMAKE_CXX_FLAGS " /WX")
336   # endif()
337
338   list(APPEND INC_SYS
339     ${WINTAB_INC}
340   )
341
342   list(APPEND SRC
343     intern/GHOST_ContextD3D.cpp
344     intern/GHOST_DisplayManagerWin32.cpp
345     intern/GHOST_DropTargetWin32.cpp
346     intern/GHOST_SystemWin32.cpp
347     intern/GHOST_WindowWin32.cpp
348
349     intern/GHOST_ContextD3D.h
350     intern/GHOST_DisplayManagerWin32.h
351     intern/GHOST_DropTargetWin32.h
352     intern/GHOST_SystemWin32.h
353     intern/GHOST_TaskbarWin32.h
354     intern/GHOST_WindowWin32.h
355   )
356
357   if(NOT WITH_GL_EGL)
358     list(APPEND SRC
359       intern/GHOST_ContextWGL.cpp
360
361       intern/GHOST_ContextWGL.h
362     )
363   endif()
364
365   if(WITH_INPUT_IME)
366     add_definitions(-DWITH_INPUT_IME)
367
368     list(APPEND SRC
369       intern/GHOST_ImeWin32.cpp
370
371       intern/GHOST_ImeWin32.h
372     )
373   endif()
374
375   if(WITH_INPUT_NDOF)
376     list(APPEND SRC
377       intern/GHOST_NDOFManagerWin32.cpp
378
379       intern/GHOST_NDOFManagerWin32.h
380     )
381   endif()
382 endif()
383
384 if(WITH_GL_EGL AND NOT (WITH_HEADLESS OR WITH_GHOST_SDL))
385   list(APPEND SRC
386     intern/GHOST_ContextEGL.cpp
387
388     intern/GHOST_ContextEGL.h
389   )
390 endif()
391
392 if(APPLE)
393   list(APPEND SRC
394     intern/GHOST_SystemPathsCocoa.h
395     intern/GHOST_SystemPathsCocoa.mm
396   )
397
398 elseif(UNIX)
399   list(APPEND SRC
400     intern/GHOST_SystemPathsUnix.cpp
401     intern/GHOST_SystemPathsUnix.h
402   )
403
404   if(NOT WITH_INSTALL_PORTABLE)
405     add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
406   endif()
407
408 elseif(WIN32)
409   list(APPEND SRC
410     intern/GHOST_SystemPathsWin32.cpp
411     intern/GHOST_SystemPathsWin32.h
412   )
413
414   list(APPEND INC
415     ../utfconv
416   )
417
418 endif()
419
420 if(WITH_XR_OPENXR)
421   list(APPEND SRC
422     intern/GHOST_Xr.cpp
423     intern/GHOST_XrContext.cpp
424     intern/GHOST_XrEvent.cpp
425     intern/GHOST_XrGraphicsBinding.cpp
426     intern/GHOST_XrSession.cpp
427     intern/GHOST_XrSwapchain.cpp
428
429     GHOST_IXrContext.h
430     intern/GHOST_IXrGraphicsBinding.h
431     intern/GHOST_XrContext.h
432     intern/GHOST_XrException.h
433     intern/GHOST_XrSession.h
434     intern/GHOST_XrSwapchain.h
435     intern/GHOST_Xr_intern.h
436     intern/GHOST_Xr_openxr_includes.h
437   )
438   list(APPEND INC_SYS
439     ${XR_OPENXR_SDK_INCLUDE_DIR}
440   )
441   list(APPEND LIB
442     ${XR_OPENXR_SDK_LIBRARIES}
443   )
444
445   set(XR_PLATFORM_DEFINES -DXR_USE_GRAPHICS_API_OPENGL)
446
447   # Add compiler defines as required by the OpenXR specification.
448   if(WIN32)
449     list(APPEND XR_PLATFORM_DEFINES
450       -DXR_USE_PLATFORM_WIN32
451       -DXR_USE_GRAPHICS_API_D3D11
452     )
453     list(APPEND LIB
454       shlwapi
455     )
456   elseif(UNIX AND NOT APPLE)
457     list(APPEND XR_PLATFORM_DEFINES
458       -DXR_OS_LINUX
459       -DXR_USE_PLATFORM_XLIB
460     )
461   endif()
462
463   add_definitions(-DWITH_XR_OPENXR ${XR_PLATFORM_DEFINES})
464
465   unset(XR_PLATFORM_DEFINES)
466 endif()
467
468 add_definitions(${GL_DEFINITIONS})
469
470 blender_add_lib(bf_intern_ghost "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")