Browse Source

some architecture issues

David Rose 16 years ago
parent
commit
bd2803089a
1 changed files with 18 additions and 3 deletions
  1. 18 3
      direct/src/showutil/FreezeTool.py

+ 18 - 3
direct/src/showutil/FreezeTool.py

@@ -76,6 +76,9 @@ class CompilationEnvironment:
         # The _d extension to add to dll filenames on Windows in debug builds.
         # The _d extension to add to dll filenames on Windows in debug builds.
         self.dllext = ''
         self.dllext = ''
 
 
+        # Any architecture-specific string.
+        self.arch = ''
+
         self.determineStandardSetup()
         self.determineStandardSetup()
 
 
     def determineStandardSetup(self):
     def determineStandardSetup(self):
@@ -122,9 +125,17 @@ class CompilationEnvironment:
 
 
         elif sys.platform == 'darwin':
         elif sys.platform == 'darwin':
             # OSX
             # OSX
-            self.compileObj = "gcc -fPIC -c -o %(basename)s.o -O2 -I%(pythonIPath)s %(filename)s"
-            self.linkExe = "gcc -o %(basename)s %(basename)s.o -framework Python"
-            self.linkDll = "gcc -undefined dynamic_lookup -bundle -o %(basename)s.so %(basename)s.o"
+            plat = PandaSystem.getPlatform()
+            proc = plat.split('_', 1)[1]
+            if proc == 'i386':
+                self.arch = '-arch i386'
+            elif proc == 'ppc':
+                self.arch = '-arch ppc'
+            elif proc == 'x86_64':
+                self.arch = '-arch x86_x64'
+            self.compileObj = "gcc -fPIC -c %(arch)s -o %(basename)s.o -O2 -I%(pythonIPath)s %(filename)s"
+            self.linkExe = "gcc %(arch)s -o %(basename)s %(basename)s.o -framework Python"
+            self.linkDll = "gcc %(arch)s -undefined dynamic_lookup -bundle -o %(basename)s.so %(basename)s.o"
 
 
         else:
         else:
             # Unix
             # Unix
@@ -144,6 +155,7 @@ class CompilationEnvironment:
             'MD' : self.MD,
             'MD' : self.MD,
             'pythonIPath' : self.PythonIPath,
             'pythonIPath' : self.PythonIPath,
             'pythonVersion' : self.PythonVersion,
             'pythonVersion' : self.PythonVersion,
+            'arch' : self.arch,
             'filename' : filename,
             'filename' : filename,
             'basename' : basename,
             'basename' : basename,
             }
             }
@@ -157,6 +169,7 @@ class CompilationEnvironment:
             'PSDK' : self.PSDK,
             'PSDK' : self.PSDK,
             'pythonIPath' : self.PythonIPath,
             'pythonIPath' : self.PythonIPath,
             'pythonVersion' : self.PythonVersion,
             'pythonVersion' : self.PythonVersion,
+            'arch' : self.arch,
             'filename' : filename,
             'filename' : filename,
             'basename' : basename,
             'basename' : basename,
             }
             }
@@ -172,6 +185,7 @@ class CompilationEnvironment:
             'MD' : self.MD,
             'MD' : self.MD,
             'pythonIPath' : self.PythonIPath,
             'pythonIPath' : self.PythonIPath,
             'pythonVersion' : self.PythonVersion,
             'pythonVersion' : self.PythonVersion,
+            'arch' : self.arch,
             'filename' : filename,
             'filename' : filename,
             'basename' : basename,
             'basename' : basename,
             }
             }
@@ -185,6 +199,7 @@ class CompilationEnvironment:
             'PSDK' : self.PSDK,
             'PSDK' : self.PSDK,
             'pythonIPath' : self.PythonIPath,
             'pythonIPath' : self.PythonIPath,
             'pythonVersion' : self.PythonVersion,
             'pythonVersion' : self.PythonVersion,
+            'arch' : self.arch,
             'filename' : filename,
             'filename' : filename,
             'basename' : basename,
             'basename' : basename,
             'dllext' : self.dllext,
             'dllext' : self.dllext,