Fixes for 64-bits windows

This commit is contained in:
rdb 2009-07-27 08:07:41 +00:00
parent c7e10f33a5
commit 804395a048
3 changed files with 75 additions and 53 deletions

View File

@ -6,6 +6,7 @@ import sys
import os import os
import marshal import marshal
import imp import imp
import platform
from distutils.sysconfig import PREFIX, get_python_inc, get_python_version from distutils.sysconfig import PREFIX, get_python_inc, get_python_version
import direct import direct
@ -58,7 +59,7 @@ if sys.platform == 'win32':
if ('WindowsSdkDir' in os.environ): if ('WindowsSdkDir' in os.environ):
PSDK = os.environ['WindowsSdkDir'] PSDK = os.environ['WindowsSdkDir']
elif (Filename('/c/Program Files/Microsoft Platform SDK for Windows Server 2003 R2').exists()): elif (platform.architecture()[0] == '32bit' and Filename('/c/Program Files/Microsoft Platform SDK for Windows Server 2003 R2').exists()):
PSDK = Filename('/c/Program Files/Microsoft Platform SDK for Windows Server 2003 R2').toOsSpecific() PSDK = Filename('/c/Program Files/Microsoft Platform SDK for Windows Server 2003 R2').toOsSpecific()
elif (os.path.exists(os.path.join(MSVC, 'PlatformSDK'))): elif (os.path.exists(os.path.join(MSVC, 'PlatformSDK'))):
PSDK = os.path.join(MSVC, 'PlatformSDK') PSDK = os.path.join(MSVC, 'PlatformSDK')
@ -66,11 +67,17 @@ if sys.platform == 'win32':
print 'Could not locate the Microsoft Windows Platform SDK! Try running from the Visual Studio Command Prompt.' print 'Could not locate the Microsoft Windows Platform SDK! Try running from the Visual Studio Command Prompt.'
exit(1) exit(1)
os.environ['PATH'] += ';' + MSVC + '\\bin;' + MSVC + '\\Common7\\IDE;' + PSDK + '\\bin' # If it is run by makepanda, it handles the MSVC and PlatformSDK paths itself.
if ('MAKEPANDA' in os.environ):
compileObj = 'cl /wd4996 /Fo%(basename)s.obj /nologo /c /MD /Zi /O2 /Ob2 /EHsc /Zm300 /W3 /I"%(pythonIPath)s" /I"%(PSDK)s\include" /I"%(MSVC)s\include" %(filename)s' compileObj = 'cl /wd4996 /Fo%(basename)s.obj /nologo /c /MD /Zi /O2 /Ob2 /EHsc /Zm300 /W3 /I"%(pythonIPath)s" %(filename)s'
linkExe = 'link /nologo /MAP:NUL /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO /LIBPATH:"%(PSDK)s\lib" /LIBPATH:"%(MSVC)s\lib" /LIBPATH:"%(python)s\libs" /out:%(basename)s.exe %(basename)s.obj' linkExe = 'link /nologo /MAP:NUL /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO /LIBPATH:"%(python)s\libs" /out:%(basename)s.exe %(basename)s.obj'
linkDll = 'link /nologo /DLL /MAP:NUL /FIXED:NO /OPT:REF /INCREMENTAL:NO /LIBPATH:"%(PSDK)s\lib" /LIBPATH:"%(MSVC)s\lib" /LIBPATH:"%(python)s\libs" /out:%(basename)s.pyd %(basename)s.obj' linkDll = 'link /nologo /DLL /MAP:NUL /FIXED:NO /OPT:REF /INCREMENTAL:NO /LIBPATH:"%(python)s\libs" /out:%(basename)s.pyd %(basename)s.obj'
else:
os.environ['PATH'] += ';' + MSVC + '\\bin;' + MSVC + '\\Common7\\IDE;' + PSDK + '\\bin'
compileObj = 'cl /wd4996 /Fo%(basename)s.obj /nologo /c /MD /Zi /O2 /Ob2 /EHsc /Zm300 /W3 /I"%(pythonIPath)s" /I"%(PSDK)s\include" /I"%(MSVC)s\include" %(filename)s'
linkExe = 'link /nologo /MAP:NUL /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO /LIBPATH:"%(PSDK)s\lib" /LIBPATH:"%(MSVC)s\lib" /LIBPATH:"%(python)s\libs" /out:%(basename)s.exe %(basename)s.obj'
linkDll = 'link /nologo /DLL /MAP:NUL /FIXED:NO /OPT:REF /INCREMENTAL:NO /LIBPATH:"%(PSDK)s\lib" /LIBPATH:"%(MSVC)s\lib" /LIBPATH:"%(python)s\libs" /out:%(basename)s.pyd %(basename)s.obj'
elif sys.platform == 'darwin': elif sys.platform == 'darwin':
# OSX # OSX

