CONFIG: add Gcc rules for MacOS (darwin)
- /usr/bin/{gcc,g++} normally just symlinks to clang/clang++ and may have unknown default flags. For a gcc toolchain, it would be better to use a homebrew installation. For these cases, the compiler will need to be specified with version=.. in WM_COMPILE_CONTROL. For example, with "version=14", to select gcc-14, g++-14 from the homebrew installation. - needs a slight hack for locating the FlexLexer.h header. Added into src/OSspecific/POSIX similar to how it is handled in src/OSspecific/MSwindows CONFIG: add simple config/detection support for libumpire (Linux)
This commit is contained in:
parent
edf9621ebe
commit
bdac68ebc7
@ -6,7 +6,7 @@
|
|||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
# Copyright (C) 2016-2022 OpenCFD Ltd.
|
# Copyright (C) 2016-2025 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
@ -32,7 +32,7 @@ setenv WM_COMPILER_LIB_ARCH # Ending for lib directories
|
|||||||
if (! $?WM_COMPILE_OPTION ) setenv WM_COMPILE_OPTION
|
if (! $?WM_COMPILE_OPTION ) setenv WM_COMPILE_OPTION
|
||||||
|
|
||||||
# Adjust according to system and architecture
|
# Adjust according to system and architecture
|
||||||
switch ($WM_ARCH)
|
switch ("$WM_ARCH")
|
||||||
case Linux:
|
case Linux:
|
||||||
setenv WM_ARCH linux
|
setenv WM_ARCH linux
|
||||||
|
|
||||||
@ -74,11 +74,22 @@ case Linux:
|
|||||||
breaksw
|
breaksw
|
||||||
|
|
||||||
# arm64 or x86_64 architectures
|
# arm64 or x86_64 architectures
|
||||||
|
# Note: /usr/bin/{gcc,g++} normally just symlinks to clang/clang++
|
||||||
|
# which may not behave as expected.
|
||||||
case Darwin:
|
case Darwin:
|
||||||
setenv WM_ARCH darwin64
|
setenv WM_ARCH darwin64
|
||||||
if ( "$WM_COMPILER" == Gcc ) then
|
if ( "$WM_COMPILER" == Gcc ) then
|
||||||
setenv WM_COMPILER Clang
|
setenv WM_COMPILER Clang
|
||||||
echo "openfoam (darwin): using clang instead of gcc"
|
# Honour use of gcc, when version=... is specifed in WM_COMPILE_CONTROL
|
||||||
|
# (eg, gcc installed via homebrew)
|
||||||
|
if ( $?WM_COMPILE_CONTROL ) then
|
||||||
|
if ( "$WM_COMPILE_CONTROL" =~ "*version=*" ) then
|
||||||
|
setenv WM_COMPILER Gcc
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
if ( "$WM_COMPILER" == Clang ) then
|
||||||
|
echo "openfoam (darwin): using clang instead of gcc"
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
breaksw
|
breaksw
|
||||||
|
|
||||||
@ -214,8 +225,8 @@ _foamEtc -config compiler
|
|||||||
# ThirdParty base for compilers
|
# ThirdParty base for compilers
|
||||||
set archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH"
|
set archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH"
|
||||||
|
|
||||||
switch ("$WM_COMPILER_TYPE-$WM_COMPILER")
|
switch ("${WM_COMPILER_TYPE}/${WM_COMPILER}")
|
||||||
case ThirdParty-Gcc*:
|
case ThirdParty/Gcc*:
|
||||||
if (! $?gmp_version ) set gmp_version=gmp-system
|
if (! $?gmp_version ) set gmp_version=gmp-system
|
||||||
if (! $?mpfr_version ) set mpfr_version=mpfr-system
|
if (! $?mpfr_version ) set mpfr_version=mpfr-system
|
||||||
if (! $?mpc_version ) set mpc_version=mpc-system
|
if (! $?mpc_version ) set mpc_version=mpc-system
|
||||||
@ -263,7 +274,7 @@ GCC_NOT_FOUND
|
|||||||
endif
|
endif
|
||||||
breaksw
|
breaksw
|
||||||
|
|
||||||
case ThirdParty-Clang*:
|
case ThirdParty/Clang*:
|
||||||
set clangDir="$archDir/$clang_version"
|
set clangDir="$archDir/$clang_version"
|
||||||
|
|
||||||
# Check that the compiler directory can be found
|
# Check that the compiler directory can be found
|
||||||
@ -290,9 +301,9 @@ CLANG_NOT_FOUND
|
|||||||
endif
|
endif
|
||||||
breaksw
|
breaksw
|
||||||
|
|
||||||
case -*:
|
case /*:
|
||||||
case system-*:
|
case system/*:
|
||||||
case ThirdParty-*:
|
case ThirdParty/*:
|
||||||
# Using empty (system), system compiler or other ThirdParty compiler
|
# Using empty (system), system compiler or other ThirdParty compiler
|
||||||
breaksw
|
breaksw
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
# Copyright (C) 2016-2022 OpenCFD Ltd.
|
# Copyright (C) 2016-2025 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
@ -70,13 +70,21 @@ Linux)
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
# arm64 or x86_64 architectures
|
# arm64 or x86_64 architectures
|
||||||
|
# Note: /usr/bin/{gcc,g++} normally just symlinks to clang/clang++
|
||||||
|
# which may not behave as expected.
|
||||||
Darwin)
|
Darwin)
|
||||||
WM_ARCH=darwin64
|
WM_ARCH=darwin64
|
||||||
# Defult to clang (not gcc) as system compiler
|
|
||||||
if [ "$WM_COMPILER" = Gcc ]
|
if [ "$WM_COMPILER" = Gcc ]
|
||||||
then
|
then
|
||||||
WM_COMPILER=Clang
|
# Honour use of gcc, when version=... is specifed in WM_COMPILE_CONTROL
|
||||||
echo "openfoam (darwin): using clang instead of gcc" 1>&2
|
# (eg, gcc installed via homebrew)
|
||||||
|
case "$WM_COMPILE_CONTROL" in
|
||||||
|
(*version=*) ;;
|
||||||
|
(*)
|
||||||
|
WM_COMPILER=Clang
|
||||||
|
echo "openfoam (darwin): using clang instead of gcc" 1>&2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@ -217,8 +225,8 @@ _foamEtc -config compiler
|
|||||||
# ThirdParty base for compilers
|
# ThirdParty base for compilers
|
||||||
archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH"
|
archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH"
|
||||||
|
|
||||||
case "$WM_COMPILER_TYPE-$WM_COMPILER" in
|
case "${WM_COMPILER_TYPE}/${WM_COMPILER}" in
|
||||||
ThirdParty-Gcc*)
|
(ThirdParty/Gcc*)
|
||||||
gccDir="$archDir/$gcc_version"
|
gccDir="$archDir/$gcc_version"
|
||||||
gmpDir="$archDir/${gmp_version:-gmp-system}"
|
gmpDir="$archDir/${gmp_version:-gmp-system}"
|
||||||
mpfrDir="$archDir/${mpfr_version:-mpfr-system}"
|
mpfrDir="$archDir/${mpfr_version:-mpfr-system}"
|
||||||
@ -259,7 +267,7 @@ GCC_NOT_FOUND
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
ThirdParty-Clang*)
|
(ThirdParty/Clang*)
|
||||||
clangDir="$archDir/$clang_version"
|
clangDir="$archDir/$clang_version"
|
||||||
|
|
||||||
# Check that the compiler directory can be found
|
# Check that the compiler directory can be found
|
||||||
@ -285,11 +293,11 @@ CLANG_NOT_FOUND
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-* | system-* | ThirdParty-*)
|
(/* | system/* | ThirdParty/*)
|
||||||
# Using empty (system), system compiler or other ThirdParty compiler
|
# Using empty (system), system compiler or other ThirdParty compiler
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
(*)
|
||||||
/bin/cat << UNKNOWN_TYPE 1>&2
|
/bin/cat << UNKNOWN_TYPE 1>&2
|
||||||
===============================================================================
|
===============================================================================
|
||||||
Unknown WM_COMPILER_TYPE="$WM_COMPILER_TYPE" - treating as 'system'
|
Unknown WM_COMPILER_TYPE="$WM_COMPILER_TYPE" - treating as 'system'
|
||||||
|
30
etc/config.sh/umpire
Normal file
30
etc/config.sh/umpire
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#----------------------------------*-sh-*--------------------------------------
|
||||||
|
# ========= |
|
||||||
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
# \\ / O peration |
|
||||||
|
# \\ / A nd | www.openfoam.com
|
||||||
|
# \\/ M anipulation |
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2025 OpenCFD Ltd.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# License
|
||||||
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
#
|
||||||
|
# File
|
||||||
|
# etc/config.sh/umpire
|
||||||
|
# [experimental]
|
||||||
|
#
|
||||||
|
# Description
|
||||||
|
# Setup for UMPIRE include/libraries (usually ThirdParty installation).
|
||||||
|
#
|
||||||
|
# Note
|
||||||
|
# No csh version. This file is only used by wmake.
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||||
|
|
||||||
|
umpire_version=umpire-2025.03.0
|
||||||
|
export UMPIRE_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$umpire_version"
|
||||||
|
|
||||||
|
# END OF (NORMAL) USER EDITABLE PART
|
||||||
|
#------------------------------------------------------------------------------
|
@ -4,12 +4,58 @@ targetType=libo # Preferred library type
|
|||||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments $*
|
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments $*
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
# Hack for MacOS (with Gcc).
|
||||||
|
# The gcc compiler include path has something like this:
|
||||||
|
# /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include
|
||||||
|
#
|
||||||
|
# but xcode flex installs under this:
|
||||||
|
# /Applications/Xcode.app/Contents/Developer/
|
||||||
|
# Toolchains/XcodeDefault.xctoolchain/usr/include
|
||||||
|
|
||||||
|
case "${WM_ARCH}/${WM_COMPILER}" in
|
||||||
|
(darwin*/Gcc*)
|
||||||
|
if [ ! -f FlexLexer.h ]
|
||||||
|
then
|
||||||
|
# Remove stale link(s)
|
||||||
|
rm -f FlexLexer.h lnInclude/FlexLexer.h
|
||||||
|
|
||||||
|
for include in \
|
||||||
|
/usr/include \
|
||||||
|
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include \
|
||||||
|
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include \
|
||||||
|
;
|
||||||
|
do
|
||||||
|
if [ -f "$include"/FlexLexer.h ]
|
||||||
|
then
|
||||||
|
echo "Adding FlexLexer.h link to ${PWD##*/} (darwin/gcc)" 1>&2
|
||||||
|
ln -sf "$include"/FlexLexer.h FlexLexer.h
|
||||||
|
|
||||||
|
if [ -d lnInclude ]
|
||||||
|
then
|
||||||
|
(cd lnInclude && ln -sf ../FlexLexer.h .)
|
||||||
|
fi
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
(*)
|
||||||
|
if [ -f FlexLexer.h ]
|
||||||
|
then
|
||||||
|
echo "Removing old FlexLexer.h link from ${PWD##*/}" 1>&2
|
||||||
|
rm -f FlexLexer.h lnInclude/FlexLexer.h
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
unset COMP_FLAGS LINK_FLAGS
|
unset COMP_FLAGS LINK_FLAGS
|
||||||
|
|
||||||
# If <sys/inotify.h> is available (Linux)
|
# If <sys/inotify.h> is available (Linux)
|
||||||
if [ -f /usr/include/sys/inotify.h ]
|
if [ -f /usr/include/sys/inotify.h ]
|
||||||
then
|
then
|
||||||
echo " found <sys/inotify.h> -- enabling inotify for file monitoring."
|
echo " found <sys/inotify.h> -- using inotify for file monitoring" 1>&2
|
||||||
export COMP_FLAGS="-DFOAM_USE_INOTIFY"
|
export COMP_FLAGS="-DFOAM_USE_INOTIFY"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
11
wmake/rules/darwin64/link-c
Normal file
11
wmake/rules/darwin64/link-c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Linking on MacOS - without rpath components
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
LINK_LIBS = $(cDBUG)
|
||||||
|
|
||||||
|
LINKLIBSO = $(cc) $(cARCH) -Wl,-dylib,-undefined,dynamic_lookup
|
||||||
|
|
||||||
|
LINKEXE = $(cc) $(cARCH) -Wl,-execute,-undefined,dynamic_lookup
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
13
wmake/rules/darwin64/link-c++
Normal file
13
wmake/rules/darwin64/link-c++
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Linking on MacOS
|
||||||
|
# with or without rpath components
|
||||||
|
# - current default is with rpath unless explicitly disabled
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
ifneq (,$(findstring ~rpath,$(WM_COMPILE_CONTROL)))
|
||||||
|
include $(ARCHITECTURE_RULES)/link-no-c++
|
||||||
|
else
|
||||||
|
include $(ARCHITECTURE_RULES)/link-rpath-c++
|
||||||
|
endif
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
13
wmake/rules/darwin64/link-no-path-c++
Normal file
13
wmake/rules/darwin64/link-no-path-c++
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Linking on MacOS - without rpath components
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
LINK_LIBS = $(c++DBUG)
|
||||||
|
|
||||||
|
LINKLIBSO = $(CC) $(c++FLAGS) \
|
||||||
|
-Wl,-dylib,-undefined,dynamic_lookup
|
||||||
|
|
||||||
|
LINKEXE = $(CC) $(c++FLAGS) \
|
||||||
|
-Wl,-execute,-undefined,dynamic_lookup
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
@ -1,5 +1,8 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
include $(DEFAULT_RULES)/rpath
|
# Linking on MacOS - with rpath components
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include $(ARCHITECTURE_RULES)/rpath
|
||||||
|
|
||||||
LINK_LIBS = $(c++DBUG)
|
LINK_LIBS = $(c++DBUG)
|
||||||
|
|
@ -1,4 +1,6 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
# Linking with rpath components (MacOS)
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Compile-time rpath information:
|
# Compile-time rpath information:
|
||||||
|
|
@ -17,10 +17,7 @@ cFLAGS = \
|
|||||||
|
|
||||||
ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $< -o $@
|
ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $< -o $@
|
||||||
|
|
||||||
LINK_LIBS = $(cDBUG)
|
# MacOS linking
|
||||||
|
include $(ARCHITECTURE_RULES)/link-c
|
||||||
LINKLIBSO = $(cc) $(cARCH) -Wl,-dylib,-undefined,dynamic_lookup
|
|
||||||
|
|
||||||
LINKEXE = $(cc) $(cARCH) -Wl,-execute,-undefined,dynamic_lookup
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -21,15 +21,7 @@ cpptoo = $(Ctoo)
|
|||||||
cxxtoo = $(Ctoo)
|
cxxtoo = $(Ctoo)
|
||||||
|
|
||||||
|
|
||||||
# Linking:
|
# MacOS linking (with or without rpath components)
|
||||||
# with or without rpath components on MacOS
|
include $(ARCHITECTURE_RULES)/link-c++
|
||||||
# - current default is with rpath unless explicitly disabled
|
|
||||||
|
|
||||||
ifneq (,$(findstring ~rpath,$(WM_COMPILE_CONTROL)))
|
|
||||||
include $(DEFAULT_RULES)/link-c++
|
|
||||||
|
|
||||||
else
|
|
||||||
include $(DEFAULT_RULES)/link-rpath-c++
|
|
||||||
endif
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
#------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
LINK_LIBS = $(c++DBUG)
|
|
||||||
|
|
||||||
LINKLIBSO = $(CC) $(c++FLAGS) -Wl,-dylib,-undefined,dynamic_lookup
|
|
||||||
|
|
||||||
LINKEXE = $(CC) $(c++FLAGS) -Wl,-execute,-undefined,dynamic_lookup
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
23
wmake/rules/darwin64Gcc/c
Normal file
23
wmake/rules/darwin64Gcc/c
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
include $(GENERAL_RULES)/Gcc/c
|
||||||
|
|
||||||
|
## ifneq (,$(findstring +xcrun,$(WM_COMPILE_CONTROL)))
|
||||||
|
## cc := xcrun cc
|
||||||
|
## endif
|
||||||
|
|
||||||
|
cARCH := -m64 -ftrapping-math
|
||||||
|
|
||||||
|
ifneq (,$(strip $(WM_COMPILE_OPTION)))
|
||||||
|
sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
|
||||||
|
endif
|
||||||
|
|
||||||
|
cFLAGS = \
|
||||||
|
$(cARCH) $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) \
|
||||||
|
$(FOAM_EXTRA_CFLAGS) $(LIB_HEADER_DIRS) -fPIC
|
||||||
|
|
||||||
|
ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
# MacOS linking
|
||||||
|
include $(ARCHITECTURE_RULES)/link-c
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
27
wmake/rules/darwin64Gcc/c++
Normal file
27
wmake/rules/darwin64Gcc/c++
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
include $(GENERAL_RULES)/Gcc/c++
|
||||||
|
|
||||||
|
## ifneq (,$(findstring +xcrun,$(WM_COMPILE_CONTROL)))
|
||||||
|
## CC := xcrun c++ -std=c++17
|
||||||
|
## endif
|
||||||
|
|
||||||
|
c++ARCH := -m64 -pthread -ftrapping-math
|
||||||
|
|
||||||
|
ifneq (,$(strip $(WM_COMPILE_OPTION)))
|
||||||
|
sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
|
||||||
|
endif
|
||||||
|
|
||||||
|
c++FLAGS = \
|
||||||
|
$(c++ARCH) $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) \
|
||||||
|
$(FOAM_EXTRA_CXXFLAGS) $(LIB_HEADER_DIRS) -fPIC
|
||||||
|
|
||||||
|
Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $< -o $@
|
||||||
|
cctoo = $(Ctoo)
|
||||||
|
cpptoo = $(Ctoo)
|
||||||
|
cxxtoo = $(Ctoo)
|
||||||
|
|
||||||
|
|
||||||
|
# MacOS linking (with or without rpath components)
|
||||||
|
include $(ARCHITECTURE_RULES)/link-c++
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
16
wmake/rules/darwin64Gcc/general
Normal file
16
wmake/rules/darwin64Gcc/general
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
CPP = cpp -traditional-cpp $(GFLAGS)
|
||||||
|
|
||||||
|
include $(GENERAL_RULES)/standard
|
||||||
|
include $(GENERAL_RULES)/Gcc/openmp
|
||||||
|
|
||||||
|
ifneq (,$(findstring ~openmp,$(WM_COMPILE_CONTROL)))
|
||||||
|
include $(GENERAL_RULES)/no-openmp
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(DEFAULT_RULES)/c
|
||||||
|
include $(DEFAULT_RULES)/c++
|
||||||
|
|
||||||
|
# Shared library extension (with '.' separator)
|
||||||
|
EXT_SO = .dylib
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
169
wmake/scripts/have_umpire
Normal file
169
wmake/scripts/have_umpire
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
#----------------------------------*-sh-*--------------------------------------
|
||||||
|
# ========= |
|
||||||
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
# \\ / O peration |
|
||||||
|
# \\ / A nd | www.openfoam.com
|
||||||
|
# \\/ M anipulation |
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2025 OpenCFD Ltd.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# License
|
||||||
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
#
|
||||||
|
# Script
|
||||||
|
# have_umpire
|
||||||
|
#
|
||||||
|
# Description
|
||||||
|
# Detection/setup of UMPIRE
|
||||||
|
#
|
||||||
|
# Requires
|
||||||
|
# UMPIRE_ARCH_PATH
|
||||||
|
#
|
||||||
|
# Functions provided
|
||||||
|
# have_umpire, no_umpire, echo_umpire, query_umpire, search_umpire
|
||||||
|
#
|
||||||
|
# Variables set on success
|
||||||
|
# HAVE_UMPIRE
|
||||||
|
# UMPIRE_ARCH_PATH
|
||||||
|
# UMPIRE_INC_DIR
|
||||||
|
# UMPIRE_LIB_DIR
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Reset
|
||||||
|
no_umpire()
|
||||||
|
{
|
||||||
|
unset HAVE_UMPIRE UMPIRE_INC_DIR UMPIRE_LIB_DIR
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Report
|
||||||
|
echo_umpire()
|
||||||
|
{
|
||||||
|
echo "umpire=${HAVE_UMPIRE:-false}"
|
||||||
|
echo "root=\"$UMPIRE_ARCH_PATH\""
|
||||||
|
echo "include=\"$UMPIRE_INC_DIR\""
|
||||||
|
echo "library=\"$UMPIRE_LIB_DIR\""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Search
|
||||||
|
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||||
|
#
|
||||||
|
# On success, return 0 and export variables
|
||||||
|
# -> HAVE_UMPIRE, UMPIRE_INC_DIR, UMPIRE_LIB_DIR
|
||||||
|
search_umpire()
|
||||||
|
{
|
||||||
|
local warn # warn="==> skip umpire"
|
||||||
|
local incName="Umpire.hpp"
|
||||||
|
local libName="libumpire"
|
||||||
|
|
||||||
|
local prefix="${1:-system}"
|
||||||
|
local header library
|
||||||
|
|
||||||
|
# ----------------------------------
|
||||||
|
if isNone "$prefix"
|
||||||
|
then
|
||||||
|
[ -n "$warn" ] && echo "$warn (disabled)"
|
||||||
|
return 1
|
||||||
|
elif hasAbsdir "$prefix"
|
||||||
|
then
|
||||||
|
header=$(findFirstFile "$prefix/include/umpire/$incName")
|
||||||
|
library=$(findExtLib "$libName")
|
||||||
|
elif isSystem "$prefix"
|
||||||
|
then
|
||||||
|
header=$(findFirstFile \
|
||||||
|
"/usr/local/include/umpire/$incName" \
|
||||||
|
"/usr/include/umpire/$incName" \
|
||||||
|
)
|
||||||
|
prefix=$(sysPrefix "$header")
|
||||||
|
else
|
||||||
|
unset prefix
|
||||||
|
fi
|
||||||
|
# ----------------------------------
|
||||||
|
|
||||||
|
# Header
|
||||||
|
[ -n "$header" ] || {
|
||||||
|
[ -n "$warn" ] && echo "$warn (no header)"
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
# Library
|
||||||
|
[ -n "$library" ] \
|
||||||
|
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||||
|
|| {
|
||||||
|
[ -n "$warn" ] && echo "$warn (no library)"
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
# ----------------------------------
|
||||||
|
|
||||||
|
# OK
|
||||||
|
export HAVE_UMPIRE=true
|
||||||
|
export UMPIRE_ARCH_PATH="$prefix"
|
||||||
|
export UMPIRE_INC_DIR="${header%/*}" # Basename
|
||||||
|
export UMPIRE_LIB_DIR="${library%/*}" # Basename
|
||||||
|
|
||||||
|
# Expect path/include/umpire -> path/include
|
||||||
|
UMPIRE_INC_DIR="${UMPIRE_INC_DIR%/umpire}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Output as per search_* function
|
||||||
|
have_umpire()
|
||||||
|
{
|
||||||
|
local warn # warn="==> skip umpire"
|
||||||
|
local config="config.sh/umpire"
|
||||||
|
local file
|
||||||
|
|
||||||
|
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||||
|
then
|
||||||
|
. "$file"
|
||||||
|
else
|
||||||
|
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
search_umpire "$UMPIRE_ARCH_PATH"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Query settings
|
||||||
|
query_umpire()
|
||||||
|
{
|
||||||
|
local config="config.sh/umpire"
|
||||||
|
local file
|
||||||
|
|
||||||
|
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||||
|
then
|
||||||
|
. "$file"
|
||||||
|
_process_query umpire "$UMPIRE_ARCH_PATH"
|
||||||
|
else
|
||||||
|
echo "(no $config)" 1>&2
|
||||||
|
echo "umpire=unknown"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Reset
|
||||||
|
no_umpire
|
||||||
|
|
||||||
|
# Test/query
|
||||||
|
case "$1" in
|
||||||
|
-test | -debug-test)
|
||||||
|
[ "$1" = "-debug-test" ] && set -x
|
||||||
|
have_umpire
|
||||||
|
[ "$1" = "-debug-test" ] && set +x
|
||||||
|
echo_umpire
|
||||||
|
;;
|
||||||
|
-query)
|
||||||
|
query_umpire
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
Loading…
Reference in New Issue
Block a user