Skip to content

Commit 110be53

Browse files
committed
fix race condition in meson build
1 parent 72232cb commit 110be53

1 file changed

Lines changed: 20 additions & 13 deletions

File tree

meson.build

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,25 +101,32 @@ if not mkl_dep.found()
101101
mkl_dep = declare_dependency(dependencies: [mkl_core, mkl_intel_lp64, mkl_tbb_thread])
102102
endif
103103

104-
# generate loops, similar to numpy
105-
src_file_cli = find_program('_vendored/process_src_template.py')
106-
107-
src_file = generator(
108-
src_file_cli,
109-
arguments: ['@INPUT@', '-o', '@OUTPUT@'],
110-
output: '@BASENAME@'
111-
)
112-
113-
gen_loops_c = src_file.process('mkl_umath/src/mkl_umath_loops.c.src')
114-
gen_loops_h = src_file.process('mkl_umath/src/mkl_umath_loops.h.src')
115-
116104
gen_umath_c = custom_target(
117105
'__umath_generated',
118106
output: '__umath_generated.c',
119107
input: 'mkl_umath/generate_umath.py',
120108
command: [py, '@INPUT@', '-o', '@OUTPUT@']
121109
)
122110

111+
gen_loops_c = custom_target(
112+
'gen_loops_c',
113+
input: 'mkl_umath/src/mkl_umath_loops.c.src',
114+
output: 'mkl_umath_loops.c',
115+
command: [
116+
py, '_vendored/process_src_template.py', '@INPUT@', '-o', '@OUTPUT@'
117+
]
118+
)
119+
120+
gen_loops_h = custom_target(
121+
'gen_loops_h',
122+
input: 'mkl_umath/src/mkl_umath_loops.h.src',
123+
output: 'mkl_umath_loops.h',
124+
command: [
125+
py, '_vendored/process_src_template.py', '@INPUT@', '-o', '@OUTPUT@'
126+
],
127+
depends: [gen_umath_c]
128+
)
129+
123130
mkl_umath_loops = shared_library(
124131
'mkl_umath_loops',
125132
sources: [gen_loops_c, gen_loops_h],
@@ -143,7 +150,7 @@ endif
143150
# gen_loops_h is generated by custom target so must be included in sources
144151
py.extension_module(
145152
'_ufuncs',
146-
sources: ['mkl_umath/src/ufuncsmodule.c', gen_umath_c, gen_loops_h],
153+
sources: ['mkl_umath/src/ufuncsmodule.c', gen_loops_h],
147154
include_directories: inc_np,
148155
dependencies: [mkl_dep, tbb_dep, loops_dep],
149156
c_args: c_args + ['-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION'],

0 commit comments

Comments
 (0)