From 04b5291c551dbe2deccb950887d18f71c8424665 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Thu, 9 Apr 2020 11:16:23 +0200 Subject: [PATCH] CONFIG: handle openmp on Darwin (#1656) - requires -Xpreprocessor - uses 'libomp' (no 'libgomp' link) --- wmake/rules/General/Clang/openmp | 9 +-------- wmake/rules/General/Clang/openmp-gomp | 8 ++++++++ wmake/rules/General/Clang/openmp-omp | 5 +++++ wmake/rules/General/mplib | 4 +--- wmake/rules/General/no-mpi | 7 +++++++ wmake/rules/General/no-openmp | 6 ++++++ wmake/rules/darwin64Clang/general | 11 ++++++++++- 7 files changed, 38 insertions(+), 12 deletions(-) mode change 100644 => 120000 wmake/rules/General/Clang/openmp create mode 100644 wmake/rules/General/Clang/openmp-gomp create mode 100644 wmake/rules/General/Clang/openmp-omp mode change 100644 => 120000 wmake/rules/General/mplib create mode 100644 wmake/rules/General/no-mpi create mode 100644 wmake/rules/General/no-openmp diff --git a/wmake/rules/General/Clang/openmp b/wmake/rules/General/Clang/openmp deleted file mode 100644 index 070a2c5d3ad..00000000000 --- a/wmake/rules/General/Clang/openmp +++ /dev/null @@ -1,8 +0,0 @@ -# Flags for compiling/linking openmp -# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) -# - -# Clang provides 'omp' and a link for 'gomp'. -# With 'gomp' we can use system libs. - -COMP_OPENMP = -DUSE_OMP -fopenmp -LINK_OPENMP = -lgomp diff --git a/wmake/rules/General/Clang/openmp b/wmake/rules/General/Clang/openmp new file mode 120000 index 00000000000..1320b58055e --- /dev/null +++ b/wmake/rules/General/Clang/openmp @@ -0,0 +1 @@ +openmp-gomp \ No newline at end of file diff --git a/wmake/rules/General/Clang/openmp-gomp b/wmake/rules/General/Clang/openmp-gomp new file mode 100644 index 00000000000..1cbfe932205 --- /dev/null +++ b/wmake/rules/General/Clang/openmp-gomp @@ -0,0 +1,8 @@ +# Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) +# - +# Clang provides 'omp' and a link for 'gomp'. +# With 'gomp' we can also use system libs. + +COMP_OPENMP = -DUSE_OMP -fopenmp +LINK_OPENMP = -lgomp diff --git a/wmake/rules/General/Clang/openmp-omp b/wmake/rules/General/Clang/openmp-omp new file mode 100644 index 00000000000..b54782f8cf0 --- /dev/null +++ b/wmake/rules/General/Clang/openmp-omp @@ -0,0 +1,5 @@ +# Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) + +COMP_OPENMP = -DUSE_OMP -fopenmp +LINK_OPENMP = -lomp diff --git a/wmake/rules/General/mplib b/wmake/rules/General/mplib deleted file mode 100644 index 294bd861501..00000000000 --- a/wmake/rules/General/mplib +++ /dev/null @@ -1,3 +0,0 @@ -PFLAGS = -PINC = -PLIBS = diff --git a/wmake/rules/General/mplib b/wmake/rules/General/mplib new file mode 120000 index 00000000000..b7d2b8d468c --- /dev/null +++ b/wmake/rules/General/mplib @@ -0,0 +1 @@ +no-mpi \ No newline at end of file diff --git a/wmake/rules/General/no-mpi b/wmake/rules/General/no-mpi new file mode 100644 index 00000000000..a682d31029b --- /dev/null +++ b/wmake/rules/General/no-mpi @@ -0,0 +1,7 @@ +# Empty flags for not compiling/linking MPI + +PFLAGS = +PINC = +PLIBS = + +#------------------------------------------------------------------------------ diff --git a/wmake/rules/General/no-openmp b/wmake/rules/General/no-openmp new file mode 100644 index 00000000000..36ff42c0d98 --- /dev/null +++ b/wmake/rules/General/no-openmp @@ -0,0 +1,6 @@ +# Empty flags for not compiling/linking OPENMP + +COMP_OPENMP = +LINK_OPENMP = + +#------------------------------------------------------------------------------ diff --git a/wmake/rules/darwin64Clang/general b/wmake/rules/darwin64Clang/general index 1409ef1e6e9..eea19222602 100644 --- a/wmake/rules/darwin64Clang/general +++ b/wmake/rules/darwin64Clang/general @@ -3,7 +3,16 @@ CPP = cpp -traditional-cpp $(GFLAGS) PROJECT_LIBS = -l$(WM_PROJECT) -ldl include $(GENERAL_RULES)/standard -include $(GENERAL_RULES)/Clang/openmp +## include $(GENERAL_RULES)/Clang/openmp + +# Darwin-specific +# ---- +COMP_OPENMP = -DUSE_OMP -Xpreprocessor -fopenmp +LINK_OPENMP = -lomp +# ---- +# Or disable +# include $(GENERAL_RULES)/no-openmp +# ---- include $(DEFAULT_RULES)/c include $(DEFAULT_RULES)/c++ -- GitLab