view3d bg image now updates on frame change, and the panel for it properly draws...
[blender.git] / SConstruct
index 2d1daba98b61406db646da80790b93cf706482e8..83570cb5c1a28b070c471ee8940ce56c97419a07 100644 (file)
@@ -31,6 +31,7 @@
 
 import platform as pltfrm
 
+# Need a better way to do this. Automagical maybe is not the best thing, maybe it is.
 if pltfrm.architecture()[0] == '64bit':
        bitness = 64
 else:
@@ -59,7 +60,6 @@ B = tools.Blender
 platform = sys.platform
 quickie = None
 quickdebug = None
-nsis_build = None
 
 ##### BEGIN SETUP #####
 
@@ -124,7 +124,10 @@ if toolset:
                #if env:
                #       btools.SetupSpawn(env)
 else:
-       env = BlenderEnvironment(ENV = os.environ)
+       if bitness==64 and platform=='win32':
+               env = BlenderEnvironment(ENV = os.environ, MSVS_ARCH='amd64')
+       else:
+               env = BlenderEnvironment(ENV = os.environ)
 
 if not env:
        print "Could not create a build environment"
@@ -186,6 +189,15 @@ if not env['BF_FANCY']:
 SetOption('num_jobs', int(env['BF_NUMJOBS']))
 print "Build with %d parallel jobs" % (GetOption('num_jobs'))
 
+# BLENDERPATH is a unix only option to enable typical style paths this is
+# spesifically a data-dir, which is used a lot but cant replace BF_INSTALLDIR
+# because the blender binary is installed in $BF_INSTALLDIR/bin/blender
+
+if env['WITH_BF_FHS']:
+       BLENDERPATH = os.path.join(env['BF_INSTALLDIR'], 'share', 'blender', env['BF_VERSION'])
+else:
+       BLENDERPATH = env['BF_INSTALLDIR']
+
 # disable elbeem (fluidsim) compilation?
 if env['BF_NO_ELBEEM'] == 1:
        env['CPPFLAGS'].append('-DDISABLE_ELBEEM')
@@ -198,7 +210,7 @@ if env['WITH_BF_OPENMP'] == 1:
                                env['CPPFLAGS'].append('/openmp')
                                env['CXXFLAGS'].append('/openmp')
                else:
-                       if env['CC'][-3:] == 'icc': # to be able to handle CC=/opt/bla/icc case
+                       if env['CC'].endswith('icc'): # to be able to handle CC=/opt/bla/icc case
                                env.Append(LINKFLAGS=['-openmp', '-static-intel'])
                                env['CCFLAGS'].append('-openmp')
                                env['CPPFLAGS'].append('-openmp')
@@ -207,7 +219,16 @@ if env['WITH_BF_OPENMP'] == 1:
                                env.Append(CCFLAGS=['-fopenmp']) 
                                env.Append(CPPFLAGS=['-fopenmp'])
                                env.Append(CXXFLAGS=['-fopenmp'])
-                               # env.Append(LINKFLAGS=['-fprofile-generate'])
+
+if env['WITH_GHOST_COCOA'] == True:
+       env.Append(CFLAGS=['-DGHOST_COCOA']) 
+       env.Append(CXXFLAGS=['-DGHOST_COCOA'])
+       env.Append(CPPFLAGS=['-DGHOST_COCOA'])
+    
+if env['USE_QTKIT'] == True:
+       env.Append(CFLAGS=['-DUSE_QTKIT']) 
+       env.Append(CXXFLAGS=['-DUSE_QTKIT'])
+       env.Append(CPPFLAGS=['-DUSE_QTKIT'])
 
 #check for additional debug libnames
 
@@ -301,9 +322,8 @@ if env['WITH_BF_SDL'] == False and env['OURPLATFORM'] in ('win32-vc', 'win32-min
        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)
 B.root_build_dir = env['BF_BUILDDIR']
-B.doc_build_dir = env['BF_DOCDIR']
+B.doc_build_dir = os.path.join(BLENDERPATH, 'doc')
 if not B.root_build_dir[-1]==os.sep:
        B.root_build_dir += os.sep
 if not B.doc_build_dir[-1]==os.sep:
@@ -358,7 +378,7 @@ if not os.path.isdir ( B.root_build_dir):
        os.makedirs ( B.root_build_dir + 'extern' )
        os.makedirs ( B.root_build_dir + 'lib' )
        os.makedirs ( B.root_build_dir + 'bin' )
-if not os.path.isdir(B.doc_build_dir):
+if not os.path.isdir(B.doc_build_dir) and env['WITH_BF_DOCS']:
        os.makedirs ( B.doc_build_dir )
 
 Help(opts.GenerateHelpText(env))
@@ -392,7 +412,7 @@ SConscript(B.root_build_dir+'/source/SConscript')
 # libraries to give as objects to linking phase
 mainlist = []
 for tp in B.possible_types:
