2.50: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19323...
[blender.git] / SConstruct
index 20d8f8f..63bc4cd 100644 (file)
 # Set up some custom actions and target/argument handling
 # Then read all SConscripts and build
 
+import platform as pltfrm
+
+if pltfrm.architecture()[0] == '64bit':
+       bitness = 64
+else:
+       bitness = 32
+
 import sys
 import os
 import os.path
@@ -56,9 +63,7 @@ nsis_build = None
 
 ##### BEGIN SETUP #####
 
-B.possible_types = ['core', 'common', 'blender', 'intern',
-                                       'international', 'game', 'game2',
-                                       'player', 'player2', 'system']
+B.possible_types = ['core', 'player', 'intern', 'extern']
 
 B.binarykind = ['blender' , 'blenderplayer']
 ##################################
@@ -134,14 +139,17 @@ if cxx:
        env['CXX'] = cxx
 
 if env['CC'] in ['cl', 'cl.exe'] and sys.platform=='win32':
-       platform = 'win32-vc'
+       if bitness == 64:
+               platform = 'win64-vc'
+       else:
+               platform = 'win32-vc'
 elif env['CC'] in ['gcc'] and sys.platform=='win32':
        platform = 'win32-mingw'
 
 env.SConscriptChdir(0)
 
 crossbuild = B.arguments.get('BF_CROSS', None)
-if crossbuild and platform!='win32':
+if crossbuild and platform not in ('win32-vc', 'win64-vc'):
        platform = 'linuxcross'
 
 env['OURPLATFORM'] = platform
@@ -185,7 +193,7 @@ if env['BF_NO_ELBEEM'] == 1:
        env['CCFLAGS'].append('-DDISABLE_ELBEEM')
 
 if env['WITH_BF_OPENMP'] == 1:
-               if env['OURPLATFORM']=='win32-vc':
+               if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
                                env['CCFLAGS'].append('/openmp')
                                env['CPPFLAGS'].append('/openmp')
                                env['CXXFLAGS'].append('/openmp')
@@ -262,29 +270,39 @@ if 'blendernogame' in B.targets:
        env['WITH_BF_GAMEENGINE'] = False
 
 if 'blenderlite' in B.targets:
-       env['WITH_BF_GAMEENGINE'] = False
-       env['WITH_BF_OPENAL'] = False
-       env['WITH_BF_OPENEXR'] = False
-       env['WITH_BF_ICONV'] = False
-       env['WITH_BF_INTERNATIONAL'] = False
-       env['WITH_BF_OPENJPEG'] = False
-       env['WITH_BF_FFMPEG'] = False
-       env['WITH_BF_QUICKTIME'] = False
-       env['WITH_BF_YAFRAY'] = False
-       env['WITH_BF_REDCODE'] = False
-       env['WITH_BF_FTGL'] = False
-       env['WITH_BF_DDS'] = False
-       env['WITH_BF_ZLIB'] = False
-       env['WITH_BF_SDL'] = False
-       env['WITH_BF_JPEG'] = False
-       env['WITH_BF_PNG'] = False
-       env['WITH_BF_ODE'] = False
-       env['WITH_BF_BULLET'] = False
-       env['WITH_BF_SOLID'] = False
-       env['WITH_BF_BINRELOC'] = False
-       env['BF_BUILDINFO'] = False
-       env['BF_NO_ELBEEM'] = True
-       env['WITH_BF_PYTHON'] = False
+       target_env_defs = {}
+       target_env_defs['WITH_BF_GAMEENGINE'] = False
+       target_env_defs['WITH_BF_OPENAL'] = False
+       target_env_defs['WITH_BF_OPENEXR'] = False
+       target_env_defs['WITH_BF_ICONV'] = False
+       target_env_defs['WITH_BF_INTERNATIONAL'] = False
+       target_env_defs['WITH_BF_OPENJPEG'] = False
+       target_env_defs['WITH_BF_FFMPEG'] = False
+       target_env_defs['WITH_BF_QUICKTIME'] = False
+       target_env_defs['WITH_BF_YAFRAY'] = False
+       target_env_defs['WITH_BF_REDCODE'] = False
+       target_env_defs['WITH_BF_FTGL'] = False
+       target_env_defs['WITH_BF_DDS'] = False
+       target_env_defs['WITH_BF_ZLIB'] = False
+       target_env_defs['WITH_BF_SDL'] = False
+       target_env_defs['WITH_BF_JPEG'] = False
+       target_env_defs['WITH_BF_PNG'] = False
+       target_env_defs['WITH_BF_ODE'] = False
+       target_env_defs['WITH_BF_BULLET'] = False
+       target_env_defs['WITH_BF_SOLID'] = False
+       target_env_defs['WITH_BF_BINRELOC'] = False
+       target_env_defs['BF_BUILDINFO'] = False
+       target_env_defs['BF_NO_ELBEEM'] = True
+       target_env_defs['WITH_BF_PYTHON'] = False
+       
+       # Merge blenderlite, let command line to override
+       for k,v in target_env_defs.iteritems():
+               if k not in B.arguments:
+                       env[k] = v
+
+if env['WITH_BF_SDL'] == False and env['OURPLATFORM'] in ('win32-vc', 'win32-ming', 'win64-vc'):
+       env['PLATFORM_LINKFLAGS'].remove('/ENTRY:mainCRTStartup')
+       env['PLATFORM_LINKFLAGS'].append('/ENTRY:main')
 
 # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
 #B.root_build_dir = B.arguments.get('BF_BUILDDIR', '..'+os.sep+'build'+os.sep+platform+os.sep)
