mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 01:44:06 -04:00
Fix makepanda to correctly do debug builds on Windows
This commit is contained in:
parent
e04ad3d78f
commit
e518fe16b4
@ -32,7 +32,6 @@ from installpanda import *
|
||||
COMPILER=0
|
||||
THIRDPARTYLIBS=0
|
||||
VC90CRTVERSION=""
|
||||
OPTIMIZE="3"
|
||||
INSTALLER=0
|
||||
RUNTIME=0
|
||||
GENMAN=0
|
||||
@ -120,20 +119,21 @@ def usage(problem):
|
||||
os._exit(0)
|
||||
|
||||
def parseopts(args):
|
||||
global OPTIMIZE,INSTALLER,RUNTIME,GENMAN
|
||||
global INSTALLER,RUNTIME,GENMAN
|
||||
global VERSION,COMPRESSOR,VERBOSE,THREADCOUNT
|
||||
longopts = [
|
||||
"help",
|
||||
"optimize=","everything","nothing","installer","runtime",
|
||||
"version=","lzma","no-python","threads=","outputdir="]
|
||||
anything = 0
|
||||
optimize = ""
|
||||
for pkg in PkgListGet(): longopts.append("no-"+pkg.lower())
|
||||
for pkg in PkgListGet(): longopts.append("use-"+pkg.lower())
|
||||
try:
|
||||
opts, extras = getopt.getopt(args, "", longopts)
|
||||
for option,value in opts:
|
||||
if (option=="--help"): raise "usage"
|
||||
elif (option=="--optimize"): OPTIMIZE=value
|
||||
elif (option=="--optimize"): optimize=value
|
||||
elif (option=="--installer"): INSTALLER=1
|
||||
elif (option=="--runtime"): RUNTIME=1
|
||||
elif (option=="--genman"): GENMAN=1
|
||||
@ -157,11 +157,11 @@ def parseopts(args):
|
||||
anything = 1
|
||||
except: usage(0)
|
||||
if (anything==0): usage(0)
|
||||
if (OPTIMIZE=="1"): OPTIMIZE=1
|
||||
elif (OPTIMIZE=="2"): OPTIMIZE=2
|
||||
elif (OPTIMIZE=="3"): OPTIMIZE=3
|
||||
elif (OPTIMIZE=="4"): OPTIMIZE=4
|
||||
else: usage("Invalid setting for OPTIMIZE")
|
||||
try:
|
||||
SetOptimize(int(optimize))
|
||||
assert GetOptimize() in [1, 2, 3, 4]
|
||||
except:
|
||||
usage("Invalid setting for OPTIMIZE")
|
||||
|
||||
parseopts(sys.argv[1:])
|
||||
|
||||
@ -522,7 +522,7 @@ def printStatus(header,warnings):
|
||||
if (PkgSkip(x)==0): tkeep = tkeep + x + " "
|
||||
else: tomit = tomit + x + " "
|
||||
print "Makepanda: Compiler:",COMPILER
|
||||
print "Makepanda: Optimize:",OPTIMIZE
|
||||
print "Makepanda: Optimize:",GetOptimize()
|
||||
print "Makepanda: Keep Pkg:",tkeep
|
||||
print "Makepanda: Omit Pkg:",tomit
|
||||
print "Makepanda: Verbose vs. Quiet Level:",VERBOSE
|
||||
@ -575,7 +575,7 @@ def CompileCxx(obj,src,opts):
|
||||
if (opt=="ALWAYS") or (opts.count(opt)): cmd += " /D" + var + "=" + val
|
||||
if (opts.count('NOFLOATWARN')): cmd += ' /wd4244 /wd4305'
|
||||
if (opts.count('MSFORSCOPE')): cmd += ' /Zc:forScope-'
|
||||
optlevel = GetOptimizeOption(opts,OPTIMIZE)
|
||||
optlevel = GetOptimizeOption(opts)
|
||||
if (optlevel==1): cmd += " /MD /Zi /RTCs /GS"
|
||||
if (optlevel==2): cmd += " /MD /Zi "
|
||||
if (optlevel==3): cmd += " /MD /Zi /O2 /Ob2 /DFORCE_INLINING "
|
||||
@ -598,7 +598,7 @@ def CompileCxx(obj,src,opts):
|
||||
if (sys.platform == "darwin"):
|
||||
cmd += " -isysroot " + SDK["MACOSX"] + " -arch i386"
|
||||
if ("NOPPC" not in opts): cmd += " -arch ppc"
|
||||
optlevel = GetOptimizeOption(opts,OPTIMIZE)
|
||||
optlevel = GetOptimizeOption(opts)
|
||||
if (optlevel==1): cmd += " -g"
|
||||
if (optlevel==2): cmd += " -O1"
|
||||
if (optlevel==3): cmd += " -O2"
|
||||
@ -680,7 +680,7 @@ def CompileIgate(woutd,wsrc,opts):
|
||||
cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -D__const=const -D_LP64'
|
||||
if (COMPILER=="LINUX") and (platform.architecture()[0]=="32bit"):
|
||||
cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -D__const=const -D__i386__'
|
||||
optlevel=GetOptimizeOption(opts,OPTIMIZE)
|
||||
optlevel=GetOptimizeOption(opts)
|
||||
if (optlevel==1): cmd += ' '
|
||||
if (optlevel==2): cmd += ' '
|
||||
if (optlevel==3): cmd += ' -DFORCE_INLINING'
|
||||
@ -763,7 +763,7 @@ def CompileLink(dll, obj, opts):
|
||||
cmd += " /NOD:MFC90.LIB /NOD:MFC80.LIB /NOD:LIBCI.LIB /NOD:MSVCRTD.LIB /DEBUG"
|
||||
cmd += " /nod:libc /nod:libcmtd /nod:atlthunk /nod:atls"
|
||||
if (GetOrigExt(dll) != ".exe"): cmd += " /DLL"
|
||||
optlevel = GetOptimizeOption(opts,OPTIMIZE)
|
||||
optlevel = GetOptimizeOption(opts)
|
||||
if (optlevel==1): cmd += " /MAP /MAPINFO:EXPORTS"
|
||||
if (optlevel==2): cmd += " /MAP:NUL "
|
||||
if (optlevel==3): cmd += " /MAP:NUL "
|
||||
@ -888,7 +888,7 @@ def CompileResource(target, src, opts):
|
||||
def RunGenPyCode(target, inputs, opts):
|
||||
if (PkgSkip("PYTHON") != 0): return
|
||||
|
||||
cmdstr = sys.executable + " " + os.path.join("direct", "src", "ffi", "jGenPyCode.py")
|
||||
cmdstr = SDK["PYTHONEXEC"] + " " + os.path.join("direct", "src", "ffi", "jGenPyCode.py")
|
||||
if (GENMAN): cmdstr += " -d"
|
||||
cmdstr += " -r"
|
||||
for i in inputs:
|
||||
@ -906,7 +906,7 @@ def RunGenPyCode(target, inputs, opts):
|
||||
def FreezePy(target, inputs, opts):
|
||||
assert len(inputs) > 0
|
||||
# Make sure this function isn't called before genpycode is run.
|
||||
cmdstr = sys.executable + " " + os.path.join("direct", "src", "showutil", "pfreeze.py")
|
||||
cmdstr = SDK["PYTHONEXEC"] + " " + os.path.join("direct", "src", "showutil", "pfreeze.py")
|
||||
src = inputs.pop(0)
|
||||
for i in inputs:
|
||||
cmdstr += " -i " + os.path.splitext(i)[0]
|
||||
@ -1211,23 +1211,23 @@ def WriteConfigSettings():
|
||||
dtool_config["HAVE_PROC_CURPROC_MAP"] = '1'
|
||||
dtool_config["HAVE_PROC_CURPROC_CMDLINE"] = '1'
|
||||
|
||||
if (OPTIMIZE <= 3):
|
||||
if (GetOptimize() <= 3):
|
||||
if (dtool_config["HAVE_NET"] != 'UNDEF'):
|
||||
dtool_config["DO_PSTATS"] = '1'
|
||||
|
||||
if (OPTIMIZE <= 3):
|
||||
if (GetOptimize() <= 3):
|
||||
dtool_config["DO_COLLISION_RECORDING"] = '1'
|
||||
|
||||
#if (OPTIMIZE <= 2):
|
||||
#if (GetOptimize() <= 2):
|
||||
# dtool_config["TRACK_IN_INTERPRETER"] = '1'
|
||||
|
||||
if (OPTIMIZE <= 3):
|
||||
if (GetOptimize() <= 3):
|
||||
dtool_config["DO_MEMORY_USAGE"] = '1'
|
||||
|
||||
#if (OPTIMIZE <= 1):
|
||||
#if (GetOptimize() <= 1):
|
||||
# dtool_config["DO_PIPELINING"] = '1'
|
||||
|
||||
if (OPTIMIZE <= 3):
|
||||
if (GetOptimize() <= 3):
|
||||
dtool_config["NOTIFY_DEBUG"] = '1'
|
||||
|
||||
if (sys.platform.startswith("win") and platform.architecture()[0] == "64bit"):
|
||||
@ -4148,12 +4148,12 @@ def MakeRuntime():
|
||||
oscmd("strip --strip-all "+GetOutputDir()+"/rlib/"+base)
|
||||
|
||||
# Invoke the make_package and make_contents scripts.
|
||||
command = sys.executable + " direct/src/plugin/make_package.py"
|
||||
command = SDK["PYTHONEXEC"] + " direct/src/plugin/make_package.py"
|
||||
command += " -d \"" + GetOutputDir() + "/stage\""
|
||||
command += " -s \"" + GetOutputDir() + "/rlib\""
|
||||
command += " -p panda3d_%s_%s" % (RUNTIME_PLATFORM, RUNTIME_VERSION)
|
||||
oscmd(command)
|
||||
command = sys.executable + " direct/src/plugin/make_contents.py"
|
||||
command = SDK["PYTHONEXEC"] + " direct/src/plugin/make_contents.py"
|
||||
command += " -d \"" + GetOutputDir() + "/stage\""
|
||||
oscmd(command)
|
||||
|
||||
@ -4364,10 +4364,12 @@ def MakeInstallerOSX():
|
||||
|
||||
if (INSTALLER != 0):
|
||||
if (sys.platform.startswith("win")):
|
||||
dbg = ""
|
||||
if (GetOptimize() <= 2): dbg = "-dbg"
|
||||
if (platform.architecture()[0] == "64bit"):
|
||||
MakeInstallerNSIS("Panda3D-"+VERSION+"-x64.exe", "Panda3D", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION)
|
||||
MakeInstallerNSIS("Panda3D-"+VERSION+dbg+"-x64.exe", "Panda3D", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION)
|
||||
else:
|
||||
MakeInstallerNSIS("Panda3D-"+VERSION+".exe", "Panda3D", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION)
|
||||
MakeInstallerNSIS("Panda3D-"+VERSION+dbg+".exe", "Panda3D", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION)
|
||||
elif (sys.platform == "linux2"):
|
||||
MakeInstallerLinux()
|
||||
elif (sys.platform == "darwin"):
|
||||
|
@ -507,10 +507,10 @@ def GetValueOption(opts, prefix):
|
||||
return x[len(prefix):]
|
||||
return 0
|
||||
|
||||
def GetOptimizeOption(opts,defval):
|
||||
def GetOptimizeOption(opts):
|
||||
val = GetValueOption(opts, "OPT:")
|
||||
if (val == 0):
|
||||
return defval
|
||||
return OPTIMIZE
|
||||
return val
|
||||
|
||||
########################################################################
|
||||
@ -637,6 +637,7 @@ def SetVC90CRTVersion(fn, ver):
|
||||
########################################################################
|
||||
##
|
||||
## Gets or sets the output directory, by default "built".
|
||||
## Gets or sets the optimize level.
|
||||
##
|
||||
########################################################################
|
||||
|
||||
@ -647,6 +648,13 @@ def SetOutputDir(outputdir):
|
||||
global OUTPUTDIR
|
||||
OUTPUTDIR=outputdir
|
||||
|
||||
def GetOptimize():
|
||||
return int(OPTIMIZE)
|
||||
|
||||
def SetOptimize(optimize):
|
||||
global OPTIMIZE
|
||||
OPTIMIZE=optimize
|
||||
|
||||
########################################################################
|
||||
##
|
||||
## Package Selection
|
||||
@ -876,18 +884,20 @@ def SdkLocateMax():
|
||||
def SdkLocatePython():
|
||||
if (PkgSkip("PYTHON")==0):
|
||||
if (sys.platform == "win32"):
|
||||
(arch, osName) = platform.architecture()
|
||||
if arch == "32bit":
|
||||
SDK["PYTHON"] = "thirdparty/win-python"
|
||||
else:
|
||||
SDK["PYTHON"] = "thirdparty/win-python-x64"
|
||||
SDK["PYTHON"] = "thirdparty/win-python"
|
||||
if (GetOptimize() <= 2):
|
||||
SDK["PYTHON"] += "-dbg"
|
||||
if (platform.architecture()[0] == "64bit" and os.path.isdir(SDK["PYTHON"] + "-x64")):
|
||||
SDK["PYTHON"] += "-x64"
|
||||
|
||||
if (not os.path.exists(SDK["PYTHON"])):
|
||||
SDK["PYTHON"] = "thirdparty/win-python"
|
||||
if (not os.path.exists(SDK["PYTHON"]+"/python.exe")):
|
||||
exit("Could not find thirdparty/win-python/python.exe!")
|
||||
SDK["PYTHONEXEC"] = SDK["PYTHON"] + "/python"
|
||||
if (GetOptimize() <= 2): SDK["PYTHONEXEC"] += "_d.exe"
|
||||
else: SDK["PYTHONEXEC"] += ".exe"
|
||||
|
||||
os.system(SDK["PYTHON"].replace("/", "\\") + "\\python.exe -V > "+OUTPUTDIR+"/tmp/pythonversion 2>&1")
|
||||
if (not os.path.isfile(SDK["PYTHONEXEC"])):
|
||||
exit("Could not find %s!" % SDK["PYTHONEXEC"])
|
||||
|
||||
os.system(SDK["PYTHONEXEC"].replace("/", "\\") + " -V > "+OUTPUTDIR+"/tmp/pythonversion 2>&1")
|
||||
pv=ReadFile(OUTPUTDIR+"/tmp/pythonversion")
|
||||
if (pv.startswith("Python ")==0):
|
||||
exit("python -V did not produce the expected output")
|
||||
@ -897,16 +907,17 @@ def SdkLocatePython():
|
||||
elif (sys.platform == "darwin"):
|
||||
if "MACOSX" not in SDK: SdkLocateMacOSX()
|
||||
if (os.path.isdir("%s/System/Library/Frameworks/Python.framework" % SDK["MACOSX"])):
|
||||
os.system("readlink %s/System/Library/Frameworks/Python.framework/Versions/Current > %s/tmp/pythonversion 2>&1" % (SDK["MACOSX"], OUTPUTDIR))
|
||||
pv = ReadFile(OUTPUTDIR+"/tmp/pythonversion")
|
||||
SDK["PYTHON"] = SDK["MACOSX"]+"/System/Library/Frameworks/Python.framework/Headers"
|
||||
SDK["PYTHONVERSION"] = "python"+pv
|
||||
pv = os.readlink("%s/System/Library/Frameworks/Python.framework/Versions/Current" % SDK["MACOSX"])
|
||||
SDK["PYTHON"] = SDK["MACOSX"] + "/System/Library/Frameworks/Python.framework/Headers"
|
||||
SDK["PYTHONVERSION"] = "python " +pv
|
||||
SDK["PYTHONEXEC"] = SDK["MACOSX"] + "/System/Library/Frameworks/Python.framework/Versions/Current/bin/python"
|
||||
else:
|
||||
exit("Could not find the python framework!")
|
||||
|
||||
else:
|
||||
SDK["PYTHON"]=sysconfig.get_python_inc()
|
||||
SDK["PYTHONVERSION"]="python"+sysconfig.get_python_version()
|
||||
SDK["PYTHON"] = sysconfig.get_python_inc()
|
||||
SDK["PYTHONVERSION"] = "python" + sysconfig.get_python_version()
|
||||
SDK["PYTHONEXEC"] = sys.executable
|
||||
|
||||
def SdkLocateVisualStudio():
|
||||
if (sys.platform != "win32"): return
|
||||
@ -1201,7 +1212,7 @@ def SetOrigExt(x, v):
|
||||
def CalcLocation(fn, ipath):
|
||||
if (fn.count("/")): return fn
|
||||
dllext = ""
|
||||
if (int(OPTIMIZE) <= 2): dllext = "_d"
|
||||
if (GetOptimize() <= 2): dllext = "_d"
|
||||
|
||||
if (fn == "PandaModules.py"): return "pandac/" + fn
|
||||
if (fn.endswith(".cxx")): return CxxFindSource(fn, ipath)
|
||||
@ -1210,7 +1221,6 @@ def CalcLocation(fn, ipath):
|
||||
if (fn.endswith(".c")): return CxxFindSource(fn, ipath)
|
||||
if (fn.endswith(".yxx")): return CxxFindSource(fn, ipath)
|
||||
if (fn.endswith(".lxx")): return CxxFindSource(fn, ipath)
|
||||
if (fn.endswith(".mll")): return OUTPUTDIR+"/plugins/"+fn
|
||||
if (sys.platform.startswith("win")):
|
||||
if (fn.endswith(".def")): return CxxFindSource(fn, ipath)
|
||||
if (fn.endswith(".rc")): return CxxFindSource(fn, ipath)
|
||||
@ -1218,6 +1228,7 @@ def CalcLocation(fn, ipath):
|
||||
if (fn.endswith(".res")): return OUTPUTDIR+"/tmp/"+fn
|
||||
if (fn.endswith(".dll")): return OUTPUTDIR+"/bin/"+fn[:-4]+dllext+".dll"
|
||||
if (fn.endswith(".pyd")): return OUTPUTDIR+"/bin/"+fn[:-4]+dllext+".pyd"
|
||||
if (fn.endswith(".mll")): return OUTPUTDIR+"/plugins/"+fn[:-4]+dllext+".mll"
|
||||
if (fn.endswith(".dlo")): return OUTPUTDIR+"/plugins/"+fn[:-4]+dllext+".dlo"
|
||||
if (fn.endswith(".dli")): return OUTPUTDIR+"/plugins/"+fn[:-4]+dllext+".dli"
|
||||
if (fn.endswith(".dle")): return OUTPUTDIR+"/plugins/"+fn[:-4]+dllext+".dle"
|
||||
@ -1233,6 +1244,7 @@ def CalcLocation(fn, ipath):
|
||||
if (fn.endswith(".obj")): return OUTPUTDIR+"/tmp/"+fn[:-4]+".o"
|
||||
if (fn.endswith(".dll")): return OUTPUTDIR+"/lib/"+fn[:-4]+".dylib"
|
||||
if (fn.endswith(".pyd")): return OUTPUTDIR+"/lib/"+fn[:-4]+".dylib"
|
||||
if (fn.endswith(".mll")): return OUTPUTDIR+"/plugins/"+fn
|
||||
if (fn.endswith(".exe")): return OUTPUTDIR+"/bin/"+fn[:-4]
|
||||
if (fn.endswith(".lib")): return OUTPUTDIR+"/lib/"+fn[:-4]+".a"
|
||||
if (fn.endswith(".ilb")): return OUTPUTDIR+"/tmp/"+fn[:-4]+".a"
|
||||
@ -1244,6 +1256,7 @@ def CalcLocation(fn, ipath):
|
||||
if (fn.endswith(".obj")): return OUTPUTDIR+"/tmp/"+fn[:-4]+".o"
|
||||
if (fn.endswith(".dll")): return OUTPUTDIR+"/lib/"+fn[:-4]+".so"
|
||||
if (fn.endswith(".pyd")): return OUTPUTDIR+"/lib/"+fn[:-4]+".so"
|
||||
if (fn.endswith(".mll")): return OUTPUTDIR+"/plugins/"+fn
|
||||
if (fn.endswith(".exe")): return OUTPUTDIR+"/bin/"+fn[:-4]
|
||||
if (fn.endswith(".lib")): return OUTPUTDIR+"/lib/"+fn[:-4]+".a"
|
||||
if (fn.endswith(".ilb")): return OUTPUTDIR+"/tmp/"+fn[:-4]+".a"
|
||||
|
Loading…
x
Reference in New Issue
Block a user