Merging r40615 through r40652 from trunk into soc-2011-tomato
[blender.git] / build_files / scons / tools / Blender.py
index 75af7e47edd5061be4fe6c0d7068e3cd39818b3b..34b245cff48ae86a1de4d8a89928ce60267764c6 100644 (file)
@@ -206,6 +206,12 @@ def setup_staticlibs(lenv):
         if lenv['WITH_BF_STATICJEMALLOC']:
             statlibs += Split(lenv['BF_JEMALLOC_LIB_STATIC'])
 
+    if lenv['OURPLATFORM']=='linux':
+        if lenv['WITH_BF_3DMOUSE']:
+            libincs += Split(lenv['BF_3DMOUSE_LIBPATH'])
+            if lenv['WITH_BF_STATIC3DMOUSE']:
+                statlibs += Split(lenv['BF_3DMOUSE_LIB_STATIC'])
+
     return statlibs, libincs
 
 def setup_syslibs(lenv):
@@ -271,6 +277,11 @@ def setup_syslibs(lenv):
         if not lenv['WITH_BF_STATICJEMALLOC']:
             syslibs += Split(lenv['BF_JEMALLOC_LIB'])
 
+    if lenv['OURPLATFORM']=='linux':
+        if lenv['WITH_BF_3DMOUSE']:
+            if not lenv['WITH_BF_STATIC3DMOUSE']:
+                syslibs += Split(lenv['BF_3DMOUSE_LIB'])
+
     syslibs += lenv['LLIBS']
 
     return syslibs
@@ -315,6 +326,10 @@ def creator(env):
     if not env['WITH_BF_SDL']:
         defs.append('DISABLE_SDL')
 
+    if env['WITH_BF_LIBMV']:
+        incs.append('#/extern/libmv')
+        defs.append('WITH_LIBMV')
+
     if env['WITH_BF_PYTHON']:
         incs.append('#/source/blender/python')
         defs.append('WITH_PYTHON')
@@ -353,16 +368,16 @@ def buildinfo(lenv, build_type):
 
     obj = []
     if lenv['BF_BUILDINFO']:
