Correct lib order for linuxers.
[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                 env.Append (LIBS=bs_globals.user_options_dict['FTGL_LIBRARY'])
45                 env.Append (LIBPATH=bs_globals.user_options_dict['FTGL_LIBPATH'])
46                 env.Append (LIBS=bs_globals.user_options_dict['FREETYPE_LIBRARY'])
47
48 def blender_libs(env):
49         """
50         Blender only libs (not in player)
51         """
52         env.Append( LIBS=['blender_creator',
53                 'blender_blendersrc',
54                 'blender_render',
55                 'blender_yafray',
56                 'blender_renderconverter',
57                 'blender_radiosity',
58                 'blender_LOD',
59                 'blender_BSP',
60                 'blender_blenkernel',
61                 'blender_IK',
62                 'blender_ONL'])
63
64 def ketsji_libs(env):
65         """
66         Game Engine libs
67         """
68         if bs_globals.user_options_dict['BUILD_GAMEENGINE'] == 1:
69                 env.Append (LIBS=['KX_blenderhook',
70                                 'KX_converter',
71                                 'PHY_Dummy',
72                                 'PHY_Physics',
73                                 'KX_ketsji',
74                                 'SCA_GameLogic',
75                                 'RAS_rasterizer',
76                                 'RAS_OpenGLRasterizer',
77                                 'blender_expressions',
78                                 'SG_SceneGraph',
79                                 'blender_MT',
80                                 'KX_blenderhook',
81                                 'KX_network',
82                                 'blender_kernel',
83                                 'NG_network',
84                                 'NG_loopbacknetwork'])
85                 if bs_globals.user_options_dict['USE_PHYSICS'] == 'solid':
86                         env.Append (LIBS=['PHY_Sumo', 'PHY_Physics', 'blender_MT', 'extern_solid', 'extern_qhull'])
87                 else:
88                         env.Append (LIBS=['PHY_Ode',
89                                         'PHY_Physics'])
90                         env.Append (LIBS=bs_globals.user_options_dict['ODE_LIBRARY'])
91                         env.Append (LIBPATH=bs_globals.user_options_dict['ODE_LIBPATH'])
92
93 def player_libs(env):
94         """
95         Player libraries
96         """
97         env.Append (LIBS=['GPG_ghost',
98                         'GPC_common'])
99
100 def player_libs2(env):
101         """
102         Link order shenannigans: these libs are added after common_libs
103         """
104         env.Append (LIBS=['blender_blenkernel_blc',
105                         'soundsystem'])
106
107 def winblenderres(env):
108         """
109         build the windows icon resource file
110         """
111         if sys.platform == 'win32':
112                 env.RES(['source/icons/winblender.rc'])
113
114 def system_libs(env):
115         """
116         System libraries: Python, SDL, PNG, JPEG, Gettext, OpenAL, Carbon
117         """
118         env.Append (LIBS=['blender_python'])
119         env.Append (LIBS=bs_globals.user_options_dict['PYTHON_LIBRARY'])
120         env.Append (LIBPATH=bs_globals.user_options_dict['PYTHON_LIBPATH'])
121         env.Append (LINKFLAGS=bs_globals.user_options_dict['PYTHON_LINKFLAGS'])
122         env.Append (LIBS=bs_globals.user_options_dict['SDL_LIBRARY'])
123         env.Append (LIBPATH=bs_globals.user_options_dict['SDL_LIBPATH'])
124         env.Append (LIBS=bs_globals.user_options_dict['PNG_LIBRARY'])
125         env.Append (LIBPATH=bs_globals.user_options_dict['PNG_LIBPATH'])
126         env.Append (LIBS=bs_globals.user_options_dict['JPEG_LIBRARY'])
127         env.Append (LIBPATH=bs_globals.user_options_dict['JPEG_LIBPATH'])
128         env.Append (LIBS=bs_globals.user_options_dict['GETTEXT_LIBRARY'])
129         env.Append (LIBPATH=bs_globals.user_options_dict['GETTEXT_LIBPATH'])
130         env.Append (LIBS=bs_globals.user_options_dict['Z_LIBRARY'])
131         env.Append (LIBPATH=bs_globals.user_options_dict['Z_LIBPATH'])
132         if bs_globals.user_options_dict['USE_OPENAL'] == 1:
133                 env.Append (LIBS=bs_globals.user_options_dict['OPENAL_LIBRARY'])
134                 env.Append (LIBPATH=bs_globals.user_options_dict['OPENAL_LIBPATH'])
135         env.Append (LIBS=bs_globals.user_options_dict['PLATFORM_LIBS'])
136         env.Append (LIBPATH=bs_globals.user_options_dict['PLATFORM_LIBPATH'])
137         if sys.platform == 'darwin':
138                 env.Append (LINKFLAGS='-framework')
139                 env.Append (LINKFLAGS='Carbon')
140                 env.Append (LINKFLAGS='-framework')
141                 env.Append (LINKFLAGS='AGL')
142                 env.Append (LINKFLAGS='-framework')
143                 env.Append (LINKFLAGS='AudioUnit')
144                 env.Append (LINKFLAGS='-framework')
145                 env.Append (LINKFLAGS='AudioToolbox')
146                 env.Append (LINKFLAGS='-framework')
147                 env.Append (LINKFLAGS='CoreAudio')
148                 if bs_globals.user_options_dict['USE_QUICKTIME'] == 1:
149                         env.Append (LINKFLAGS='-framework')
150                         env.Append (LINKFLAGS='QuickTime')
151         else:
152                 env.Append (LINKFLAGS=bs_globals.user_options_dict['PLATFORM_LINKFLAGS'])
153         env.BuildDir (bs_globals.root_build_dir, '.', duplicate=0)
154
155