From cc292afaedd01bc2641f515190917627b437bde7 Mon Sep 17 00:00:00 2001 From: Louis MARTIN Date: Sat, 6 Jul 2019 12:27:58 -0700 Subject: [PATCH] Add specific compile flags for macOS (#862) Summary: Fairseq wouldn't install on macOS. A workaround was found here: https://github.com/pytorch/fairseq/issues/289 This is now automatic in setup.py, maybe be there's a cleaner way to do it. I checked that it compiles fine on Linux and macOS. Pull Request resolved: https://github.com/pytorch/fairseq/pull/862 Differential Revision: D16142105 Pulled By: myleott fbshipit-source-id: 998ac7781d7a1ac047f4f9239c1fe16eab4be0dd --- setup.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index a15f3b3a9..19cea3898 100644 --- a/setup.py +++ b/setup.py @@ -16,14 +16,17 @@ if sys.version_info < (3,): with open('README.md') as f: readme = f.read() - +if sys.platform == 'darwin': + extra_compile_args = ['-stdlib=libc++'] +else: + extra_compile_args = ['-std=c++11'] bleu = Extension( 'fairseq.libbleu', sources=[ 'fairseq/clib/libbleu/libbleu.cpp', 'fairseq/clib/libbleu/module.cpp', ], - extra_compile_args=['-std=c++11'], + extra_compile_args=extra_compile_args, )