Ejemplo n.º 1
0
        def build_extension(self, ext):
            # When compiling with GNU compilers, use a version script to
            # hide symbols during linking.
            if self.__is_using_gnu_linker(ext):
                export_symbols = self.get_export_symbols(ext)
                text = '{global: %s; local: *; };' % (
                    ';'.join(export_symbols), )

                script_fn = os.path.join(
                    self.build_temp, 'link-version-{}.map'.format(ext.name))
                with open(script_fn, 'w') as f:
                    f.write(text)
                    # line below fixes gh-8680
                    ext.extra_link_args = [
                        arg for arg in ext.extra_link_args
                        if not "version-script" in arg
                    ]
                    ext.extra_link_args.append('-Wl,--version-script=' +
                                               script_fn)

            # Allow late configuration
            hooks = getattr(ext, '_pre_build_hook', ())
            _run_pre_build_hooks(hooks, (self, ext))

            old_build_ext.build_extension(self, ext)
Ejemplo n.º 2
0
 def build_extension(self, ext):
     # at this point we know what the C compiler is.
     if self.compiler.compiler_type == 'msvc' or self.compiler.compiler_type == 'intelemw':
         ext.extra_compile_args = []
         # also remove extra linker arguments msvc doesn't understand
         ext.extra_link_args = []
         # also remove gcc math library
         ext.libraries.remove('m')
     numpy_build_ext.build_extension(self, ext)
Ejemplo n.º 3
0
 def build_extension(self, ext):
     # at this point we know what the C compiler is.
     if self.compiler.compiler_type == 'msvc' or self.compiler.compiler_type == 'intelemw':
         ext.extra_compile_args = []
         # also remove extra linker arguments msvc doesn't understand
         ext.extra_link_args = []
         # also remove gcc math library
         ext.libraries.remove('m')
     numpy_build_ext.build_extension(self, ext)
Ejemplo n.º 4
0
    def build_extension(self, ext):
        from numpy.distutils.command.build_ext import build_ext as numpy_build_ext

        # at this point we know what the C compiler is.
        if self.compiler.compiler_type == 'msvc':
            ext.extra_compile_args = []
            # also remove extra linker arguments msvc doesn't understand
            ext.extra_link_args = []
            # also remove gcc math library
            ext.libraries.remove('m')
        numpy_build_ext.build_extension(self, ext)
Ejemplo n.º 5
0
        def build_extension(self, ext):
            # When compiling with GNU compilers, use a version script to
            # hide symbols during linking.
            if self.__is_using_gnu_linker(ext):
                export_symbols = self.get_export_symbols(ext)
                text = '{global: %s; local: *; };' % (';'.join(export_symbols),)

                script_fn = os.path.join(self.build_temp, 'link-version-{}.map'.format(ext.name))
                with open(script_fn, 'w') as f:
                    f.write(text)
                    ext.extra_link_args.append('-Wl,--version-script=' + script_fn)

            old_build_ext.build_extension(self, ext)
Ejemplo n.º 6
0
    def build_extension(self, ext):
        if 'linux' in sys.platform:
            if not 'NOOMP' in os.environ:
                ext.extra_compile_args += ['-fopenmp']
                ext.extra_link_args += ['-fopenmp']
            ext.extra_compile_args += ['-Wno-unused-value']
            ext.extra_link_args += [
                '-Wl,-Bsymbolic-functions', '-Wl,--as-needed'
            ]
        elif 'darwin' in sys.platform:
            ext.extra_compile_args += [
                '-Wno-unused-value', '-Wno-unused-private-field'
            ]

        # adding numpy late to allow setup to install it in the build env
        import numpy
        ext.extra_compile_args += [
            '-I' + os.path.join(numpy.__path__[0], 'core/include/numpy')
        ]

        # force C++14
        if 'linux' in sys.platform or 'darwin' in sys.platform:
            ext.extra_compile_args += ['-std=c++14']
        elif 'win32' in sys.platform:
            # also define DLL_EXPORTS for sgtelib and NOMAD::Clock
            ext.extra_compile_args += ['/std:c++14', '/DDLL_EXPORTS']

        return _build_ext.build_extension(self, ext)