-        lenv.Append (CPPDEFINES = ['BUILD_TIME="%s"'%(build_time),
-                                    'BUILD_DATE="%s"'%(build_date),
-                                    'BUILD_TYPE="%s"'%(build_type),
-                                    'BUILD_REV="%s"'%(build_rev),
-                                    'NAN_BUILDINFO',
-                                    'BUILD_PLATFORM="%s:%s"'%(platform.system(), platform.architecture()[0]),
+        lenv.Append (CPPDEFINES = ['BUILD_TIME=\\"%s\\"'%(build_time),
+                                    'BUILD_DATE=\\"%s\\"'%(build_date),
+                                    'BUILD_TYPE=\\"%s\\"'%(build_type),
+                                    'BUILD_REV=\\"%s\\"'%(build_rev),
+                                    'WITH_BUILDINFO',
+                                    'BUILD_PLATFORM=\\"%s:%s\\"'%(platform.system(), platform.architecture()[0]),
                                     'BUILD_CFLAGS=\\"%s\\"'%(build_cflags),
                                     'BUILD_CXXFLAGS=\\"%s\\"'%(build_cxxflags),
                                     'BUILD_LINKFLAGS=\\"%s\\"'%(build_linkflags),
-                                    'BUILD_SYSTEM="SCons"'
+                                    'BUILD_SYSTEM=\\"SCons\\"'
                     ])
 
         lenv.Append (CPPPATH = [root_build_dir+'source/blender/blenkernel'])
@@ -525,7 +540,10 @@ def AppIt(target=None, source=None, env=None):
     print("Installing to %s"%(installdir))
     # TODO, use tar.
     python_zip = 'python_' + osxarch + '.zip' # set specific python_arch.zip
-    print("unzipping to app-bundle: %s"%(python_zip))
+    if env['WITH_OSX_STATICPYTHON']:
+        print("unzipping to app-bundle: %s"%(python_zip))
+    else:
+        print("dynamic build - make sure to have python3.x-framework installed")
     bldroot = env.Dir('.').abspath
     binary = env['BINARYKIND']
      
@@ -547,28 +565,26 @@ def AppIt(target=None, source=None, env=None):
     cmd = 'cp %s/%s %s/%s.app/Contents/MacOS/%s'%(builddir, binary,installdir, binary, binary)
     commands.getoutput(cmd)
     cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/'%(installdir, binary, VERSION)
-#    print cmd
     commands.getoutput(cmd)
     cmd = installdir + '/%s.app/Contents/MacOS/%s'%(binary,VERSION)
-    shutil.copy(bldroot + '/release/bin/.blender/.bfont.ttf', cmd)
-    shutil.copy(bldroot + '/release/bin/.blender/.Blanguages', cmd)
-    cmd = 'cp -R %s/release/bin/%s/locale %s/%s.app/Contents/Resources/'%(bldroot,VERSION,installdir,binary)
-    commands.getoutput(cmd)
-    cmd = 'cp -R %s/release/bin/%s/locale %s/%s.app/Contents/MacOS/%s/'%(bldroot,VERSION,installdir,binary,VERSION)
-    commands.getoutput(cmd)
-    cmd = 'cp %s/release/bin/%s/.Blanguages %s/%s.app/Contents/Resources/'%(bldroot,VERSION,installdir,binary)
-    commands.getoutput(cmd)
-    cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/python/'%(installdir,binary, VERSION)
-    commands.getoutput(cmd)
-    cmd = 'unzip -q %s/release/%s -d %s/%s.app/Contents/MacOS/%s/python/'%(libdir,python_zip,installdir,binary,VERSION)
-    commands.getoutput(cmd)
 
-    if binary == 'blender':#not copy everything for blenderplayer
+    # blenderplayer doesn't need all the files
+    if binary == 'blender':
+        cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/datafiles'%(installdir, binary, VERSION)
+        commands.getoutput(cmd)
+        cmd = 'cp -R %s/release/bin/.blender/locale %s/%s.app/Contents/MacOS/%s/datafiles/'%(bldroot,installdir,binary,VERSION)
+        commands.getoutput(cmd)
+        cmd = 'cp -R %s/release/bin/.blender/fonts %s/%s.app/Contents/MacOS/%s/datafiles/'%(bldroot,installdir,binary,VERSION)
+        commands.getoutput(cmd)
+        cmd = 'cp %s/release/bin/%s/.Blanguages %s/%s.app/Contents/Resources/'%(bldroot,VERSION,installdir,binary)
+        commands.getoutput(cmd)
         cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION)
         commands.getoutput(cmd)
-        cmd = 'cp -R %s/release/ui %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION)
+
+    if env['WITH_OSX_STATICPYTHON']:
+        cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/python/'%(installdir,binary, VERSION)
         commands.getoutput(cmd)
-        cmd = 'cp -R %s/release/io %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION)
+        cmd = 'unzip -q %s/release/%s -d %s/%s.app/Contents/MacOS/%s/python/'%(libdir,python_zip,installdir,binary,VERSION)
         commands.getoutput(cmd)
 
     cmd = 'chmod +x  %s/%s.app/Contents/MacOS/%s'%(installdir,binary, binary)
@@ -684,7 +700,7 @@ class BlenderEnvironment(SConsEnvironment):
         SConsEnvironment.Default(self, res)
         resources.append(res)
 
-    def BlenderLib(self=None, libname=None, sources=None, includes=[], defines=[], libtype='common', priority = 100, compileflags=None, cc_compileflags=None, cxx_compileflags=None):
+    def BlenderLib(self=None, libname=None, sources=None, includes=[], defines=[], libtype='common', priority = 100, compileflags=None, cc_compileflags=None, cxx_compileflags=None, cc_compilerchange=None, cxx_compilerchange=None):
         global vcp
         if not self or not libname or not sources:
             print bc.FAIL+'Cannot continue. Missing argument for BuildBlenderLib '+libname+bc.ENDC
@@ -722,6 +738,10 @@ class BlenderEnvironment(SConsEnvironment):
                 lenv.Replace(CCFLAGS = cc_compileflags)
             if cxx_compileflags:
                 lenv.Replace(CXXFLAGS = cxx_compileflags)
+            if cc_compilerchange:
+                lenv.Replace(CC = cc_compilerchange)
+            if cxx_compilerchange:
+                lenv.Replace(CXX = cxx_compilerchange)
             lenv.Append(CFLAGS = lenv['C_WARN'])
             lenv.Append(CCFLAGS = lenv['CC_WARN'])
             lenv.Append(CXXFLAGS = lenv['CXX_WARN'])
@@ -764,7 +784,7 @@ class BlenderEnvironment(SConsEnvironment):
         if lenv['OURPLATFORM'] in ('win32-vc', 'cygwin', 'win64-vc'):
             if lenv['BF_DEBUG']:
                 lenv.Prepend(LINKFLAGS = ['/DEBUG','/PDB:'+progname+'.pdb','/NODEFAULTLIB:libcmt'])
-        if  lenv['OURPLATFORM']=='linux2':
+        if  lenv['OURPLATFORM']=='linux':
             if lenv['WITH_BF_PYTHON']:
                 lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
         if  lenv['OURPLATFORM']=='sunos5':