diff --git a/direct/src/p3d/DeploymentTools.py b/direct/src/p3d/DeploymentTools.py index 084dd18e4e..f261ff2854 100644 --- a/direct/src/p3d/DeploymentTools.py +++ b/direct/src/p3d/DeploymentTools.py @@ -624,7 +624,7 @@ class Installer: if platform == None: platform = PandaSystem.getPlatform() - if platform == "win32": + if platform.startswith("win"): self.buildNSIS(output, platform) return elif "_" in platform: diff --git a/direct/src/showutil/FreezeTool.py b/direct/src/showutil/FreezeTool.py index 5e93cb2933..7c9f348695 100644 --- a/direct/src/showutil/FreezeTool.py +++ b/direct/src/showutil/FreezeTool.py @@ -86,7 +86,7 @@ class CompilationEnvironment: self.determineStandardSetup() def determineStandardSetup(self): - if self.platform == 'win32': + if self.platform.startswith('win'): self.Python = PREFIX if ('VCINSTALLDIR' in os.environ): @@ -117,17 +117,23 @@ class CompilationEnvironment: self.MD = '/MDd' self.dllext = '_d' + # MSVC/bin and /lib directories have a different location + # for win64. + self.suffix64 = '' + if self.platform == 'win64': + self.suffix64 = '\\amd64' + # If it is run by makepanda, it handles the MSVC and PlatformSDK paths itself. if ('MAKEPANDA' in os.environ): self.compileObj = 'cl /wd4996 /Fo%(basename)s.obj /nologo /c %(MD)s /Zi /O2 /Ob2 /EHsc /Zm300 /W3 /I"%(pythonIPath)s" %(filename)s' self.linkExe = 'link /nologo /MAP:NUL /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO /LIBPATH:"%(python)s\libs" /out:%(basename)s.exe %(basename)s.obj' self.linkDll = 'link /nologo /DLL /MAP:NUL /FIXED:NO /OPT:REF /INCREMENTAL:NO /LIBPATH:"%(python)s\libs" /out:%(basename)s%(dllext)s.pyd %(basename)s.obj' else: - os.environ['PATH'] += ';' + self.MSVC + '\\bin;' + self.MSVC + '\\Common7\\IDE;' + self.PSDK + '\\bin' + os.environ['PATH'] += ';' + self.MSVC + '\\bin' + self.suffix64 + ';' + self.MSVC + '\\Common7\\IDE;' + self.PSDK + '\\bin' self.compileObj = 'cl /wd4996 /Fo%(basename)s.obj /nologo /c %(MD)s /Zi /O2 /Ob2 /EHsc /Zm300 /W3 /I"%(pythonIPath)s" /I"%(PSDK)s\include" /I"%(MSVC)s\include" %(filename)s' - self.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' - self.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%(dllext)s.pyd %(basename)s.obj' + self.linkExe = 'link /nologo /MAP:NUL /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO /LIBPATH:"%(PSDK)s\lib" /LIBPATH:"%(MSVC)s\\lib%(suffix64)s" /LIBPATH:"%(python)s\libs" /out:%(basename)s.exe %(basename)s.obj' + self.linkDll = 'link /nologo /DLL /MAP:NUL /FIXED:NO /OPT:REF /INCREMENTAL:NO /LIBPATH:"%(PSDK)s\lib" /LIBPATH:"%(MSVC)s\\lib%(suffix64)s" /LIBPATH:"%(python)s\libs" /out:%(basename)s%(dllext)s.pyd %(basename)s.obj' elif self.platform.startswith('osx_'): # OSX @@ -157,6 +163,7 @@ class CompilationEnvironment: 'python' : self.Python, 'MSVC' : self.MSVC, 'PSDK' : self.PSDK, + 'suffix64' : self.suffix64, 'MD' : self.MD, 'pythonIPath' : self.PythonIPath, 'pythonVersion' : self.PythonVersion, @@ -172,6 +179,7 @@ class CompilationEnvironment: 'python' : self.Python, 'MSVC' : self.MSVC, 'PSDK' : self.PSDK, + 'suffix64' : self.suffix64, 'pythonIPath' : self.PythonIPath, 'pythonVersion' : self.PythonVersion, 'arch' : self.arch, @@ -187,6 +195,7 @@ class CompilationEnvironment: 'python' : self.Python, 'MSVC' : self.MSVC, 'PSDK' : self.PSDK, + 'suffix64' : self.suffix64, 'MD' : self.MD, 'pythonIPath' : self.PythonIPath, 'pythonVersion' : self.PythonVersion, @@ -202,6 +211,7 @@ class CompilationEnvironment: 'python' : self.Python, 'MSVC' : self.MSVC, 'PSDK' : self.PSDK, + 'suffix64' : self.suffix64, 'pythonIPath' : self.PythonIPath, 'pythonVersion' : self.PythonVersion, 'arch' : self.arch, @@ -442,6 +452,7 @@ extend_frozen_modules(const struct _frozen *new_modules, int new_count) { programFile = """ #include "Python.h" +#include "malloc.h" %(moduleDefs)s @@ -560,7 +571,7 @@ class Freezer: # The filename extension to append to the object file. self.objectExtension = '.o' - if self.platform == 'win32': + if self.platform.startswith('win'): self.objectExtension = '.obj' # Change any of these to change the generated startup and glue @@ -1250,7 +1261,7 @@ class Freezer: dllexport = '' dllimport = '' - if self.platform == 'win32': + if self.platform.startswith('win'): dllexport = '__declspec(dllexport) ' dllimport = '__declspec(dllimport) ' @@ -1259,7 +1270,7 @@ class Freezer: if compileToExe: code = self.frozenMainCode - if self.platform == 'win32': + if self.platform.startswith('win'): code += self.frozenDllMainCode initCode = self.mainInitCode % { 'frozenMainCode' : code, @@ -1267,7 +1278,7 @@ class Freezer: 'dllexport' : dllexport, 'dllimport' : dllimport, } - if self.platform == 'win32': + if self.platform.startswith('win'): initCode += self.frozenExtensions target = basename + '.exe' else: @@ -1276,7 +1287,7 @@ class Freezer: compileFunc = self.cenv.compileExe else: - if self.platform == 'win32': + if self.platform.startswith('win'): target = basename + self.cenv.dllext + '.pyd' else: target = basename + '.so' diff --git a/dtool/src/dtoolbase/dtool_platform.h b/dtool/src/dtoolbase/dtool_platform.h index ab7bc98407..906aecdfbe 100755 --- a/dtool/src/dtoolbase/dtool_platform.h +++ b/dtool/src/dtoolbase/dtool_platform.h @@ -25,12 +25,12 @@ #if defined(DTOOL_PLATFORM) // This has already been defined explicitly by the Config.pp file. -#elif defined(_WIN32) -#define DTOOL_PLATFORM "win32" - #elif defined(_WIN64) #define DTOOL_PLATFORM "win64" +#elif defined(_WIN32) +#define DTOOL_PLATFORM "win32" + #elif defined(__APPLE__) #if defined(BUILD_IPHONE) #define DTOOL_PLATFORM "iphone"