def build_extensions(self): # Numpy bug: if an extension has a library only consisting of f77 # files, the extension language will always be f77 and no f90 # compiler will be initialized need_f90_compiler = self._f90_compiler is None and \ any(any(f90_ext_match(s) for s in _.sources) for _ in self.extensions) if need_f90_compiler: self._f90_compiler = new_fcompiler(compiler=self.fcompiler, verbose=self.verbose, dry_run=self.dry_run, force=self.force, requiref90=True, c_compiler=self.compiler) fcompiler = self._f90_compiler if fcompiler: fcompiler.customize(self.distribution) if fcompiler and fcompiler.get_version(): fcompiler.customize_cmd(self) fcompiler.show_customization() else: ctype = fcompiler.compiler_type if fcompiler \ else self.fcompiler self.warn('f90_compiler=%s is not available.' % ctype) for fc in self._f77_compiler, self._f90_compiler: if isinstance(fc, numpy.distutils.fcompiler.gnu.Gnu95FCompiler): flags = F77_COMPILE_ARGS_GFORTRAN + F77_COMPILE_OPT_GFORTRAN if self.debug: flags += F77_COMPILE_DEBUG_GFORTRAN if F77_OPENMP: flags += ['-openmp'] fc.executables['compiler_f77'] += flags flags = F90_COMPILE_ARGS_GFORTRAN + F90_COMPILE_OPT_GFORTRAN if self.debug: flags += F90_COMPILE_DEBUG_GFORTRAN if F90_OPENMP: flags += ['-openmp'] fc.executables['compiler_f90'] += flags fc.libraries += [LIBRARY_OPENMP_GFORTRAN] elif isinstance(fc, numpy.distutils.fcompiler.intel.IntelFCompiler): flags = F77_COMPILE_ARGS_IFORT + F77_COMPILE_OPT_IFORT if self.debug: flags += F77_COMPILE_DEBUG_IFORT if F77_OPENMP: flags += ['-openmp'] fc.executables['compiler_f77'] += flags flags = F90_COMPILE_ARGS_IFORT + F90_COMPILE_OPT_IFORT if self.debug: flags += F90_COMPILE_DEBUG_IFORT if F90_OPENMP: flags += ['-openmp'] fc.executables['compiler_f90'] += flags fc.libraries += [LIBRARY_OPENMP_IFORT] elif fc is not None: raise RuntimeError( "Unhandled compiler: '{}'.".format(fcompiler)) build_ext.build_extensions(self)
def build_extensions(self): # Numpy bug: if an extension has a library only consisting of f77 # files, the extension language will always be f77 and no f90 # compiler will be initialized need_f90_compiler = self._f90_compiler is None and \ any(any(f90_ext_match(s) for s in _.sources) for _ in self.extensions) if need_f90_compiler: self._f90_compiler = new_fcompiler(compiler=self.fcompiler, verbose=self.verbose, dry_run=self.dry_run, force=self.force, requiref90=True, c_compiler=self.compiler) fcompiler = self._f90_compiler if fcompiler: fcompiler.customize(self.distribution) if fcompiler and fcompiler.get_version(): fcompiler.customize_cmd(self) fcompiler.show_customization() else: ctype = fcompiler.compiler_type if fcompiler \ else self.fcompiler self.warn('f90_compiler=%s is not available.' % ctype) for fc in self._f77_compiler, self._f90_compiler: if isinstance(fc, numpy.distutils.fcompiler.gnu.Gnu95FCompiler): flags = F77_COMPILE_ARGS_GFORTRAN + F77_COMPILE_OPT_GFORTRAN if self.debug: flags += F77_COMPILE_DEBUG_GFORTRAN if F77_OPENMP: flags += ['-openmp'] fc.executables['compiler_f77'] += flags flags = F90_COMPILE_ARGS_GFORTRAN + F90_COMPILE_OPT_GFORTRAN if self.debug: flags += F90_COMPILE_DEBUG_GFORTRAN if F90_OPENMP: flags += ['-openmp'] fc.executables['compiler_f90'] += flags fc.libraries += [LIBRARY_OPENMP_GFORTRAN] elif isinstance(fc, numpy.distutils.fcompiler.intel.IntelFCompiler): flags = F77_COMPILE_ARGS_IFORT + F77_COMPILE_OPT_IFORT if self.debug: flags += F77_COMPILE_DEBUG_IFORT if F77_OPENMP: flags += ['-qopenmp'] fc.executables['compiler_f77'] += flags flags = F90_COMPILE_ARGS_IFORT + F90_COMPILE_OPT_IFORT if self.debug: flags += F90_COMPILE_DEBUG_IFORT if F90_OPENMP: flags += ['-qopenmp'] fc.executables['compiler_f90'] += flags fc.libraries += [LIBRARY_OPENMP_IFORT] elif fc is not None: raise RuntimeError( "Unhandled compiler: '{}'.".format(fcompiler)) build_ext.build_extensions(self)