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


Python build_ext.build_extensions方法代码示例

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


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

示例1: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
def build_extensions(self):
        ct = self.compiler.compiler_type
        opts = self.c_opts.get(ct, [])
        link_opts = self.l_opts.get(ct, [])
        if ct == 'unix':
            opts.append(cpp_flag(self.compiler))
            if has_flag(self.compiler, '-fvisibility=hidden'):
                opts.append('-fvisibility=hidden')

        for ext in self.extensions:
            ext.define_macros = [
                ('VERSION_INFO', '"{}"'.format(self.distribution.get_version()))
            ]
            ext.extra_compile_args = opts
            ext.extra_link_args = link_opts
        build_ext.build_extensions(self) 
开发者ID:pikepdf,项目名称:pikepdf,代码行数:18,代码来源:setup.py

示例2: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
def build_extensions(self):
        comp = self.compiler.compiler_type
        if comp in ('unix', 'cygwin', 'mingw32'):
            # Check if build is with OpenMP
            if use_omp:
                extra_compile_args = ['-std=c99', '-O3', '-fopenmp']
                extra_link_args=['-lgomp']
            else:
                extra_compile_args = ['-std=c99', '-O3']
                extra_link_args = []
        elif comp == 'msvc':
            extra_compile_args = ['/Ox']
            extra_link_args = []
            if use_omp:
                extra_compile_args.append('/openmp')
        else:
            # Add support for more compilers here
            raise ValueError('Compiler flags undefined for %s. Please modify setup.py and add compiler flags'
                             % comp)
        self.extensions[0].extra_compile_args = extra_compile_args
        self.extensions[0].extra_link_args = extra_link_args
        build_ext.build_extensions(self) 
开发者ID:autonomousvision,项目名称:occupancy_flow,代码行数:24,代码来源:setup.py

示例3: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
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())
        if not sys.platform == 'darwin':
            opts.append('-fopenmp')  # For pqk-means
        opts.append('-march=native')  # For fast SIMD computation of L2 distance
        opts.append('-mtune=native')  # Do optimization (It seems this doesn't boost, but just in case)
        opts.append('-Ofast')  # This makes the program faster

        for ext in self.extensions:
            ext.extra_compile_args = opts
            if not sys.platform == 'darwin':
                ext.extra_link_args = ['-fopenmp']  # Because of PQk-means

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

示例4: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
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())
        for ext in self.extensions:
            if ext.language == "c++":
                ext.extra_compile_args += opts
                ext.extra_link_args += opts
        build_ext.build_extensions(self)


### Build Tools End ### 
开发者ID:LCAV,项目名称:pyroomacoustics,代码行数:20,代码来源:setup.py

示例5: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
def build_extensions(self):
        compile_so_command = self.compiler.compiler_so
        if "-Wstrict-prototypes" in compile_so_command:
            compile_so_command.remove("-Wstrict-prototypes")

        ct = self.compiler.compiler_type
        opts = self.c_opts.get(ct, [])
        link_opts = self.l_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())

        for ext in self.extensions:
            ext.extra_compile_args = opts
            ext.extra_link_args = link_opts
        build_ext.build_extensions(self) 
开发者ID:zhixinwang,项目名称:frustum-convnet,代码行数:22,代码来源:setup.py

示例6: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
def build_extensions(self):
        if not has_cython:
            log.info(
                "%s is not installed. Pre-generated *.c sources will be "
                "will be used to build the extensions." % required_cython
            )

        try:
            _build_ext.build_extensions(self)
        except Exception as e:
            if with_cython:
                raise
            from distutils.errors import DistutilsModuleError

            # optional compilation failed: we delete 'ext_modules' and make sure
            # the generated wheel is 'pure'
            del self.distribution.ext_modules[:]
            try:
                bdist_wheel = self.get_finalized_command("bdist_wheel")
            except DistutilsModuleError:
                # 'bdist_wheel' command not available as wheel is not installed
                pass
            else:
                bdist_wheel.root_is_pure = True
            log.error('error: building extensions failed: %s' % e) 
开发者ID:googlefonts,项目名称:cu2qu,代码行数:27,代码来源:setup.py

示例7: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
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())
        for ext in self.extensions:
            ext.extra_compile_args = opts
        build_ext.build_extensions(self) 
开发者ID:pmelchior,项目名称:scarlet,代码行数:15,代码来源:setup.py

示例8: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
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:tonysy,项目名称:Deep-Feature-Flow-Segmentation,代码行数:10,代码来源:setup_windows_cuda.py

