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


Python Extension.runtime_library_dirs方法代码示例

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


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

示例1: Extension

# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import runtime_library_dirs [as 别名]
                     'trottersuzuki/src/solver.cpp',
                     'trottersuzuki/trottersuzuki_wrap.cxx']

    ts_module = Extension('_trottersuzuki', sources=sources_files,
                          include_dirs=[numpy_include, 'src'],
                          extra_compile_args=extra_compile_args,
                          libraries=libraries,
                          )
    if CUDA is not None:
        ts_module.sources += ['trottersuzuki/src/cc2kernel.cu',
                              'trottersuzuki/src/hybrid.cu']
        ts_module.define_macros = [('CUDA', None)]
        ts_module.include_dirs.append(CUDA['include'])
        ts_module.library_dirs = [CUDA['lib']]
        ts_module.libraries += ['cudart', 'cublas']
        ts_module.runtime_library_dirs = [CUDA['lib']]
        if len(ts_module.extra_compile_args['cc']) > 0:
            extra_args = ts_module.extra_compile_args['cc'][0]
        else:
            extra_args = ""
        ts_module.extra_compile_args['nvcc'] = ['-use_fast_math',
                                                '--ptxas-options=-v', '-c',
                                                '--compiler-options',
                                                '-fPIC ' + extra_args]
    cmdclass = {'build_ext': custom_build_ext}


setup(name='trottersuzuki',
      version='1.5.2',
      license='GPL3',
      author="Peter Wittek, Luca Calderaro",
开发者ID:PanPalitta,项目名称:trotter-suzuki-mpi,代码行数:33,代码来源:setup.py

示例2: create_exension

# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import runtime_library_dirs [as 别名]
def create_exension():
    global EPICSBASE, HOSTARCH
    umacros = []
    macros = []
    cflags = []
    lflags = []
    dlls = []
    extra_objects = []
    libraries = ["ca", "Com"]
    CMPL = 'gcc'
    UNAME = platform.system()
    ARCH = platform.architecture()[0]
    # platform dependent libraries and macros
    if UNAME.lower() == "windows":
        UNAME = "WIN32"
        static = False
        if HOSTARCH in ['win32-x86', 'windows-x64', 'win32-x86-debug', 'windows-x64-debug']:
            if not SHARED:
                dlls = ['Com.dll', 'ca.dll']
                for dll in dlls:
                    dllpath = os.path.join(EPICSBASE, 'bin', HOSTARCH, dll)
                    if not os.path.exists(dllpath):
                        static = True
                        break
                    shutil.copy(dllpath,
                                os.path.join(os.path.dirname(os.path.abspath(__file__)), 'src', 'CaChannel'))
            macros += [('_CRT_SECURE_NO_WARNINGS', 'None'), ('EPICS_CALL_DLL', '')]
            cflags += ['/Z7']
            CMPL = 'msvc'
        if HOSTARCH in ['win32-x86-static', 'windows-x64-static'] or static:
            libraries += ['ws2_32', 'user32', 'advapi32']
            macros += [('_CRT_SECURE_NO_WARNINGS', 'None'), ('EPICS_DLL_NO', '')]
            umacros += ['_DLL']
            cflags += ['/EHsc', '/Z7']
            lflags += ['/LTCG']
            if HOSTARCH[-5:] == 'debug':
                libraries += ['msvcrtd']
                lflags += ['/NODEFAULTLIB:libcmtd.lib']
            else:
                libraries += ['msvcrt']
                lflags += ['/NODEFAULTLIB:libcmt.lib']
            CMPL = 'msvc'
        # GCC compiler
        if HOSTARCH in ['win32-x86-mingw', 'windows-x64-mingw']:
            macros += [('_MINGW', ''), ('EPICS_DLL_NO', '')]
            lflags += ['-static']
            CMPL = 'gcc'
        if HOSTARCH == 'windows-x64-mingw':
            macros += [('MS_WIN64', '')]
            CMPL = 'gcc'
    elif UNAME.lower() == "darwin":
        CMPL = 'clang'
        HOSTARCH = 'darwin-x86'
        if not SHARED:
            extra_objects = [os.path.join(EPICSBASE, 'lib', HOSTARCH, 'lib%s.a' % lib) for lib in libraries]
            libraries = []
    elif UNAME.lower() == "linux":
        CMPL = 'gcc'
        if not SHARED:
            extra_objects = [os.path.join(EPICSBASE, 'lib', HOSTARCH, 'lib%s.a' % lib) for lib in libraries]
            libraries = ['rt']
            if subprocess.call('nm %s | grep -q rl_' % os.path.join(EPICSBASE, 'lib', HOSTARCH, 'libCom.a'), shell=True) == 0:
                libraries += ['readline']
    else:
        print("Platform", UNAME, ARCH, " Not Supported")
        sys.exit(1)

    include_dirs = [os.path.join(EPICSBASE, "include"),
                    os.path.join(EPICSBASE, "include", "os", UNAME),
                    os.path.join(EPICSBASE, "include", "compiler", CMPL),
                    ]

    ca_module = Extension('CaChannel._ca',
                          sources=['src/CaChannel/_ca.cpp'],
                          extra_compile_args=cflags,
                          include_dirs=include_dirs,
                          define_macros=macros,
                          undef_macros=umacros,
                          extra_link_args=lflags,
                          extra_objects=extra_objects,
                          libraries=libraries,
                          library_dirs=[os.path.join(EPICSBASE, "lib", HOSTARCH)])

    if UNAME == "Linux" and SHARED:
        ca_module.runtime_library_dirs = [os.path.join(EPICSBASE, "lib", HOSTARCH)]

    return [ca_module], dlls
开发者ID:CaChannel,项目名称:CaChannel,代码行数:89,代码来源:setup.py


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