Skip to content

Commit 51c572e

Browse files
committed
Use lld linker on travis.
1 parent 415b93c commit 51c572e

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

.travis.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,18 @@ python:
44
- "2.7"
55
compiler: clang
66
env:
7-
- CC="clang" CXX="clang++"
7+
- CC="clang" CXX="clang++" LDFLAGS="-fuse-ld=lld"
88

99
dist: xenial
1010
addons:
1111
apt:
1212
packages:
1313
- build-essential
1414
- cython
15-
- llvm-3.7-dev
1615
- python-numpy
1716
- python-pytest
1817

1918
install:
20-
- llvm-config --libdir
21-
- llvm-config --libdir | xargs sudo mkdir -p
22-
- llvm-config --libdir | xargs sudo ln -s /usr/lib/llvm-3.7/lib/LLVMgold.so
2319
- pip install numpy cython pytest
2420
script:
2521
- pwd

setup.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"""
88

99
import sys
10+
import os
1011
import platform
1112

1213
from distutils.core import setup
@@ -47,16 +48,18 @@
4748

4849
else:
4950
# LINUX
50-
51+
ldflags = ['-flto', '-ffast-math']
52+
if 'LDFLAGS' in os.environ and os.environ['LDFLAGS']:
53+
ldflags.extend(os.environ['LDFLAGS'].split(' '))
54+
ldflags.extend(['-Wl,-Bdynamic,--as-needed', '-lgcc_s'])
5155
ext_modules = [Extension(name='bh_sne',
5256
sources=['tsne/bh_sne_src/sptree.cpp',
5357
'tsne/bh_sne_src/tsne.cpp', 'tsne/bh_sne.pyx'],
5458
include_dirs=[
5559
numpy.get_include(), 'tsne/bh_sne_src/'],
5660
extra_compile_args=['-msse3', '-O3', '-Wall', '-flto',
5761
'-fPIC', '-w', '-std=c++14'],
58-
extra_link_args=['-flto', '-ffast-math',
59-
'-Wl,-Bdynamic,--as-needed', '-lgcc_s'],
62+
extra_link_args=ldflags,
6063
language='c++'),
6164
]
6265

0 commit comments

Comments
 (0)