Ejemplo n.º 7
0
        def build_extension(self, ext):
            # When compiling with GNU compilers, use a version script to
            # hide symbols during linking.
            if self.__is_using_gnu_linker(ext):
                export_symbols = self.get_export_symbols(ext)
                text = '{global: %s; local: *; };' % (
                    ';'.join(export_symbols), )

                script_fn = os.path.join(
                    self.build_temp, 'link-version-{}.map'.format(ext.name))
                with open(script_fn, 'w') as f:
                    f.write(text)
                    ext.extra_link_args.append('-Wl,--version-script=' +
                                               script_fn)

            old_build_ext.build_extension(self, ext)
Ejemplo n.º 8
0
    def build_extension(self, ext):
        r"""
        
        Parameters
        ----------
        ext

        Returns
        -------

        """
        try:
            build_ext.build_extension(self, ext)
        except:
            self.announce("*** WARNING: Building of optimizer '%s' failed: %s"
                          % (ext.name, sys.exc_info()[1]))
Ejemplo n.º 9
0
 def build_extension(self, ext):
     # at this point we know what the C compiler is.
     c = self.compiler
     old_compile_options = None
     # For MS Visual C, we use /O1 instead of the default /Ox,
     # as /Ox takes a long time (~5 mins) to compile.
     # The speed of the code isn't noticeably different.
     if c.compiler_type == 'msvc':
         if not c.initialized:
             c.initialize()
         old_compile_options = c.compile_options[:]
         if '/Ox' in c.compile_options:
             c.compile_options.remove('/Ox')
         c.compile_options.append('/O1')
         ext.extra_compile_args = []
     numpy_build_ext.build_extension(self, ext)
     if old_compile_options is not None:
         self.compiler.compile_options = old_compile_options
Ejemplo n.º 10
0
 def build_extension(self, ext):
     # at this point we know what the C compiler is.
     c = self.compiler
     old_compile_options = None
     # For MS Visual C, we use /O1 instead of the default /Ox,
     # as /Ox takes a long time (~5 mins) to compile.
     # The speed of the code isn't noticeably different.
     if c.compiler_type == 'msvc':
         if not c.initialized:
             c.initialize()
         old_compile_options = c.compile_options[:]
         if '/Ox' in c.compile_options:
             c.compile_options.remove('/Ox')
         c.compile_options.append('/O1')
         ext.extra_compile_args = []
     numpy_build_ext.build_extension(self, ext)
     if old_compile_options is not None:
         self.compiler.compile_options = old_compile_options
Ejemplo n.º 11
0
Archivo: setup.py Proyecto: sudsj/numpy
 def build_extension(self, ext):
     if _is_using_gcc(self):
         if '-std=c99' not in ext.extra_compile_args:
             ext.extra_compile_args.append('-std=c99')
     build_ext.build_extension(self, ext)
Ejemplo n.º 12
0
 def build_extension(self, ext):
     if _needs_gcc_c99_flag(self):
         if '-std=c99' not in ext.extra_compile_args:
             ext.extra_compile_args.append('-std=c99')
     build_ext.build_extension(self, ext)
Ejemplo n.º 13
0
 def build_extension(self, ext):
     try:
         build_ext.build_extension(self, ext)
     except:
         self.announce('*** WARNING: Building of optimizer "%s" '
                       'failed: %s' % (ext.name, sys.exc_info()[1]))
Ejemplo n.º 14
0
 def build_extension(self, ext):
     try:
         build_ext.build_extension(self, ext)
     except:
         self.announce('*** WARNING: Building of optimizer "%s" '
         'failed: %s' %(ext.name, sys.exc_info()[1]))