pyobjc_setup.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:moobjc-framework-Security 作者: mosen 项目源码 文件源码
def Extension(*args, **kwds):
    """
    Simple wrapper about distutils.core.Extension that adds additional PyObjC
    specific flags.
    """
    os_level = get_sdk_level()
    if os_level is None:
        os_level = get_os_level()

    cflags =  ["-DPyObjC_BUILD_RELEASE=%02d%02d"%(tuple(map(int, os_level.split('.'))))]
    ldflags = []
    if 'clang' in get_config_var('CC'):
        cflags.append('-Wno-deprecated-declarations')

    CFLAGS = get_config_var('CFLAGS')
    if '-isysroot' not in CFLAGS and os.path.exists('/usr/include/stdio.h'):
        # We're likely on a system with de Xcode Command Line Tools.
        # Explicitly use the most recent problems to avoid compile problems.
        data = os.popen('xcodebuild -version -sdk macosx Path').read()
        data = data.strip()
        if data:
            cflags.append('-isysroot')
            cflags.append(data)


    if os_level == '10.4':
        cflags.append('-DNO_OBJC2_RUNTIME')

    if 'extra_compile_args' in kwds:
        kwds['extra_compile_args'] = kwds['extra_compile_args'] + cflags
    else:
        kwds['extra_compile_args'] = cflags

    if 'extra_link_args' in kwds:
        kwds['extra_link_args'] = kwds['extra_link_args'] + ldflags
    else:
        kwds['extra_link_args'] = ldflags

    return _Extension(*args, **kwds)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号