-       if not tp == 'player' and not tp == 'player2':
+       if not tp == 'player':
                mainlist += B.create_blender_liblist(env, tp)
 
 if B.arguments.get('BF_PRIORITYLIST', '0')=='1':
@@ -402,23 +422,12 @@ dobj = B.buildinfo(env, "dynamic") + B.resources
 thestatlibs, thelibincs = B.setup_staticlibs(env)
 thesyslibs = B.setup_syslibs(env)
 
-if env['WITH_BF_PLAYER']:
-       print("Warning: Game player may not build on 2.5")
-
 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')
-       blen = env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
-
-       build_data = {"lib": thestatlibs + thesyslibs, "libpath": thelibincs, "blen": blen}
-
-       Export('env')
-       Export('build_data')
-
-       BuildDir(B.root_build_dir+'/tests', 'tests', duplicate=0)
-       SConscript(B.root_build_dir+'/tests/SConscript')
-
+       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')
+       playerlist += B.create_blender_liblist(env, 'intern')
+       playerlist += B.create_blender_liblist(env, 'extern')
        env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
 
 ##### Now define some targets
@@ -433,15 +442,16 @@ if  env['OURPLATFORM']=='darwin':
                bundle = '%s.app' % prg[0]
                bundledir = os.path.dirname(bundle)
                for dp, dn, df in os.walk(bundle):
-                       if 'CVS' in dn:
-                               dn.remove('CVS')
                        if '.svn' in dn:
                                dn.remove('.svn')
                        dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
                        source=[dp+os.sep+f for f in df]
                        blenderinstall.append(env.Install(dir=dir,source=source))
 else:
-       blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
+       if env['WITH_BF_FHS']:  dir= os.path.join(env['BF_INSTALLDIR'], 'bin')
+       else:                                   dir= env['BF_INSTALLDIR']
+       
+       blenderinstall = env.Install(dir=dir, source=B.program_list)
 
 #-- .blender
 #- dont do .blender and scripts for darwin, it is already in the bundle
@@ -451,8 +461,6 @@ scriptinstall = []
 
 if  env['OURPLATFORM']!='darwin':
                for dp, dn, df in os.walk('bin/.blender'):
-                       if 'CVS' in dn:
-                               dn.remove('CVS')
                        if '.svn' in dn:
                                dn.remove('.svn')
                        
@@ -467,7 +475,13 @@ if  env['OURPLATFORM']!='darwin':
                                                continue
                                
                                dotblendlist.append(os.path.join(dp, f))
-                               dottargetlist.append(env['BF_INSTALLDIR']+dp[3:]+os.sep+f)
+                               if env['WITH_BF_FHS']:  dir= os.path.join(*([BLENDERPATH] + dp.split(os.sep)[2:]))      # skip bin/.blender
+                               else:                                   dir= os.path.join(*([BLENDERPATH] + dp.split(os.sep)[1:]))      # skip bin
+                               
+                               # print dir+ os.sep + f
+                               print dir
+                               dottargetlist.append(dir + os.sep + f)
+                                       
 
                dotblenderinstall = []
                for targetdir,srcfile in zip(dottargetlist, dotblendlist):
@@ -475,16 +489,18 @@ if  env['OURPLATFORM']!='darwin':
                        dotblenderinstall.append(env.Install(dir=td, source=srcfile))
                
                if env['WITH_BF_PYTHON']:
-                       #-- .blender/scripts, .blender/ui, .blender/io
-                       scriptpaths=['release/scripts', 'release/ui', 'release/io']
+                       #-- .blender/scripts
+                       scriptpaths=['release/scripts']
                        for scriptpath in scriptpaths:
                                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/'+os.path.basename(scriptpath)+dp[len(scriptpath):]
-                                       source=[dp+os.sep+f for f in df]
+                                       
+                                       if env['WITH_BF_FHS']:          dir = BLENDERPATH
+                                       else:                                           dir = os.path.join(env['BF_INSTALLDIR'], '.blender')                            
+                                       dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):]
+                                       
+                                       source=[os.path.join(dp, f) for f in df]
                                        scriptinstall.append(env.Install(dir=dir,source=source))
 
 #-- icons
@@ -493,13 +509,11 @@ if env['OURPLATFORM']=='linux2':
        icontargetlist = []
 
        for tp, tn, tf in os.walk('release/freedesktop/icons'):
-               if 'CVS' in tn:
-                       tn.remove('CVS')
                if '.svn' in tn:
                        tn.remove('.svn')
                for f in tf:
