From 79eef715ef0edcba6bf1969da7a382929accb8b1 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 9 Apr 2026 23:14:05 -0600 Subject: [PATCH] Add llvm-openmp as recommended OpenMP runtime for Windows * Add recommendation of having llvm-openmp be a host requirement for Windows builds that need an OpenMP runtime and note that for this to work the /openmp:llvm option must be added. - c.f. https://learn.microsoft.com/en-us/cpp/build/reference/openmp-enable-openmp-2-0-support?view=msvc-170 --- docs/maintainer/knowledge_base.mdx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/maintainer/knowledge_base.mdx b/docs/maintainer/knowledge_base.mdx index a81fdf8d2e..6ef688dd77 100644 --- a/docs/maintainer/knowledge_base.mdx +++ b/docs/maintainer/knowledge_base.mdx @@ -782,8 +782,8 @@ corresponding compilers in `requirements/build` as normal. The default OpenMP runtime used depends on the compiler and platform used. GCC (on Linux and the Windows MinGW toolchain) uses the `libgomp` runtime. Clang (on all platforms) and GNU Fortran on macOS default to the `llvm-openmp` -runtime. MSVC may use its own runtime or `llvm-openmp`. However, individual projects may force building against -a different runtime through their build system configuration. +runtime. For MSVC `llvm-openmp` is recommended, though `llvm-openmp` requires use of the `/openmp:llvm` option. +However, individual projects may force building against a different runtime through their build system configuration. On Linux, building against `libgomp` is recommended as the other OpenMP providers are backwards compatible with it. When packages are built against `libgomp`, it is possible to use both `libgomp` and `llvm-openmp` provider at runtime. @@ -794,19 +794,31 @@ to the defaults, though individual packages may require a different set: ```recipe +build: + script: + - set "CXXFLAGS=%CXXFLAGS% /openmp:llvm" # [win] + +... + requirements: host: - - llvm-openmp # [osx] - libgomp # [linux] + - llvm-openmp # [not linux] ``` ```recipe +build: + script: + - if: win + then: set "CXXFLAGS=%CXXFLAGS% /openmp:llvm" + +... + requirements: host: - - if: osx - then: llvm-openmp - if: linux then: libgomp + else: llvm-openmp ```