* integrate bFTGL with Scons
[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_LOD',
62                 'blender_BSP',
63                 'blender_blenkernel',
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                 else:
91                         env.Append (LIBS=['PHY_Ode',
92                                         'PHY_Physics'])
93                         env.Append (LIBS=bs_globals.user_options_dict['ODE_LIBRARY'])
94                         env.Append (LIBPATH=bs_globals.user_options_dict['ODE_LIBPATH'])
95
96 def player_libs(env):
97         """
98         Player libraries
99         """
100         env.Append (LIBS=['GPG_ghost',
101                         'GPC_common'])
102
103 def player_libs2(env):
104         """
105         Link order shenannigans: these libs are added after common_libs
106         """
107         env.Append (LIBS=['blender_blenkernel_blc',
108                         'soundsystem'])
109
110 def winblenderres(env):
111         """
112         build the windows icon resource file
113         """
114         if sys.platform == 'win32':
115                 env.RES(['source/icons/winblender.rc'])
116
117 def system_libs(env):
118         """
119         System libraries: Python, SDL, PNG, JPEG, Gettext, OpenAL, Carbon
120         """
121         env.Append (LIBS=['blender_python'])
122         env.Append (LIBS=bs_globals.user_options_dict['PYTHON_LIBRARY'])
123         env.Append (LIBPATH=bs_globals.user_options_dict['PYTHON_LIBPATH'])
124         env.Append (LINKFLAGS=bs_globals.user_options_dict['PYTHON_LINKFLAGS'])
125         env.Append (LIBS=bs_globals.user_options_dict['SDL_LIBRARY'])
126         env.Append (LIBPATH=bs_globals.user_options_dict['SDL_LIBPATH'])
127         env.Append (LIBS=bs_globals.user_options_dict['PNG_LIBRARY'])
128         env.Append (LIBPATH=bs_globals.user_options_dict['PNG_LIBPATH'])
129         env.Append (LIBS=bs_globals.user_options_dict['JPEG_LIBRARY'])
130         env.Append (LIBPATH=bs_globals.user_options_dict['JPEG_LIBPATH'])
131         env.Append (LIBS=bs_globals.user_options_dict['GETTEXT_LIBRARY'])
132         env.Append (LIBPATH=bs_globals.user_options_dict['GETTEXT_LIBPATH'])
133         env.Append (LIBS=bs_globals.user_options_dict['Z_LIBRARY'])
134         env.Append (LIBPATH=bs_globals.user_options_dict['Z_LIBPATH'])
135         if bs_globals.user_options_dict['USE_OPENAL'] == 1:
136                 env.Append (LIBS=bs_globals.user_options_dict['OPENAL_LIBRARY'])
137                 env.Append (LIBPATH=bs_globals.user_options_dict['OPENAL_LIBPATH'])
138         env.Append (LIBS=bs_globals.user_options_dict['PLATFORM_LIBS'])
139         env.Append (LIBPATH=bs_globals.user_options_dict['PLATFORM_LIBPATH'])
140         if sys.platform == 'darwin':
141                 env.Append (LINKFLAGS='-framework')
142                 env.Append (LINKFLAGS='Carbon')
143                 env.Append (LINKFLAGS='-framework')
144                 env.Append (LINKFLAGS='AGL')
145                 env.Append (LINKFLAGS='-framework')
146                 env.Append (LINKFLAGS='AudioUnit')
147                 env.Append (LINKFLAGS='-framework')
148                 env.Append (LINKFLAGS='AudioToolbox')
149                 env.Append (LINKFLAGS='-framework')
150                 env.Append (LINKFLAGS='CoreAudio')
151                 if bs_globals.user_options_dict['USE_QUICKTIME'] == 1:
152                         env.Append (LINKFLAGS='-framework')
153                         env.Append (LINKFLAGS='QuickTime')
154         else:
155                 env.Append (LINKFLAGS=bs_globals.user_options_dict['PLATFORM_LINKFLAGS'])
156         env.BuildDir (bs_globals.root_build_dir, '.', duplicate=0)
157
158