Skip to content

Commit 7eb9fde

Browse files
committed
Fix: Skip OpenMP on Clang
1 parent 5915d3e commit 7eb9fde

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scripts/nbody.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@
3838
#include <span> // `std::span`
3939
#include <bit> // `std::bit_cast`
4040

41+
// Clang generally defines `_OPENMP` when OpenMP, but compiling it is
42+
/// tricky and the header may not be available.
4143
#if defined(_OPENMP)
44+
#if __has_include(<omp.h>)
4245
#include <omp.h>
46+
#else
47+
#undef _OPENMP
48+
#endif
4349
#endif
4450

4551
#include <fork_union.hpp>

0 commit comments

Comments
 (0)