Skip to content

Commit

Permalink
Use -stdlib argument only on OS X
Browse files Browse the repository at this point in the history
This is a valid argument for clang but not gcc.
  • Loading branch information
bsolomon1124 committed Jan 23, 2020
1 parent db305f5 commit ebca462
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python

import platform
import shutil
import subprocess
from distutils.command.build import build
Expand Down Expand Up @@ -68,15 +69,22 @@
LIBRARIES = ["protobuf"]

# https://docs.python.org/3/distutils/setupscript.html#describing-extension-modules
kwargs = dict(
sources=SOURCES,
include_dirs=INCLUDES,
libraries=LIBRARIES,
language="c++",
)
if platform.system() == "Darwin":
kwargs["extra_compile_args"] = ["-std=c++11", "-stdlib=libc++"]
kwargs["extra_link_args"] = ['-stdlib=libc++']
else:
kwargs["extra_compile_args"] = ["-std=c++11"]

ext = [
Extension(
"cld3", # Name of the extension by which it can be imported
sources=SOURCES,
include_dirs=INCLUDES,
libraries=LIBRARIES,
language="c++",
extra_compile_args=["-std=c++11", "-stdlib=libc++"],
extra_link_args=['-stdlib=libc++'],
**kwargs
)
]

Expand Down Expand Up @@ -145,7 +153,7 @@ def run(self):

setup(
name="pycld3",
version="0.18",
version="0.19",
cmdclass={"build": BuildProtobuf},
author="Brad Solomon",
maintainer="Brad Solomon",
Expand Down

0 comments on commit ebca462

Please sign in to comment.