makepanda: changes to support static building better

Fixes LP 1081784
This commit is contained in:
rdb 2017-07-03 13:22:59 +02:00
parent fa1c480508
commit 69eab74b77
2 changed files with 30 additions and 2 deletions

View File

@ -1515,7 +1515,9 @@ def CompileLib(lib, obj, opts):
if HasTargetArch():
cmd += " /MACHINE:" + GetTargetArch().upper()
cmd += ' /OUT:' + BracketNameWithQuotes(lib)
for x in obj: cmd += ' ' + BracketNameWithQuotes(x)
for x in obj:
if not x.endswith('.lib'):
cmd += ' ' + BracketNameWithQuotes(x)
oscmd(cmd)
else:
# Choose Intel linker; from Jean-Claude
@ -1568,6 +1570,21 @@ def CompileLink(dll, obj, opts):
cmd += " /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO "
cmd += ' /OUT:' + BracketNameWithQuotes(dll)
if not PkgSkip("PYTHON"):
# If we're building without Python, don't pick it up implicitly.
if "PYTHON" not in opts:
pythonv = SDK["PYTHONVERSION"].replace('.', '')
if optlevel <= 2:
cmd += ' /NOD:{}d.lib'.format(pythonv)
else:
cmd += ' /NOD:{}.lib'.format(pythonv)
# Yes, we know we are importing "locally defined symbols".
for x in obj:
if x.endswith('libp3pystub.lib'):
cmd += ' /ignore:4049,4217'
break
# Set the subsystem. Specify that we want to target Windows XP.
subsystem = GetValueOption(opts, "SUBSYSTEM:") or "CONSOLE"
cmd += " /SUBSYSTEM:" + subsystem
@ -2691,7 +2708,7 @@ if GetTarget() == 'windows':
import os
bindir = os.path.join(os.path.dirname(__file__), '..', 'bin')
if os.path.isfile(os.path.join(bindir, 'libpanda.dll')):
if os.path.isdir(bindir):
if not os.environ.get('PATH'):
os.environ['PATH'] = bindir
else:

View File

@ -3157,6 +3157,17 @@ def TargetAdd(target, dummy=0, opts=[], input=[], dep=[], ipath=None, winrc=None
for d in CxxCalcDependencies(fullinput, ipath, []):
t.deps[d] = 1
# If we are linking statically, add the source DLL's dynamic dependencies.
if GetLinkAllStatic() and ORIG_EXT[fullinput] == '.lib' and fullinput in TARGET_TABLE:
tdep = TARGET_TABLE[fullinput]
for y in tdep.inputs:
if ORIG_EXT[y] == '.lib':
t.inputs.append(y)
for opt, _ in LIBNAMES + LIBDIRECTORIES + FRAMEWORKDIRECTORIES:
if opt in tdep.opts and opt not in t.opts:
t.opts.append(opt)
if x.endswith(".in"):
# Mark the _igate.cxx file as a dependency also.
outbase = os.path.basename(x)[:-3]