COMP: stricter handling of openmp vs no-openmp

- give precedence to ~openmp (-no-openmp) over +openmp (-openmp)
  in the general rules and in the Makefile. This makes it robuster
  when specifying +openmp in general, but ~openmp for specific build
  components.

- disable openmp for OSspecific and Pstream components.
  Neither should contain any openmp code anyhow.

  Additionally, since OSspecific is generally built as a static
  object, it can become problematic (eg, with AMD ROCm) if the
  compiler generates information that openmp is required but then uses
  static linkage.
This commit is contained in:
Mark Olesen
2023-12-11 09:54:49 +01:00
parent cd493897d3
commit d086cc5a0e
9 changed files with 61 additions and 18 deletions

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2019-2022 OpenCFD Ltd.
# Copyright (C) 2019-2023 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -19,7 +19,7 @@
#
# Embedded Control Parameters
#
# WM_COMPILE_CONTROL (+openmp)
# WM_COMPILE_CONTROL (+openmp | ~openmp)
# WM_COMPILE_CONTROL (~openfoam)
# WM_OSTYPE (windows)
#
@ -62,9 +62,13 @@ SYS_INC =
SYS_LIBS =
# Add linkage for openmp into the system libraries
# - if enabled (+openmp) and not disabled (~openmp).
# - disable has higher precedence
ifeq (,$(findstring ~openmp,$(WM_COMPILE_CONTROL)))
ifneq (,$(findstring +openmp,$(WM_COMPILE_CONTROL)))
SYS_LIBS = $(LINK_OPENMP)
endif
endif
# These are set by Make/options
EXE_INC =