diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index bb1ecb15ba..8ad22c45ce 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -21,6 +21,15 @@ except: from makepandacore import * from installpanda import * +import time +import os +import sys + +## jGenPyCode tries to get the directory for Direct from the sys.path. This only works if you +## have installed the sdk using a installer. This would not work if the installer was +## never used and everything was grabbed into a virign environment using cvs. +sys.path.append( os.getcwd() ) +import __builtin__ ######################################################################## ## @@ -53,6 +62,9 @@ COREAPI_VERSION=None PLUGIN_VERSION=None OSXTARGET=None HOST_URL="https://runtime.panda3d.org/" +global STRDXSDKVERSION, STRMSPLATFORMVERSION +STRDXSDKVERSION = 'default' +STRMSPLATFORMVERSION = 'default' if "MACOSX_DEPLOYMENT_TARGET" in os.environ: OSXTARGET=os.environ["MACOSX_DEPLOYMENT_TARGET"] @@ -61,17 +73,20 @@ PkgListSet(["PYTHON", "DIRECT", # Python support "GL", "GLES", "GLES2"] + DXVERSIONS + ["TINYDISPLAY", "NVIDIACG", # 3D graphics "EGL", # OpenGL (ES) integration "OPENAL", "FMODEX", "FFMPEG", # Multimedia - "ODE", "PHYSX", "BULLET", # Physics + "ODE", "PHYSX", "BULLET", "PANDAPHYSICS", # Physics "SPEEDTREE", # SpeedTree "ZLIB", "PNG", "JPEG", "TIFF", "SQUISH", "FREETYPE", # 2D Formats support ] + MAYAVERSIONS + MAXVERSIONS + [ "FCOLLADA", # 3D Formats support "VRPN", "OPENSSL", # Transport "FFTW", "SWSCALE", # Algorithm helpers - "ARTOOLKIT", "OPENCV", "DIRECTCAM", # Augmented Reality + "ARTOOLKIT", "OPENCV", "DIRECTCAM", "VISION", # Augmented Reality "NPAPI", "AWESOMIUM", # Browser embedding "GTK2", "WX", "FLTK", # Toolkit support "OSMESA", "X11", "XF86DGA", "XRANDR", "XCURSOR", # Unix platform support "PANDATOOL", "PVIEW", "DEPLOYTOOLS", # Toolchain + "SKELETON", # Example skeleton project + "PANDADISTORTFX", # Some distortion special lenses + "PANDAPARTICLESYSTEM", # Built in particle system "CONTRIB" # Experimental ]) @@ -119,6 +134,8 @@ def usage(problem): print "" print " --nothing (disable every third-party lib)" print " --everything (enable every third-party lib)" + print " --dxSdk=X (specify version of Dx9 SDK to use: jun2010, aug2009, mar2009, aug2006)" + print " --MSPlatSdk=X (specify MSPlatSdk to use: win71, win61, win60A, winserver2003r2" print "" print "The simplest way to compile panda is to just type:" print "" @@ -130,11 +147,13 @@ def parseopts(args): global INSTALLER,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION global COMPRESSOR,THREADCOUNT,OSXTARGET,HOST_URL global DEBVERSION,RPMRELEASE,P3DSUFFIX + global STRDXSDKVERSION, STRMSPLATFORMVERSION longopts = [ "help","distributor=","verbose","runtime","osxtarget=", "optimize=","everything","nothing","installer","rtdist","nocolor", "version=","lzma","no-python","threads=","outputdir=","override=", - "static","host=","debversion=","rpmrelease=","p3dsuffix="] + "static","host=","debversion=","rpmrelease=","p3dsuffix=", + "dxSdk=", "MSPlatSdk="] anything = 0 optimize = "" for pkg in PkgListGet(): longopts.append("no-"+pkg.lower()) @@ -169,6 +188,16 @@ def parseopts(args): # Backward compatibility, OPENGL was renamed to GL elif (option=="--use-opengl"): PkgEnable("GL") elif (option=="--no-opengl"): PkgDisable("GL") + elif (option=="--dxSdk"): + STRDXSDKVERSION = value.strip().lower() + if STRDXSDKVERSION == '': + print "No DirectX SDK version specified. Using 'default' DirectX SDK search" + STRDXSDKVERSION = 'default' + elif (option=="--MSPlatSdk"): + STRMSPLATFORMVERSION = value.strip().lower() + if STRMSPLATFORMVERSION == '': + print "No MS Platform SDK version specified. Using 'default' MS Platform SDK search" + STRMSPLATFORMVERSION = 'default' else: for pkg in PkgListGet(): if (option=="--use-"+pkg.lower()): @@ -318,13 +347,13 @@ LoadDependencyCache() MakeBuildTree() -SdkLocateDirectX() +SdkLocateDirectX( STRDXSDKVERSION ) SdkLocateMaya() SdkLocateMax() SdkLocateMacOSX(OSXTARGET) SdkLocatePython(RTDIST) SdkLocateVisualStudio() -SdkLocateMSPlatform() +SdkLocateMSPlatform( STRMSPLATFORMVERSION ) SdkLocatePhysX() SdkLocateSpeedTree() @@ -770,10 +799,11 @@ def CompileCxx(obj,src,opts): # Enables Windows 7 mode if SDK is detected. # But only if it is Windows 7 (0x601) and not e. g. Vista (0x600) - platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.0", "InstallationFolder") - winver = sys.getwindowsversion() - if platsdk and os.path.isdir(platsdk) and winver[0] >= 6 and winver[1] >= 1: - cmd += "/DPANDA_WIN7 /DWINVER=0x601 " + if (STRMSPLATFORMVERSION not in ['winserver2003r2', 'win60A']): + platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1", "InstallationFolder") + winver = sys.getwindowsversion() + if platsdk and os.path.isdir(platsdk) and winver[0] >= 6 and winver[1] >= 1: + cmd += "/DPANDA_WIN7 /DWINVER=0x601 " cmd += "/Fo" + obj + " /nologo /c" for x in ipath: cmd += " /I" + x @@ -785,9 +815,13 @@ def CompileCxx(obj,src,opts): if (opts.count('MSFORSCOPE')): cmd += ' /Zc:forScope-' optlevel = GetOptimizeOption(opts) if (optlevel==1): cmd += " /MDd /Zi /RTCs /GS" - if (optlevel==2): cmd += " /MDd /Zi" - if (optlevel==3): cmd += " /MD /Zi /O2 /Ob2 /DFORCE_INLINING" - if (optlevel==4): cmd += " /MD /Zi /Ox /Ob2 /DFORCE_INLINING /DNDEBUG /GL" + if (optlevel==2): cmd += " /MDd /Zi /arch:SSE2" + if (optlevel==3): cmd += " /MD /Zi /O2 /Ob2 /Oi /Ot /arch:SSE2 /fp:fast /DFORCE_INLINING" + if (optlevel==4): + cmd += " /MD /Zi /Ox /Ob2 /Oi /Ot /arch:SSE2 /fp:fast /DFORCE_INLINING /DNDEBUG /GL" + cmd += " /Oy" # jcr add + cmd += " /Zp16" # jcr add # Is this necessary with /Ox? + cmd += " /Fd" + os.path.splitext(obj)[0] + ".pdb" building = GetValueOption(opts, "BUILDING:") if (building): cmd += " /DBUILDING_" + building @@ -970,6 +1004,22 @@ def CompileLib(lib, obj, opts): oscmd("ranlib " + BracketNameWithQuotes(lib)) +######################################################################## +## +## CompileLink implicitly checks whether or not a file like libpanda.lib exists +## This is not explicitly checked stated in the dependency, but is necessary on windows to link in a dll +## +######################################################################## + +def CompileLink_DoesImplicitLibExist(dll, obj, opts): + for x in obj: + if (x.endswith(".dll")): + baseStr = GetOutputDir() + '/lib/' + os.path.splitext(os.path.basename(x))[0] + ".lib" + strFullPath = os.path.join( os.getcwd(), baseStr ) + if not os.path.exists( strFullPath ): + return False + return True + ######################################################################## ## ## CompileLink @@ -983,7 +1033,7 @@ def CompileLink(dll, obj, opts): cmd += " /MACHINE:X64" if ("MFC" not in opts): cmd += " /NOD:MFC90.LIB /NOD:MFC80.LIB /NOD:LIBCMT" - cmd += " /NOD:LIBCI.LIB /DEBUG /MANIFEST" + cmd += " /NOD:LIBCI.LIB /DEBUG" cmd += " /nod:libc /nod:libcmtd /nod:atlthunk /nod:atls" if (GetOrigExt(dll) != ".exe"): cmd += " /DLL" optlevel = GetOptimizeOption(opts) @@ -1157,6 +1207,10 @@ def RunGenPyCode(target, inputs, opts): for i in inputs: if (GetOrigExt(i)==".dll"): cmdstr += " " + os.path.basename(os.path.splitext(i)[0].replace("_d","").replace(GetOutputDir()+"/lib/","")) + + ## On a win7 64 bit system, dir/dir/python.exe doesn't work. Needs dir\\dir\\python.exe + if sys.platform.startswith("win"): + cmdstr = cmdstr.replace('/','\\') oscmd(cmdstr) @@ -2043,7 +2097,8 @@ CopyAllHeaders('panda/src/device') CopyAllHeaders('panda/src/pnmtext') CopyAllHeaders('panda/src/text') CopyAllHeaders('panda/src/grutil') -CopyAllHeaders('panda/src/vision') +if (PkgSkip("VISION")==0): + CopyAllHeaders('panda/src/vision') CopyAllHeaders('panda/src/awesomium') CopyAllHeaders('panda/src/tform') CopyAllHeaders('panda/src/collide') @@ -2051,12 +2106,15 @@ CopyAllHeaders('panda/src/parametrics') CopyAllHeaders('panda/src/pgui') CopyAllHeaders('panda/src/pnmimagetypes') CopyAllHeaders('panda/src/recorder') -CopyAllHeaders('panda/src/vrpn') +if (PkgSkip("VRPN")==0): + CopyAllHeaders('panda/src/vrpn') CopyAllHeaders('panda/src/wgldisplay') CopyAllHeaders('panda/src/ode') CopyAllHeaders('panda/metalibs/pandaode') -CopyAllHeaders('panda/src/physics') -CopyAllHeaders('panda/src/particlesystem') +if (PkgSkip("PANDAPHYSICS")==0): + CopyAllHeaders('panda/src/physics') +if (PkgSkip("PANDAPARTICLESYSTEM")==0): + CopyAllHeaders('panda/src/particlesystem') CopyAllHeaders('panda/src/dxml') CopyAllHeaders('panda/metalibs/panda') CopyAllHeaders('panda/src/audiotraits') @@ -2089,8 +2147,6 @@ CopyAllHeaders('panda/metalibs/pandagl') CopyAllHeaders('panda/metalibs/pandagles') CopyAllHeaders('panda/metalibs/pandagles2') -CopyAllHeaders('panda/src/physics') -CopyAllHeaders('panda/src/particlesystem') CopyAllHeaders('panda/metalibs/pandaphysics') CopyAllHeaders('panda/src/testbed') @@ -3036,7 +3092,7 @@ if (not RUNTIME): # DIRECTORY: panda/src/vision/ # -if (not RUNTIME): +if (PkgSkip("VISION") ==0) & (not RUNTIME): OPTS=['DIR:panda/src/vision', 'BUILDING:VISION', 'ARTOOLKIT', 'OPENCV', 'DX9', 'DIRECTCAM', 'JPEG'] TargetAdd('p3vision_composite1.obj', opts=OPTS, input='p3vision_composite1.cxx') IGATEFILES=GetDirectoryContents('panda/src/vision', ["*.h", "*_composite.cxx"]) @@ -3080,7 +3136,7 @@ if PkgSkip("AWESOMIUM") == 0 and not RUNTIME: # DIRECTORY: panda/src/p3skel # -if (not RUNTIME): +if (PkgSkip('SKELETON')==0) & (not RUNTIME): OPTS=['DIR:panda/src/skel', 'BUILDING:PANDASKEL', 'ADVAPI'] TargetAdd('p3skel_composite1.obj', opts=OPTS, input='p3skel_composite1.cxx') IGATEFILES=GetDirectoryContents("panda/src/skel", ["*.h", "*_composite.cxx"]) @@ -3092,7 +3148,7 @@ if (not RUNTIME): # DIRECTORY: panda/src/p3skel # -if (not RUNTIME): +if (PkgSkip('SKELETON')==0) & (not RUNTIME): OPTS=['BUILDING:PANDASKEL', 'ADVAPI'] TargetAdd('libpandaskel_module.obj', input='libp3skel.in') @@ -3109,7 +3165,7 @@ if (not RUNTIME): # DIRECTORY: panda/src/distort/ # -if (not RUNTIME): +if (PkgSkip('PANDADISTORTFX')==0) & (not RUNTIME): OPTS=['DIR:panda/src/distort', 'BUILDING:PANDAFX'] TargetAdd('p3distort_composite1.obj', opts=OPTS, input='p3distort_composite1.cxx') IGATEFILES=GetDirectoryContents('panda/src/distort', ["*.h", "*_composite.cxx"]) @@ -3121,7 +3177,7 @@ if (not RUNTIME): # DIRECTORY: panda/metalibs/pandafx/ # -if (not RUNTIME): +if (PkgSkip('PANDADISTORTFX')==0) & (not RUNTIME): OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'BUILDING:PANDAFX', 'NVIDIACG'] TargetAdd('pandafx_pandafx.obj', opts=OPTS, input='pandafx.cxx') @@ -3387,7 +3443,8 @@ if (not sys.platform.startswith("win") and PkgSkip("GL")==0 and PkgSkip("OSMESA" OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAMESA', 'NVIDIACG', 'GL'] TargetAdd('libpandamesa.dll', input='p3mesadisplay_composite1.obj') TargetAdd('libpandamesa.dll', input='libp3glstuff.dll') - TargetAdd('libpandamesa.dll', input='libpandafx.dll') + if (PkgSkip('PANDADISTORTFX')==0): + TargetAdd('libpandamesa.dll', input='libpandafx.dll') TargetAdd('libpandamesa.dll', input=COMMON_PANDA_LIBS) TargetAdd('libpandamesa.dll', opts=['MODULE', 'GL', 'OSMESA']) @@ -3433,7 +3490,8 @@ if (sys.platform == 'darwin' and PkgSkip("GL")==0 and not RUNTIME): TargetAdd('libpandagl.dll', input='p3osxdisplay_composite1.obj') TargetAdd('libpandagl.dll', input='p3osxdisplay_osxGraphicsWindow.obj') TargetAdd('libpandagl.dll', input='libp3glstuff.dll') - TargetAdd('libpandagl.dll', input='libpandafx.dll') + if (PkgSkip('PANDADISTORTFX')==0): + TargetAdd('libpandagl.dll', input='libpandafx.dll') TargetAdd('libpandagl.dll', input=COMMON_PANDA_LIBS) TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'NVIDIACG', 'CGGL', 'CARBON', 'AGL', 'COCOA']) @@ -3452,7 +3510,8 @@ if (sys.platform == "win32" and PkgSkip("GL")==0 and not RUNTIME): TargetAdd('libpandagl.dll', input='p3wgldisplay_composite1.obj') TargetAdd('libpandagl.dll', input='libp3windisplay.dll') TargetAdd('libpandagl.dll', input='libp3glstuff.dll') - TargetAdd('libpandagl.dll', input='libpandafx.dll') + if (PkgSkip('PANDADISTORTFX')==0): + TargetAdd('libpandagl.dll', input='libpandafx.dll') TargetAdd('libpandagl.dll', input=COMMON_PANDA_LIBS) TargetAdd('libpandagl.dll', opts=['MODULE', 'WINGDI', 'GL', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM', 'NVIDIACG', 'CGGL']) @@ -3596,7 +3655,7 @@ if (PkgSkip("PHYSX")==0): # DIRECTORY: panda/src/physics/ # -if (not RUNTIME): +if (PkgSkip("PANDAPHYSICS")==0) & (not RUNTIME): OPTS=['DIR:panda/src/physics', 'BUILDING:PANDAPHYSICS'] TargetAdd('p3physics_composite1.obj', opts=OPTS, input='p3physics_composite1.cxx') TargetAdd('p3physics_composite2.obj', opts=OPTS, input='p3physics_composite2.cxx') @@ -3627,12 +3686,13 @@ if (not RUNTIME): # DIRECTORY: panda/metalibs/pandaphysics/ # -if (not RUNTIME): +if (PkgSkip("PANDAPHYSICS")==0) & (not RUNTIME): OPTS=['DIR:panda/metalibs/pandaphysics', 'BUILDING:PANDAPHYSICS'] TargetAdd('pandaphysics_pandaphysics.obj', opts=OPTS, input='pandaphysics.cxx') TargetAdd('libpandaphysics_module.obj', input='libp3physics.in') - TargetAdd('libpandaphysics_module.obj', input='libp3particlesystem.in') + if (PkgSkip("PANDAPARTICLESYSTEM")==0): + TargetAdd('libpandaphysics_module.obj', input='libp3particlesystem.in') TargetAdd('libpandaphysics_module.obj', opts=OPTS) TargetAdd('libpandaphysics_module.obj', opts=['IMOD:pandaphysics', 'ILIB:libpandaphysics']) @@ -5012,12 +5072,16 @@ if (PkgSkip("PYTHON")==0 and not RUNTIME): # add new libraries here. See direct/src/ffi/panda3d.py TargetAdd('PandaModules.py', input='libpandaexpress.dll') TargetAdd('PandaModules.py', input='libpanda.dll') - TargetAdd('PandaModules.py', input='libpandaphysics.dll') - TargetAdd('PandaModules.py', input='libpandafx.dll') + if (PkgSkip("PANDAPHYSICS")==0): + TargetAdd('PandaModules.py', input='libpandaphysics.dll') + if (PkgSkip('PANDADISTORTFX')==0): + TargetAdd('PandaModules.py', input='libpandafx.dll') if (PkgSkip("DIRECT")==0): TargetAdd('PandaModules.py', input='libp3direct.dll') - TargetAdd('PandaModules.py', input='libp3vision.dll') - TargetAdd('PandaModules.py', input='libpandaskel.dll') + if (PkgSkip("VISION")==0): + TargetAdd('PandaModules.py', input='libp3vision.dll') + if (PkgSkip("SKELETON")==0): + TargetAdd('PandaModules.py', input='libpandaskel.dll') TargetAdd('PandaModules.py', input='libpandaegg.dll') if (PkgSkip("AWESOMIUM")==0): TargetAdd('PandaModules.py', input='libp3awesomium.dll') @@ -5127,6 +5191,10 @@ def BuildWorker(taskqueue, donequeue): def AllSourcesReady(task, pending): sources = task[3] + for x in sources: + if (x in pending): + return 0 + sources = task[1][1] for x in sources: if (x in pending): return 0 @@ -5141,6 +5209,23 @@ def ParallelMake(tasklist): donequeue=Queue.Queue() taskqueue=Queue.Queue() # Build up a table listing all the pending targets + #task = [CompileAnything, [name, inputs, opts], [name], deps, []] + # task[2] = [name] + # task[3] = deps + # import pdb + # for task in tasklist: + # for targets in task[2]: + # # if 'libpanda.dll' in targets: + # # print "\n\n\n" + # # print task + # # print "\n\n\n" + # # pdb.set_trace() + # if 'libpandaskel.dll' in targets: + # print "\n\n\n" + # print task + # print "\n\n\n" + # pdb.set_trace() + iNumStartingTasks = len(tasklist) pending = {} for task in tasklist: for target in task[2]: @@ -5153,10 +5238,10 @@ def ParallelMake(tasklist): # Feed tasks to the workers. tasksqueued = 0 while (1): - if (tasksqueued < THREADCOUNT*2): + if (tasksqueued < THREADCOUNT): extras = [] for task in tasklist: - if (tasksqueued < THREADCOUNT*3) & (AllSourcesReady(task, pending)): + if (tasksqueued < THREADCOUNT) & (AllSourcesReady(task, pending)): if (NeedsBuild(task[2], task[3])): tasksqueued += 1 taskqueue.put(task) @@ -5166,6 +5251,7 @@ def ParallelMake(tasklist): else: extras.append(task) tasklist = extras + print '**Number of tasks left', len(tasklist), 'out of ', iNumStartingTasks, ' starting tasks' sys.stdout.flush() if (tasksqueued == 0): break donetask = donequeue.get() @@ -5186,6 +5272,7 @@ def ParallelMake(tasklist): def SequentialMake(tasklist): i = 0 + print '--->Number of tasks', len(tasklist) for task in tasklist: if (NeedsBuild(task[2], task[3])): apply(task[0], task[1] + [(i * 100.0) / len(tasklist)]) diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 923f34456a..072de34ca6 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -204,7 +204,9 @@ def exit(msg = ""): print GetColor("red") + "Build terminated." + GetColor() sys.stdout.flush() sys.stderr.flush() - os._exit(1) + ##Don't quit the interperter if I'm running this file directly (debugging) + if __name__ != '__main__': + os._exit(1) else: print msg raise "initiate-exit" @@ -1330,49 +1332,151 @@ def GetSdkDir(sdkname, sdkkey = None): return sdir -def SdkLocateDirectX(): +def SdkLocateDirectX( strMode = 'default' ): if (sys.platform != "win32"): return - GetSdkDir("directx8", "DX8") - GetSdkDir("directx9", "DX9") - ## We first try to locate the August SDK in 64 bits, then 32. - if ("DX9" not in SDK): - dir = GetRegistryKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath") - if (dir != 0): - SDK["DX9"] = dir.replace("\\", "/").rstrip("/") - SDK["GENERIC_DXERR_LIBRARY"] = 1; - if ("DX9" not in SDK): - dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath") - if (dir != 0): - SDK["DX9"] = dir.replace("\\", "/").rstrip("/") - SDK["GENERIC_DXERR_LIBRARY"] = 1; - if ("DX9" not in SDK): - ## Try to locate the key within the "new" March 2009 location in the registry (yecch): - dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (March 2009)", "InstallPath") - if (dir != 0): - SDK["DX9"] = dir.replace("\\", "/").rstrip("/") - archStr = "x86" - 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): - if (subdir[0]=="{"): - dir = GetRegistryKey(uninstaller+"\\"+subdir, "InstallLocation") - if (dir != 0): - if (("DX8" not in SDK) and - (os.path.isfile(dir+"\\Include\\d3d8.h")) and - (os.path.isfile(dir+"\\Include\\d3dx8.h")) and - (os.path.isfile(dir+"\\Lib\\d3d8.lib")) and - (os.path.isfile(dir+"\\Lib\\d3dx8.lib"))): - SDK["DX8"] = dir.replace("\\", "/").rstrip("/") - if (("DX9" not in SDK) and - (os.path.isfile(dir+"\\Include\\d3d9.h")) and - (os.path.isfile(dir+"\\Include\\d3dx9.h")) and - (os.path.isfile(dir+"\\Include\\dxsdkver.h")) and - (os.path.isfile(dir+"\\Lib\\" + archStr + "\\d3d9.lib")) and - (os.path.isfile(dir+"\\Lib\\" + archStr + "\\d3dx9.lib"))): - SDK["DX9"] = dir.replace("\\", "/").rstrip("/") + print '\nDirectX SDK:' + if strMode == 'default': + GetSdkDir("directx8", "DX8") + GetSdkDir("directx9", "DX9") + if ("DX9" not in SDK): + strMode = 'latest' + if strMode == 'latest': + print '\tLooking for the latest DirectX SDK' + ## We first try to locate the August SDK in 64 bits, then 32. + if ("DX9" not in SDK): + dir = GetRegistryKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX\\Microsoft DirectX SDK (June 2010)", "InstallPath") + if (dir != 0): + print "\t\tUsing DirectX SDK June 2010" + SDK["DX9"] = dir.replace("\\", "/").rstrip("/") + SDK["GENERIC_DXERR_LIBRARY"] = 1; + if ("DX9" not in SDK): + dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (June 2010)", "InstallPath") + if (dir != 0): + print "\t\tUsing DirectX SDK June 2010" + SDK["DX9"] = dir.replace("\\", "/").rstrip("/") + SDK["GENERIC_DXERR_LIBRARY"] = 1; + if ("DX9" not in SDK): + dir = GetRegistryKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath") + if (dir != 0): + print "\t\tUsing DirectX SDK Aug 2009" + SDK["DX9"] = dir.replace("\\", "/").rstrip("/") + SDK["GENERIC_DXERR_LIBRARY"] = 1; + if ("DX9" not in SDK): + dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath") + if (dir != 0): + print "\t\tUsing DirectX SDK Aug 2009" + SDK["DX9"] = dir.replace("\\", "/").rstrip("/") + SDK["GENERIC_DXERR_LIBRARY"] = 1; + if ("DX9" not in SDK): + ## Try to locate the key within the "new" March 2009 location in the registry (yecch): + dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (March 2009)", "InstallPath") + if (dir != 0): + print "\t\tUsing DirectX SDK March 2009" + SDK["DX9"] = dir.replace("\\", "/").rstrip("/") + archStr = "x86" + if (is_64): archStr = "x64" + if ("DX9" not in SDK) or ("DX8" not in SDK): + if 'DX9' in SDK: + print "\t\tLooking for the Dx8 SDK in the registry uninstaller keys" + if 'DX8' in SDK: + print "\t\tLooking for the Dx9 SDK in the registry uninstaller keys" + if ("DX9" not in SDK) & ("DX8" not in SDK): + print "\t\tLooking for the Dx8,9 SDKs in the register uninstaller keys" + uninstaller = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; + for subdir in ListRegistryKeys(uninstaller): + if (subdir[0]=="{"): + dir = GetRegistryKey(uninstaller+"\\"+subdir, "InstallLocation") + if (dir != 0): + if (("DX8" not in SDK) and + (os.path.isfile(dir+"\\Include\\d3d8.h")) and + (os.path.isfile(dir+"\\Include\\d3dx8.h")) and + (os.path.isfile(dir+"\\Lib\\d3d8.lib")) and + (os.path.isfile(dir+"\\Lib\\d3dx8.lib"))): + SDK["DX8"] = dir.replace("\\", "/").rstrip("/") + print '\t\t\tFound Default Dx8 Sdk from the uninstaller keys in the registry!' + if (("DX9" not in SDK) and + (os.path.isfile(dir+"\\Include\\d3d9.h")) and + (os.path.isfile(dir+"\\Include\\d3dx9.h")) and + (os.path.isfile(dir+"\\Include\\dxsdkver.h")) and + (os.path.isfile(dir+"\\Lib\\" + archStr + "\\d3d9.lib")) and + (os.path.isfile(dir+"\\Lib\\" + archStr + "\\d3dx9.lib"))): + SDK["DX9"] = dir.replace("\\", "/").rstrip("/") + print '\t\t\tFound default Dx9 Sdk from the uninstaller keys in the registery' + if ("DX9" not in SDK): + exit("\t\tCouldn't find a DirectX SDK") + elif strMode == 'jun2010': + if ("DX9" not in SDK): + dir = GetRegistryKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX\\Microsoft DirectX SDK (June 2010)", "InstallPath") + if (dir != 0): + print "\t\tFound DirectX SDK June 2010" + SDK["DX9"] = dir.replace("\\", "/").rstrip("/") + SDK["GENERIC_DXERR_LIBRARY"] = 1; + if ("DX9" not in SDK): + dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (June 2010)", "InstallPath") + if (dir != 0): + print "\t\tFound DirectX SDK June 2010" + SDK["DX9"] = dir.replace("\\", "/").rstrip("/") + SDK["GENERIC_DXERR_LIBRARY"] = 1; + if ("DX9" not in SDK): + exit("Couldn't find DirectX June2010 SDK") + elif strMode == 'aug2009': + if ("DX9" not in SDK): + dir = GetRegistryKey("SOFTWARE\\Wow6432Node\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath") + if (dir != 0): + print "\t\tFound DirectX SDK Aug 2009" + SDK["DX9"] = dir.replace("\\", "/").rstrip("/") + SDK["GENERIC_DXERR_LIBRARY"] = 1; + if ("DX9" not in SDK): + dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (August 2009)", "InstallPath") + if (dir != 0): + print "\t\tFound DirectX SDK Aug 2009" + SDK["DX9"] = dir.replace("\\", "/").rstrip("/") + SDK["GENERIC_DXERR_LIBRARY"] = 1; + if ("DX9" not in SDK): + exit("Couldn't find DirectX Aug 2009 SDK") + elif strMode == 'mar2009': + if ("DX9" not in SDK): + ## Try to locate the key within the "new" March 2009 location in the registry (yecch): + dir = GetRegistryKey("SOFTWARE\\Microsoft\\DirectX\\Microsoft DirectX SDK (March 2009)", "InstallPath") + if (dir != 0): + print "\t\tFound DirectX SDK March 2009" + SDK["DX9"] = dir.replace("\\", "/").rstrip("/") + if ("DX9" not in SDK): + exit("Couldn't find DirectX March 2009 SDK") + elif strMode == 'aug2006': + archStr = "x86" + if (is_64): archStr = "x64" + if ("DX9" not in SDK) or ("DX8" not in SDK): + print "\t\tLooking for the DirectX SDK in registry uninstaller keys" + uninstaller = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; + for subdir in ListRegistryKeys(uninstaller): + if (subdir[0]=="{"): + dir = GetRegistryKey(uninstaller+"\\"+subdir, "InstallLocation") + if (dir != 0): + if (("DX8" not in SDK) and + (os.path.isfile(dir+"\\Include\\d3d8.h")) and + (os.path.isfile(dir+"\\Include\\d3dx8.h")) and + (os.path.isfile(dir+"\\Lib\\d3d8.lib")) and + (os.path.isfile(dir+"\\Lib\\d3dx8.lib"))): + SDK["DX8"] = dir.replace("\\", "/").rstrip("/") + print '\t\t\tFound Dx8 Sdk in registry uninstaller keys' + if (("DX9" not in SDK) and + (os.path.isfile(dir+"\\Include\\d3d9.h")) and + (os.path.isfile(dir+"\\Include\\d3dx9.h")) and + (os.path.isfile(dir+"\\Include\\dxsdkver.h")) and + (os.path.isfile(dir+"\\Lib\\" + archStr + "\\d3d9.lib")) and + (os.path.isfile(dir+"\\Lib\\" + archStr + "\\d3dx9.lib"))): + SDK["DX9"] = dir.replace("\\", "/").rstrip("/") + print '\t\t\tFound Dx9 Sdk in registry uninstaller keys' + if ("DX9" not in SDK): + exit("Couldn't find a DirectX Aug 2006 SDK") if ("DX9" in SDK): SDK["DIRECTCAM"] = SDK["DX9"] + else: + print "\tCouldn't find a DirectX 9 SDK" + if ("DX8" not in SDK): + print "\tCouldn't find a DirectX 8 SDK" + print "\n" def SdkLocateMaya(): for (ver,key) in MAYAVERSIONINFO: @@ -1467,45 +1571,123 @@ def SdkLocateVisualStudio(): vcdir = vcdir[:-3] SDK["VISUALSTUDIO"] = vcdir -def SdkLocateMSPlatform(): - if (sys.platform != "win32"): return - platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.0", "InstallationFolder") - if (platsdk): - if os.path.isdir(platsdk): - print "Windows 7 SDK detected. Enabling special features (multi-touch)." - else: +def SdkLocateMSPlatform( strMode = 'default'): + print '\nWindows Platform SDK:' + platsdk = 0 + if (strMode == 'default'): + print '\tSearching for the latest version' + platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1", "InstallationFolder") + if (platsdk and not os.path.isdir(platsdk)): platsdk = 0 - if (platsdk == 0): - 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: + print "\tWindows 7.1 SDK detected. Enabling special features (multi-touch)." + + if (platsdk == 0): + 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: + print "\tFound Windows Server 2003 R2 SDK from registry key" + + if (platsdk == 0): + platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.1","InstallationFolder") + if (platsdk and not os.path.isdir(platsdk)): + platsdk = 0 + if platsdk: + print "\tFound Win 6.1 Platform SDK" + + if (platsdk == 0): + platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.0A","InstallationFolder") + if (platsdk and not os.path.isdir(platsdk)): + platsdk = 0 + if platsdk: + print "\tFound Win 6.0A Platform SDK" + + if (platsdk == 0 and os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2"))): + 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 + if platsdk: + print "\tFound Microsoft Platform SDK for Windows Server 2003 R2 from GetProgramFiles()" + + if (platsdk == 0 and os.path.isdir("C:/Program Files/Microsoft Platform SDK for Windows Server 2003 R2")): + if (not is_64 or os.path.isdir(os.path.join("C:/Program Files/Microsoft Platform SDK for Windows Server 2003 R2", "Lib", "AMD64"))): + platsdk = os.path.join("C:/Program Files/Microsoft Platform SDK for Windows Server 2003 R2") + if (not os.path.isdir(platsdk)): + platsdk = 0 + if platsdk: + print "\tFound Microsoft Platform SDK for Windows Server 2003 R2 from C:/Program Files/..." + + # 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")) + 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") + if (not os.path.isdir(platsdk)): + platsdk = 0 + if platsdk: + print "\tUsing the VC 9.0 platform SDK" + + # This may not be the best idea but it does give a warning + if (platsdk == 0): + if ("WindowsSdkDir" in os.environ): + WARNINGS.append("Windows SDK directory not found in registry, found in Environment variables instead") + platsdk = os.environ["WindowsSdkDir"] + print "\tUsing Win PlatformSDK from os.environ" + + elif (strMode == 'win71'): + platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1", "InstallationFolder") + if (platsdk and not os.path.isdir(platsdk)): + platsdk = 0 + if platsdk: + print "\tWindows 7.1 SDK detected. Enabling special features (multi-touch)." + else: + exit("Couldn't find Win7.1 Platform SDK") + elif (strMode == 'win61'): platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.1","InstallationFolder") - if (platsdk and not os.path.isdir(platsdk)): platsdk = 0 - - if (platsdk == 0): + if (platsdk and not os.path.isdir(platsdk)): + platsdk = 0 + if platsdk: + print "\tWindows 6.1 SDK detected." + else: + exit("Couldn't find Win6.1 Platform SDK") + elif (strMode == 'win60A'): platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.0A","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 (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 - - # 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")) - 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") - if (not os.path.isdir(platsdk)): platsdk = 0 - - # This may not be the best idea but it does give a warning - if (platsdk == 0): - if ("WindowsSdkDir" in os.environ): - WARNINGS.append("Windows SDK directory not found in registry, found in Environment variables instead") - platsdk = os.environ["WindowsSdkDir"] + if (platsdk and not os.path.isdir(platsdk)): + platsdk = 0 + if platsdk: + print "\tWin 6.0A Platform SDK detected." + else: + exit("Couldn't find Win6.0 Platform SDK") + elif (strMode == 'winserver2003r2'): + 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: + print "\tFound Windows Server 2003 R2 Platform SDK from registry key \\D2FF...." + if (platsdk == 0 and os.path.isdir(os.path.join(GetProgramFiles(), "Microsoft Platform SDK for Windows Server 2003 R2"))): + 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 + if platsdk: + print "\tUsing Microsoft Platform SDK for Windows Server 2003 R2 from GetProgramFiles()" + if (platsdk == 0 and os.path.isdir("C:/Program Files/Microsoft Platform SDK for Windows Server 2003 R2")): + if (not is_64 or os.path.isdir(os.path.join("C:/Program Files/Microsoft Platform SDK for Windows Server 2003 R2", "Lib", "AMD64"))): + platsdk = os.path.join("C:/Program Files/Microsoft Platform SDK for Windows Server 2003 R2") + if (not os.path.isdir(platsdk)): + platsdk = 0 + if platsdk: + print "\tUsing Microsoft Platform SDK for Windows Server 2003 R2 from C:/Progra Files/..." + if not platsdk: + exit("Couldn't find Windows Server 2003 R2 PlatformSDK") + if (platsdk != 0): if (not platsdk.endswith("\\")): platsdk += "\\" SDK["MSPLATFORM"] = platsdk + else: + print "\tCouldn't locate a windows platform SDK." def SdkLocateMacOSX(osxtarget=None): if (sys.platform != "darwin"): return @@ -2101,4 +2283,12 @@ def TargetAdd(target, dummy=0, opts=0, input=0, dep=0, ipath=0, winrc=0): if (target.endswith(".in")): t.deps[FindLocation("interrogate.exe",[])] = 1 t.deps[FindLocation("dtool_have_python.dat",[])] = 1 + if (target.endswith(".pz")): + t.deps[FindLocation("pzip.exe",[])] = 1 +if __name__ == '__main__': + ##Debug SDK search check + if sys.platform == "win32": + SdkLocateDirectX( 'aug2006' ) + SdkLocateMSPlatform( 'winserver2003r2') + \ No newline at end of file