当前位置: 首页>>代码示例>>Python>>正文


Python build_ext.build_extensions函数代码示例

本文整理汇总了Python中setuptools.command.build_ext.build_ext.build_extensions函数的典型用法代码示例。如果您正苦于以下问题:Python build_extensions函数的具体用法?Python build_extensions怎么用?Python build_extensions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了build_extensions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_extensions

    def build_extensions(self):
        c = self.compiler.compiler_type

        if self.omp not in ('0', '1', True, False):
            raise ValueError("Invalid omp argument. Mut be '0' or '1'.")
        self.omp = int(self.omp)

        if self.omp:
            if not hasattr(self, "_printed_omp_message"):
                self._printed_omp_message = True
                print("\n#################################")
                print("# Compiling with OpenMP support #")
                print("#################################\n")
            # More portable to pass -fopenmp to linker.
            # self.libraries += ['gomp']
            if self.compiler.compiler_type == 'msvc':
                openmpflag = '/openmp'
                compileflags = COMPILE_FLAGS_MSVC
            else:
                openmpflag = '-fopenmp'
                compileflags = COMPILE_FLAGS
            for e in self.extensions:
                e.extra_compile_args = list(set(e.extra_compile_args).union(compileflags))
                if openmpflag not in e.extra_compile_args:
                    e.extra_compile_args += [openmpflag]
                if openmpflag not in e.extra_link_args:
                    e.extra_link_args += [openmpflag]

        build_ext_.build_extensions(self)
开发者ID:cctbx,项目名称:bitshuffle,代码行数:29,代码来源:setup.py