@@ -389,10 +407,11 @@ thestatlibs, thelibincs = B.setup_staticlibs(env)
 thesyslibs = B.setup_syslibs(env)
 
 if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
-       env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
+       #env.BlenderProg(B.root_build_dir, "blender", dobj , [], mainlist + thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
+       env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
 if env['WITH_BF_PLAYER']:
        playerlist = B.create_blender_liblist(env, 'player')
-       env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
+       env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
 
 ##### Now define some targets
 
@@ -459,6 +478,17 @@ if  env['OURPLATFORM']!='darwin':
                                source=[dp+os.sep+f for f in df]
                                scriptinstall.append(env.Install(dir=dir,source=source))
 
+                       #-- .blender/ui 
+                       scriptpath='release/ui'
+                       for dp, dn, df in os.walk(scriptpath):
+                               if 'CVS' in dn:
+                                       dn.remove('CVS')
+                               if '.svn' in dn:
+                                       dn.remove('.svn')
+                               dir=env['BF_INSTALLDIR']+'/.blender/ui'+dp[len(scriptpath):]
+                               source=[dp+os.sep+f for f in df]
+                               scriptinstall.append(env.Install(dir=dir,source=source))
+
 #-- icons
 if env['OURPLATFORM']=='linux2':
        iconlist = []
@@ -470,7 +500,6 @@ if env['OURPLATFORM']=='linux2':
                if '.svn' in tn:
                        tn.remove('.svn')
                for f in tf:
-                       print ">>>", env['BF_INSTALLDIR'], tp, f
                        iconlist.append(tp+os.sep+f)
                        icontargetlist.append(env['BF_INSTALLDIR']+tp[19:]+os.sep+f)
 
@@ -495,7 +524,6 @@ for tp, tn, tf in os.walk('release/plugins'):
        if '.svn' in tn:
                tn.remove('.svn')
        for f in tf:
-               print ">>>", env['BF_INSTALLDIR'], tp, f
                pluglist.append(tp+os.sep+f)
                plugtargetlist.append(env['BF_INSTALLDIR']+tp[7:]+os.sep+f)
 
@@ -539,32 +567,43 @@ elif env['OURPLATFORM']=='linux2':
 else:
                allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
-       dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll',
-                                               '${BF_PNG_LIBPATH}/libpng.dll',
-                                               '${BF_ZLIB_LIBPATH}/zlib.dll',
-                                               '${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc'):
+       if env['OURPLATFORM'] == 'win64-vc':
+               dllsources = []
+       else:
+               dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll',
+                               '${BF_PNG_LIBPATH}/libpng.dll',
+                               '${BF_ZLIB_LIBPATH}/zlib.dll',
+                               '${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
        dllsources += ['${BF_PTHREADS_LIBPATH}/${BF_PTHREADS_LIB}.dll']
        if env['WITH_BF_SDL']:
-               dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
+               if env['OURPLATFORM'] == 'win64-vc':
+                       pass # we link statically already to SDL on win64
+               else:
+                       dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
        if env['WITH_BF_PYTHON']:
-               dllsources.append('#release/windows/extra/python25.zip')
+               ver = env["BF_PYTHON_VERSION"].replace(".", "")
+               
+               dllsources.append('#release/windows/extra/python' + ver + '.zip')
                dllsources.append('#release/windows/extra/zlib.pyd')
                if env['BF_DEBUG']:
                        dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_LIB}_d.dll')
                else:
                        dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_LIB}.dll')
        if env['WITH_BF_ICONV']:
-               dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
+               if env['OURPLATFORM'] == 'win64-vc':
+                       pass # we link statically to iconv on win64
+               else:
+                       dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
        if env['WITH_BF_FFMPEG']:
-               dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-51.dll',
+               dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-52.dll',
                                                '${LCGDIR}/ffmpeg/lib/avformat-52.dll',
                                                '${LCGDIR}/ffmpeg/lib/avdevice-52.dll',
-                                               '${LCGDIR}/ffmpeg/lib/avutil-49.dll',
-                                               '${LCGDIR}/ffmpeg/lib/libfaad-0.dll',
+                                               '${LCGDIR}/ffmpeg/lib/avutil-50.dll',
+                                               '${LCGDIR}/ffmpeg/lib/libfaad-2.dll',
                                                '${LCGDIR}/ffmpeg/lib/libfaac-0.dll',
                                                '${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
-                                               '${LCGDIR}/ffmpeg/lib/libx264-59.dll',
+                                               '${LCGDIR}/ffmpeg/lib/libx264-67.dll',
                                                '${LCGDIR}/ffmpeg/lib/xvidcore.dll',
                                                '${LCGDIR}/ffmpeg/lib/swscale-0.dll']
        windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
@@ -600,14 +639,15 @@ Default(B.program_list)
 if not env['WITHOUT_BF_INSTALL']:
                Default(installtarget)
 
-#------------ RELEASE
-# TODO: zipup the installation
-
-#------------ BLENDERPLAYER
-# TODO: build stubs and link into blenderplayer
-
 #------------ EPYDOC
 if env['WITH_BF_DOCS']:
-       SConscript('source/blender/python/api2_2x/doc/SConscript')
-       SConscript('source/gameengine/PyDoc/SConscript')
+       try:            import epydoc
+       except: epydoc = None
+       
+       if epydoc:
+               SConscript('source/blender/python/api2_2x/doc/SConscript')
+               SConscript('source/gameengine/PyDoc/SConscript')
+       else:
+               print "No epydoc install detected, Python API and Gameengine API Docs will not be generated "
+