Permalink
Browse files

ENH: add support for the PathScale compilers on Linux. Closes #1043.

Thanks to R. Perez.
  • Loading branch information...
1 parent a70de5c commit 8d0b5817a3fd4f3ce465aba2fd0ddd30677b8e60 @rgommers rgommers committed with charris Nov 30, 2010
@@ -506,7 +506,11 @@ def CCompiler_cxx_compiler(self):
"Intel C Compiler for 32-bit applications")
compiler_class['intele'] = ('intelccompiler','IntelItaniumCCompiler',
"Intel C Itanium Compiler for Itanium-based applications")
-ccompiler._default_compilers += (('linux.*','intel'),('linux.*','intele'))
+compiler_class['pathcc'] = ('pathccompiler','PathScaleCCompiler',
+ "PathScale Compiler for SiCortex-based applications")
+ccompiler._default_compilers += (('linux.*','intel'),
+ ('linux.*','intele'),
+ ('linux.*','pathcc'))
if sys.platform == 'win32':
compiler_class['mingw32'] = ('mingw32ccompiler', 'Mingw32CCompiler',
@@ -694,7 +694,7 @@ def _environment_hook(self, name, hook_name):
'intelvem', 'intelem')),
('cygwin.*', ('gnu','intelv','absoft','compaqv','intelev','gnu95','g95')),
('linux.*', ('gnu','intel','lahey','pg','absoft','nag','vast','compaq',
- 'intele','intelem','gnu95','g95')),
+ 'intele','intelem','gnu95','g95','pathf95')),
('darwin.*', ('nag', 'absoft', 'ibm', 'intel', 'gnu', 'gnu95', 'g95', 'pg')),
('sunos.*', ('sun','gnu','gnu95','g95')),
('irix.*', ('mips','gnu','gnu95',)),
@@ -0,0 +1,36 @@
+from numpy.distutils.fcompiler import FCompiler
+
+compilers = ['PathScaleFCompiler']
+
+class PathScaleFCompiler(FCompiler):
+
+ compiler_type = 'pathf95'
+ description = 'PathScale Fortran Compiler'
+ version_pattern = r'PathScale\(TM\) Compiler Suite: Version (?P<version>[\d.]+)'
+
+ executables = {
+ 'version_cmd' : ["pathf95", "-version"],
+ 'compiler_f77' : ["pathf95", "-fixedform"],
+ 'compiler_fix' : ["pathf95", "-fixedform"],
+ 'compiler_f90' : ["pathf95"],
+ 'linker_so' : ["pathf95", "-shared"],
+ 'archiver' : ["ar", "-cr"],
+ 'ranlib' : ["ranlib"]
+ }
+ pic_flags = ['-fPIC']
+ module_dir_switch = '-module ' # Don't remove ending space!
+ module_include_switch = '-I'
+
+ def get_flags_opt(self):
+ return ['-O3']
+ def get_flags_debug(self):
+ return ['-g']
+
+if __name__ == '__main__':
+ from distutils import log
+ log.set_verbosity(2)
+ #compiler = PathScaleFCompiler()
+ from numpy.distutils.fcompiler import new_fcompiler
+ compiler = new_fcompiler(compiler='pathf95')
+ compiler.customize()
+ print compiler.get_version()
@@ -0,0 +1,21 @@
+from distutils.unixccompiler import UnixCCompiler
+
+class PathScaleCCompiler(UnixCCompiler):
+
+ """
+ PathScale compiler compatible with an gcc built Python.
+ """
+
+ compiler_type = 'pathcc'
+ cc_exe = 'pathcc'
+ cxx_exe = 'pathCC'
+
+ def __init__ (self, verbose=0, dry_run=0, force=0):
+ UnixCCompiler.__init__ (self, verbose, dry_run, force)
+ cc_compiler = self.cc_exe
+ cxx_compiler = self.cxx_exe
+ self.set_executables(compiler=cc_compiler,
+ compiler_so=cc_compiler,
+ compiler_cxx=cxx_compiler,
+ linker_exe=cc_compiler,
+ linker_so=cc_compiler + ' -shared')

0 comments on commit 8d0b581

Please sign in to comment.