|
|
@@ -57,6 +57,36 @@ for (ver,key) in MAYAVERSIONINFO:
|
|
|
for (ver,key1,key2,subdir) in MAXVERSIONINFO:
|
|
|
MAXVERSIONS.append(ver)
|
|
|
|
|
|
+########################################################################
|
|
|
+##
|
|
|
+## Potentially Conflicting Files
|
|
|
+##
|
|
|
+## The next few functions can automatically move away files that
|
|
|
+## are commonly generated by ppremake that may conflict with the
|
|
|
+## build. When makepanda exits, those files will automatically be
|
|
|
+## put back to their original location.
|
|
|
+##
|
|
|
+########################################################################
|
|
|
+
|
|
|
+CONFLICTING_FILES=["dtool/src/dtoolutil/pandaVersion.h",
|
|
|
+ "dtool/src/dtoolutil/checkPandaVersion.h",
|
|
|
+ "dtool/src/dtoolutil/checkPandaVersion.cxx",
|
|
|
+ "dtool/src/prc/prc_parameters.h",
|
|
|
+ "direct/src/plugin/p3d_plugin_config.h",
|
|
|
+ "direct/src/plugin_activex/P3DActiveX.rc",
|
|
|
+ "direct/src/plugin_npapi/nppanda3d.rc",
|
|
|
+ "direct/src/plugin_standalone/panda3d.rc"]
|
|
|
+
|
|
|
+def MoveAwayConflictingFiles():
|
|
|
+ for cfile in CONFLICTING_FILES:
|
|
|
+ if os.path.exists(cfile):
|
|
|
+ os.rename(cfile, cfile + ".moved")
|
|
|
+
|
|
|
+def MoveBackConflictingFiles():
|
|
|
+ for cfile in CONFLICTING_FILES:
|
|
|
+ if os.path.exists(cfile + ".moved"):
|
|
|
+ os.rename(cfile + ".moved", cfile)
|
|
|
+
|
|
|
########################################################################
|
|
|
##
|
|
|
## The exit routine will normally
|
|
|
@@ -140,19 +170,11 @@ def ProgressOutput(progress, msg, target = None):
|
|
|
print "%s%s%s" % (GetColor("green"), target, GetColor())
|
|
|
|
|
|
def exit(msg = ""):
|
|
|
+ sys.stdout.flush()
|
|
|
+ sys.stderr.flush()
|
|
|
if (threading.currentThread() == MAINTHREAD):
|
|
|
SaveDependencyCache()
|
|
|
- # Move any files we've moved away back.
|
|
|
- if os.path.isfile("dtool/src/dtoolutil/pandaVersion.h.moved"):
|
|
|
- os.rename("dtool/src/dtoolutil/pandaVersion.h.moved", "dtool/src/dtoolutil/pandaVersion.h")
|
|
|
- if os.path.isfile("dtool/src/dtoolutil/checkPandaVersion.h.moved"):
|
|
|
- os.rename("dtool/src/dtoolutil/checkPandaVersion.h.moved", "dtool/src/dtoolutil/checkPandaVersion.h")
|
|
|
- if os.path.isfile("dtool/src/dtoolutil/checkPandaVersion.cxx.moved"):
|
|
|
- os.rename("dtool/src/dtoolutil/checkPandaVersion.cxx.moved", "dtool/src/dtoolutil/checkPandaVersion.cxx")
|
|
|
- if os.path.isfile("dtool/src/prc/prc_parameters.h.moved"):
|
|
|
- os.rename("dtool/src/prc/prc_parameters.h.moved", "dtool/src/prc/prc_parameters.h")
|
|
|
- if os.path.isfile("direct/src/plugin/p3d_plugin_config.h.moved"):
|
|
|
- os.rename("direct/src/plugin/p3d_plugin_config.h.moved", "direct/src/plugin/p3d_plugin_config.h")
|
|
|
+ MoveAwayConflictingFiles()
|
|
|
print "Elapsed Time: "+PrettyTime(time.time() - STARTTIME)
|
|
|
print msg
|
|
|
print GetColor("red") + "Build terminated." + GetColor()
|
|
|
@@ -1572,6 +1594,70 @@ def ParsePluginVersion(fn):
|
|
|
except: pass
|
|
|
return "0.0.0"
|
|
|
|
|
|
+##########################################################################################
|
|
|
+#
|
|
|
+# Utility function to generate a resource file
|
|
|
+#
|
|
|
+##########################################################################################
|
|
|
+
|
|
|
+RESOURCE_FILE_TEMPLATE = """#define APSTUDIO_READONLY_SYMBOLS
|
|
|
+#include "winresrc.h"
|
|
|
+#undef APSTUDIO_READONLY_SYMBOLS
|
|
|
+
|
|
|
+VS_VERSION_INFO VERSIONINFO
|
|
|
+ FILEVERSION %(commaversion)s
|
|
|
+ PRODUCTVERSION %(commaversion)s
|
|
|
+ FILEFLAGSMASK 0x3fL
|
|
|
+ FILEFLAGS $(debugflag)s
|
|
|
+ FILEOS 0x40004L
|
|
|
+ FILETYPE 0x2L
|
|
|
+ FILESUBTYPE 0x0L
|
|
|
+BEGIN
|
|
|
+ BLOCK "StringFileInfo"
|
|
|
+ BEGIN
|
|
|
+ BLOCK "040904e4"
|
|
|
+ BEGIN
|
|
|
+ VALUE "FileDescription", "%(description)s\0"
|
|
|
+ VALUE "FileVersion", "%(dotversion)s"
|
|
|
+ VALUE "LegalTrademarks", "\0"
|
|
|
+ VALUE "MIMEType", "%(mimetype)s\0"
|
|
|
+ VALUE "FileExtents", "%(extension)s\0"
|
|
|
+ VALUE "FileOpenName", "%(filedesc)s\0"
|
|
|
+ VALUE "OriginalFilename", "%(filename)s\0"
|
|
|
+ VALUE "ProductName", "%(name)s %(version)s\0"
|
|
|
+ VALUE "ProductVersion", "%(dotversion)s"
|
|
|
+ END
|
|
|
+ END
|
|
|
+ BLOCK "VarFileInfo"
|
|
|
+ BEGIN
|
|
|
+ VALUE "Translation", 0x409, 1252
|
|
|
+ END
|
|
|
+END
|
|
|
+"""
|
|
|
+
|
|
|
+def GenerateResourceFile(basename, **kwargs):
|
|
|
+ if "debugflag" not in kwargs:
|
|
|
+ if GetOptimize() <= 2:
|
|
|
+ kwargs["debugflag"] = "0x1L"
|
|
|
+ else:
|
|
|
+ kwargs["debugflag"] = "0x0L"
|
|
|
+ kwargs["dotversion"] = kwargs["version"]
|
|
|
+ if len(kwargs["dotversion"].split(".")) == 3:
|
|
|
+ kwargs["dotversion"] += ".0"
|
|
|
+ if "commaversion" not in kwargs:
|
|
|
+ kwargs["commaversion"] = kwargs["dotversion"].replace(".", ",")
|
|
|
+
|
|
|
+ rcdata = RESOURCE_FILE_TEMPLATE % kwargs
|
|
|
+
|
|
|
+ if "icon" in kwargs:
|
|
|
+ rcdata += "\nICON_FILE ICON \"%s\"\n" % kwargs["icon"]
|
|
|
+
|
|
|
+ if not basename.endswith(".rc"):
|
|
|
+ basename += ".rc"
|
|
|
+ basename = GetOutputDir() + "/include/" + basename
|
|
|
+ ConditionalWriteFile(basename, rcdata)
|
|
|
+ return basename
|
|
|
+
|
|
|
########################################################################
|
|
|
##
|
|
|
## FindLocation
|
|
|
@@ -1707,7 +1793,7 @@ class Target:
|
|
|
TARGET_LIST=[]
|
|
|
TARGET_TABLE={}
|
|
|
|
|
|
-def TargetAdd(target, dummy=0, opts=0, input=0, dep=0, ipath=0):
|
|
|
+def TargetAdd(target, dummy=0, opts=0, input=0, dep=0, ipath=0, winrc=0):
|
|
|
if (dummy != 0):
|
|
|
exit("Syntax error in TargetAdd "+target)
|
|
|
if (ipath == 0): ipath = opts
|
|
|
@@ -1746,6 +1832,8 @@ def TargetAdd(target, dummy=0, opts=0, input=0, dep=0, ipath=0):
|
|
|
for x in dep:
|
|
|
fulldep = FindLocation(x, ipath)
|
|
|
t.deps[fulldep] = 1
|
|
|
+ if (winrc != 0 and sys.platform.startswith("win")):
|
|
|
+ t.deps[GenerateResourceFile(target.split("/")[-1].split(".")[0], **winrc)] = 1
|
|
|
if (target.endswith(".in")):
|
|
|
t.deps[FindLocation("interrogate.exe",[])] = 1
|
|
|
t.deps[FindLocation("dtool_have_python.dat",[])] = 1
|