diff --git a/meson_options.txt b/meson_options.txt index ddde5662..83a2dfd4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -13,3 +13,4 @@ option('openmp_support', type: 'boolean', value: false, description: 'Enable Ope option('use_mimalloc', type: 'boolean', value: true, description: 'Use mimalloc as the memory allocator for GridFire. Generally this is ~10% faster than the system allocator.') option('build_benchmarks', type: 'boolean', value: false, description: 'build the benchmark suite') option('asan', type: 'boolean', value: false, description: 'Enable AddressSanitizer (ASan) support for detecting memory errors') +option('libomp_prefix', type: 'string', value: '', description: 'Explicit prefix of an LLVM OpenMP runtime to use instead of auto-detection (macOS wheel builds). Empty = dependency(\'openmp\') auto-detection.') diff --git a/src/meson.build b/src/meson.build index fbf0005d..c9e51271 100644 --- a/src/meson.build +++ b/src/meson.build @@ -57,7 +57,16 @@ if get_option('plugin_support') endif if get_option('openmp_support') - openmp_dep = dependency('openmp', required: true) + libomp_prefix = get_option('libomp_prefix') + if libomp_prefix != '' + omp_lib = cpp.find_library('omp', dirs: [libomp_prefix + '/lib']) + openmp_dep = declare_dependency( + compile_args: ['-Xpreprocessor', '-fopenmp', '-I' + libomp_prefix + '/include'], + dependencies: omp_lib, + ) + else + openmp_dep = dependency('openmp', required: true) + endif gridfire_build_dependencies += [openmp_dep] endif