This is a temporary file. Eventually, if this works, it will become the new makepanda.

This commit is contained in:
Josh Yelon 2007-11-07 06:24:39 +00:00
parent 05f73ce836
commit b595e97994
2 changed files with 4490 additions and 39 deletions

View File

@ -46,20 +46,23 @@ MAXSDK = {}
MAXSDKCS = {} MAXSDKCS = {}
PYTHONSDK=0 PYTHONSDK=0
STARTTIME=time.time() STARTTIME=time.time()
SLAVEFILE=0 THREADCOUNT=1
DEPENDENCYQUEUE=[]
TIMESTAMPCACHE = {}
FINDSOURCESTUBS = {}
BUILTFROMCACHE = {}
CXXINCLUDECACHE = {}
THREADCOUNT=0
DXVERSIONS=["8","9"] DXVERSIONS=["8","9"]
MAYAVERSIONS=["6","65","7","8","85"] MAYAVERSIONS=["6","65","7","8","85"]
MAXVERSIONS=["6","7","8","9"] MAXVERSIONS=["6","7","8","9"]
ICACHEPATH="built/tmp/makepanda-dcache"
INTERRUPT=0
MAINTHREAD=threading.currentThread() MAINTHREAD=threading.currentThread()
##########################################################################################
#
# Global State
#
##########################################################################################
TIMESTAMPCACHE = {}
DEPENDENCYQUEUE=[]
BUILTFROMCACHE = {}
CXXINCLUDECACHE = {}
########################################################################################## ##########################################################################################
# #
# If there is a makepandaPreferences.py, import it # If there is a makepandaPreferences.py, import it
@ -189,7 +192,7 @@ def CxxGetIncludes(path):
######################################################################## ########################################################################
def SaveDependencyCache(): def SaveDependencyCache():
try: icache = open(ICACHEPATH,'wb') try: icache = open("built/tmp/makepanda-dcache",'wb')
except: icache = 0 except: icache = 0
if (icache!=0): if (icache!=0):
print "Storing dependency cache." print "Storing dependency cache."
@ -200,7 +203,7 @@ def SaveDependencyCache():
def LoadDependencyCache(): def LoadDependencyCache():
global CXXINCLUDECACHE global CXXINCLUDECACHE
global BUILTFROMCACHE global BUILTFROMCACHE
try: icache = open(ICACHEPATH,'rb') try: icache = open("built/tmp/makepanda-dcache",'rb')
except: icache = 0 except: icache = 0
if (icache!=0): if (icache!=0):
CXXINCLUDECACHE = cPickle.load(icache) CXXINCLUDECACHE = cPickle.load(icache)
@ -464,7 +467,6 @@ def usage(problem):
print " --v2 X (set the minor version number)" print " --v2 X (set the minor version number)"
print " --v3 X (set the sequence version number)" print " --v3 X (set the sequence version number)"
print " --lzma (use lzma compression when building installer)" print " --lzma (use lzma compression when building installer)"
print " --slaves X (use the distributed build system. see manual)"
print " --threads N (use the multithreaded build system. see manual)" print " --threads N (use the multithreaded build system. see manual)"
print "" print ""
for pkg in PACKAGES: for pkg in PACKAGES:
@ -485,11 +487,11 @@ def usage(problem):
def parseopts(args): def parseopts(args):
global OPTIMIZE,OMIT,INSTALLER,GENMAN global OPTIMIZE,OMIT,INSTALLER,GENMAN
global VERSION,COMPRESSOR,VERBOSE,SLAVEFILE,THREADCOUNT global VERSION,COMPRESSOR,VERBOSE,THREADCOUNT
longopts = [ longopts = [
"help","package-info", "help","package-info",
"optimize=","everything","nothing","installer","quiet","verbose", "optimize=","everything","nothing","installer","quiet","verbose",
"version=","lzma","no-python","slaves=","threads="] "version=","lzma","no-python","threads="]
anything = 0 anything = 0
for pkg in PACKAGES: longopts.append("no-"+pkg.lower()) for pkg in PACKAGES: longopts.append("no-"+pkg.lower())
for pkg in PACKAGES: longopts.append("use-"+pkg.lower()) for pkg in PACKAGES: longopts.append("use-"+pkg.lower())
@ -504,7 +506,6 @@ def parseopts(args):
elif (option=="--genman"): GENMAN=1 elif (option=="--genman"): GENMAN=1
elif (option=="--everything"): OMIT=[] elif (option=="--everything"): OMIT=[]
elif (option=="--nothing"): OMIT=PACKAGES[:] elif (option=="--nothing"): OMIT=PACKAGES[:]
elif (option=="--slaves"): SLAVEFILE=value
elif (option=="--threads"): THREADCOUNT=int(value) elif (option=="--threads"): THREADCOUNT=int(value)
elif (option=="--version"): elif (option=="--version"):
VERSION=value VERSION=value
@ -1336,7 +1337,7 @@ def CompileLink(dll, obj, opts, ldef):
wdll = FindLocation(dll, []) wdll = FindLocation(dll, [])
if (COMPILER=="MSVC"): if (COMPILER=="MSVC"):
cmd = 'link /nologo /NOD:MFC80.LIB /NOD:LIBCI.LIB /NOD:MSVCRTD.LIB /DEBUG ' cmd = 'link /nologo /NOD:MFC80.LIB /NOD:LIBCI.LIB /NOD:MSVCRTD.LIB /DEBUG '
if (THIRDPARTYLIBS=="thirdparty/win-libs-vc8/"): cmd = cmd + " /nod:libc /nod:libcmtd /nod:atlthunk" cmd = cmd + " /nod:libc /nod:libcmtd /nod:atlthunk"
if (wdll.endswith(".exe")==0): cmd = cmd + " /DLL" if (wdll.endswith(".exe")==0): cmd = cmd + " /DLL"
optlevel = getoptlevel(opts,OPTIMIZE) optlevel = getoptlevel(opts,OPTIMIZE)
if (optlevel==1): cmd = cmd + " /MAP /MAPINFO:EXPORTS" if (optlevel==1): cmd = cmd + " /MAP /MAPINFO:EXPORTS"
@ -4569,8 +4570,7 @@ if (OMIT.count("PANDATOOL")==0):
# #
########################################################################################## ##########################################################################################
def BuildWorker(taskqueue, donequeue, slave): def BuildWorker(taskqueue, donequeue):
print "Slave online: "+slave
while (1): while (1):
task = taskqueue.get() task = taskqueue.get()
sys.stdout.flush() sys.stdout.flush()
@ -4593,10 +4593,6 @@ def AllSourcesReady(task, pending):
return 1 return 1
def ParallelMake(tasklist): def ParallelMake(tasklist):
# Read the slave-file.
slaves = []
for i in range(THREADCOUNT):
slaves.append("local")
# create the communication queues. # create the communication queues.
donequeue=Queue.Queue() donequeue=Queue.Queue()
taskqueue=Queue.Queue() taskqueue=Queue.Queue()
@ -4606,17 +4602,17 @@ def ParallelMake(tasklist):
for target in task[2]: for target in task[2]:
pending[target] = 1 pending[target] = 1
# create the workers # create the workers
for slave in slaves: for slave in range(THREADCOUNT):
th = threading.Thread(target=BuildWorker, args=[taskqueue,donequeue,slave]) th = threading.Thread(target=BuildWorker, args=[taskqueue,donequeue])
th.setDaemon(1) th.setDaemon(1)
th.start() th.start()
# feed tasks to the workers. # feed tasks to the workers.
tasksqueued = 0 tasksqueued = 0
while (1): while (1):
if (tasksqueued < len(slaves)*2): if (tasksqueued < THREADCOUNT*2):
extras = [] extras = []
for task in tasklist: for task in tasklist:
if (tasksqueued < len(slaves)*3) & (AllSourcesReady(task, pending)): if (tasksqueued < THREADCOUNT*3) & (AllSourcesReady(task, pending)):
if (NeedsBuild(task[2], task[3])): if (NeedsBuild(task[2], task[3])):
tasksqueued += 1 tasksqueued += 1
taskqueue.put(task) taskqueue.put(task)
@ -4637,25 +4633,14 @@ def ParallelMake(tasklist):
for target in donetask[2]: for target in donetask[2]:
del pending[target] del pending[target]
# kill the workers. # kill the workers.
for slave in slaves: for slave in range(THREADCOUNT):
taskqueue.put(0) taskqueue.put(0)
# make sure there aren't any unsatisfied tasks # make sure there aren't any unsatisfied tasks
if (len(tasklist)>0): if (len(tasklist)>0):
exit("Dependency problem - task unsatisfied: "+str(tasklist[0][2])) exit("Dependency problem - task unsatisfied: "+str(tasklist[0][2]))
def SequentialMake(tasklist):
for task in tasklist:
if (NeedsBuild(task[2], task[3])):
apply(task[0], task[1])
JustBuilt(task[2], task[3])
def RunDependencyQueue(tasklist): ParallelMake(DEPENDENCYQUEUE)
if (THREADCOUNT!=0):
ParallelMake(tasklist)
else:
SequentialMake(tasklist)
RunDependencyQueue(DEPENDENCYQUEUE)
########################################################################################## ##########################################################################################
# #

File diff suppressed because it is too large Load Diff