示例9: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
def build_extensions(self):
        use_openmp = self._check_openmp_support()
        if use_openmp:
            for ext in self.extensions:
                if not ext.extra_compile_args:
                    ext.extra_compile_args = []
                ext.extra_compile_args.append('-fopenmp')
                if not ext.extra_link_args:
                    ext.extra_link_args = []
                ext.extra_link_args.append('-fopenmp')

        # Add language level directive (for the cython compiler)
        for ext in self.extensions:
            ext.compiler_directives = {'language_level' : sys.version_info[0]}

        # Chain to method in parent class.
        build_ext.build_extensions(self)
        if not _CYTHON_INSTALLED:
            log.info('No supported version of Cython installed. '
                     'Installing from compiled files.')
            for extension in self.extensions:
                sources = []
                for sfile in extension.sources:
                    path, ext = os.path.splitext(sfile)
                    if ext in ('.pyx', '.py'):
                        if extension.language == 'c++':
                            ext = '.cpp'
                        else:
                            ext = '.c'
                        sfile = path + ext
                    sources.append(sfile)
                extension.sources[:] = sources


# Custom clean command to remove build artifacts 
开发者ID:hpclab,项目名称:rankeval,代码行数:37,代码来源:setup.py

示例10: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
def build_extensions(self):
        # Compile OSQP using CMake

        # Create build directory
        if os.path.exists(osqp_build_dir):
            sh.rmtree(osqp_build_dir)
        os.makedirs(osqp_build_dir)
        os.chdir(osqp_build_dir)

        try:
            check_output(['cmake', '--version'])
        except OSError:
            raise RuntimeError("CMake must be installed to build OSQP")

        # Compile static library with CMake
        call(['cmake'] + cmake_args + ['..'])
        call(['cmake', '--build', '.', '--target', 'osqpstatic'] +
             cmake_build_flags)

        # Change directory back to the python interface
        os.chdir(current_dir)

        # Copy static library to src folder
        lib_origin = [osqp_build_dir, 'out'] + lib_subdir + [lib_name]
        lib_origin = os.path.join(*lib_origin)
        copyfile(lib_origin, os.path.join('extension', 'src', lib_name))

        # Run extension
        build_ext.build_extensions(self) 
开发者ID:oxfordcontrol,项目名称:osqp-python,代码行数:31,代码来源:setup.py

示例11: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
def build_extensions(self):
        ct = self.compiler.compiler_type
        opts = self.c_opts.get(ct, [])
        opts_remove = self.c_opts_remove.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")
            self.compiler.compiler = [
                o for o in self.compiler.compiler if o not in opts_remove
            ]
            self.compiler.compiler_cxx = [
                o for o in self.compiler.compiler_cxx if o not in opts_remove
            ]
            self.compiler.compiler_so = [
                o for o in self.compiler.compiler_so if o not in opts_remove
            ]
        elif ct == "msvc":
            opts.append('/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version())
            if opts_remove:
                raise NotImplementedError

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

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

示例12: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
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())
        for ext in self.extensions:
            ext.extra_compile_args = opts
        build_ext.build_extensions(self) 
开发者ID:xtensor-stack,项目名称:xtensor-python-cookiecutter,代码行数:15,代码来源:setup.py

示例13: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
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())
        for ext in self.extensions:
            ext.extra_compile_args = deepcopy(opts)
            ext.extra_link_args = deepcopy(opts)
            lang = ext.language or self.compiler.detect_language(ext.sources)
            if lang == 'c++':
                ext.extra_compile_args.append(cpp_flag(self.compiler))
                ext.extra_link_args.append(cpp_flag(self.compiler))
        build_ext.build_extensions(self) 
开发者ID:brainiak,项目名称:brainiak,代码行数:16,代码来源:setup.py

示例14: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
def build_extensions(self):
        ct = self.compiler.compiler_type
        opts = self.c_opts.get(ct, [])
        link_opts = self.l_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())
        for ext in self.extensions:
            ext.extra_compile_args = opts
            ext.extra_link_args = link_opts
        # third-party libraries flags
        localincl = "third-party"
        if not os.path.exists(os.path.join(localincl, "eigen_3.3.7", "Eigen",
                                           "Core")):
            raise RuntimeError("couldn't find Eigen headers")
        include_dirs = [
            os.path.join(localincl, "eigen_3.3.7"),
        ]
        for ext in self.extensions:
            ext.include_dirs = include_dirs + ext.include_dirs
        # run standard build procedure
        build_ext.build_extensions(self) 
开发者ID:dppalomar,项目名称:riskparity.py,代码行数:28,代码来源:setup.py

示例15: build_extensions

# 需要导入模块: from setuptools.command.build_ext import build_ext [as 别名]
# 或者: from setuptools.command.build_ext.build_ext import build_extensions [as 别名]
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 use_omp:
                opts.append('-fopenmp')
            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
        build_ext.build_extensions(self) 
开发者ID:neka-nat,项目名称:probreg,代码行数:17,代码来源:setup.py


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