Skip to content

Commit 69eab74

Browse files
committed
makepanda: changes to support static building better
Fixes LP 1081784
1 parent fa1c480 commit 69eab74

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

makepanda/makepanda.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,9 @@ def CompileLib(lib, obj, opts):
15151515
if HasTargetArch():
15161516
cmd += " /MACHINE:" + GetTargetArch().upper()
15171517
cmd += ' /OUT:' + BracketNameWithQuotes(lib)
1518-
for x in obj: cmd += ' ' + BracketNameWithQuotes(x)
1518+
for x in obj:
1519+
if not x.endswith('.lib'):
1520+
cmd += ' ' + BracketNameWithQuotes(x)
15191521
oscmd(cmd)
15201522
else:
15211523
# Choose Intel linker; from Jean-Claude
@@ -1568,6 +1570,21 @@ def CompileLink(dll, obj, opts):
15681570
cmd += " /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO "
15691571
cmd += ' /OUT:' + BracketNameWithQuotes(dll)
15701572

1573+
if not PkgSkip("PYTHON"):
1574+
# If we're building without Python, don't pick it up implicitly.
1575+
if "PYTHON" not in opts:
1576+
pythonv = SDK["PYTHONVERSION"].replace('.', '')
1577+
if optlevel <= 2:
1578+
cmd += ' /NOD:{}d.lib'.format(pythonv)
1579+
else:
1580+
cmd += ' /NOD:{}.lib'.format(pythonv)
1581+
1582+
# Yes, we know we are importing "locally defined symbols".
1583+
for x in obj:
1584+
if x.endswith('libp3pystub.lib'):
1585+
cmd += ' /ignore:4049,4217'
1586+
break
1587+
15711588
# Set the subsystem. Specify that we want to target Windows XP.
15721589
subsystem = GetValueOption(opts, "SUBSYSTEM:") or "CONSOLE"
15731590
cmd += " /SUBSYSTEM:" + subsystem
@@ -2691,7 +2708,7 @@ def CreatePandaVersionFiles():
26912708
import os
26922709
26932710
bindir = os.path.join(os.path.dirname(__file__), '..', 'bin')
2694-
if os.path.isfile(os.path.join(bindir, 'libpanda.dll')):
2711+
if os.path.isdir(bindir):
26952712
if not os.environ.get('PATH'):
26962713
os.environ['PATH'] = bindir
26972714
else:

makepanda/makepandacore.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3157,6 +3157,17 @@ def TargetAdd(target, dummy=0, opts=[], input=[], dep=[], ipath=None, winrc=None
31573157
for d in CxxCalcDependencies(fullinput, ipath, []):
31583158
t.deps[d] = 1
31593159

3160+
# If we are linking statically, add the source DLL's dynamic dependencies.
3161+
if GetLinkAllStatic() and ORIG_EXT[fullinput] == '.lib' and fullinput in TARGET_TABLE:
3162+
tdep = TARGET_TABLE[fullinput]
3163+
for y in tdep.inputs:
3164+
if ORIG_EXT[y] == '.lib':
3165+
t.inputs.append(y)
3166+
3167+
for opt, _ in LIBNAMES + LIBDIRECTORIES + FRAMEWORKDIRECTORIES:
3168+
if opt in tdep.opts and opt not in t.opts:
3169+
t.opts.append(opt)
3170+
31603171
if x.endswith(".in"):
31613172
# Mark the _igate.cxx file as a dependency also.
31623173
outbase = os.path.basename(x)[:-3]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy