Fixing some more OSX issues. Let's just avoid platform.architecture() as a 32/64 bit test altogether.

This commit is contained in:
David Rose 2011-09-01 17:23:42 +00:00
parent cc5c26743c
commit e034e375c9
2 changed files with 25 additions and 24 deletions

View File

@ -498,7 +498,7 @@ if (COMPILER=="MSVC"):
# We need to be able to find NxCharacter.dll when importing code library libpandaphysx
AddToPathEnv("PATH", SDK["PHYSX"]+"/../Bin/win32/")
if (PkgSkip("SPEEDTREE")==0):
win64 = (sys.platform.startswith("win") and platform.architecture()[0] == "64bit")
win64 = (sys.platform.startswith("win") and is_64)
if win64:
libdir = SDK["SPEEDTREE"] + "/Lib/Windows/VC9.x64/"
p64ext = '64'
@ -758,7 +758,7 @@ def CompileCxx(obj,src,opts):
ipath = GetListOption(opts, "DIR:")
if (COMPILER=="MSVC"):
cmd = "cl "
if (platform.architecture()[0]=="64bit"):
if (is_64):
cmd += "/favor:blend "
cmd += "/wd4996 /wd4275 /wd4267 /wd4101 /wd4273 "
@ -785,7 +785,7 @@ def CompileCxx(obj,src,opts):
cmd += " /Fd" + os.path.splitext(obj)[0] + ".pdb"
building = GetValueOption(opts, "BUILDING:")
if (building): cmd += " /DBUILDING_" + building
if ("BIGOBJ" in opts) or (platform.architecture()[0]=="64bit"):
if ("BIGOBJ" in opts) or (is_64):
cmd += " /bigobj"
cmd += " /EHa /Zm300 /DWIN32_VC /DWIN32 /W3 " + BracketNameWithQuotes(src)
oscmd(cmd)
@ -804,8 +804,7 @@ def CompileCxx(obj,src,opts):
if (OSXTARGET != None):
cmd += " -isysroot " + SDK["MACOSX"]
cmd += " -mmacosx-version-min=" + OSXTARGET
# platform.architecture isn't reliable on OSX.
if sys.maxint > 0x100000000L:
if is_64:
cmd += " -arch x86_64"
else:
cmd += " -arch i386"
@ -888,9 +887,9 @@ def CompileIgate(woutd,wsrc,opts):
cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -longlong __int64 -D_X86_ -DWIN32_VC -D_WIN32'
#NOTE: this 1500 value is the version number for VC2008.
cmd += ' -D_MSC_VER=1500 -D"_declspec(param)=" -D_near -D_far -D__near -D__far -D__stdcall'
if (COMPILER=="LINUX") and (platform.architecture()[0]=="64bit"):
if (COMPILER=="LINUX") and (is_64):
cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -D__const=const -D_LP64'
if (COMPILER=="LINUX") and (platform.architecture()[0]=="32bit"):
if (COMPILER=="LINUX") and (not is_64):
cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -D__const=const -D__i386__'
optlevel=GetOptimizeOption(opts)
if (optlevel==1): cmd += ' -D_DEBUG'
@ -950,7 +949,7 @@ def CompileImod(wobj, wsrc, opts):
def CompileLib(lib, obj, opts):
if (COMPILER=="MSVC"):
cmd = 'link /lib /nologo '
if (platform.architecture()[0] == "64bit"):
if (is_64):
cmd += "/MACHINE:X64 "
cmd += '/OUT:' + BracketNameWithQuotes(lib)
for x in obj: cmd += ' ' + BracketNameWithQuotes(x)
@ -974,7 +973,7 @@ def CompileLib(lib, obj, opts):
def CompileLink(dll, obj, opts):
if (COMPILER=="MSVC"):
cmd = "link /nologo"
if (platform.architecture()[0] == "64bit"):
if (is_64):
cmd += " /MACHINE:X64"
if ("MFC" not in opts):
cmd += " /NOD:MFC90.LIB /NOD:MFC80.LIB /NOD:LIBCMT"
@ -1050,8 +1049,7 @@ def CompileLink(dll, obj, opts):
if (OSXTARGET != None):
cmd += " -isysroot " + SDK["MACOSX"] + " -Wl,-syslibroot," + SDK["MACOSX"]
cmd += " -mmacosx-version-min=" + OSXTARGET
# platform.architecture isn't reliable on OSX.
if sys.maxint > 0x100000000L:
if is_64:
cmd += " -arch x86_64"
else:
cmd += " -arch i386"
@ -1614,7 +1612,7 @@ def WriteConfigSettings():
# Now that we have OS_SIMPLE_THREADS, we can support
# SIMPLE_THREADS on exotic architectures like win64, so we no
# longer need to disable it for this platform.
## if (sys.platform.startswith("win") and platform.architecture()[0] == "64bit"):
## if (sys.platform.startswith("win") and is_64):
## dtool_config["SIMPLE_THREADS"] = 'UNDEF'
if (RTDIST or RUNTIME):
@ -5704,7 +5702,7 @@ if (INSTALLER != 0):
if (sys.platform.startswith("win")):
dbg = ""
if (GetOptimize() <= 2): dbg = "-dbg"
if (platform.architecture()[0] == "64bit"):
if (is_64):
if (RUNTIME):
MakeInstallerNSIS("Panda3D-Runtime-"+VERSION+dbg+"-x64.exe", "Panda3D", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION)
else:

View File

