8000 Merge pull request #18 from bashtage/add-lm-flag · mattip/numpy@2d6f9d6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2d6f9d6

Browse files
authored
Merge pull request #18 from bashtage/add-lm-flag
BLD: Add lm flag for non-windows platforms
2 parents f3ef206 + f878610 commit 2d6f9d6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

_randomgen/setup.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454

5555
EXTRA_INCLUDE_DIRS = []
5656
EXTRA_LINK_ARGS = []
57+
EXTRA_LIBRARIES = ['m'] if os.name != 'nt' else []
5758
# Undef for manylinux
5859
EXTRA_COMPILE_ARGS = [] if os.name == 'nt' else [
5960
'-std=c99', '-U__GNUC_GNU_INLINE__']
@@ -64,6 +65,7 @@
6465
EXTRA_COMPILE_ARGS += ["-Zi", "/Od"]
6566
if sys.version_info < (3, 0):
6667
EXTRA_INCLUDE_DIRS += [join(MOD_DIR, 'src', 'common')]
68+
6769
PCG64_DEFS = []
6870
if sys.maxsize < 2 ** 32 or os.name == 'nt':
6971
# Force emulated mode here
@@ -100,6 +102,7 @@
100102
include_dirs=EXTRA_INCLUDE_DIRS + [np.get_include(),
101103
join(MOD_DIR, 'src',
102104
'entropy')],
105+
libraries=EXTRA_LIBRARIES,
103106
extra_compile_args=EXTRA_COMPILE_ARGS,
104107
extra_link_args=EXTRA_LINK_ARGS
105108
),
@@ -111,6 +114,7 @@
111114
include_dirs=EXTRA_INCLUDE_DIRS + [np.get_include(),
112115
join(MOD_DIR, 'src',
113116
'dsfmt')],
117+
libraries=EXTRA_LIBRARIES,
114118
extra_compile_args=EXTRA_COMPILE_ARGS,
115119
extra_link_args=EXTRA_LINK_ARGS,
116120
define_macros=DSFMT_DEFS,
@@ -122,6 +126,7 @@
122126
include_dirs=EXTRA_INCLUDE_DIRS + [np.get_include(),
123127
join(MOD_DIR, 'src',
124128
'mt19937')],
129+
libraries=EXTRA_LIBRARIES,
125130
extra_compile_args=EXTRA_COMPILE_ARGS,
126131
extra_link_args=EXTRA_LINK_ARGS
127132
),
@@ -131,6 +136,7 @@
131136
include_dirs=EXTRA_INCLUDE_DIRS + [np.get_include(),
132137
join(MOD_DIR, 'src',
133138
'philox')],
139+
libraries=EXTRA_LIBRARIES,
134140
extra_compile_args=EXTRA_COMPILE_ARGS,
135141
extra_link_args=EXTRA_LINK_ARGS
136142
),
@@ -140,6 +146,7 @@
140146
include_dirs=EXTRA_INCLUDE_DIRS + [np.get_include(),
141147
join(MOD_DIR, 'src',
142148
'pcg64')],
149+
libraries=EXTRA_LIBRARIES,
143150
extra_compile_args=EXTRA_COMPILE_ARGS,
144151
define_macros=PCG64_DEFS,
145152
extra_link_args=EXTRA_LINK_ARGS
@@ -150,6 +157,7 @@
150157
include_dirs=EXTRA_INCLUDE_DIRS + [np.get_include(),
151158
join(MOD_DIR, 'src',
152159
'pcg32')],
160+
libraries=EXTRA_LIBRARIES,
153161
extra_compile_args=EXTRA_COMPILE_ARGS,
154162
extra_link_args=EXTRA_LINK_ARGS
155163
),
@@ -159,6 +167,7 @@
159167
include_dirs=EXTRA_INCLUDE_DIRS + [np.get_include(),
160168
join(MOD_DIR, 'src',
161169
'threefry')],
170+
libraries=EXTRA_LIBRARIES,
162171
extra_compile_args=EXTRA_COMPILE_ARGS,
163172
extra_link_args=EXTRA_LINK_ARGS
164173
),
@@ -168,6 +177,7 @@
168177
include_dirs=EXTRA_INCLUDE_DIRS + [np.get_include(),
169178
join(MOD_DIR, 'src',
170179
'threefry32')],
180+
libraries=EXTRA_LIBRARIES,
171181
extra_compile_args=EXTRA_COMPILE_ARGS,
172182
extra_link_args=EXTRA_LINK_ARGS
173183
),
@@ -179,6 +189,7 @@
179189
join(
180190
MOD_DIR, 'src',
181191
'xoroshiro128')],
192+
libraries=EXTRA_LIBRARIES,
182193
extra_compile_args=EXTRA_COMPILE_ARGS,
183194
extra_link_args=EXTRA_LINK_ARGS
184195
),
@@ -189,19 +200,22 @@
189200
include_dirs=EXTRA_INCLUDE_DIRS + [np.get_include(),
190201
join(MOD_DIR, 'src',
191202
'xorshift1024')],
203+
libraries=EXTRA_LIBRARIES,
192204
extra_compile_args=EXTRA_COMPILE_ARGS,
193205
extra_link_args=EXTRA_LINK_ARGS
194206
),
195207
Extension("randomgen.generator",
196208
["randomgen/generator.pyx",
197209
join(MOD_DIR, 'src', 'distributions',
198210
'distributions.c')],
211+
libraries=EXTRA_LIBRARIES,
199212
include_dirs=EXTRA_INCLUDE_DIRS + [np.get_include()],
200213
extra_compile_args=EXTRA_COMPILE_ARGS,
201214
extra_link_args=EXTRA_LINK_ARGS
202215
),
203216
Extension("randomgen.common",
204217
["randomgen/common.pyx"],
218+
libraries=EXTRA_LIBRARIES,
205219
include_dirs=EXTRA_INCLUDE_DIRS + [np.get_include()],
206220
extra_compile_args=EXTRA_COMPILE_ARGS,
207221
extra_link_args=EXTRA_LINK_ARGS
@@ -210,6 +224,7 @@
210224
["randomgen/bounded_integers.pyx",
211225
join(MOD_DIR, 'src', 'distributions',
212226
'distributions.c')],
227+
libraries=EXTRA_LIBRARIES,
213228
include_dirs=EXTRA_INCLUDE_DIRS + [np.get_include()],
214229
extra_compile_args=EXTRA_COMPILE_ARGS,
215230
extra_link_args=EXTRA_LINK_ARGS
@@ -219,6 +234,7 @@
219234
join(MOD_DIR, 'src', 'legacy',
220235
'distributions-boxmuller.c'),
221236
join(MOD_DIR, 'src', 'distributions', 'distributions.c')],
237+
libraries=EXTRA_LIBRARIES,
222238
include_dirs=EXTRA_INCLUDE_DIRS +
223239
[np.get_include()] + [join(MOD_DIR, 'legacy')],
224240
extra_compile_args=EXTRA_COMPILE_ARGS,

0 commit comments

Comments
 (0)
0