diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 4c06fc4706..b707623ed4 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -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: diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 0999b5a42f..9f42b92580 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -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]