mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
Make it easier to make Python 3 builds on Windows
This commit is contained in:
parent
9b6f4eeaf9
commit
88f7279522
@ -127,7 +127,7 @@ def GetLibDir():
|
|||||||
something like "lib" or "lib64" or in some cases, something
|
something like "lib" or "lib64" or in some cases, something
|
||||||
similar to "lib/x86_64-linux-gnu". """
|
similar to "lib/x86_64-linux-gnu". """
|
||||||
|
|
||||||
if sys.platform == "darwin":
|
if sys.platform in ("darwin", "win32"):
|
||||||
return "lib"
|
return "lib"
|
||||||
|
|
||||||
# This one's a bit tricky. Some systems require us to install
|
# This one's a bit tricky. Some systems require us to install
|
||||||
|
@ -2764,6 +2764,10 @@ if tp_dir is not None:
|
|||||||
CopyFile(GetOutputDir() + "/bin" + pydll, SDK["PYTHON"] + pydll)
|
CopyFile(GetOutputDir() + "/bin" + pydll, SDK["PYTHON"] + pydll)
|
||||||
if not RTDIST:
|
if not RTDIST:
|
||||||
CopyTree(GetOutputDir() + "/python", SDK["PYTHON"])
|
CopyTree(GetOutputDir() + "/python", SDK["PYTHON"])
|
||||||
|
if not os.path.isfile(SDK["PYTHON"] + "/ppython.exe") and os.path.isfile(SDK["PYTHON"] + "/python.exe"):
|
||||||
|
CopyFile(GetOutputDir() + "/python/ppython.exe", SDK["PYTHON"] + "/python.exe")
|
||||||
|
if not os.path.isfile(SDK["PYTHON"] + "/ppythonw.exe") and os.path.isfile(SDK["PYTHON"] + "/pythonw.exe"):
|
||||||
|
CopyFile(GetOutputDir() + "/python/ppythonw.exe", SDK["PYTHON"] + "/pythonw.exe")
|
||||||
ConditionalWriteFile(GetOutputDir() + "/python/panda.pth", "..\n../bin\n")
|
ConditionalWriteFile(GetOutputDir() + "/python/panda.pth", "..\n../bin\n")
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
@ -6411,7 +6415,7 @@ def MakeInstallerNSIS(file, title, installdir):
|
|||||||
shutil.move("direct\\src\\plugin_installer\\p3d-setup.exe", file)
|
shutil.move("direct\\src\\plugin_installer\\p3d-setup.exe", file)
|
||||||
return
|
return
|
||||||
|
|
||||||
print("Building "+title+" installer. This can take up to an hour.")
|
print("Building "+title+" installer at %s" % (file))
|
||||||
if (COMPRESSOR != "lzma"):
|
if (COMPRESSOR != "lzma"):
|
||||||
print("Note: you are using zlib, which is faster, but lzma gives better compression.")
|
print("Note: you are using zlib, which is faster, but lzma gives better compression.")
|
||||||
if (os.path.exists("nsis-output.exe")):
|
if (os.path.exists("nsis-output.exe")):
|
||||||
@ -6953,19 +6957,29 @@ try:
|
|||||||
if INSTALLER:
|
if INSTALLER:
|
||||||
ProgressOutput(100.0, "Building installer")
|
ProgressOutput(100.0, "Building installer")
|
||||||
target = GetTarget()
|
target = GetTarget()
|
||||||
if (target == 'windows'):
|
if target == 'windows':
|
||||||
dbg = ""
|
fn = "Panda3D-"
|
||||||
if (GetOptimize() <= 2): dbg = "-dbg"
|
dir = "C:\\Panda3D-" + VERSION
|
||||||
|
|
||||||
|
if RUNTIME:
|
||||||
|
fn += "Runtime-"
|
||||||
|
title = "Panda3D " + VERSION
|
||||||
|
else:
|
||||||
|
title = "Panda3D SDK " + VERSION
|
||||||
|
|
||||||
|
fn += VERSION
|
||||||
|
|
||||||
|
if SDK["PYTHONVERSION"] != "python2.7":
|
||||||
|
fn += '-py' + SDK["PYTHONVERSION"][6:]
|
||||||
|
|
||||||
|
if GetOptimize() <= 2:
|
||||||
|
fn += "-dbg"
|
||||||
if GetTargetArch() == 'x64':
|
if GetTargetArch() == 'x64':
|
||||||
if (RUNTIME):
|
fn += '-x64'
|
||||||
MakeInstallerNSIS("Panda3D-Runtime-"+VERSION+dbg+"-x64.exe", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION+"-x64")
|
dir += '-x64'
|
||||||
else:
|
|
||||||
MakeInstallerNSIS("Panda3D-"+VERSION+dbg+"-x64.exe", "Panda3D SDK "+VERSION, "C:\\Panda3D-"+VERSION+"-x64")
|
fn += '.exe'
|
||||||
else:
|
MakeInstallerNSIS(fn, title, dir)
|
||||||
if (RUNTIME):
|
|
||||||
MakeInstallerNSIS("Panda3D-Runtime-"+VERSION+dbg+".exe", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION)
|
|
||||||
else:
|
|
||||||
MakeInstallerNSIS("Panda3D-"+VERSION+dbg+".exe", "Panda3D SDK "+VERSION, "C:\\Panda3D-"+VERSION)
|
|
||||||
elif (target == 'linux'):
|
elif (target == 'linux'):
|
||||||
MakeInstallerLinux()
|
MakeInstallerLinux()
|
||||||
elif (target == 'darwin'):
|
elif (target == 'darwin'):
|
||||||
|
@ -1845,12 +1845,18 @@ def SdkLocatePython(prefer_thirdparty_python=False):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if GetTarget() == 'windows':
|
if GetTarget() == 'windows':
|
||||||
SDK["PYTHON"] = GetThirdpartyBase() + "/win-python"
|
sdkdir = GetThirdpartyBase() + "/win-python"
|
||||||
if (GetOptimize() <= 2):
|
|
||||||
SDK["PYTHON"] += "-dbg"
|
|
||||||
if (GetTargetArch() == 'x64' and os.path.isdir(SDK["PYTHON"] + "-x64")):
|
|
||||||
SDK["PYTHON"] += "-x64"
|
|
||||||
|
|
||||||
|
if sys.version_info >= (3, 0):
|
||||||
|
# Python 3 build...
|
||||||
|
sdkdir += "%d.%d" % sys.version_info[:2]
|
||||||
|
|
||||||
|
if GetOptimize() <= 2:
|
||||||
|
sdkdir += "-dbg"
|
||||||
|
if GetTargetArch() == 'x64':
|
||||||
|
sdkdir += "-x64"
|
||||||
|
|
||||||
|
SDK["PYTHON"] = sdkdir
|
||||||
SDK["PYTHONEXEC"] = SDK["PYTHON"].replace('/', '\\') + "\\python"
|
SDK["PYTHONEXEC"] = SDK["PYTHON"].replace('/', '\\') + "\\python"
|
||||||
if (GetOptimize() <= 2):
|
if (GetOptimize() <= 2):
|
||||||
SDK["PYTHONEXEC"] += "_d.exe"
|
SDK["PYTHONEXEC"] += "_d.exe"
|
||||||
@ -1872,10 +1878,14 @@ def SdkLocatePython(prefer_thirdparty_python=False):
|
|||||||
exit("Found multiple Python dlls in %s." % (SDK["PYTHON"]))
|
exit("Found multiple Python dlls in %s." % (SDK["PYTHON"]))
|
||||||
|
|
||||||
py_dll = os.path.basename(py_dlls[0])
|
py_dll = os.path.basename(py_dlls[0])
|
||||||
SDK["PYTHONVERSION"] = "python" + py_dll[6] + "." + py_dll[7]
|
ver = py_dll[6] + "." + py_dll[7]
|
||||||
|
|
||||||
|
SDK["PYTHONVERSION"] = "python" + ver
|
||||||
os.environ["PYTHONHOME"] = SDK["PYTHON"]
|
os.environ["PYTHONHOME"] = SDK["PYTHON"]
|
||||||
|
|
||||||
|
if sys.version[:3] != ver:
|
||||||
|
print("Warning: running makepanda with Python %s, but building Panda3D with Python %s." % (sys.version[:3], ver))
|
||||||
|
|
||||||
elif CrossCompiling() or (prefer_thirdparty_python and os.path.isdir(os.path.join(GetThirdpartyDir(), "python"))):
|
elif CrossCompiling() or (prefer_thirdparty_python and os.path.isdir(os.path.join(GetThirdpartyDir(), "python"))):
|
||||||
tp_python = os.path.join(GetThirdpartyDir(), "python")
|
tp_python = os.path.join(GetThirdpartyDir(), "python")
|
||||||
|
|
||||||
@ -1933,6 +1943,8 @@ def SdkLocatePython(prefer_thirdparty_python=False):
|
|||||||
|
|
||||||
if GetVerbose():
|
if GetVerbose():
|
||||||
print("Using Python %s build located at %s" % (SDK["PYTHONVERSION"][6:9], SDK["PYTHON"]))
|
print("Using Python %s build located at %s" % (SDK["PYTHONVERSION"][6:9], SDK["PYTHON"]))
|
||||||
|
else:
|
||||||
|
print("Using Python %s" % (SDK["PYTHONVERSION"][6:9]))
|
||||||
|
|
||||||
def SdkLocateVisualStudio():
|
def SdkLocateVisualStudio():
|
||||||
if (GetHost() != "windows"): return
|
if (GetHost() != "windows"): return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user