diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 375132d6ef..59c163a4c3 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -30,7 +30,6 @@ from installpanda import * ######################################################################## COMPILER=0 -VC90CRTVERSION="" INSTALLER=0 GENMAN=0 COMPRESSOR="zlib" @@ -289,7 +288,7 @@ if (COMPILER=="MSVC"): elif (pkg[:2]=="DX"): IncDirectory(pkg, SDK[pkg] + "/include") else: - IncDirectory(pkg, THIRDPARTYLIBS + pkg.lower() + "/include") + IncDirectory(pkg, GetThirdpartyDir() + pkg.lower() + "/include") for pkg in DXVERSIONS: if (PkgSkip(pkg)==0): vnum=pkg[2:] @@ -320,35 +319,35 @@ if (COMPILER=="MSVC"): if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "quartz.lib") if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "odbc32.lib") if (PkgSkip("DIRECTCAM")==0): LibName("DIRECTCAM", "odbccp32.lib") - if (PkgSkip("PNG")==0): LibName("PNG", THIRDPARTYLIBS + "png/lib/libpandapng.lib") - if (PkgSkip("JPEG")==0): LibName("JPEG", THIRDPARTYLIBS + "jpeg/lib/libpandajpeg.lib") - if (PkgSkip("TIFF")==0): LibName("TIFF", THIRDPARTYLIBS + "tiff/lib/libpandatiff.lib") - if (PkgSkip("ZLIB")==0): LibName("ZLIB", THIRDPARTYLIBS + "zlib/lib/libpandazlib1.lib") - if (PkgSkip("VRPN")==0): LibName("VRPN", THIRDPARTYLIBS + "vrpn/lib/vrpn.lib") - if (PkgSkip("VRPN")==0): LibName("VRPN", THIRDPARTYLIBS + "vrpn/lib/quat.lib") - if (PkgSkip("FMODEX")==0): LibName("FMODEX", THIRDPARTYLIBS + "fmodex/lib/fmodex_vc.lib") - if (PkgSkip("OPENAL")==0): LibName("OPENAL", THIRDPARTYLIBS + "openal/lib/pandaopenal32.lib") - if (PkgSkip("NVIDIACG")==0): LibName("CGGL", THIRDPARTYLIBS + "nvidiacg/lib/cgGL.lib") - if (PkgSkip("NVIDIACG")==0): LibName("CGDX9", THIRDPARTYLIBS + "nvidiacg/lib/cgD3D9.lib") - if (PkgSkip("NVIDIACG")==0): LibName("NVIDIACG", THIRDPARTYLIBS + "nvidiacg/lib/cg.lib") - if (PkgSkip("OPENSSL")==0): LibName("OPENSSL", THIRDPARTYLIBS + "openssl/lib/libpandassl.lib") - if (PkgSkip("OPENSSL")==0): LibName("OPENSSL", THIRDPARTYLIBS + "openssl/lib/libpandaeay.lib") - if (PkgSkip("FREETYPE")==0): LibName("FREETYPE", THIRDPARTYLIBS + "freetype/lib/freetype.lib") - if (PkgSkip("FFTW")==0): LibName("FFTW", THIRDPARTYLIBS + "fftw/lib/rfftw.lib") - if (PkgSkip("FFTW")==0): LibName("FFTW", THIRDPARTYLIBS + "fftw/lib/fftw.lib") - if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", THIRDPARTYLIBS + "ffmpeg/lib/avcodec-51-panda.lib") - if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", THIRDPARTYLIBS + "ffmpeg/lib/avformat-50-panda.lib") - if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", THIRDPARTYLIBS + "ffmpeg/lib/avutil-49-panda.lib") - if (PkgSkip("ARTOOLKIT")==0):LibName("ARTOOLKIT",THIRDPARTYLIBS + "artoolkit/lib/libAR.lib") - if (PkgSkip("ODE")==0): LibName("ODE", THIRDPARTYLIBS + "ode/lib/ode.lib") - if (PkgSkip("FCOLLADA")==0): LibName("FCOLLADA", THIRDPARTYLIBS + "fcollada/lib/FCollada.lib") - if (PkgSkip("SQUISH")==0): LibName("SQUISH", THIRDPARTYLIBS + "squish/lib/squish.lib") - if (PkgSkip("OPENCV")==0): LibName("OPENCV", THIRDPARTYLIBS + "opencv/lib/cv.lib") - if (PkgSkip("OPENCV")==0): LibName("OPENCV", THIRDPARTYLIBS + "opencv/lib/highgui.lib") - if (PkgSkip("OPENCV")==0): LibName("OPENCV", THIRDPARTYLIBS + "opencv/lib/cvaux.lib") - if (PkgSkip("OPENCV")==0): LibName("OPENCV", THIRDPARTYLIBS + "opencv/lib/ml.lib") - if (PkgSkip("OPENCV")==0): LibName("OPENCV", THIRDPARTYLIBS + "opencv/lib/cxcore.lib") - if (PkgSkip("TINYXML")==0): LibName("TINYXML", THIRDPARTYLIBS + "tinyxml/lib/tinyxml.lib") + if (PkgSkip("PNG")==0): LibName("PNG", GetThirdpartyDir() + "png/lib/libpandapng.lib") + if (PkgSkip("JPEG")==0): LibName("JPEG", GetThirdpartyDir() + "jpeg/lib/libpandajpeg.lib") + if (PkgSkip("TIFF")==0): LibName("TIFF", GetThirdpartyDir() + "tiff/lib/libpandatiff.lib") + if (PkgSkip("ZLIB")==0): LibName("ZLIB", GetThirdpartyDir() + "zlib/lib/libpandazlib1.lib") + if (PkgSkip("VRPN")==0): LibName("VRPN", GetThirdpartyDir() + "vrpn/lib/vrpn.lib") + if (PkgSkip("VRPN")==0): LibName("VRPN", GetThirdpartyDir() + "vrpn/lib/quat.lib") + if (PkgSkip("FMODEX")==0): LibName("FMODEX", GetThirdpartyDir() + "fmodex/lib/fmodex_vc.lib") + if (PkgSkip("OPENAL")==0): LibName("OPENAL", GetThirdpartyDir() + "openal/lib/pandaopenal32.lib") + if (PkgSkip("NVIDIACG")==0): LibName("CGGL", GetThirdpartyDir() + "nvidiacg/lib/cgGL.lib") + if (PkgSkip("NVIDIACG")==0): LibName("CGDX9", GetThirdpartyDir() + "nvidiacg/lib/cgD3D9.lib") + if (PkgSkip("NVIDIACG")==0): LibName("NVIDIACG", GetThirdpartyDir() + "nvidiacg/lib/cg.lib") + if (PkgSkip("OPENSSL")==0): LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libpandassl.lib") + if (PkgSkip("OPENSSL")==0): LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libpandaeay.lib") + if (PkgSkip("FREETYPE")==0): LibName("FREETYPE", GetThirdpartyDir() + "freetype/lib/freetype.lib") + if (PkgSkip("FFTW")==0): LibName("FFTW", GetThirdpartyDir() + "fftw/lib/rfftw.lib") + if (PkgSkip("FFTW")==0): LibName("FFTW", GetThirdpartyDir() + "fftw/lib/fftw.lib") + if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", GetThirdpartyDir() + "ffmpeg/lib/avcodec-51-panda.lib") + if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", GetThirdpartyDir() + "ffmpeg/lib/avformat-50-panda.lib") + if (PkgSkip("FFMPEG")==0): LibName("FFMPEG", GetThirdpartyDir() + "ffmpeg/lib/avutil-49-panda.lib") + if (PkgSkip("ARTOOLKIT")==0):LibName("ARTOOLKIT",GetThirdpartyDir() + "artoolkit/lib/libAR.lib") + if (PkgSkip("ODE")==0): LibName("ODE", GetThirdpartyDir() + "ode/lib/ode.lib") + if (PkgSkip("FCOLLADA")==0): LibName("FCOLLADA", GetThirdpartyDir() + "fcollada/lib/FCollada.lib") + if (PkgSkip("SQUISH")==0): LibName("SQUISH", GetThirdpartyDir() + "squish/lib/squish.lib") + if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cv.lib") + if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/highgui.lib") + if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cvaux.lib") + if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/ml.lib") + if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cxcore.lib") + if (PkgSkip("TINYXML")==0): LibName("TINYXML", GetThirdpartyDir() + "tinyxml/lib/tinyxml.lib") for pkg in MAYAVERSIONS: if (PkgSkip(pkg)==0): LibName(pkg, '"' + SDK[pkg] + '/lib/Foundation.lib"') @@ -768,7 +767,7 @@ def CompileLink(dll, obj, opts): for (opt, name) in LIBNAMES: if (opt=="ALWAYS") or (opts.count(opt)): cmd += " " + BracketNameWithQuotes(name) oscmd(cmd) - SetVC90CRTVersion(dll+".manifest", VC90CRTVERSION) + SetVC90CRTVersion(dll+".manifest") mtcmd = "mt -manifest " + dll + ".manifest -outputresource:" + dll if (dll.endswith(".exe")==0): mtcmd = mtcmd + ";2" else: mtcmd = mtcmd + ";1" @@ -1435,14 +1434,14 @@ ConditionalWriteFile(GetOutputDir()+"/etc/Confauto.prc", confautoprc) for pkg in PkgListGet(): if (PkgSkip(pkg)==0): if (COMPILER == "MSVC"): - if (os.path.exists(THIRDPARTYLIBS+pkg.lower()+"/bin")): - CopyAllFiles(GetOutputDir()+"/bin/",THIRDPARTYLIBS+pkg.lower()+"/bin/") + if (os.path.exists(GetThirdpartyDir()+pkg.lower()+"/bin")): + CopyAllFiles(GetOutputDir()+"/bin/",GetThirdpartyDir()+pkg.lower()+"/bin/") if (COMPILER == "LINUX"): - if (os.path.exists(THIRDPARTYLIBS+pkg.lower()+"/lib")): - CopyAllFiles(GetOutputDir()+"/lib/",THIRDPARTYLIBS+pkg.lower()+"/lib/") + if (os.path.exists(GetThirdpartyDir()+pkg.lower()+"/lib")): + CopyAllFiles(GetOutputDir()+"/lib/",GetThirdpartyDir()+pkg.lower()+"/lib/") if (COMPILER=="MSVC"): - CopyAllFiles(GetOutputDir()+"/bin/", THIRDPARTYLIBS+"extras"+"/bin/") + CopyAllFiles(GetOutputDir()+"/bin/", GetThirdpartyDir()+"extras"+"/bin/") if (sys.platform.startswith("win")): if (PkgSkip("PYTHON")==0): pydll = "/" + SDK["PYTHONVERSION"].replace(".", "") diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 2f80155247..519da6bf8b 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -19,6 +19,7 @@ STARTTIME=time.time() MAINTHREAD=threading.currentThread() OUTPUTDIR="built" CUSTOM_OUTPUTDIR=False +THIRDPARTYDIR=None OPTIMIZE="3" VERBOSE=False @@ -644,58 +645,6 @@ def CreateFile(file): if (os.path.exists(file)==0): WriteFile(file,"") -######################################################################## -## -## Visual Studio Manifest Manipulation. -## -######################################################################## - -VC90CRTVERSIONRE=re.compile("name=['\"]Microsoft.VC90.CRT['\"]\\s+version=['\"]([0-9.]+)['\"]") - -def GetVC90CRTVersion(fn): - manifest = ReadFile(fn) - version = VC90CRTVERSIONRE.search(manifest) - if (version == None): - exit("Cannot locate version number in "+fn) - return version.group(1) - -def SetVC90CRTVersion(fn, ver): - manifest = ReadFile(fn) - subst = " name='Microsoft.VC90.CRT' version='"+ver+"' " - manifest = VC90CRTVERSIONRE.sub(subst, manifest) - WriteFile(fn, manifest) - -######################################################################## -## -## Thirdparty libraries paths -## -######################################################################## - -if (sys.platform == "win32"): - if (platform.architecture()[0] == "64bit"): - THIRDPARTYLIBS="thirdparty/win-libs-vc9-x64/" - else: - THIRDPARTYLIBS="thirdparty/win-libs-vc9/" - if not os.path.isdir(THIRDPARTYLIBS): - THIRDPARTYLIBS="thirdparty/win-libs-vc9/" - VC90CRTVERSION = GetVC90CRTVersion(THIRDPARTYLIBS+"extras/bin/Microsoft.VC90.CRT.manifest") -else: - if (sys.platform == "darwin"): - THIRDPARTYLIBS="thirdparty/darwin-libs-a/" - elif (sys.platform.startswith("linux")): - if (platform.architecture()[0] == "64bit"): - THIRDPARTYLIBS="thirdparty/linux-libs-x64/" - else: - THIRDPARTYLIBS="thirdparty/linux-libs-a/" - elif (sys.platform.startswith("freebsd")): - if (platform.architecture()[0] == "64bit"): - THIRDPARTYLIBS="thirdparty/freebsd-libs-x64/" - else: - THIRDPARTYLIBS="thirdparty/freebsd-libs-a/" - else: - exit("Unknown platform: %s" % sys.platform) - VC90CRTVERSION = 0 - ######################################################################## # # Create the panda build tree. @@ -733,6 +682,71 @@ def CheckPandaSourceTree(): (os.path.exists(os.path.join(dir, "panda","src","pandabase","pandabase.h"))==0)): exit("Current directory is not the root of the panda tree.") +######################################################################## +## +## Thirdparty libraries paths +## +######################################################################## + +def GetThirdpartyDir(): + global THIRDPARTYDIR + if (THIRDPARTYDIR != None): + return THIRDPARTYDIR + if (sys.platform.startswith("win")): + if (platform.architecture()[0] == "64bit"): + THIRDPARTYDIR="thirdparty/win-libs-vc9-x64/" + else: + THIRDPARTYDIR="thirdparty/win-libs-vc9/" + if not os.path.isdir(THIRDPARTYDIR): + THIRDPARTYDIR="thirdparty/win-libs-vc9/" + elif (sys.platform == "darwin"): + THIRDPARTYDIR="thirdparty/darwin-libs-a/" + elif (sys.platform.startswith("linux")): + if (platform.architecture()[0] == "64bit"): + THIRDPARTYDIR="thirdparty/linux-libs-x64/" + else: + THIRDPARTYDIR="thirdparty/linux-libs-a/" + elif (sys.platform.startswith("freebsd")): + if (platform.architecture()[0] == "64bit"): + THIRDPARTYDIR="thirdparty/freebsd-libs-x64/" + else: + THIRDPARTYDIR="thirdparty/freebsd-libs-a/" + else: + print GetColor("red") + "WARNING:" + GetColor("Unsupported platform: " + sys.platform) + return THIRDPARTYDIR + +######################################################################## +## +## Visual Studio Manifest Manipulation. +## +######################################################################## + +VC90CRTVERSIONRE=re.compile("name=['\"]Microsoft.VC90.CRT['\"]\\s+version=['\"]([0-9.]+)['\"]") +VC90CRTVERSION=None + +def GetVC90CRTVersion(fn = None): + global VC90CRTVERSION + if (VC90CRTVERSION != None): + return VC90CRTVERSION + if (not sys.platform.startswith("win")): + VC90CRTVERSION = 0 + return 0 + if (fn == None): + fn = GetThirdpartyDir()+"extras/bin/Microsoft.VC90.CRT.manifest" + manifest = ReadFile(fn) + version = VC90CRTVERSIONRE.search(manifest) + if (version == None): + exit("Cannot locate version number in "+fn) + VC90CRTVERSION = version.group(1) + return version.group(1) + +def SetVC90CRTVersion(fn, ver = None): + if (ver == None): ver = GetVC90CRTVersion() + manifest = ReadFile(fn) + subst = " name='Microsoft.VC90.CRT' version='"+ver+"' " + manifest = VC90CRTVERSIONRE.sub(subst, manifest) + WriteFile(fn, manifest) + ######################################################################## ## ## Gets or sets the output directory, by default "built". @@ -976,16 +990,16 @@ def PkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, fram for d in olddefs: defs[d] = "" - if (os.path.isdir(THIRDPARTYLIBS + pkg.lower())): - IncDirectory(pkg, THIRDPARTYLIBS + pkg.lower() + "/include") - LibDirectory(pkg, THIRDPARTYLIBS + pkg.lower() + "/lib") + if (os.path.isdir(GetThirdpartyDir() + pkg.lower())): + IncDirectory(pkg, GetThirdpartyDir() + pkg.lower() + "/include") + LibDirectory(pkg, GetThirdpartyDir() + pkg.lower() + "/lib") for l in libs: libname = l if (l.startswith("lib")): libname = l[3:] # This is for backward compatibility - in the thirdparty dir, we kept some libs with "panda" prefix, like libpandatiff. - if (len(glob.glob(THIRDPARTYLIBS + pkg.lower() + "/lib/libpanda%s.*" % libname)) > 0 and - len(glob.glob(THIRDPARTYLIBS + pkg.lower() + "/lib/lib%s.*" % libname)) == 0): + if (len(glob.glob(GetThirdpartyDir() + pkg.lower() + "/lib/libpanda%s.*" % libname)) > 0 and + len(glob.glob(GetThirdpartyDir() + pkg.lower() + "/lib/lib%s.*" % libname)) == 0): libname = "panda" + libname LibName(pkg, "-l" + libname) for d, v in defs.values():