Added support for compiling BULLET with scons on windows
[blender-staging.git] / tools / scons / bs / bs_libs.py
1 # Blender library functions
2
3 import sys
4 import os
5 import string
6 import SCons
7
8 import bs_globals
9
10 def common_libs(env):
11         """
12         Append to env all libraries that are common to Blender and Blenderplayer
13         """
14         env.Append (LIBS=[
15                 'blender_readblenfile',
16                 'blender_img',
17                 'blender_blenkernel',
18                 'blender_blenloader',
19                 'blender_blenpluginapi',
20                 'blender_imbuf',
21                 'blender_avi',
22                 'blender_blenlib',
23                 'blender_makesdna',
24                 'blender_kernel',
25                 'blender_GHOST',
26                 'blender_STR',
27                 'blender_guardedalloc',
28                 'blender_CTR',
29                 'blender_MEM',
30                 'blender_MT',
31                 'blender_BMF',
32                 'soundsystem'])
33         if bs_globals.user_options_dict['USE_QUICKTIME'] == 1:
34                 env.Append (LIBS=['blender_quicktime'])
35
36 def international_libs(env):
37         """
38         Append international font support libraries
39         """
40         if bs_globals.user_options_dict['USE_INTERNATIONAL'] == 1:
41                 env.Append (LIBS=bs_globals.user_options_dict['FREETYPE_LIBRARY'])
42                 env.Append (LIBPATH=bs_globals.user_options_dict['FREETYPE_LIBPATH'])
43                 env.Append (LIBS=['blender_FTF'])
44                 if sys.platform=='darwin':
45                         env.Append (LIBS=bs_globals.user_options_dict['FTGL_LIBRARY'])
46                         env.Append (LIBPATH=bs_globals.user_options_dict['FTGL_LIBPATH'])
47                 else:
48                         env.Append (LIBS=['extern_ftgl'])
49                 env.Append (LIBS=bs_globals.user_options_dict['FREETYPE_LIBRARY'])
50
51 def blender_libs(env):
52         """
53         Blender only libs (not in player)
54         """
55         env.Append( LIBS=['blender_creator',
56                 'blender_blendersrc',
57                 'blender_render',
58                 'blender_yafray',
59                 'blender_renderconverter',
60                 'blender_radiosity',
61                 'blender_BSP',
62                 'blender_blenkernel',
63                 'blender_LOD',
64                 'blender_IK',
65                 'blender_ONL'])
66
67 def ketsji_libs(env):
68         """
69         Game Engine libs
70         """
71         if bs_globals.user_options_dict['BUILD_GAMEENGINE'] == 1:
72                 env.Append (LIBS=['KX_blenderhook',
73                                 'KX_converter',
74                                 'PHY_Dummy',
75                                 'PHY_Physics',
76                                 'KX_ketsji',
77                                 'SCA_GameLogic',
78                                 'RAS_rasterizer',
79                                 'RAS_OpenGLRasterizer',
80                                 'blender_expressions',
81                                 'SG_SceneGraph',
82                                 'blender_MT',
83                                 'KX_blenderhook',
84                                 'KX_network',
85                                 'blender_kernel',
86                                 'NG_network',
87                                 'NG_loopbacknetwork'])
88                 if bs_globals.user_options_dict['USE_PHYSICS'] == 'solid':
89                         env.Append (LIBS=['PHY_Sumo', 'PHY_Physics', 'blender_MT', 'extern_solid', 'extern_qhull'])
90                 elif bs_globals.user_options_dict['USE_PHYSICS'] == 'bullet':
91                         env.Append (LIBS=['PHY_Bullet', 'PHY_Physics', 'blender_MT','extern_bullet'])
92                 else:
93                         env.Append (LIBS=['PHY_Ode',
94                                         'PHY_Physics'])
95                         env.Append (LIBS=bs_globals.user_options_dict['ODE_LIBRARY'])
96                         env.Append (LIBPATH=bs_globals.user_options_dict['ODE_LIBPATH'])
97
98 def player_libs(env):
99         """
100         Player libraries
101         """
102         env.Append (LIBS=['GPG_ghost',
103                         'GPC_common'])
104
105 def player_libs2(env):
106         """
107         Link order shenannigans: these libs are added after common_libs
108         """
109         env.Append (LIBS=['blender_blenkernel_blc',
110                                           'blender_LOD',                                  
111                                           'soundsystem'])
112
113 def winblenderres(env):
114         """
115         build the windows icon resource file
116         """
117         if sys.platform == 'win32':
118                 env.RES(['source/icons/winblender.rc'])
119
120 def system_libs(env):
121         """
122         System libraries: Python, SDL, PNG, JPEG, Gettext, OpenAL, Carbon
123         """
124         env.Append (LIBS=['blender_python'])
125         env.Append (LIBS=bs_globals.user_options_dict['PYTHON_LIBRARY'])
126         env.Append (LIBPATH=bs_globals.user_options_dict['PYTHON_LIBPATH'])
127         env.Append (LINKFLAGS=bs_globals.user_options_dict['PYTHON_LINKFLAGS'])
128         env.Append (LIBS=bs_globals.user_options_dict['SDL_LIBRARY'])
129         env.Append (LIBPATH=bs_globals.user_options_dict['SDL_LIBPATH'])
130         env.Append (LIBS=bs_globals.user_options_dict['PNG_LIBRARY'])
131         env.Append (LIBPATH=bs_globals.user_options_dict['PNG_LIBPATH'])
132         env.Append (LIBS=bs_globals.user_options_dict['JPEG_LIBRARY'])
133         env.Append (LIBPATH=bs_globals.user_options_dict['JPEG_LIBPATH'])
134         env.Append (LIBS=bs_globals.user_options_dict['GETTEXT_LIBRARY'])
135         env.Append (LIBPATH=bs_globals.user_options_dict['GETTEXT_LIBPATH'])
136         env.Append (LIBS=bs_globals.user_options_dict['Z_LIBRARY'])
137         env.Append (LIBPATH=bs_globals.user_options_dict['Z_LIBPATH'])
138         if bs_globals.user_options_dict['USE_OPENAL'] == 1:
139                 env.Append (LIBS=bs_globals.user_options_dict['OPENAL_LIBRARY'])
140                 env.Append (LIBPATH=bs_globals.user_options_dict['OPENAL_LIBPATH'])
141         env.Append (LIBS=bs_globals.user_options_dict['PLATFORM_LIBS'])
142         env.Append (LIBPATH=bs_globals.user_options_dict['PLATFORM_LIBPATH'])
143         if sys.platform == 'darwin':
144                 env.Append (LINKFLAGS='-framework')
145                 env.Append (LINKFLAGS='Carbon')
146                 env.Append (LINKFLAGS='-framework')
147                 env.Append (LINKFLAGS='AGL')
148                 env.Append (LINKFLAGS='-framework')
149                 env.Append (LINKFLAGS='AudioUnit')
150                 env.Append (LINKFLAGS='-framework')
151                 env.Append (LINKFLAGS='AudioToolbox')
152                 env.Append (LINKFLAGS='-framework')
153                 env.Append (LINKFLAGS='CoreAudio')
154                 if bs_globals.user_options_dict['USE_QUICKTIME'] == 1:
155                         env.Append (LINKFLAGS='-framework')
156                         env.Append (LINKFLAGS='QuickTime')
157         else:
158                 env.Append (LINKFLAGS=bs_globals.user_options_dict['PLATFORM_LINKFLAGS'])
159         env.BuildDir (bs_globals.root_build_dir, '.', duplicate=0)
160
161