more cmake/x11 edits
[blender.git] / intern / ghost / CMakeLists.txt
1 # $Id$
2 # ***** BEGIN GPL LICENSE BLOCK *****
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation,
16 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 #
18 # The Original Code is Copyright (C) 2006, Blender Foundation
19 # All rights reserved.
20 #
21 # The Original Code is: all of this file.
22 #
23 # Contributor(s): Jacques Beaurain.
24 #
25 # ***** END GPL LICENSE BLOCK *****
26
27 set(INC
28         .
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_DisplayManager.cpp
43         intern/GHOST_EventManager.cpp
44         intern/GHOST_ISystem.cpp
45         intern/GHOST_ISystemPaths.cpp
46         intern/GHOST_ModifierKeys.cpp
47         intern/GHOST_NDOFManager.cpp
48         intern/GHOST_Path-api.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_Debug.h
70         intern/GHOST_DisplayManager.h
71         intern/GHOST_Event.h
72         intern/GHOST_EventButton.h
73         intern/GHOST_EventCursor.h
74         intern/GHOST_EventDragnDrop.h
75         intern/GHOST_EventKey.h
76         intern/GHOST_EventManager.h
77         intern/GHOST_EventNDOF.h
78         intern/GHOST_EventString.h
79         intern/GHOST_EventTrackpad.h
80         intern/GHOST_EventWheel.h
81         intern/GHOST_ModifierKeys.h
82         intern/GHOST_NDOFManager.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         list(APPEND INC_SYS
103                 ${NDOF_INCLUDE_DIRS}
104         )
105 endif()
106
107 if(WITH_HEADLESS OR WITH_GHOST_SDL)
108         if(WITH_HEADLESS)
109                 list(APPEND SRC
110                         intern/GHOST_DisplayManagerNULL.h
111                         intern/GHOST_SystemNULL.h
112                         intern/GHOST_WindowNULL.h
113                 )
114                 add_definitions(-DWITH_HEADLESS)
115         else()
116                 list(APPEND SRC
117                         intern/GHOST_DisplayManagerSDL.cpp
118                         intern/GHOST_SystemSDL.cpp
119                         intern/GHOST_WindowSDL.cpp
120
121                         intern/GHOST_DisplayManagerSDL.h
122                         intern/GHOST_SystemSDL.h
123                         intern/GHOST_WindowSDL.h
124                 )
125                 add_definitions(-DWITH_GHOST_SDL)
126         endif()
127
128
129         # ack, this is still system dependant
130         if(APPLE)
131                 if(WITH_COCOA)
132                         list(APPEND SRC
133                                 intern/GHOST_SystemPathsCocoa.mm
134                                 intern/GHOST_SystemPathsCocoa.h
135                         )
136                 else()
137                         list(APPEND SRC
138                                 intern/GHOST_SystemPathsCarbon.cpp
139                                 intern/GHOST_SystemPathsCarbon.h
140                         )
141                 endif()
142         elseif(UNIX)
143                 list(APPEND SRC
144                         intern/GHOST_SystemPathsX11.cpp
145                         intern/GHOST_SystemPathsX11.h
146                 )
147         elseif(WIN32)
148
149                 list(APPEND SRC
150                         intern/GHOST_SystemPathsWin32.cpp
151
152                         intern/GHOST_SystemPathsWin32.h
153                 )
154         endif()
155
156         list(APPEND INC_SYS
157                 ${SDL_INCLUDE_DIR}
158         )
159
160 elseif(APPLE)
161         if(WITH_COCOA)
162                 list(APPEND SRC
163                         intern/GHOST_DisplayManagerCocoa.mm
164                         intern/GHOST_SystemCocoa.mm
165                         intern/GHOST_SystemPathsCocoa.mm
166                         intern/GHOST_WindowCocoa.mm
167
168                         intern/GHOST_DisplayManagerCocoa.h
169                         intern/GHOST_SystemCocoa.h
170                         intern/GHOST_SystemPathsCocoa.h
171                         intern/GHOST_WindowCocoa.h
172                 )
173
174                 if(WITH_INPUT_NDOF)
175                         list(APPEND SRC
176                                 intern/GHOST_NDOFManagerCocoa.mm
177
178                                 intern/GHOST_NDOFManagerCocoa.h
179                         )
180                 endif()
181
182         else()
183                 list(APPEND SRC
184                         intern/GHOST_DisplayManagerCarbon.cpp
185                         intern/GHOST_SystemCarbon.cpp
186                         intern/GHOST_SystemPathsCarbon.cpp
187                         intern/GHOST_WindowCarbon.cpp
188
189                         intern/GHOST_DisplayManagerCarbon.h
190                         intern/GHOST_SystemCarbon.h
191                         intern/GHOST_SystemPathsCarbon.h
192                         intern/GHOST_WindowCarbon.h
193                 )
194         endif()
195
196         if(WITH_CODEC_QUICKTIME)
197                 add_definitions(-DWITH_QUICKTIME)
198         endif()
199
200 elseif(UNIX)
201
202         if(WITH_X11_XINPUT)
203                 add_definitions(-DWITH_X11_XINPUT)
204         endif()
205
206         list(APPEND INC_SYS
207                 ${X11_X11_INCLUDE_PATH}
208         )
209
210         list(APPEND SRC
211                 intern/GHOST_DisplayManagerX11.cpp
212                 intern/GHOST_SystemX11.cpp
213                 intern/GHOST_SystemPathsX11.cpp
214                 intern/GHOST_WindowX11.cpp
215
216                 intern/GHOST_DisplayManagerX11.h
217                 intern/GHOST_SystemX11.h
218                 intern/GHOST_SystemPathsX11.h
219                 intern/GHOST_WindowX11.h
220         )
221
222         if(NOT WITH_INSTALL_PORTABLE)
223                 add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
224         endif()
225
226         if(X11_XF86keysym_INCLUDE_PATH)
227                 add_definitions(-DWITH_XF86KEYSYM)
228                 list(APPEND INC_SYS
229                         ${X11_XF86keysym_INCLUDE_PATH}
230                 )
231         endif()
232
233         if(WITH_INPUT_NDOF)
234                 list(APPEND SRC
235                         intern/GHOST_NDOFManagerX11.cpp
236
237                         intern/GHOST_NDOFManagerX11.h
238                 )
239         endif()
240
241 elseif(WIN32)
242         if(MSVC)
243                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
244         endif()
245
246         list(APPEND INC_SYS
247                 ${WINTAB_INC}
248         )
249
250         list(APPEND SRC
251                 intern/GHOST_DisplayManagerWin32.cpp
252                 intern/GHOST_SystemWin32.cpp
253                 intern/GHOST_SystemPathsWin32.cpp
254                 intern/GHOST_WindowWin32.cpp
255                 intern/GHOST_DropTargetWin32.cpp
256
257                 intern/GHOST_DisplayManagerWin32.h
258                 intern/GHOST_DropTargetWin32.h
259                 intern/GHOST_SystemWin32.h
260                 intern/GHOST_SystemPathsWin32.h
261                 intern/GHOST_WindowWin32.h
262                 intern/GHOST_TaskbarWin32.h
263         )
264
265         if(WITH_INPUT_NDOF)
266                 list(APPEND SRC
267                         intern/GHOST_NDOFManagerWin32.cpp
268
269                         intern/GHOST_NDOFManagerWin32.h
270                 )
271         endif()
272
273 endif()
274
275 blender_add_lib(bf_intern_ghost "${SRC}" "${INC}" "${INC_SYS}")
276