From 9261a7baad4155d5624c051c2fe44ca5b71b5c20 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 19 Sep 2009 09:05:14 +0000 Subject: [PATCH] - Integrate new plugin certificate tool - Support for wx-config (needed to compile p3dcert) - Added some flags that make sure the windows linker won't accidentally pick up symbols from the debug runtime - Some generic linker fixes --- makepanda/makepanda.py | 21 ++++++++---- makepanda/makepandacore.py | 69 +++++++++++++++++++++++++++++--------- 2 files changed, 69 insertions(+), 21 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 2ee67e3dbc..97e0ecbb50 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -406,6 +406,9 @@ if (COMPILER=="LINUX"): else: exit("Failed to locate pkg-config binary!") + if (LocateBinary("wx-config")): + PkgConfigEnable("WX", "", tool = "wx-config") + if (platform.uname()[1]=="pcbsd"): IncDirectory("ALWAYS", "/usr/PCBSD/local/include") LibDirectory("ALWAYS", "/usr/PCBSD/local/lib") @@ -787,10 +790,10 @@ def CompileLink(dll, obj, opts): cmd += " /nod:libc /nod:libcmtd /nod:atlthunk /nod:atls" if (GetOrigExt(dll) != ".exe"): cmd += " /DLL" optlevel = GetOptimizeOption(opts) - if (optlevel==1): cmd += " /MAP /MAPINFO:EXPORTS /NOD:MSVCRT.LIB" - if (optlevel==2): cmd += " /MAP:NUL /NOD:MSVCRT.LIB" - if (optlevel==3): cmd += " /MAP:NUL /NOD:MSVCRTD.LIB" - if (optlevel==4): cmd += " /MAP:NUL /LTCG /NOD:MSVCRTD.LIB" + if (optlevel==1): cmd += " /MAP /MAPINFO:EXPORTS /NOD:MSVCRT.LIB /NOD:MSVCPRT.LIB /NOD:MSVCIRT.LIB" + if (optlevel==2): cmd += " /MAP:NUL /NOD:MSVCRT.LIB /NOD:MSVCPRT.LIB /NOD:MSVCIRT.LIB" + if (optlevel==3): cmd += " /MAP:NUL /NOD:MSVCRTD.LIB /NOD:MSVCPRTD.LIB /NOD:MSVCIRTD.LIB" + if (optlevel==4): cmd += " /MAP:NUL /LTCG /NOD:MSVCRTD.LIB /NOD:MSVCPRTD.LIB /NOD:MSVCIRTD.LIB" cmd += " /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO " cmd += ' /OUT:' + BracketNameWithQuotes(dll) if (dll.endswith(".dll")): @@ -2980,7 +2983,7 @@ elif (sys.platform == "win32"): TargetAdd('libtinydisplay.dll', opts=['WINIMM', 'WINGDI', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM']) else: TargetAdd('libtinydisplay.dll', input='x11display_composite.obj') - TargetAdd('libtinydisplay.dll', opts=['X11']) + TargetAdd('libtinydisplay.dll', opts=['X11', 'XF86DGA']) TargetAdd('libtinydisplay.dll', input='tinydisplay_composite1.obj') TargetAdd('libtinydisplay.dll', input='tinydisplay_composite2.obj') TargetAdd('libtinydisplay.dll', input='tinydisplay_ztriangle_1.obj') @@ -3196,6 +3199,12 @@ if (RUNTIME): TargetAdd('p3dpython.exe', input=COMMON_PANDA_LIBS) TargetAdd('p3dpython.exe', opts=['PYTHON', 'TINYXML', 'WINUSER']) + if (PkgSkip("OPENSSL")==0): + OPTS=['DIR:direct/src/plugin', 'OPENSSL', 'WX'] + TargetAdd('plugin_p3dCert.obj', opts=OPTS, input='p3dCert.cxx') + TargetAdd('p3dcert.exe', input='plugin_p3dCert.obj') + TargetAdd('p3dcert.exe', opts=['OPENSSL', 'WX', 'CARBON']) + # # DIRECTORY: direct/src/plugin_npapi/ # @@ -4237,7 +4246,7 @@ Priority: optional Architecture: ARCH Essential: no Depends: PYTHONV -Recommends: panda3d-runtime, python-profiler (>= PV) +Recommends: panda3d-runtime, python-wxversion, python-profiler (>= PV) Provides: panda3d Maintainer: etc-panda3d@lists.andrew.cmu.edu Description: The Panda3D free 3D engine diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index c1b6c425bf..2a06dded06 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -772,20 +772,26 @@ if os.path.isfile("direct/src/plugin/p3d_plugin_config.h.moved"): ## ######################################################################## -def PkgConfigHavePkg(pkgname): +def PkgConfigHavePkg(pkgname, tool = "pkg-config"): """Returns a bool whether the pkg-config package is installed.""" if (sys.platform == "win32" or not LocateBinary("pkg-config")): return False - handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --modversion " + pkgname) + if (tool == "pkg-config"): + handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --modversion " + pkgname) + else: + return bool(LocateBinary(tool) != None) result = handle.read().strip() handle.close() return bool(len(result) > 0) -def PkgConfigGetLibs(pkgname): +def PkgConfigGetLibs(pkgname, tool = "pkg-config"): """Returns a list of libs for the package, prefixed by -l.""" if (sys.platform == "win32" or not LocateBinary("pkg-config")): return [] - handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --libs-only-l " + pkgname) + if (tool == "pkg-config"): + handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --libs-only-l " + pkgname) + else: + handle = os.popen(LocateBinary(tool) + " --libs") result = handle.read().strip() handle.close() libs = [] @@ -793,40 +799,73 @@ def PkgConfigGetLibs(pkgname): libs.append(l) return libs -def PkgConfigGetIncDirs(pkgname): +def PkgConfigGetIncDirs(pkgname, tool = "pkg-config"): """Returns a list of includes for the package, NOT prefixed by -I.""" if (sys.platform == "win32" or not LocateBinary("pkg-config")): return [] - handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --cflags-only-I " + pkgname) + if (tool == "pkg-config"): + handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --cflags-only-I " + pkgname) + else: + handle = os.popen(LocateBinary(tool) + " --cflags") result = handle.read().strip() - handle.close() if len(result) == 0: return [] + handle.close() libs = [] for l in result.split(" "): - libs.append(l.replace("-I", "").replace("\"", "").strip()) + if (l.startswith("-I")): + libs.append(l.replace("-I", "").replace("\"", "").strip()) return libs -def PkgConfigGetLibDirs(pkgname): +def PkgConfigGetLibDirs(pkgname, tool = "pkg-config"): """Returns a list of library paths for the package, NOT prefixed by -L.""" if (sys.platform == "win32" or not LocateBinary("pkg-config")): return [] - handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --libs-only-L " + pkgname) + if (tool == "pkg-config"): + handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --libs-only-L " + pkgname) + elif (tool == "wx-config"): + return [] + else: + handle = os.popen(LocateBinary(tool) + " --ldflags") result = handle.read().strip() handle.close() if len(result) == 0: return [] libs = [] for l in result.split(" "): - libs.append(l.replace("-L", "").replace("\"", "").strip()) + if (l.startswith("-L")): + libs.append(l.replace("-L", "").replace("\"", "").strip()) return libs -def PkgConfigEnable(opt, pkgname): +def PkgConfigGetDefSymbols(pkgname, tool = "pkg-config"): + """Returns a dictionary of preprocessor definitions.""" + if (sys.platform == "win32" or not LocateBinary("pkg-config")): + return [] + if (tool == "pkg-config"): + handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --cflags " + pkgname) + else: + handle = os.popen(LocateBinary(tool) + " --cflags") + result = handle.read().strip() + handle.close() + if len(result) == 0: return {} + defs = {} + for l in result.split(" "): + if (l.startswith("-D")): + d = l.replace("-D", "").replace("\"", "").strip().split("=") + if (len(d) == 1): + defs[d[0]] = "" + else: + defs[d[0]] = d[1] + return defs + +def PkgConfigEnable(opt, pkgname, tool = "pkg-config"): """Adds the libraries and includes to IncDirectory, LibName and LibDirectory.""" - for i in PkgConfigGetIncDirs(pkgname): + for i in PkgConfigGetIncDirs(pkgname, tool): IncDirectory(opt, i) - for i in PkgConfigGetLibDirs(pkgname): + for i in PkgConfigGetLibDirs(pkgname, tool): LibDirectory(opt, i) - for i in PkgConfigGetLibs(pkgname): + for i in PkgConfigGetLibs(pkgname, tool): LibName(opt, i) + for i, j in PkgConfigGetDefSymbols(pkgname, tool).items(): + DefSymbol(opt, i, j) ######################################################################## ##