示例2: build_extensions

    def build_extensions(self):
        ct = self.compiler.compiler_type
        opts = self.c_opts.get(ct, [])
        if ct == 'unix':
            opts.append('-DVERSION_INFO="%s"' % self.distribution.get_version())
            opts.append(cpp_flag(self.compiler))
            if has_flag(self.compiler, '-fvisibility=hidden'):
                opts.append('-fvisibility=hidden')
        elif ct == 'msvc':
            opts.append('/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version())

        # extend include dirs here (don't assume numpy/pybind11 are installed when first run, since
        # pip could have installed them as part of executing this script
        import pybind11
        import numpy as np
        for ext in self.extensions:
            ext.extra_compile_args.extend(opts)
            ext.extra_link_args.extend(self.link_opts.get(ct, []))
            ext.include_dirs.extend([
                # Path to pybind11 headers
                pybind11.get_include(),
                pybind11.get_include(True),

                # Path to numpy headers
                np.get_include()
            ])

        build_ext.build_extensions(self)
开发者ID:eracle,项目名称:nmslib,代码行数:28,代码来源:setup.py

示例3: build_extensions

    def build_extensions(self):
        ct = self.compiler.compiler_type
        opts = self.c_opts.get(ct, [])
        link_args = []

        if ct == 'unix':
            opts.append('-DVERSION_INFO="%s"' % self.distribution.get_version())
            opts.append(cpp_flag(self.compiler))
            if has_flag(self.compiler, '-fvisibility=hidden'):
                opts.append('-fvisibility=hidden')
        elif ct == 'msvc':
            opts.append('/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version())

        if has_flag(self.compiler, '-fopenmp'):
            opts.append('-fopenmp')
            link_args.append('-fopenmp')
        elif has_flag(self.compiler, '-openmp'):
            opts.append('-openmp')
            link_args.append('-openmp')

        for ext in self.extensions:
            ext.extra_compile_args = opts
            ext.extra_link_args = link_args

        build_ext.build_extensions(self)
开发者ID:ddemidov,项目名称:amgcl,代码行数:25,代码来源:setup.py

示例4: build_extensions

    def build_extensions(self):
        # set compiler flags
        c = self.compiler.compiler_type
        if self.copt.has_key(c):
           for e in self.extensions:
               e.extra_compile_args = self.copt[ c ]
        if self.lopt.has_key(c):
            for e in self.extensions:
                e.extra_link_args = self.lopt[ c ]

        # handle numpy
        if not disabled_numpy:
            try:
                import numpy
                jpypeLib.define_macros.append(('HAVE_NUMPY', 1))
                jpypeLib.include_dirs.append(numpy.get_include())
                warnings.warn("Turned ON Numpy support for fast Java array access",
                               FeatureNotice)
            except ImportError:
                pass
        else:
            warnings.warn("Turned OFF Numpy support for fast Java array access",
                          FeatureNotice)
        
        # has to be last call
        build_ext.build_extensions(self)
开发者ID:Eothred,项目名称:jpype,代码行数:26,代码来源:setup.py

示例5: build_extensions

 def build_extensions(self):
     # Stop GCC complaining about -Wstrict-prototypes in C++ code
     try:
         self.compiler.compiler_so.remove('-Wstrict-prototypes')
     except ValueError:
         pass
     build_ext.build_extensions(self)
开发者ID:ska-sa,项目名称:spead2,代码行数:7,代码来源:setup.py

示例6: build_extensions

    def build_extensions(self):
        if sys.platform == 'darwin':
            all_flags = ['-stdlib=libc++', '-mmacosx-version-min=10.7']
            if has_flag(self.compiler, [all_flags[0]]):
                self.c_opts['unix'] += [all_flags[0]]
            elif has_flag(self.compiler, all_flags):
                self.c_opts['unix'] += all_flags
            else:
                raise RuntimeError(
                    'libc++ is needed! Failed to compile with {} and {}.'.
                    format(" ".join(all_flags), all_flags[0])
                )
        ct = self.compiler.compiler_type
        opts = self.c_opts.get(ct, [])
        extra_link_args = []

        if coverage:
            coverage_option = '--coverage'
            opts.append(coverage_option)
            extra_link_args.append(coverage_option)

        if ct == 'unix':
            opts.append('-DVERSION_INFO="%s"' % self.distribution.get_version())
            opts.append(cpp_flag(self.compiler))
            if has_flag(self.compiler, ['-fvisibility=hidden']):
                opts.append('-fvisibility=hidden')
        elif ct == 'msvc':
            opts.append(
                '/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version()
            )
        for ext in self.extensions:
            ext.extra_compile_args = opts
            ext.extra_link_args = extra_link_args
        build_ext.build_extensions(self)
开发者ID:basicv8vc,项目名称:fastText,代码行数:34,代码来源:setup.py

示例7: build_extensions

    def build_extensions(self):
        # Get 64-bitness
        c = self.compiler.compiler_type
        print("Compiling with %s (64bit=%s)" % (c, str(is_64bits)))
        #print("=== compiler attributes ===")
        #print("\n".join("%s: %s"%(k, v) for k, v in sorted(self.compiler.__dict__.items())))
        #print("=== build_ext attributes ===")
        #print("\n".join("%s: %s"%(k, v) for k, v in self.__dict__.items()))
        #sys.exit(1)

        # OpenMP build options
        if enable_openmp:
            if c in copt:
                for e in self.extensions:
                    e.extra_compile_args = copt[c]
            if c in lopt:
                for e in self.extensions:
                    e.extra_link_args = lopt[c]

        # Platform-specific build options
        if c in platform_lopt:
            for e in self.extensions:
                e.extra_link_args = platform_lopt[c]

        if c in platform_copt:
            for e in self.extensions:
                e.extra_compile_args = platform_copt[c]

        build_ext.build_extensions(self)
开发者ID:rprospero,项目名称:sasview,代码行数:29,代码来源:setup.py

示例8: build_extensions

    def build_extensions(self):
        from numpy.distutils.misc_util import get_numpy_include_dirs

        for e in self.extensions:
            e.include_dirs.extend(get_numpy_include_dirs())

        build_ext.build_extensions(self)
开发者ID:hdfeos,项目名称:bcolz,代码行数:7,代码来源:setup.py

示例9: build_extensions

    def build_extensions(self):
        """
        Sets up the compiler arguments
        """
        try:
            # Filter compiler arguments
            self.compiler.compiler = [arg for arg in self.compiler.compiler
                                      if arg not in self.ignored_arguments]
            self.compiler.compiler_so = [arg
                                         for arg in self.compiler.compiler_so
                                         if arg not in self.ignored_arguments]
        except AttributeError:
            # Incompatible compiler
            pass

        compiler = self.compiler.compiler_type
        if compiler in self.compile_args:
            for ext in self.extensions:
                ext.extra_compile_args = self.compile_args[compiler]

        if compiler in self.linker_args:
            for ext in self.extensions:
                ext.extra_link_args = self.linker_args[compiler]

        build_ext.build_extensions(self)
开发者ID:tcalmant,项目名称:jpype-py3,代码行数:25,代码来源:setup.py

示例10: build_extensions

 def build_extensions(self):
     if sys.platform == "win32":
         from distutils.msvccompiler import MSVCCompiler
         if isinstance(self.compiler, MSVCCompiler):
             # disable Language Extensions not compatible with ANSI C
             for ext in self.extensions:
                 ext.extra_compile_args.append("/Za")
     build_ext.build_extensions(self)
开发者ID:anthrotype,项目名称:py-zopfli,代码行数:8,代码来源:setup.py

示例11: build_extensions

 def build_extensions(self):
     self.compiler.src_extensions.append(".cu")
     self.compiler.set_executable("compiler_so", "nvcc")
     self.compiler.set_executable("linker_so", "nvcc --shared")
     if hasattr(self.compiler, "_c_extensions"):
         self.compiler._c_extensions.append(".cu")  # needed for Windows
     self.compiler.spawn = self.spawn
     build_ext.build_extensions(self)
开发者ID:lucasbrunialti,项目名称:cudamat,代码行数:8,代码来源:setup.py

示例12: build_extensions

 def build_extensions(self):
   compiler = self.compiler.compiler_type
   print('COMPILER',compiler)
   args     = BUILD_ARGS[compiler]
   for ext in self.extensions:
       ext.extra_compile_args = args
   print('COMPILER ARGUMENTS',ext.extra_compile_args)
   _build_ext.build_extensions(self)
开发者ID:r-barnes,项目名称:richdem,代码行数:8,代码来源:setup.py

示例13: build_extensions

    def build_extensions(self):
        import pkg_resources
        numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')

        for ext in self.extensions:
            if (hasattr(ext, 'include_dirs') and
                    not numpy_incl in ext.include_dirs):
                ext.include_dirs.append(numpy_incl)
        _build_ext.build_extensions(self)
开发者ID:kvpradap,项目名称:conda-pysm-appveyor,代码行数:9,代码来源:setup.py

示例14: build_extensions

 def build_extensions(self):
     compiler_type = self.compiler.compiler_type
     if compiler_type in "unix":
         for ext in self.extensions:
             # on some Unix-like systems, such as Linux, the libc math
             # library is not linked by default:
             # https://github.com/cython/cython/issues/1585
             ext.extra_link_args.append("-lm")
     build_ext.build_extensions(self)
开发者ID:moyogo,项目名称:py-zopfli,代码行数:9,代码来源:setup.py

示例15: build_extensions

 def build_extensions(self):
     ct = self.compiler.compiler_type
     opts = self.c_opts.get(ct, [])
     import pybind11
     for ext in self.extensions:
         ext.extra_compile_args = opts
         ext.include_dirs.append(pybind11.get_include())
         ext.include_dirs.append(pybind11.get_include(user=True))
     build_ext.build_extensions(self)
开发者ID:xoltar,项目名称:phat,代码行数:9,代码来源:setup.py


注:本文中的setuptools.command.build_ext.build_ext.build_extensions函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。