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

View File

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