@ -25,6 +25,9 @@ OPTIMIZE="3"
VERBOSE=False
LINK_ALL_STATIC=False
# platform.architecture isn't reliable on OSX.
is_64 = (sys.maxint > 0x100000000L)
########################################################################
##
## Maya and Max Version List (with registry keys)
@ -603,7 +606,7 @@ def ListRegistryValues(path):
return result
def GetRegistryKey(path, subkey, override64=True):
if (platform.architecture()[0]=="64bit" and override64==True):
if (is_64 and override64==True):
path = path.replace("SOFTWARE\\", "SOFTWARE\\Wow6432Node\\")
k1=0
key = TryRegistryKey(path)
@ -786,7 +789,7 @@ def GetThirdpartyDir():
if (THIRDPARTYDIR != None):
return THIRDPARTYDIR
if (sys.platform.startswith("win")):
if (platform.architecture()[0] == "64bit"):
if (is_64):
THIRDPARTYDIR=GetThirdpartyBase()+"/win-libs-vc9-x64/"
else:
THIRDPARTYDIR=GetThirdpartyBase()+"/win-libs-vc9/"
@ -797,14 +800,14 @@ def GetThirdpartyDir():
elif (sys.platform.startswith("linux")):
if (platform.machine().startswith("arm")):
THIRDPARTYDIR=GetThirdpartyBase()+"/linux-libs-arm/"
elif (platform.architecture()[0] == "64bit"):
elif (is_64):
THIRDPARTYDIR=GetThirdpartyBase()+"/linux-libs-x64/"
else:
THIRDPARTYDIR=GetThirdpartyBase()+"/linux-libs-a/"
elif (sys.platform.startswith("freebsd")):
if (platform.machine().startswith("arm")):
THIRDPARTYDIR=GetThirdpartyBase()+"/freebsd-libs-arm/"
elif (platform.architecture()[0] == "64bit"):
elif (is_64):
THIRDPARTYDIR=GetThirdpartyBase()+"/freebsd-libs-x64/"
else:
THIRDPARTYDIR=GetThirdpartyBase()+"/freebsd-libs-a/"
@ -1087,7 +1090,7 @@ def GetLibCache():
LD_CACHE.append(lib)
libdirs = ["/lib", "/usr/lib", "/usr/local/lib", "/usr/PCBSD/local/lib", "/usr/X11/lib", "/usr/X11R6/lib"]
if platform.architecture()[0] == "64bit":
if is_64:
libdirs += ["/lib64", "/usr/lib64"]
if "LD_LIBRARY_PATH" in os.environ:
libdirs += os.environ["LD_LIBRARY_PATH"].split(":")
@ -1326,7 +1329,7 @@ def SdkLocateDirectX():
if (dir != 0):
SDK["DX9"] = dir.replace("\\", "/").rstrip("/")
archStr = "x86"
if (platform.architecture()[0] == "64bit"): archStr = "x64"
if (is_64): archStr = "x64"
if ("DX9" not in SDK) or ("DX8" not in SDK):
uninstaller = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
for subdir in ListRegistryKeys(uninstaller):
@ -1365,7 +1368,7 @@ def SdkLocateMaya():
ddir = "/Applications/Autodesk/maya"+key
if (os.path.isdir(ddir)): SDK[ver] = ddir
else:
if (platform.architecture()[0] == "64bit"):
if (is_64):
ddir1 = "/usr/autodesk/maya"+key+"-x64"
ddir2 = "/usr/aw/maya"+key+"-x64"
else:
@ -1395,7 +1398,7 @@ def SdkLocatePython(force_use_sys_executable = False):
SDK["PYTHON"] = GetThirdpartyBase()+"/win-python"
if (GetOptimize() <= 2):
SDK["PYTHON"] += "-dbg"
if (platform.architecture()[0] == "64bit" and os.path.isdir(SDK["PYTHON"] + "-x64")):
if (is_64 and os.path.isdir(SDK["PYTHON"] + "-x64")):
SDK["PYTHON"] += "-x64"
SDK["PYTHONEXEC"] = SDK["PYTHON"] + "/python"
@ -1462,7 +1465,7 @@ def SdkLocateMSPlatform():
if (platsdk and not os.path.isdir(platsdk)): platsdk = 0
if (platsdk == 0 and os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2"))):
if (platform.architecture()[0]!="64bit" or os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2", "Lib", "AMD64"))):
if (not is_64 or os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2", "Lib", "AMD64"))):
platsdk = os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2")
if (not os.path.isdir(platsdk)): platsdk = 0
@ -1628,7 +1631,7 @@ def SetupVisualStudioEnviron():
os.environ["VCINSTALLDIR"] = SDK["VISUALSTUDIO"] + "VC"
os.environ["WindowsSdkDir"] = SDK["MSPLATFORM"]
suffix=""
if (platform.architecture()[0]=="64bit"): suffix = "\\amd64"
if (is_64): suffix = "\\amd64"
AddToPathEnv("PATH", SDK["VISUALSTUDIO"] + "VC\\bin"+suffix)
AddToPathEnv("PATH", SDK["VISUALSTUDIO"] + "Common7\\IDE")
AddToPathEnv("INCLUDE", SDK["VISUALSTUDIO"] + "VC\\include")
@ -1639,7 +1642,7 @@ def SetupVisualStudioEnviron():
AddToPathEnv("INCLUDE", SDK["MSPLATFORM"] + "include")
AddToPathEnv("INCLUDE", SDK["MSPLATFORM"] + "include\\atl")
AddToPathEnv("INCLUDE", SDK["MSPLATFORM"] + "include\\mfc")
if (platform.architecture()[0]=="32bit"):
if (not is_64):
AddToPathEnv("LIB", SDK["MSPLATFORM"] + "lib")
AddToPathEnv("PATH",SDK["VISUALSTUDIO"] + "VC\\redist\\x86\\Microsoft.VC90.CRT")
AddToPathEnv("PATH",SDK["VISUALSTUDIO"] + "VC\\redist\\x86\\Microsoft.VC90.MFC")