mirror of
https://develop.openfoam.com/Development/ThirdParty-common.git
synced 2025-12-08 06:57:50 +00:00
ENH: remove reliance on OpenFOAM etc/config.sh/functions file.
- similar functionality in etc/tools/ThirdPartyFunctions to improve the independence of ThirdParty while reducing clutter in the callers. - add useGcc function for convenience - mask seeing our own git-repo when building STYLE: various items - eliminate old user-editable configuration in files - now command-line only. - use *_BUILD_DIR instead of *_BINARY_DIR for more clarity of the purpose - drop use of '-q' option for wmakeCheckPwd (already has stderr redirect) - drop checkVersion for makeParaView since it stopped working properly with newer paraview version CONFIG: update list of versions
This commit is contained in:
44
makeLLVM
44
makeLLVM
@ -46,21 +46,22 @@
|
||||
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
|
||||
#------------------------------------------------------------------------------
|
||||
# Run from third-party directory only
|
||||
cd ${0%/*} && wmakeCheckPwd -q "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
|
||||
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
|
||||
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
|
||||
echo " Check your OpenFOAM environment and installation"
|
||||
exit 1
|
||||
}
|
||||
. etc/tools/ThirdPartyFunctions
|
||||
#------------------------------------------------------------------------------
|
||||
# LLVM/Clang version from OpenFOAM etc/config.sh file
|
||||
WM_COMPILER_TYPE=ThirdParty # ensure we get the correct compiler settings
|
||||
WM_COMPILER=Clang # force values for 'clang'
|
||||
|
||||
. $WM_PROJECT_DIR/etc/config.sh/functions
|
||||
_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/compiler)
|
||||
[ "${WM_COMPILER#Clang}" = "$WM_COMPILER" ] && WM_COMPILER=Clang # Force clang
|
||||
WM_COMPILER_TYPE=ThirdParty # Ensure we get the correct settings
|
||||
|
||||
# LLVM/Clang version from OpenFOAM etc/config.sh file:
|
||||
_foamEtc config.sh/compiler
|
||||
|
||||
llvmPACKAGE=$clang_version
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
usage() {
|
||||
exec 1>&2
|
||||
@ -80,7 +81,7 @@ USAGE
|
||||
exit 1
|
||||
}
|
||||
#-----------------------------------------------------------------------------
|
||||
# Ensure CMake gets the correct C/C++ compiler
|
||||
# Compiler settings for CMake/configure
|
||||
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
||||
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
||||
|
||||
@ -88,13 +89,10 @@ USAGE
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-h | -help)
|
||||
usage
|
||||
;;
|
||||
-gcc)
|
||||
export CC=gcc # use gcc/g++
|
||||
export CXX=g++
|
||||
;;
|
||||
'') ;; # Ignore empty
|
||||
-h | -help) usage ;;
|
||||
-gcc) useGcc ;;
|
||||
|
||||
-cmake)
|
||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||
CMAKE_PATH="${2%%/}"
|
||||
@ -119,12 +117,12 @@ installBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH
|
||||
|
||||
# Build LLVM (clang)
|
||||
# LLVM_SOURCE_DIR : location of the original sources
|
||||
# LLVM_BINARY_DIR : location of the build
|
||||
# LLVM_BUILD_DIR : location of the build
|
||||
# LLVM_ARCH_PATH : location of the installed program
|
||||
# - Strip any trailing '.src' from the proper names
|
||||
|
||||
LLVM_SOURCE_DIR=$sourceBASE/$llvmPACKAGE
|
||||
LLVM_BINARY_DIR=$buildBASE/${llvmPACKAGE%%.src}
|
||||
LLVM_BUILD_DIR=$buildBASE/${llvmPACKAGE%%.src}
|
||||
LLVM_ARCH_PATH=$installBASE/${llvmPACKAGE%%.src}
|
||||
|
||||
#
|
||||
@ -143,11 +141,12 @@ then
|
||||
echo
|
||||
(
|
||||
cd $LLVM_SOURCE_DIR || exit 1
|
||||
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
|
||||
make distclean 2>/dev/null
|
||||
|
||||
rm -rf $LLVM_BINARY_DIR
|
||||
mkdir -p $LLVM_BINARY_DIR
|
||||
cd $LLVM_BINARY_DIR
|
||||
rm -rf $LLVM_BUILD_DIR
|
||||
mkdir -p $LLVM_BUILD_DIR
|
||||
cd $LLVM_BUILD_DIR
|
||||
|
||||
set -x
|
||||
$LLVM_SOURCE_DIR/configure \
|
||||
@ -171,10 +170,11 @@ else
|
||||
echo
|
||||
(
|
||||
cd $LLVM_SOURCE_DIR || exit 1
|
||||
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
|
||||
|
||||
rm -rf $LLVM_BINARY_DIR
|
||||
mkdir -p $LLVM_BINARY_DIR
|
||||
cd $LLVM_BINARY_DIR
|
||||
rm -rf $LLVM_BUILD_DIR
|
||||
mkdir -p $LLVM_BUILD_DIR
|
||||
cd $LLVM_BUILD_DIR
|
||||
|
||||
cmake=$(findCMake)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user