mirror of https://github.com/explosion/spaCy.git
Fix OSX build problem
This commit is contained in:
parent
ea00dbaaa4
commit
378ca4b46d
30
setup.py
30
setup.py
|
@ -7,10 +7,27 @@ import sys
|
||||||
import contextlib
|
import contextlib
|
||||||
from distutils.command.build_ext import build_ext
|
from distutils.command.build_ext import build_ext
|
||||||
from distutils.sysconfig import get_python_inc
|
from distutils.sysconfig import get_python_inc
|
||||||
|
import distutils.util
|
||||||
from distutils import ccompiler, msvccompiler
|
from distutils import ccompiler, msvccompiler
|
||||||
from setuptools import Extension, setup, find_packages
|
from setuptools import Extension, setup, find_packages
|
||||||
|
|
||||||
|
|
||||||
|
def is_new_osx():
|
||||||
|
'''Check whether we're on OSX >= 10.10'''
|
||||||
|
name = distutils.util.get_platform()
|
||||||
|
if sys.platform != 'darwin':
|
||||||
|
return False
|
||||||
|
elif name.startswith('macosx-10'):
|
||||||
|
minor_version = int(name.split('-')[1].split('.')[1])
|
||||||
|
if minor_version >= 7:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PACKAGE_DATA = {"": ["*.pyx", "*.pxd", "*.txt", "*.tokens"]}
|
PACKAGE_DATA = {"": ["*.pyx", "*.pxd", "*.txt", "*.tokens"]}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,8 +74,17 @@ COMPILE_OPTIONS = {
|
||||||
LINK_OPTIONS = {"msvc": [], "mingw32": [], "other": []}
|
LINK_OPTIONS = {"msvc": [], "mingw32": [], "other": []}
|
||||||
|
|
||||||
|
|
||||||
# I don't understand this very well yet. See Issue #267
|
if is_new_osx():
|
||||||
# Fingers crossed!
|
# On Mac, use libc++ because Apple deprecated use of
|
||||||
|
# libstdc
|
||||||
|
COMPILE_OPTIONS["other"].append("-stdlib=libc++")
|
||||||
|
LINK_OPTIONS["other"].append("-lc++")
|
||||||
|
# g++ (used by unix compiler on mac) links to libstdc++ as a default lib.
|
||||||
|
# See: https://stackoverflow.com/questions/1653047/avoid-linking-to-libstdc
|
||||||
|
LINK_OPTIONS["other"].append("-nodefaultlibs")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
USE_OPENMP_DEFAULT = "0" if sys.platform != "darwin" else None
|
USE_OPENMP_DEFAULT = "0" if sys.platform != "darwin" else None
|
||||||
if os.environ.get("USE_OPENMP", USE_OPENMP_DEFAULT) == "1":
|
if os.environ.get("USE_OPENMP", USE_OPENMP_DEFAULT) == "1":
|
||||||
if sys.platform == "darwin":
|
if sys.platform == "darwin":
|
||||||
|
|
Loading…
Reference in New Issue