@@ -128,19 +128,18 @@ if use_intel_sort and not fs.exists('src/npysort/x86-simd-sort/README.md')
128
128
error (' Missing the `x86-simd-sort` git submodule! Run `git submodule update --init` to fix this.' )
129
129
endif
130
130
131
- use_openmp = not get_option (' disable-threading' ) and get_option (' enable-openmp' ) and cpp.has_argument(' -fopenmp' )
132
- summary ({
133
- ' Build with openMP? ' : use_openmp,
134
- })
131
+ # openMP related settings:
132
+ if get_option (' disable-threading' ) and get_option (' enable-openmp' )
133
+ error (' Build options `disable-threading` and `enable-openmp` are conflicting. Please set at most one to true.' )
134
+ endif
135
+
136
+ use_openmp = get_option (' enable-openmp' ) and not get_option (' disable-threading' )
135
137
136
138
# Setup openmp flags for x86-simd-sort:
137
- omp_cflags = []
138
- omp = []
139
+ omp_dep = []
139
140
if use_intel_sort and use_openmp
140
- omp = dependency (' openmp' , required : false )
141
- if omp.found()
142
- omp_cflags = [' -fopenmp' , ' -DXSS_USE_OPENMP' ]
143
- endif
141
+ omp = dependency (' openmp' , required : true )
142
+ omp_dep = declare_dependency (dependencies : omp, compile_args : [' -DXSS_USE_OPENMP' ])
144
143
endif
145
144
146
145
if not fs.exists(' src/common/pythoncapi-compat' )
@@ -890,9 +889,9 @@ foreach gen_mtargets : [
890
889
dispatch : gen_mtargets[2 ],
891
890
# baseline: CPU_BASELINE, it doesn't provide baseline fallback
892
891
prefix : ' NPY_' ,
893
- dependencies : [py_dep, np_core_dep],
892
+ dependencies : [py_dep, np_core_dep, omp_dep ],
894
893
c_args : c_args_common + max_opt,
895
- cpp_args : cpp_args_common + max_opt + omp_cflags ,
894
+ cpp_args : cpp_args_common + max_opt,
896
895
include_directories : [
897
896
' include' ,
898
897
' src/common' ,
0 commit comments