FINALLY! With this commit command-length problems are History. Thanks go to xuru from #scons for giving the nice pointer.
src is now again one lib, and further libsplitting should be rather unnecessary, unless we somehow reach the 37K limit (for internally used CreateProcess, by subprocess module)
#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
env.Tool('mstoolkit', ['tools'])
else:
env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
+ if env:
+ btools.SetupSpawn(env)
else:
env = BlenderEnvironment(ENV = os.environ)
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:
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':
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')
##### 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')
# 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'
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] )
-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
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):