diff options
-rw-r--r-- | SConstruct | 60 | ||||
-rw-r--r-- | source/blender/src/SConscript | 18 | ||||
-rwxr-xr-x | tools/btools.py | 53 |
3 files changed, 32 insertions, 99 deletions
diff --git a/SConstruct b/SConstruct index 2a8adac2338..8f1ab1d2529 100644 --- a/SConstruct +++ b/SConstruct @@ -74,8 +74,8 @@ if not use_color=='1': #on defaut white Os X terminal, some colors are totally unlegible if platform=='darwin': - B.bc.OKGREEN = '\033[34m' - B.bc.WARNING = '\033[36m' + B.bc.OKGREEN = '\033[34m' + B.bc.WARNING = '\033[36m' # arguments print B.bc.HEADER+'Command-line arguments'+B.bc.ENDC @@ -115,6 +115,8 @@ if toolset: env.Tool('mstoolkit', ['tools']) else: env = BlenderEnvironment(tools=[toolset], ENV = os.environ) + if env: + btools.SetupSpawn(env) else: env = BlenderEnvironment(ENV = os.environ) @@ -122,7 +124,7 @@ if not env: print "Could not create a build environment" Exit() -env.SConscriptChdir(0) + cc = B.arguments.get('CC', None) cxx = B.arguments.get('CXX', None) if cc: @@ -135,53 +137,7 @@ if env['CC'] in ['cl', 'cl.exe'] and sys.platform=='win32': elif env['CC'] in ['gcc'] and sys.platform=='win32': platform = 'win32-mingw' -# Fix me! -#if platform == 'win32-mingw': -if 0: - try: - import win32file - import win32event - import win32process - import win32security - import string - - slash= re.compile(r"\\") - - def myesc(b): - if b[0]!= "-": - b = slash.sub(r"\\\\", b[1:-1]) - return "\"" + b + "\"" - else: - return b - - def my_spawn(sh, escape, cmd, args, spawnenv): - for var in spawnenv: - spawnenv[var] = spawnenv[var].encode('ascii', 'replace') - - sAttrs = win32security.SECURITY_ATTRIBUTES() - StartupInfo = win32process.STARTUPINFO() - if cmd=='ar' and args[1]=='r': - args[1] = '-r' - newargs = string.join(map(myesc, args[1:]), ' ') - cmdline = cmd + " " + newargs - - # check for any special operating system commands - if cmd == 'del': - for arg in args[1:]: - win32file.DeleteFile(arg) - exit_code = 0 - else: - # otherwise execute the command. - hProcess, hThread, dwPid, dwTid = win32process.CreateProcess(None, cmdline, None, None, 1, 0, spawnenv, None, StartupInfo) - win32event.WaitForSingleObject(hProcess, win32event.INFINITE) - exit_code = win32process.GetExitCodeProcess(hProcess) - win32file.CloseHandle(hProcess); - win32file.CloseHandle(hThread); - return exit_code - - env['SPAWN'] = my_spawn - except: - print "install win32all from http://sourceforge.net/project/showfiles.php?group_id=78018" +env.SConscriptChdir(0) crossbuild = B.arguments.get('BF_CROSS', None) if crossbuild and platform!='win32': @@ -285,7 +241,7 @@ def NSIS_Installer(): Exit() install_base_dir = os.getcwd() + "\\" - + if not os.path.exists(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include'): os.mkdir(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include') @@ -484,8 +440,6 @@ B.init_lib_dict() ##### END SETUP ########## Export('env') -#Export('root_build_dir') # this one is still needed for makesdna -##TODO: improve makesdna usage BuildDir(B.root_build_dir+'/intern', 'intern', duplicate=0) SConscript(B.root_build_dir+'/intern/SConscript') diff --git a/source/blender/src/SConscript b/source/blender/src/SConscript index 815cf532c88..729e79dcb6f 100644 --- a/source/blender/src/SConscript +++ b/source/blender/src/SConscript @@ -4,18 +4,6 @@ Import ('env') # TODO: src_env.Append (CCFLAGS = user_options_dict['SDL_CFLAGS']) sources = env.Glob('*.c') -numobj = len(sources) -maxobj = 30 - -numlibs = numobj / maxobj -if (numobj % maxobj): - numlibs = numlibs + 1 -subsources = [] - -if (env['OURPLATFORM'] == 'win32-mingw'): - for i in range(numlibs - 1): - subsources.append(sources[i*maxobj:(i+1)*maxobj]) - subsources.append(sources[(numlibs-1)*maxobj:]) incs = ' #/intern/guardedalloc #/intern/memutil' incs += ' ../blenlib ../makesdna ../blenkernel' @@ -67,8 +55,4 @@ if env['WITH_BF_VERSE']: if env['BF_BUILDINFO'] == 1: defs.append('NAN_BUILDINFO') -if (env['OURPLATFORM'] == 'win32-mingw'): - for i in range(numlibs): - env.BlenderLib ( libname = 'src%d' % (i), sources = subsources[i], includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] ) -else: - env.BlenderLib ( libname = 'src', sources = sources, includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] ) +env.BlenderLib ( libname = 'src', sources = sources, includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] ) diff --git a/tools/btools.py b/tools/btools.py index fba884ed09b..cf936a95e26 100755 --- a/tools/btools.py +++ b/tools/btools.py @@ -1,7 +1,9 @@ -import sys -import StringIO +import os +import os.path import SCons.Options import SCons.Options.BoolOption +import subprocess +import string Options = SCons.Options BoolOption = SCons.Options.BoolOption @@ -84,33 +86,26 @@ def validate_targets(targs, bc): print '\t'+bc.WARNING+'Invalid target: '+bc.ENDC+t return oklist - - -class idBuffering: - def buffered_spawn( self, sh, escape, cmd, args, env ): - stderr = StringIO.StringIO() - stdout = StringIO.StringIO() - command_string = '' - for i in args: - if ( len( command_string ) ): - command_string += ' ' - command_string += i - try: - retval = self.env['PSPAWN']( sh, escape, cmd, args, env, stdout, stderr ) - except OSError, x: - if x.errno != 10: - raise x - print 'OSError ignored on command: %s' % command_string - retval = 0 - sys.stdout.write( stdout.getvalue() ) - sys.stderr.write( stderr.getvalue() ) - return retval - -# get a clean error output when running multiple jobs -def SetupBufferedOutput( env ): - buf = idBuffering() - buf.env = env - env['SPAWN'] = buf.buffered_spawn +class ourSpawn: + def ourspawn(self, sh, escape, cmd, args, env): + newargs = string.join(args[1:], ' ') + cmdline = cmd + " " + newargs + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW + proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False) + data, err = proc.communicate() + rv = proc.wait() + if rv: + print "=====" + print err + print "=====" + return rv + +def SetupSpawn( env ): + buf = ourSpawn() + buf.ourenv = env + env['SPAWN'] = buf.ourspawn def read_opts(cfg, args): |