mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -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
|
||||
similar to "lib/x86_64-linux-gnu". """
|
||||
|
||||
if sys.platform == "darwin":
|
||||
if sys.platform in ("darwin", "win32"):
|
||||
return "lib"
|
||||
|
||||
# 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)
|
||||
if not RTDIST:
|
||||
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")
|
||||
|
||||
########################################################################
|
||||
@ -6411,7 +6415,7 @@ def MakeInstallerNSIS(file, title, installdir):
|
||||
shutil.move("direct\\src\\plugin_installer\\p3d-setup.exe", file)
|
||||
return
|
||||
|
||||
print("Building "+title+" installer. This can take up to an hour.")
|
||||
print("Building "+title+" installer at %s" % (file))
|
||||
if (COMPRESSOR != "lzma"):
|
||||
print("Note: you are using zlib, which is faster, but lzma gives better compression.")
|
||||
if (os.path.exists("nsis-output.exe")):
|
||||
@ -6953,19 +6957,29 @@ try:
|
||||
if INSTALLER:
|
||||
ProgressOutput(100.0, "Building installer")
|
||||
target = GetTarget()
|
||||
if (target == 'windows'):
|
||||
dbg = ""
|
||||
if (GetOptimize() <= 2): dbg = "-dbg"
|
||||
if GetTargetArch() == 'x64':
|
||||
if (RUNTIME):
|
||||
MakeInstallerNSIS("Panda3D-Runtime-"+VERSION+dbg+"-x64.exe", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION+"-x64")
|
||||
else:
|
||||
MakeInstallerNSIS("Panda3D-"+VERSION+dbg+"-x64.exe", "Panda3D SDK "+VERSION, "C:\\Panda3D-"+VERSION+"-x64")
|
||||
if target == 'windows':
|
||||
fn = "Panda3D-"
|
||||
dir = "C:\\Panda3D-" + VERSION
|
||||
|
||||
if RUNTIME:
|
||||
fn += "Runtime-"
|
||||
title = "Panda3D " + VERSION
|
||||
else:
|
||||
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)
|
||||
title = "Panda3D SDK " + VERSION
|
||||
|
||||
fn += VERSION
|
||||
|
||||
if SDK["PYTHONVERSION"] != "python2.7":
|
||||
fn += '-py' + SDK["PYTHONVERSION"][6:]
|
||||
|
||||
if GetOptimize() <= 2:
|
||||
fn += "-dbg"
|
||||
if GetTargetArch() == 'x64':
|
||||
fn += '-x64'
|
||||
dir += '-x64'
|
||||
|
||||
fn += '.exe'
|
||||
MakeInstallerNSIS(fn, title, dir)
|
||||
elif (target == 'linux'):
|
||||
MakeInstallerLinux()
|
||||
elif (target == 'darwin'):
|
||||
|
@ -1845,12 +1845,18 @@ def SdkLocatePython(prefer_thirdparty_python=False):
|
||||
return
|
||||
|
||||
if GetTarget() == 'windows':
|
||||
SDK["PYTHON"] = GetThirdpartyBase() + "/win-python"
|
||||
if (GetOptimize() <= 2):
|
||||
SDK["PYTHON"] += "-dbg"
|
||||
if (GetTargetArch() == 'x64' and os.path.isdir(SDK["PYTHON"] + "-x64")):
|
||||
SDK["PYTHON"] += "-x64"
|
||||
sdkdir = GetThirdpartyBase() + "/win-python"
|
||||
|
||||
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"
|
||||
if (GetOptimize() <= 2):
|
||||
SDK["PYTHONEXEC"] += "_d.exe"
|
||||
@ -1872,10 +1878,14 @@ def SdkLocatePython(prefer_thirdparty_python=False):
|
||||
exit("Found multiple Python dlls in %s." % (SDK["PYTHON"]))
|
||||
|
||||
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"]
|
||||
|
||||
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"))):
|
||||
tp_python = os.path.join(GetThirdpartyDir(), "python")
|
||||
|
||||
@ -1933,6 +1943,8 @@ def SdkLocatePython(prefer_thirdparty_python=False):
|
||||
|
||||
if GetVerbose():
|
||||
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():
|
||||
if (GetHost() != "windows"): return
|
||||
@ -2287,7 +2299,7 @@ def SetupBuildEnvironment(compiler):
|
||||
print("Host OS: %s" % GetHost())
|
||||
print("Host arch: %s" % GetHostArch())
|
||||
print("Target OS: %s" % GetTarget())
|
||||
print("Target arch: %s" % GetTargetArch())
|
||||
print("Target arch: %s" % GetTargetArch())
|
||||
|
||||
if compiler == "MSVC":
|
||||
# Add the visual studio tools to PATH et al.
|
||||
|
Loading…
x
Reference in New Issue
Block a user