View File

@ -176,6 +176,8 @@ if ("CFLAGS" in os.environ):
if ("RPM_OPT_FLAGS" in os.environ): if ("RPM_OPT_FLAGS" in os.environ):
CFLAGS+=os.environ["RPM_OPT_FLAGS"] CFLAGS+=os.environ["RPM_OPT_FLAGS"]
os.environ["MAKEPANDA"] = os.path.abspath(sys.argv[0])
######################################################################## ########################################################################
## ##
## Load the dependency cache. ## Load the dependency cache.
@ -582,8 +584,7 @@ def CompileCxx(obj,src,opts):
building = GetValueOption(opts, "BUILDING:") building = GetValueOption(opts, "BUILDING:")
if (building): cmd += " /DBUILDING_" + building if (building): cmd += " /DBUILDING_" + building
if ("LINK_ALL_STATIC" in opts): cmd += " /DLINK_ALL_STATIC" if ("LINK_ALL_STATIC" in opts): cmd += " /DLINK_ALL_STATIC"
bigObjFlag = GetValueOption(opts, "BIGOBJ:") if ("BIGOBJ" in opts): cmd += " /bigobj"
if (bigObjFlag): cmd += " /bigobj"
cmd += " /EHsc /Zm300 /DWIN32_VC /DWIN32 /W3 " + BracketNameWithQuotes(src) cmd += " /EHsc /Zm300 /DWIN32_VC /DWIN32 /W3 " + BracketNameWithQuotes(src)
oscmd(cmd) oscmd(cmd)
if (COMPILER=="LINUX"): if (COMPILER=="LINUX"):
@ -756,10 +757,10 @@ 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 (platform.architecture()[0] == "64bit"):
cmd += "/MACHINE:X64 " cmd += " /MACHINE:X64"
cmd += '/NOD:MFC90.LIB /NOD:MFC80.LIB /NOD:LIBCI.LIB /NOD:MSVCRTD.LIB /DEBUG ' cmd += " /NOD:MFC90.LIB /NOD:MFC80.LIB /NOD:LIBCI.LIB /NOD:MSVCRTD.LIB /DEBUG"
cmd += " /nod:libc /nod:libcmtd /nod:atlthunk /nod:atls" cmd += " /nod:libc /nod:libcmtd /nod:atlthunk /nod:atls"
if (GetOrigExt(dll) != ".exe"): cmd += " /DLL" if (GetOrigExt(dll) != ".exe"): cmd += " /DLL"
optlevel = GetOptimizeOption(opts,OPTIMIZE) optlevel = GetOptimizeOption(opts,OPTIMIZE)
@ -787,14 +788,14 @@ def CompileLink(dll, obj, opts):
pass pass
else: cmd += ' ' + BracketNameWithQuotes(x) else: cmd += ' ' + BracketNameWithQuotes(x)
if (GetOrigExt(dll)==".exe"): if (GetOrigExt(dll)==".exe"):
cmd += ' built/tmp/pandaIcon.res' cmd += " built/tmp/pandaIcon.res"
for (opt, name) in LIBNAMES: for (opt, name) in LIBNAMES:
if (opt=="ALWAYS") or (opts.count(opt)): cmd += ' ' + BracketNameWithQuotes(name) if (opt=="ALWAYS") or (opts.count(opt)): cmd += " " + BracketNameWithQuotes(name)
oscmd(cmd) oscmd(cmd)
SetVC90CRTVersion(dll+".manifest", VC90CRTVERSION) SetVC90CRTVersion(dll+".manifest", VC90CRTVERSION)
mtcmd = 'mt -manifest ' + dll + '.manifest -outputresource:' + dll mtcmd = "mt -manifest " + dll + ".manifest -outputresource:" + dll
if (dll.endswith(".exe")==0): mtcmd = mtcmd + ';2' if (dll.endswith(".exe")==0): mtcmd = mtcmd + ";2"
else: mtcmd = mtcmd + ';1' else: mtcmd = mtcmd + ";1"
oscmd(mtcmd) oscmd(mtcmd)
if (COMPILER=="LINUX"): if (COMPILER=="LINUX"):
if (GetOrigExt(dll)==".exe"): cmd = 'g++ -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp -L/usr/X11R6/lib' if (GetOrigExt(dll)==".exe"): cmd = 'g++ -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp -L/usr/X11R6/lib'
@ -2050,7 +2051,7 @@ TargetAdd('libpstatclient_igate.obj', input='libpstatclient.in', opts=["DEPENDEN
# DIRECTORY: panda/src/gobj/ # DIRECTORY: panda/src/gobj/
# #
OPTS=['DIR:panda/src/gobj', 'BUILDING:PANDA', 'NVIDIACG', 'ZLIB', 'SQUISH', "BIGOBJ:TRUE"] OPTS=['DIR:panda/src/gobj', 'BUILDING:PANDA', 'NVIDIACG', 'ZLIB', 'SQUISH', "BIGOBJ"]
TargetAdd('gobj_composite1.obj', opts=OPTS, input='gobj_composite1.cxx') TargetAdd('gobj_composite1.obj', opts=OPTS, input='gobj_composite1.cxx')
TargetAdd('gobj_composite2.obj', opts=OPTS, input='gobj_composite2.cxx') TargetAdd('gobj_composite2.obj', opts=OPTS, input='gobj_composite2.cxx')
IGATEFILES=GetDirectoryContents('panda/src/gobj', ["*.h", "*_composite.cxx"]) IGATEFILES=GetDirectoryContents('panda/src/gobj', ["*.h", "*_composite.cxx"])
@ -2074,7 +2075,7 @@ TargetAdd('liblerp_igate.obj', input='liblerp.in', opts=["DEPENDENCYONLY"])
# DIRECTORY: panda/src/pgraphnodes/ # DIRECTORY: panda/src/pgraphnodes/
# #
OPTS=['DIR:panda/src/pgraphnodes', 'BUILDING:PANDA'] OPTS=['DIR:panda/src/pgraphnodes', 'BUILDING:PANDA', "BIGOBJ"]
TargetAdd('pgraphnodes_composite1.obj', opts=OPTS, input='pgraphnodes_composite1.cxx') TargetAdd('pgraphnodes_composite1.obj', opts=OPTS, input='pgraphnodes_composite1.cxx')
TargetAdd('pgraphnodes_composite2.obj', opts=OPTS, input='pgraphnodes_composite2.cxx') TargetAdd('pgraphnodes_composite2.obj', opts=OPTS, input='pgraphnodes_composite2.cxx')
IGATEFILES=GetDirectoryContents('panda/src/pgraphnodes', ["*.h", "*_composite.cxx"]) IGATEFILES=GetDirectoryContents('panda/src/pgraphnodes', ["*.h", "*_composite.cxx"])
@ -2088,15 +2089,15 @@ TargetAdd('libpgraphnodes_igate.obj', input='libpgraphnodes.in', opts=["DEPENDEN
OPTS=['DIR:panda/src/pgraph', 'BUILDING:PANDA'] OPTS=['DIR:panda/src/pgraph', 'BUILDING:PANDA']
TargetAdd('pgraph_nodePath.obj', opts=OPTS, input='nodePath.cxx') TargetAdd('pgraph_nodePath.obj', opts=OPTS, input='nodePath.cxx')
TargetAdd('pgraph_composite1.obj', opts=OPTS+['BIGOBJ:True'], input='pgraph_composite1.cxx') TargetAdd('pgraph_composite1.obj', opts=OPTS+['BIGOBJ'], input='pgraph_composite1.cxx')
TargetAdd('pgraph_composite2.obj', opts=OPTS+['BIGOBJ:True'], input='pgraph_composite2.cxx') TargetAdd('pgraph_composite2.obj', opts=OPTS+['BIGOBJ'], input='pgraph_composite2.cxx')
TargetAdd('pgraph_composite3.obj', opts=OPTS+['BIGOBJ:True'], input='pgraph_composite3.cxx') TargetAdd('pgraph_composite3.obj', opts=OPTS+['BIGOBJ'], input='pgraph_composite3.cxx')
TargetAdd('pgraph_composite4.obj', opts=OPTS+['BIGOBJ:True'], input='pgraph_composite4.cxx') TargetAdd('pgraph_composite4.obj', opts=OPTS+['BIGOBJ'], input='pgraph_composite4.cxx')
IGATEFILES=GetDirectoryContents('panda/src/pgraph', ["*.h", "nodePath.cxx", "*_composite.cxx"]) IGATEFILES=GetDirectoryContents('panda/src/pgraph', ["*.h", "nodePath.cxx", "*_composite.cxx"])
# IGATEFILES.remove("antialiasAttrib.h") # IGATEFILES.remove("antialiasAttrib.h")
TargetAdd('libpgraph.in', opts=OPTS+["BIGOBJ:TRUE"], input=IGATEFILES) TargetAdd('libpgraph.in', opts=OPTS+["BIGOBJ"], input=IGATEFILES)
TargetAdd('libpgraph.in', opts=['IMOD:panda', 'ILIB:libpgraph', 'SRCDIR:panda/src/pgraph']) TargetAdd('libpgraph.in', opts=['IMOD:panda', 'ILIB:libpgraph', 'SRCDIR:panda/src/pgraph'])
TargetAdd('libpgraph_igate.obj', input='libpgraph.in', opts=["DEPENDENCYONLY","BIGOBJ:TRUE"]) TargetAdd('libpgraph_igate.obj', input='libpgraph.in', opts=["DEPENDENCYONLY","BIGOBJ"])
# #
# DIRECTORY: panda/src/cull/ # DIRECTORY: panda/src/cull/
@ -2149,7 +2150,7 @@ TargetAdd('libdgraph_igate.obj', input='libdgraph.in', opts=["DEPENDENCYONLY"])
# #
OPTS=['DIR:panda/src/display', 'BUILDING:PANDA'] OPTS=['DIR:panda/src/display', 'BUILDING:PANDA']
TargetAdd('display_composite.obj', opts=OPTS+["BIGOBJ:TRUE"], input='display_composite.cxx') TargetAdd('display_composite.obj', opts=OPTS+["BIGOBJ"], input='display_composite.cxx')
IGATEFILES=GetDirectoryContents('panda/src/display', ["*.h", "*_composite.cxx"]) IGATEFILES=GetDirectoryContents('panda/src/display', ["*.h", "*_composite.cxx"])
IGATEFILES.remove("renderBuffer.h") IGATEFILES.remove("renderBuffer.h")
TargetAdd('libdisplay.in', opts=OPTS, input=IGATEFILES) TargetAdd('libdisplay.in', opts=OPTS, input=IGATEFILES)
@ -2183,7 +2184,7 @@ if (PkgSkip("FREETYPE")==0):
# DIRECTORY: panda/src/text/ # DIRECTORY: panda/src/text/
# #
OPTS=['DIR:panda/src/text', 'BUILDING:PANDA', 'ZLIB', 'FREETYPE', 'BIGOBJ:TRUE'] OPTS=['DIR:panda/src/text', 'BUILDING:PANDA', 'ZLIB', 'FREETYPE', 'BIGOBJ']
TargetAdd('text_composite.obj', opts=OPTS, input='text_composite.cxx') TargetAdd('text_composite.obj', opts=OPTS, input='text_composite.cxx')
IGATEFILES=GetDirectoryContents('panda/src/text', ["*.h", "*_composite.cxx"]) IGATEFILES=GetDirectoryContents('panda/src/text', ["*.h", "*_composite.cxx"])
TargetAdd('libtext.in', opts=OPTS, input=IGATEFILES) TargetAdd('libtext.in', opts=OPTS, input=IGATEFILES)
@ -2205,10 +2206,10 @@ TargetAdd('libmovies_igate.obj', input='libmovies.in', opts=["DEPENDENCYONLY"])
# DIRECTORY: panda/src/grutil/ # DIRECTORY: panda/src/grutil/
# #
OPTS=['DIR:panda/src/grutil', 'BUILDING:PANDA', 'FFMPEG', 'ARTOOLKIT', 'OPENCV', 'BIGOBJ:TRUE'] OPTS=['DIR:panda/src/grutil', 'BUILDING:PANDA', 'FFMPEG', 'ARTOOLKIT', 'OPENCV', 'BIGOBJ']
TargetAdd('grutil_multitexReducer.obj', opts=OPTS, input='multitexReducer.cxx') TargetAdd('grutil_multitexReducer.obj', opts=OPTS, input='multitexReducer.cxx')
TargetAdd('grutil_composite1.obj', opts=OPTS+["BIGOBJ:TRUE"], input='grutil_composite1.cxx') TargetAdd('grutil_composite1.obj', opts=OPTS+["BIGOBJ"], input='grutil_composite1.cxx')
TargetAdd('grutil_composite2.obj', opts=OPTS+["BIGOBJ:TRUE"], input='grutil_composite2.cxx') TargetAdd('grutil_composite2.obj', opts=OPTS+["BIGOBJ"], input='grutil_composite2.cxx')
IGATEFILES=GetDirectoryContents('panda/src/grutil', ["*.h", "*_composite.cxx"]) IGATEFILES=GetDirectoryContents('panda/src/grutil', ["*.h", "*_composite.cxx"])
TargetAdd('libgrutil.in', opts=OPTS, input=IGATEFILES) TargetAdd('libgrutil.in', opts=OPTS, input=IGATEFILES)
TargetAdd('libgrutil.in', opts=['IMOD:panda', 'ILIB:libgrutil', 'SRCDIR:panda/src/grutil']) TargetAdd('libgrutil.in', opts=['IMOD:panda', 'ILIB:libgrutil', 'SRCDIR:panda/src/grutil'])
@ -2218,7 +2219,7 @@ TargetAdd('libgrutil_igate.obj', input='libgrutil.in', opts=["DEPENDENCYONLY"])
# DIRECTORY: panda/src/tform/ # DIRECTORY: panda/src/tform/
# #
OPTS=['DIR:panda/src/tform', 'BUILDING:PANDA', 'BIGOBJ:TRUE'] OPTS=['DIR:panda/src/tform', 'BUILDING:PANDA', 'BIGOBJ']
TargetAdd('tform_composite.obj', opts=OPTS, input='tform_composite.cxx') TargetAdd('tform_composite.obj', opts=OPTS, input='tform_composite.cxx')
IGATEFILES=GetDirectoryContents('panda/src/tform', ["*.h", "*_composite.cxx"]) IGATEFILES=GetDirectoryContents('panda/src/tform', ["*.h", "*_composite.cxx"])
TargetAdd('libtform.in', opts=OPTS, input=IGATEFILES) TargetAdd('libtform.in', opts=OPTS, input=IGATEFILES)
@ -2230,7 +2231,7 @@ TargetAdd('libtform_igate.obj', input='libtform.in', opts=["DEPENDENCYONLY"])
# #
OPTS=['DIR:panda/src/collide', 'BUILDING:PANDA'] OPTS=['DIR:panda/src/collide', 'BUILDING:PANDA']
TargetAdd('collide_composite.obj', opts=OPTS+["BIGOBJ:TRUE"], input='collide_composite.cxx') TargetAdd('collide_composite.obj', opts=OPTS+["BIGOBJ"], input='collide_composite.cxx')
IGATEFILES=GetDirectoryContents('panda/src/collide', ["*.h", "*_composite.cxx"]) IGATEFILES=GetDirectoryContents('panda/src/collide', ["*.h", "*_composite.cxx"])
TargetAdd('libcollide.in', opts=OPTS, input=IGATEFILES) TargetAdd('libcollide.in', opts=OPTS, input=IGATEFILES)
TargetAdd('libcollide.in', opts=['IMOD:panda', 'ILIB:libcollide', 'SRCDIR:panda/src/collide']) TargetAdd('libcollide.in', opts=['IMOD:panda', 'ILIB:libcollide', 'SRCDIR:panda/src/collide'])
@ -2252,7 +2253,7 @@ TargetAdd('libparametrics_igate.obj', input='libparametrics.in', opts=["DEPENDEN
# #
OPTS=['DIR:panda/src/pgui', 'BUILDING:PANDA'] OPTS=['DIR:panda/src/pgui', 'BUILDING:PANDA']
TargetAdd('pgui_composite.obj', opts=OPTS+["BIGOBJ:TRUE"], input='pgui_composite.cxx') TargetAdd('pgui_composite.obj', opts=OPTS+["BIGOBJ"], input='pgui_composite.cxx')
IGATEFILES=GetDirectoryContents('panda/src/pgui', ["*.h", "*_composite.cxx"]) IGATEFILES=GetDirectoryContents('panda/src/pgui', ["*.h", "*_composite.cxx"])
TargetAdd('libpgui.in', opts=OPTS, input=IGATEFILES) TargetAdd('libpgui.in', opts=OPTS, input=IGATEFILES)
TargetAdd('libpgui.in', opts=['IMOD:panda', 'ILIB:libpgui', 'SRCDIR:panda/src/pgui']) TargetAdd('libpgui.in', opts=['IMOD:panda', 'ILIB:libpgui', 'SRCDIR:panda/src/pgui'])
@ -2584,14 +2585,14 @@ if PkgSkip("ZLIB")==0:
if (sys.platform.startswith("win")): if (sys.platform.startswith("win")):
OPTS=['DIR:panda/src/windisplay', 'BUILDING:PANDAWIN'] OPTS=['DIR:panda/src/windisplay', 'BUILDING:PANDAWIN']
TargetAdd('windisplay_composite.obj', opts=OPTS+["BIGOBJ:TRUE"], input='windisplay_composite.cxx') TargetAdd('windisplay_composite.obj', opts=OPTS+["BIGOBJ"], input='windisplay_composite.cxx')
TargetAdd('windisplay_windetectdx8.obj', opts=OPTS + ["DX8"], input='winDetectDx8.cxx') TargetAdd('windisplay_windetectdx8.obj', opts=OPTS + ["DX8"], input='winDetectDx8.cxx')
TargetAdd('windisplay_windetectdx9.obj', opts=OPTS + ["DX9"], input='winDetectDx9.cxx') TargetAdd('windisplay_windetectdx9.obj', opts=OPTS + ["DX9"], input='winDetectDx9.cxx')
TargetAdd('libp3windisplay.dll', input='windisplay_composite.obj') TargetAdd('libp3windisplay.dll', input='windisplay_composite.obj')
TargetAdd('libp3windisplay.dll', input='windisplay_windetectdx8.obj') TargetAdd('libp3windisplay.dll', input='windisplay_windetectdx8.obj')
TargetAdd('libp3windisplay.dll', input='windisplay_windetectdx9.obj') TargetAdd('libp3windisplay.dll', input='windisplay_windetectdx9.obj')
TargetAdd('libp3windisplay.dll', input=COMMON_PANDA_LIBS) TargetAdd('libp3windisplay.dll', input=COMMON_PANDA_LIBS)
TargetAdd('libp3windisplay.dll', opts=['WINIMM', 'WINGDI', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM',"BIGOBJ:TRUE"]) TargetAdd('libp3windisplay.dll', opts=['WINIMM', 'WINGDI', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM',"BIGOBJ"])
# #
# DIRECTORY: panda/metalibs/pandadx8/ # DIRECTORY: panda/metalibs/pandadx8/

View File

@ -465,6 +465,8 @@ def ListRegistryKeys(path):
return result return result
def GetRegistryKey(path, subkey): def GetRegistryKey(path, subkey):
if (platform.architecture()[0]=="64bit"):
path = path.replace("SOFTWARE\\", "SOFTWARE\\Wow6432Node\\")
k1=0 k1=0
key = TryRegistryKey(path) key = TryRegistryKey(path)
if (key != 0): if (key != 0):
@ -911,27 +913,32 @@ def SdkLocateVisualStudio():
if (vcdir != 0) and (vcdir[-4:] == "\\VC\\"): if (vcdir != 0) and (vcdir[-4:] == "\\VC\\"):
vcdir = vcdir[:-3] vcdir = vcdir[:-3]
SDK["VISUALSTUDIO"] = vcdir SDK["VISUALSTUDIO"] = vcdir
else: elif "VCINSTALLDIR" in os.environ:
if "VCINSTALLDIR" in os.environ: vcdir = os.environ["VCINSTALLDIR"]
vcdir = os.environ["VCINSTALLDIR"] if (vcdir[-3:] == "\\VC"):
if (vcdir[-3:] == "\\VC"): vcdir = vcdir[:-2]
vcdir = vcdir[:-2] elif (vcdir[-4:] == "\\VC\\"):
elif (vcdir[-4:] == "\\VC\\"): vcdir = vcdir[:-3]
vcdir = vcdir[:-3] SDK["VISUALSTUDIO"] = vcdir
SDK["VISUALSTUDIO"] = vcdir
def SdkLocateMSPlatform(): def SdkLocateMSPlatform():
if (sys.platform != "win32"): return if (sys.platform != "win32"): return
platsdk=GetRegistryKey("SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1", "Install Dir") platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1", "Install Dir")
if (platsdk and not os.path.isdir(platsdk)): platsdk = 0
if (platsdk == 0): if (platsdk == 0):
platsdk=GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.1","InstallationFolder") platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.1","InstallationFolder")
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"))):
platsdk = 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"))):
platsdk = os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2")
if (not os.path.isdir(platsdk)): platsdk = 0
# Doesn't work with the Express versions, so we're checking for the "atlmfc" dir, which is not in the Express # Doesn't work with the Express versions, so we're checking for the "atlmfc" dir, which is not in the Express
if (platsdk == 0 and os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Visual Studio 9\\VC\\atlmfc"))): if (platsdk == 0 and os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Visual Studio 9\\VC\\atlmfc"))
and os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Visual Studio 9\\VC\\PlatformSDK"))):
platsdk = os.path.join(GetProgramFiles(), "Microsoft Visual Studio 9\\VC\\PlatformSDK") platsdk = os.path.join(GetProgramFiles(), "Microsoft Visual Studio 9\\VC\\PlatformSDK")
if (not os.path.isdir(platsdk)): platsdk = 0
# This may not be the best idea but it does give a warning # This may not be the best idea but it does give a warning
if (platsdk == 0): if (platsdk == 0):
@ -939,8 +946,8 @@ def SdkLocateMSPlatform():
WARNINGS.append("Windows SDK directory not found in registry, found in Environment variables instead") WARNINGS.append("Windows SDK directory not found in registry, found in Environment variables instead")
platsdk = os.environ["WindowsSdkDir"] platsdk = os.environ["WindowsSdkDir"]
if (platsdk != 0): if (platsdk != 0):
if (not platsdk.endswith("//")): if (not platsdk.endswith("\\")):
platsdk += "//" platsdk += "\\"
SDK["MSPLATFORM"] = platsdk SDK["MSPLATFORM"] = platsdk
def SdkLocateMacOSX(): def SdkLocateMacOSX():
@ -1018,16 +1025,24 @@ def SetupVisualStudioEnviron():
exit("Could not find the Microsoft Platform SDK") exit("Could not find the Microsoft Platform SDK")
os.environ["VCINSTALLDIR"] = SDK["VISUALSTUDIO"] + "VC" os.environ["VCINSTALLDIR"] = SDK["VISUALSTUDIO"] + "VC"
os.environ["WindowsSdkDir"] = SDK["MSPLATFORM"] os.environ["WindowsSdkDir"] = SDK["MSPLATFORM"]
AddToPathEnv("PATH", SDK["VISUALSTUDIO"] + "VC\\bin") suffix=""
if (platform.architecture()[0]=="64bit"): suffix = "\\amd64"
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")
AddToPathEnv("INCLUDE", SDK["VISUALSTUDIO"] + "VC\\atlmfc\\include") AddToPathEnv("INCLUDE", SDK["VISUALSTUDIO"] + "VC\\atlmfc\\include")
AddToPathEnv("LIB", SDK["VISUALSTUDIO"] + "VC\\lib") AddToPathEnv("LIB", SDK["VISUALSTUDIO"] + "VC\\lib"+suffix)
AddToPathEnv("PATH", SDK["MSPLATFORM"] + "bin")
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")
AddToPathEnv("LIB", SDK["MSPLATFORM"] + "lib") if (platform.architecture()[0]=="32bit"):
AddToPathEnv("LIB", SDK["MSPLATFORM"] + "lib")
elif (os.path.isdir(SDK["MSPLATFORM"] + "lib\\x64")):
AddToPathEnv("LIB", SDK["MSPLATFORM"] + "lib\\x64")
elif (os.path.isdir(SDK["MSPLATFORM"] + "lib\\amd64")):
AddToPathEnv("LIB", SDK["MSPLATFORM"] + "lib\\amd64")
else:
exit("Could not locate 64-bits libraries in Platform SDK!")
######################################################################## ########################################################################
# #
@ -1330,4 +1345,3 @@ def TargetAdd(target, dummy=0, opts=0, input=0, dep=0, ipath=0):
t.deps[FindLocation("interrogate.exe",[])] = 1 t.deps[FindLocation("interrogate.exe",[])] = 1
t.deps[FindLocation("dtool_have_python.dat",[])] = 1 t.deps[FindLocation("dtool_have_python.dat",[])] = 1