Browse Source

Whoops, fix build error on windows

rdb 16 years ago
parent
commit
0715e7eb14
1 changed files with 47 additions and 26 deletions
  1. 47 26
      makepanda/makepandacore.py

+ 47 - 26
makepanda/makepandacore.py

@@ -55,6 +55,27 @@ for (ver,key) in MAYAVERSIONINFO:
 for (ver,key1,key2,subdir) in MAXVERSIONINFO:
 for (ver,key1,key2,subdir) in MAXVERSIONINFO:
     MAXVERSIONS.append(ver)
     MAXVERSIONS.append(ver)
 
 
+########################################################################
+##
+## 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
 ## Thirdparty libraries paths
@@ -218,11 +239,14 @@ def oscmd(cmd, ignoreError = False):
         res = os.system(cmd)
         res = os.system(cmd)
         if (res == 11):
         if (res == 11):
             if (LocateBinary("gdb") and GetVerbose()):
             if (LocateBinary("gdb") and GetVerbose()):
-                print GetColor("red") + "Received SIGSEGV, getting traceback..." + GetColor()
+                print GetColor("red") + "Received SIGSEGV, retrieving traceback..." + GetColor()
                 os.system("gdb -batch -ex 'handle SIG33 pass nostop noprint' -ex 'set pagination 0' -ex 'run' -ex 'bt full' -ex 'info registers' -ex 'thread apply all backtrace' -ex 'quit' --args %s < /dev/null" % cmd)
                 os.system("gdb -batch -ex 'handle SIG33 pass nostop noprint' -ex 'set pagination 0' -ex 'run' -ex 'bt full' -ex 'info registers' -ex 'thread apply all backtrace' -ex 'quit' --args %s < /dev/null" % cmd)
             else:
             else:
                 print GetColor("red") + "Received SIGSEGV" + GetColor()
                 print GetColor("red") + "Received SIGSEGV" + GetColor()
     if res != 0 and not ignoreError:
     if res != 0 and not ignoreError:
+        if "interrogate" in cmd.split(" ", 1)[0] and GetVerbose():
+            print GetColor("red") + "Interrogate failed, retrieving debug output..." + GetColor()
+            os.system(cmd.split(" ", 1)[0] + " -v " + cmd.split(" ", 1)[1])
         exit("")
         exit("")
 
 
 ########################################################################
 ########################################################################
@@ -710,27 +734,6 @@ def CheckPandaSourceTree():
         (os.path.exists(os.path.join(dir, "panda","src","pandabase","pandabase.h"))==0)):
         (os.path.exists(os.path.join(dir, "panda","src","pandabase","pandabase.h"))==0)):
         exit("Current directory is not the root of the panda tree.")
         exit("Current directory is not the root of the panda tree.")
 
 
-########################################################################
-##
-## 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)
-
 ########################################################################
 ########################################################################
 ##
 ##
 ## Gets or sets the output directory, by default "built".
 ## Gets or sets the output directory, by default "built".
@@ -909,7 +912,7 @@ def PkgConfigEnable(opt, pkgname, tool = "pkg-config"):
 LD_CACHE = None
 LD_CACHE = None
 STATIC_CACHE = None
 STATIC_CACHE = None
 
 
-def GetLdCache():
+def GetLibCache():
     # Returns a list of cached libraries, not prefixed by lib and not suffixed by .so* or .a!
     # Returns a list of cached libraries, not prefixed by lib and not suffixed by .so* or .a!
     global LD_CACHE
     global LD_CACHE
     if (LD_CACHE == None):
     if (LD_CACHE == None):
@@ -935,8 +938,23 @@ def GetLdCache():
             LD_CACHE.append(lib)
             LD_CACHE.append(lib)
     return LD_CACHE
     return LD_CACHE
 
 
+def ChooseLib(*libs):
+    # Chooses a library from the parameters, in order of preference. Returns the first if none of them were found.
+    for l in libs:
+        libname = l
+        if (l.startswith("lib")):
+            libname = l[3:]
+        if (libname in GetLibCache()):
+            return libname
+        else:
+            print GetColor("cyan") + "Couldn't find library lib" + libname + GetColor()
+    if (len(libs) > 0):
+        return libs[0]
+
 def PkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, framework = None, tool = "pkg-config"):
 def PkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, framework = None, tool = "pkg-config"):
     global PKG_LIST_ALL
     global PKG_LIST_ALL
+    if (pkg in PkgListGet() and PkgSkip(pkg)):
+        return
     if (pkgconfig == ""):
     if (pkgconfig == ""):
         pkgconfig = None
         pkgconfig = None
     if (framework == ""):
     if (framework == ""):
@@ -1011,11 +1029,14 @@ def PkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, fram
         # Okay, our pkg-config attempts failed. Let's try locating the libs by ourselves.
         # Okay, our pkg-config attempts failed. Let's try locating the libs by ourselves.
         have_pkg = True
         have_pkg = True
         for l in libs:
         for l in libs:
-            if (l in GetLdCache()):
-                LibName(pkg, "-l" + l)
+            libname = l
+            if (l.startswith("lib")):
+                libname = l[3:]
+            if (libname in GetLibCache()):
+                LibName(pkg, "-l" + libname)
             else:
             else:
                 if (VERBOSE):
                 if (VERBOSE):
-                    print GetColor("cyan") + "Couldn't find library lib" + l + GetColor()
+                    print GetColor("cyan") + "Couldn't find library lib" + libname + GetColor()
                 have_pkg = False
                 have_pkg = False
         
         
         for i in incs:
         for i in incs: