def Extension(*args, **kwds): """ Simple wrapper about distutils.core.Extension that adds additional PyObjC specific flags. """ 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') if os_level != '10.4': if os.path.exists('/usr/include/stdio.h'): # only tweak the SDK when using the command-line tools # FIXME: This should be properly fixed cflags.extend(['-isysroot','/']) ldflags.extend(['-isysroot','/']) else: 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)
def Extension(*args, **kwds): """ Simple wrapper about distutils.core.Extension that adds additional PyObjC specific flags. """ os_level = get_os_level() cflags = ["-DPyObjC_BUILD_RELEASE=%02d%02d" % os_level] ldflags = [] if os_level != (10, 4): pass pass else: 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)
def Extension(*args, **kwds): """ Simple wrapper about distutils.core.Extension that adds additional PyObjC specific flags. """ os_level = get_os_level() cflags = ["-DPyObjC_BUILD_RELEASE=%02d%02d"%os_level] ldflags = [] if os_level != (10, 4): pass pass else: 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)
def Extension(*args, **kwds): """ Simple wrapper about distutils.core.Extension that adds additional PyObjC specific flags. """ 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') if os_level != '10.4': if os.path.exists('/usr/include/stdio.h'): # only tweak the SDK when using the command-line tools # FIXME: This should be properly fixed cflags.extend(['-isysroot', '/']) ldflags.extend(['-isysroot', '/']) else: 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)
def Extension(*args, **kwds): """ Simple wrapper about distutils.core.Extension that adds additional PyObjC specific flags. """ os_level = get_os_level() cflags = [ "-DPyObjC_BUILD_RELEASE=%02d%02d" % (tuple(map(int, os_level.split('.')))) ] ldflags = [] if os_level != '10.4': cflags.extend(['-isysroot', '/']) ldflags.extend(['-isysroot', '/']) else: 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)
def Extension(*args, **kwds): """ Simple wrapper about distutils.core.Extension that adds additional PyObjC specific flags. """ os_level = get_os_level() cflags = ["-DPyObjC_BUILD_RELEASE=%02d%02d" % (tuple(map(int, os_level.split("."))))] ldflags = [] if os_level != "10.4": cflags.extend(["-isysroot", "/"]) ldflags.extend(["-isysroot", "/"]) else: 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)
def Extension(*args, **kwds): """ Simple wrapper about distutils.core.Extension that adds additional PyObjC specific flags. """ os_level = get_os_level() cflags = ["-DPyObjC_BUILD_RELEASE=%02d%02d"%(tuple(map(int, os_level.split('.'))))] ldflags = [] if os_level != '10.4': cflags.extend(['-isysroot','/']) ldflags.extend(['-isysroot','/']) else: 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)
def Extension(*args, **kwds): """ Simple wrapper about distutils.core.Extension that adds additional PyObjC specific flags. """ if sys.platform != "darwin": # Fake version, the code in setup() will # notice we're not on darwin and will fail # the build os_level = "9.9" else: os_level = get_sdk_level() if os_level is None: os_level = get_os_level() cflags = [] ldflags = [] if "clang" in get_config_var("CC"): cflags.append("-Wno-deprecated-declarations") sdk = get_sdk() if not sdk: # and os.path.exists('/usr/include/stdio.h'): # We're likely on a system with the Xcode Command Line Tools. # Explicitly use the most recent SDK to avoid compile problems. data = subprocess.check_output( ["/usr/bin/xcrun", "-sdk", "macosx", "--show-sdk-path"], universal_newlines=True, ).strip() if data: cflags.append("-isysroot") cflags.append(data) cflags.append( "-DPyObjC_BUILD_RELEASE=%02d%02d" % (tuple(map(int, os.path.basename(data)[6:-4].split("."))))) else: cflags.append("-DPyObjC_BUILD_RELEASE=%02d%02d" % (tuple(map(int, os_level.split("."))))) if os_level == "10.4": cflags.append("-DNO_OBJC2_RUNTIME") if "-Werror" not in cflags: cflags.append("-Werror") 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)
def _get_all_extensions(): try: import numpy except: return [] # valid only for gcc/clang extra_args = ['-O3'] import sys if sys.platform.find('linux') > -1: extra_args += ['-fopenmp'] # openmp not supported on OSX define_macros = [('NDEBUG', '1')] define_macros_mesh_ext_without_cgal_link = [ ('CGAL_NDEBUG', 1), ('MESH_CGAL_AVOID_COMPILED_VERSION', 1), ('CGAL_HAS_NO_THREADS', 1), ('CGAL_NO_AUTOLINK_CGAL', 1) ] undef_macros = [] package_name_and_srcs = [ ('aabb_normals', ['mesh/src/aabb_normals.cpp'], define_macros_mesh_ext_without_cgal_link), ('spatialsearch', ['mesh/src/spatialsearchmodule.cpp'], define_macros_mesh_ext_without_cgal_link), ('visibility', ['mesh/src/py_visibility.cpp', 'mesh/src/visibility.cpp' ], define_macros_mesh_ext_without_cgal_link), ('serialization.plyutils', ['mesh/src/plyutils.c', 'mesh/src/rply.c'], []), ('serialization.loadobj', ['mesh/src/py_loadobj.cpp'], []), ] out = [] for current_package_name, src_list, additional_defines in package_name_and_srcs: ext = _Extension("%s.mesh.%s" % (namespace_package, current_package_name), src_list, language="c++", include_dirs=['mesh/src', numpy.get_include()], libraries=[], define_macros=define_macros + additional_defines, undef_macros=undef_macros, extra_compile_args=extra_args, extra_link_args=extra_args) out += [ext] return out
def Extension(*args, **kwargs): ext = _Extension(*args, **kwargs) if debug_symbols: if os.name == 'nt': ext.extra_compile_args.append("-Zi") ext.extra_compile_args.append("-Ox") ext.extra_link_args.append("-debug:full") else: ext.extra_compile_args.append("-g3") ext.extra_compile_args.append("-O0") # ext.extra_compile_args.append("/fsanitize=address") return ext
def __new__(cls, name, sources, *args, **kwargs): include_dirs = kwargs.get('include_dirs', []) include_dirs += include_paths() kwargs['include_dirs'] = include_dirs library_dirs = kwargs.get('library_dirs', []) library_dirs += library_paths() kwargs['library_dirs'] = library_dirs libraries = kwargs.get('libraries', []) libraries.extend(COMMON_LINK_LIBRARIES + ['dragon']) kwargs['libraries'] = libraries define_macros = kwargs.get('define_macros', []) define_macros.append(('DRAGON_API=' + DLLIMPORT_STR, None)) kwargs['define_macros'] = define_macros kwargs['language'] = 'c++' return _Extension(name, sources, *args, **kwargs)
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 = [] 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) cflags.append( "-DPyObjC_BUILD_RELEASE=%02d%02d" % (tuple(map(int, os.path.basename(data)[6:-4].split('.'))))) else: cflags.append("-DPyObjC_BUILD_RELEASE=%02d%02d" % (tuple(map(int, os_level.split('.'))))) 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)
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 = [] ldflags = [] if "clang" in get_config_var("CC"): cflags.append("-Wno-deprecated-declarations") sdk = get_sdk() if not sdk: # We're likely on a system with the Xcode Command Line Tools. # Explicitly use the most recent SDK to avoid compile problems. data = subprocess.check_output( ["/usr/bin/xcrun", "-sdk", "macosx", "--show-sdk-path"], universal_newlines=True, ).strip() if data: sdk_settings_path = os.path.join(data, "SDKSettings.plist") if os.path.exists(sdk_settings_path): with open(sdk_settings_path, "rb") as fp: sdk_settings = plistlib.load(fp) version = sdk_settings["Version"] else: version = os.path.basename(data)[6:-4] cflags.append("-isysroot") cflags.append(data) cflags.append("-DPyObjC_BUILD_RELEASE=%02d%02d" % (tuple(map(int, version.split(".")[:2])))) else: cflags.append("-DPyObjC_BUILD_RELEASE=%02d%02d" % (tuple(map(int, os_level.split(".")[:2])))) else: cflags.append("-DPyObjC_BUILD_RELEASE=%02d%02d" % (tuple(map(int, os_level.split(".")[:2])))) if os_level == "10.4": cflags.append("-DNO_OBJC2_RUNTIME") if "-Werror" not in cflags: cflags.append("-Werror") 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)