-                       iconlist.append(tp+os.sep+f)
-                       icontargetlist.append(env['BF_INSTALLDIR']+tp[19:]+os.sep+f)
+                       iconlist.append(os.path.join(tp, f))
+                       icontargetlist.append( os.path.join(*([BLENDERPATH] + tp.split(os.sep)[2:] + [f])) )
 
        iconinstall = []
        for targetdir,srcfile in zip(icontargetlist, iconlist):
@@ -517,29 +531,29 @@ if env['OURPLATFORM']=='linuxcross':
 pluglist = []
 plugtargetlist = []
 for tp, tn, tf in os.walk('release/plugins'):
-       if 'CVS' in tn:
-               tn.remove('CVS')
        if '.svn' in tn:
                tn.remove('.svn')
+       df = tp[8:] # remove 'release/'
        for f in tf:
-               pluglist.append(tp+os.sep+f)
-               plugtargetlist.append(env['BF_INSTALLDIR']+tp[7:]+os.sep+f)
+               pluglist.append(os.path.join(tp, f))
+               plugtargetlist.append( os.path.join(BLENDERPATH, df, f) )
+
 
 # header files for plugins
 pluglist.append('source/blender/blenpluginapi/documentation.h')
-plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'documentation.h')
+plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'documentation.h'))
 pluglist.append('source/blender/blenpluginapi/externdef.h')
-plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'externdef.h')
+plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'externdef.h'))
 pluglist.append('source/blender/blenpluginapi/floatpatch.h')
-plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'floatpatch.h')
+plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'floatpatch.h'))
 pluglist.append('source/blender/blenpluginapi/iff.h')
-plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'iff.h')
+plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'iff.h'))
 pluglist.append('source/blender/blenpluginapi/plugin.h')
-plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'plugin.h')
+plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'plugin.h'))
 pluglist.append('source/blender/blenpluginapi/util.h')
-plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'util.h')
+plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'util.h'))
 pluglist.append('source/blender/blenpluginapi/plugin.DEF')
-plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep + 'plugin.def')
+plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'plugin.def'))
 
 plugininstall = []
 for targetdir,srcfile in zip(plugtargetlist, pluglist):
@@ -549,14 +563,12 @@ for targetdir,srcfile in zip(plugtargetlist, pluglist):
 textlist = []
 texttargetlist = []
 for tp, tn, tf in os.walk('release/text'):
-       if 'CVS' in tn:
-               tn.remove('CVS')
        if '.svn' in tn:
                tn.remove('.svn')
        for f in tf:
                textlist.append(tp+os.sep+f)
 
-textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
+textinstall = env.Install(dir=BLENDERPATH, source=textlist)
 
 if  env['OURPLATFORM']=='darwin':
                allinstall = [blenderinstall, plugininstall, textinstall]
@@ -580,30 +592,32 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc'):
                else:
                        dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
        if env['WITH_BF_PYTHON']:
-               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')
+                       dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll')
                else:
-                       dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_LIB}.dll')
+                       dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll')
        if env['WITH_BF_ICONV']:
                if env['OURPLATFORM'] == 'win64-vc':
                        pass # we link statically to iconv on win64
                else:
                        dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
+       if env['WITH_BF_OPENAL']:
+               dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
+               dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
+       if env['WITH_BF_SNDFILE']:
+               dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
        if env['WITH_BF_FFMPEG']:
                dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-52.dll',
                                                '${LCGDIR}/ffmpeg/lib/avformat-52.dll',
                                                '${LCGDIR}/ffmpeg/lib/avdevice-52.dll',
                                                '${LCGDIR}/ffmpeg/lib/avutil-50.dll',
-                                               '${LCGDIR}/ffmpeg/lib/libfaad-2.dll',
+                                               '${LCGDIR}/ffmpeg/lib/swscale-0.dll',
                                                '${LCGDIR}/ffmpeg/lib/libfaac-0.dll',
+                                               '${LCGDIR}/ffmpeg/lib/libfaad-2.dll',
                                                '${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
-                                               '${LCGDIR}/ffmpeg/lib/libx264-67.dll',
-                                               '${LCGDIR}/ffmpeg/lib/xvidcore.dll',
-                                               '${LCGDIR}/ffmpeg/lib/swscale-0.dll']
+                                               '${LCGDIR}/ffmpeg/lib/libx264-67.dll']
+       if env['WITH_BF_JACK']:
+               dllsources += ['${LCGDIR}/jack/lib/libjack.dll']
        windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
        allinstall += windlls
 
@@ -639,13 +653,14 @@ if not env['WITHOUT_BF_INSTALL']:
 
 #------------ EPYDOC
 if env['WITH_BF_DOCS']:
-       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 "
-       
+    try:
+        import epydoc
+    except ImportError:
+        epydoc = None
+
+    if epydoc:
+        SConscript('source/gameengine/PyDoc/SConscript')
+    else:
+        print "No epydoc install detected, Python API and Gameengine API Docs will not be generated "
+