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