build(omp): added explicit omp prefix override

this is useful when building omp compatible wheels on mac which bundle libomp with them
This commit is contained in:
2026-06-12 14:49:19 -04:00
parent 61cd7359d4
commit 5502b0ac80
2 changed files with 11 additions and 1 deletions

View File

@@ -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.')

View File

@@ -57,7 +57,16 @@ if get_option('plugin_support')
endif
if get_option('openmp_support')
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