@@ -180,6 +180,8 @@ else:
180
180
check :true
181
181
).stdout().strip()
182
182
183
+ cython_program= find_program (cython.cmd_array()[0 ])
184
+
183
185
scikit_learn_cython_args= [
184
186
' -X language_level=3' ,' -X boundscheck=' + boundscheck,' -X wraparound=False' ,
185
187
' -X initializedcheck=False' ,' -X nonecheck=False' ,' -X cdivision=True' ,
@@ -190,7 +192,25 @@ scikit_learn_cython_args = [
190
192
]
191
193
cython_args+= scikit_learn_cython_args
192
194
193
- cython_program= find_program (cython.cmd_array()[0 ])
195
+ if cython.version().version_compare(' >=3.1.0' )
196
+ cython_shared_src= custom_target (
197
+ install :false ,
198
+ output :' _cyutility.c' ,
199
+ command : [
200
+ cython_program,' -3' ,' --fast-fail' ,
201
+ ' --generate-shared=' + meson .current_build_dir()/ ' _cyutility.c'
202
+ ],
203
+ )
204
+
205
+ py.extension_module(' _cyutility' ,
206
+ cython_shared_src,
207
+ subdir :' sklearn' ,
208
+ cython_args : cython_args,
209
+ install :true ,
210
+ )
211
+
212
+ cython_args+= [' --shared=sklearn._cyutility' ]
213
+ endif
194
214
195
215
cython_gen= generator (cython_program,
196
216
arguments : cython_args+ [' @INPUT@' ,' --output-file' ,' @OUTPUT@' ],
@@ -202,7 +222,6 @@ cython_gen_cpp = generator(cython_program,
202
222
output :' @BASENAME@.cpp' ,
203
223
)
204
224
205
-
206
225
# Write file in Meson build dir to be able to figure out from Python code
207
226
# whether scikit-learn was built with Meson. Adapted from pandas
208
227
# _version_meson.py.