- don't build ghost's event printer unless ghost debug is enabled.
[blender.git] / intern / ghost / SConscript
1 #!/usr/bin/python
2 import sys
3 import os
4
5 Import ('env')
6
7 window_system = env['OURPLATFORM']
8
9 sources = env.Glob('intern/*.cpp')
10 if window_system == 'darwin':
11     sources += env.Glob('intern/*.mm')
12
13
14 pf = ['GHOST_DisplayManager', 'GHOST_System', 'GHOST_SystemPaths', 'GHOST_Window', 'GHOST_DropTarget']
15 defs=['_USE_MATH_DEFINES']
16
17 incs = '. ../string #extern/glew/include #source/blender/imbuf #source/blender/makesdna ' + env['BF_OPENGL_INC']
18
19 if env['WITH_GHOST_SDL']:
20     for f in pf:
21         try:
22             sources.remove('intern' + os.sep + f + 'Carbon.cpp')
23             sources.remove('intern' + os.sep + f + 'Win32.cpp')
24             sources.remove('intern' + os.sep + f + 'X11.cpp')
25         except ValueError:
26             pass
27     incs += ' ' + env['BF_SDL_INC']
28     defs += ['WITH_GHOST_SDL']
29 elif window_system in ('linux2', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'freebsd9', 'irix6', 'aix4', 'aix5'):
30     for f in pf:
31         try:
32             sources.remove('intern' + os.sep + f + 'Win32.cpp')
33             sources.remove('intern' + os.sep + f + 'Carbon.cpp')
34             sources.remove('intern' + os.sep + f + 'SDL.cpp')
35         except ValueError:
36             pass
37     defs += ['PREFIX=\\"/usr/local/\\"']  # XXX, make an option
38     defs += ['WITH_X11_XINPUT']  # XXX, make an option
39
40 elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'):
41     for f in pf:
42         try:
43             sources.remove('intern' + os.sep + f + 'X11.cpp')
44             sources.remove('intern' + os.sep + f + 'Carbon.cpp')
45             sources.remove('intern' + os.sep + f + 'SDL.cpp')
46         except ValueError:
47             pass
48 elif window_system == 'darwin':
49     if env['WITH_GHOST_COCOA']:
50         if env['WITH_BF_QUICKTIME']:
51             defs.append('WITH_QUICKTIME')
52         if env['USE_QTKIT']:
53             defs.append('USE_QTKIT')
54         for f in pf:
55             try:
56                 sources.remove('intern' + os.sep + f + 'Win32.cpp')
57                 sources.remove('intern' + os.sep + f + 'X11.cpp')
58                 sources.remove('intern' + os.sep + f + 'Carbon.cpp')
59                 sources.remove('intern' + os.sep + f + 'SDL.cpp')
60             except ValueError:
61                 pass
62     else:
63         for f in pf:
64             try:
65                 sources.remove('intern' + os.sep + f + 'Win32.cpp')
66                 sources.remove('intern' + os.sep + f + 'X11.cpp')
67                 sources.remove('intern' + os.sep + f + 'Cocoa.mm')
68                 sources.remove('intern' + os.sep + f + 'SDL.cpp')
69             except ValueError:
70                 pass
71
72 else:
73     print "Unknown window system specified."
74     Exit()
75
76 if env['BF_GHOST_DEBUG']:
77     defs.append('WITH_GHOST_DEBUG')
78 else:
79         sources.remove('intern' + os.sep + 'GHOST_EventPrinter.cpp')
80
81 if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'):
82     incs = env['BF_WINTAB_INC'] + ' ' + incs
83
84 if window_system in ('win32-vc', 'win64-vc'):
85     env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15]) #, cc_compileflags=env['CCFLAGS'].append('/WX') ) 
86 else:
87     env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15] )