updated SConstruct and Makefile so that if you compile the gameengine, is always...
[blender.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                 'blender_elbeem' ])
67
68 def ketsji_libs(env):
69         """
70         Game Engine libs
71         """
72         if bs_globals.user_options_dict['BUILD_GAMEENGINE'] == 1:
73                 env.Append (LIBS=['KX_blenderhook',
74                                 'KX_converter',
75                                 'PHY_Dummy',
76                                 'PHY_Bullet',
77                                 'PHY_Physics',
78                                 'extern_bullet',
79                                 'KX_ketsji',
80                                 'SCA_GameLogic',
81                                 'RAS_rasterizer',
82                                 'RAS_OpenGLRasterizer',
83                                 'blender_expressions',
84                                 'SG_SceneGraph',
85                                 'blender_MT',
86                                 'KX_blenderhook',
87                                 'KX_network',
88                                 'blender_kernel',
89                                 'NG_network',
90                                 'NG_loopbacknetwork'])
91                 if bs_globals.user_options_dict['USE_PHYSICS'] == 'solid':
92                         env.Append (LIBS=['PHY_Sumo', 'PHY_Physics', 'blender_MT', 'extern_solid', 'extern_qhull'])
93                 else:
94                         env.Append (LIBS=['PHY_Ode',
95                                         'PHY_Physics'])
96                         env.Append (LIBS=bs_globals.user_options_dict['ODE_LIBRARY'])
97                         env.Append (LIBPATH=bs_globals.user_options_dict['ODE_LIBPATH'])
98
99 def player_libs(env):
100         """
101         Player libraries
102         """
103         env.Append (LIBS=['GPG_ghost',
104                         'GPC_common'])
105
106 def player_libs2(env):
107         """
108         Link order shenannigans: these libs are added after common_libs
109         """
110         env.Append (LIBS=['blender_blenkernel_blc',
111                                           'blender_LOD',                                  
112                                           'soundsystem'])
113
114 def winblenderres(env):
115         """
116         build the windows icon resource file
117         """
118         if sys.platform == 'win32':
119                 env.RES(['source/icons/winblender.rc'])
120
121 def system_libs(env):
122         """
123         System libraries: Python, SDL, PNG, JPEG, Gettext, OpenAL, Carbon
124         """
125         env.Append (LIBS=['blender_python'])
126         env.Append (LIBS=bs_globals.user_options_dict['PYTHON_LIBRARY'])
127         env.Append (LIBPATH=bs_globals.user_options_dict['PYTHON_LIBPATH'])
128         env.Append (LINKFLAGS=bs_globals.user_options_dict['PYTHON_LINKFLAGS'])
129         env.Append (LIBS=bs_globals.user_options_dict['SDL_LIBRARY'])
130         env.Append (LIBPATH=bs_globals.user_options_dict['SDL_LIBPATH'])
131         env.Append (LIBS=bs_globals.user_options_dict['PNG_LIBRARY'])
132         env.Append (LIBPATH=bs_globals.user_options_dict['PNG_LIBPATH'])
133         env.Append (LIBS=bs_globals.user_options_dict['JPEG_LIBRARY'])
134         env.Append (LIBPATH=bs_globals.user_options_dict['JPEG_LIBPATH'])
135         env.Append (LIBS=bs_globals.user_options_dict['GETTEXT_LIBRARY'])
136         env.Append (LIBPATH=bs_globals.user_options_dict['GETTEXT_LIBPATH'])
137         env.Append (LIBS=bs_globals.user_options_dict['Z_LIBRARY'])
138         env.Append (LIBPATH=bs_globals.user_options_dict['Z_LIBPATH'])
139         if bs_globals.user_options_dict['USE_OPENAL'] == 1:
140                 env.Append (LIBS=bs_globals.user_options_dict['OPENAL_LIBRARY'])
141                 env.Append (LIBPATH=bs_globals.user_options_dict['OPENAL_LIBPATH'])
142         env.Append (LIBS=bs_globals.user_options_dict['PLATFORM_LIBS'])
143         env.Append (LIBPATH=bs_globals.user_options_dict['PLATFORM_LIBPATH'])
144         if sys.platform == 'darwin':
145                 env.Append (LINKFLAGS='-framework')
146                 env.Append (LINKFLAGS='Carbon')
147                 env.Append (LINKFLAGS='-framework')
148                 env.Append (LINKFLAGS='AGL')
149                 env.Append (LINKFLAGS='-framework')
150                 env.Append (LINKFLAGS='AudioUnit')
151                 env.Append (LINKFLAGS='-framework')
152                 env.Append (LINKFLAGS='AudioToolbox')
153                 env.Append (LINKFLAGS='-framework')
154                 env.Append (LINKFLAGS='CoreAudio')
155                 if bs_globals.user_options_dict['USE_QUICKTIME'] == 1:
156                         env.Append (LINKFLAGS='-framework')
157                         env.Append (LINKFLAGS='QuickTime')
158         else:
159                 env.Append (LINKFLAGS=bs_globals.user_options_dict['PLATFORM_LINKFLAGS'])
160         env.BuildDir (bs_globals.root_build_dir, '.', duplicate=0)
161
162