mirror of
https://develop.openfoam.com/Development/ThirdParty-common.git
synced 2025-12-08 06:57:50 +00:00
COMP: ensure min compiler versions are properly noted.
- update makeLLVM to build latest clang (3.9.0), which needs cmake.
This commit is contained in:
2
Allclean
2
Allclean
@ -67,7 +67,7 @@ fi
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Clean various packages via 'distclean'
|
# Clean various packages via 'distclean'
|
||||||
for i in openmpi-* ADIOS-*
|
for i in openmpi-* ADIOS-* metis-*
|
||||||
do
|
do
|
||||||
[ -d "$i" ] && (
|
[ -d "$i" ] && (
|
||||||
echo
|
echo
|
||||||
|
|||||||
11
README.org
11
README.org
@ -11,19 +11,18 @@
|
|||||||
* Description
|
* Description
|
||||||
Scripts for building third-party packages.
|
Scripts for building third-party packages.
|
||||||
* Build Order:
|
* Build Order:
|
||||||
+ makeGcc (recommended if the system gcc is < 4.7)
|
+ makeGcc (recommended if the system gcc is < 4.8)
|
||||||
+ Allwmake (Builds OpenMPI, Scotch etc.)
|
+ Allwmake (Builds OpenMPI, Scotch etc.)
|
||||||
+ makeCmake (if the system cmake version is < 2.8.8)
|
+ makeCmake (if the system cmake version is < 2.8.8)
|
||||||
+ makeParaView
|
+ makeParaView
|
||||||
*** Optional Build Components:
|
*** Optional Build Components:
|
||||||
+ makeLLVM (Replaces makeGcc in the above description
|
+ makeLLVM (Replaces makeGcc in the above description to use clang as compiler)
|
||||||
- to use clang as compiler)
|
|
||||||
+ makeADIOS (Only required for ADIOS support)
|
+ makeADIOS (Only required for ADIOS support)
|
||||||
+ makeCCMIO (Only required for conversion of STAR-CCM+ meshes)
|
+ makeCCMIO (Only required for conversion of STAR-CCM+ meshes)
|
||||||
+ Allclean (Only required to save disk space)
|
+ Allclean (Only required to save disk space)
|
||||||
* Versions and locations to download the third party packages
|
* Versions and locations to download the third party packages
|
||||||
*** Gcc C++ Compiler
|
*** Gcc C++ Compiler
|
||||||
The minimum version of gcc required is 4.5.0
|
The minimum version of gcc required is 4.8.0
|
||||||
+ gcc http://gcc.gnu.org/releases.html
|
+ gcc http://gcc.gnu.org/releases.html
|
||||||
+ gmp http://gmplib.org/
|
+ gmp http://gmplib.org/
|
||||||
ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.0.tar.bz2
|
ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.0.tar.bz2
|
||||||
@ -31,6 +30,10 @@
|
|||||||
ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.4.tar.bz2
|
ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.4.tar.bz2
|
||||||
+ mpc http://www.multiprecision.org/
|
+ mpc http://www.multiprecision.org/
|
||||||
ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
|
ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
|
||||||
|
*** Clang/LLVM C++ Compiler
|
||||||
|
The minimum version of clang required is 3.3
|
||||||
|
+ clang http://llvm.org/releases/3.9.0/cfe-3.9.0.src.tar.xz
|
||||||
|
+ llvm http://llvm.org/releases/3.9.0/llvm-3.9.0.src.tar.xz
|
||||||
*** Parallel Processing
|
*** Parallel Processing
|
||||||
***** Scotch
|
***** Scotch
|
||||||
+ Scotch/PtScotch: https://gforge.inria.fr/frs/download.php/file/34099/scotch_6.0.3.tar.gz
|
+ Scotch/PtScotch: https://gforge.inria.fr/frs/download.php/file/34099/scotch_6.0.3.tar.gz
|
||||||
|
|||||||
83
makeLLVM
83
makeLLVM
@ -52,7 +52,7 @@
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# get default llvm/clang version
|
# get default llvm/clang version
|
||||||
WM_COMPILER_TYPE="ThirdParty" # ensure we get the correct compiler settings
|
WM_COMPILER_TYPE=ThirdParty # ensure we get the correct compiler settings
|
||||||
WM_COMPILER=Clang # force values for 'clang'
|
WM_COMPILER=Clang # force values for 'clang'
|
||||||
|
|
||||||
. $WM_PROJECT_DIR/etc/config.sh/functions
|
. $WM_PROJECT_DIR/etc/config.sh/functions
|
||||||
@ -79,6 +79,8 @@ usage() {
|
|||||||
|
|
||||||
usage: $Script [OPTION] [llvm-VERSION]
|
usage: $Script [OPTION] [llvm-VERSION]
|
||||||
options:
|
options:
|
||||||
|
-cmake PATH with cmake from the path given
|
||||||
|
-gcc force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
|
||||||
-help
|
-help
|
||||||
|
|
||||||
* build llvm/clang
|
* build llvm/clang
|
||||||
@ -89,6 +91,10 @@ USAGE
|
|||||||
}
|
}
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
# Ensure CMake gets the correct C/C++ compiler
|
||||||
|
[ -n "$WM_CC" ] && export CC="$WM_CCX"
|
||||||
|
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
||||||
|
|
||||||
|
|
||||||
# parse options
|
# parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
@ -97,6 +103,15 @@ do
|
|||||||
-h | -help)
|
-h | -help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
-gcc)
|
||||||
|
export CC=gcc # use gcc/g++
|
||||||
|
export CXX=g++
|
||||||
|
;;
|
||||||
|
-cmake)
|
||||||
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
|
CMAKE_PATH="${2%%/}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
llvm-[0-9]* | llvm-svn*)
|
llvm-[0-9]* | llvm-svn*)
|
||||||
llvmPACKAGE="${1%%/}"
|
llvmPACKAGE="${1%%/}"
|
||||||
;;
|
;;
|
||||||
@ -114,16 +129,16 @@ done
|
|||||||
buildBASE=$WM_THIRD_PARTY_DIR/build/$WM_ARCH$WM_COMPILER_ARCH
|
buildBASE=$WM_THIRD_PARTY_DIR/build/$WM_ARCH$WM_COMPILER_ARCH
|
||||||
installBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH
|
installBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH
|
||||||
|
|
||||||
LLVM_ARCH_PATH=$installBASE/$llvmPACKAGE
|
# Build LLVM (clang)
|
||||||
|
# LLVM_SOURCE_DIR : location of the original sources
|
||||||
|
# LLVM_BINARY_DIR : location of the build
|
||||||
|
# LLVM_ARCH_PATH : location of the installed program
|
||||||
|
# - Strip any trailing '.src' from the proper names
|
||||||
|
|
||||||
|
LLVM_SOURCE_DIR=$WM_THIRD_PARTY_DIR/$llvmPACKAGE
|
||||||
|
LLVM_BINARY_DIR=$buildBASE/${llvmPACKAGE%%.src}
|
||||||
|
LLVM_ARCH_PATH=$installBASE/${llvmPACKAGE%%.src}
|
||||||
|
|
||||||
# name of source directory
|
|
||||||
# - may have a llvm/ subdirectory, depending on how the sources were fetched
|
|
||||||
#
|
|
||||||
sourceDIR=$WM_THIRD_PARTY_DIR/$llvmPACKAGE
|
|
||||||
if [ -f $sourceDIR/llvm/configure ]
|
|
||||||
then
|
|
||||||
sourceDIR=$sourceDIR/llvm
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Build LLVM
|
# Build LLVM
|
||||||
@ -132,20 +147,23 @@ echo "---------------"
|
|||||||
if [ -d $LLVM_ARCH_PATH ]
|
if [ -d $LLVM_ARCH_PATH ]
|
||||||
then
|
then
|
||||||
echo "Already built: $llvmPACKAGE"
|
echo "Already built: $llvmPACKAGE"
|
||||||
else
|
elif [ -z "$CMAKE_PATH" ] && $LLVM_SOURCE_DIR/configure -help >/dev/null 2>&1
|
||||||
echo "Starting build: $llvmPACKAGE"
|
then
|
||||||
|
# configure can be used prior to 3.9.0
|
||||||
|
# but use cmake if someone explicitly mentioned -cmake on the command-line
|
||||||
|
|
||||||
|
echo "Starting build: $llvmPACKAGE (using configure)"
|
||||||
echo
|
echo
|
||||||
(
|
(
|
||||||
cd $sourceDIR || exit 1
|
cd $LLVM_SOURCE_DIR || exit 1
|
||||||
make distclean 2>/dev/null
|
make distclean 2>/dev/null
|
||||||
|
|
||||||
buildDIR=$buildBASE/$llvmPACKAGE
|
rm -rf $LLVM_BINARY_DIR
|
||||||
rm -rf $buildDIR
|
mkdir -p $LLVM_BINARY_DIR
|
||||||
mkdir -p $buildDIR
|
cd $LLVM_BINARY_DIR
|
||||||
cd $buildDIR
|
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
$sourceDIR/configure \
|
$LLVM_SOURCE_DIR/configure \
|
||||||
--prefix=$LLVM_ARCH_PATH \
|
--prefix=$LLVM_ARCH_PATH \
|
||||||
--with-gcc-toolchain=$(which gcc | sed s%/bin/gcc%%) \
|
--with-gcc-toolchain=$(which gcc | sed s%/bin/gcc%%) \
|
||||||
--enable-optimized \
|
--enable-optimized \
|
||||||
@ -157,6 +175,35 @@ else
|
|||||||
echo "Error building: $llvmPACKAGE"
|
echo "Error building: $llvmPACKAGE"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
# CMake used with 3.9.0 and later
|
||||||
|
|
||||||
|
echo "Starting build: $llvmPACKAGE (using cmake)"
|
||||||
|
echo
|
||||||
|
(
|
||||||
|
cd $LLVM_SOURCE_DIR || exit 1
|
||||||
|
|
||||||
|
rm -rf $LLVM_BINARY_DIR
|
||||||
|
mkdir -p $LLVM_BINARY_DIR
|
||||||
|
cd $LLVM_BINARY_DIR
|
||||||
|
|
||||||
|
cmake=$(findCMake)
|
||||||
|
|
||||||
|
set -x
|
||||||
|
$cmake \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=$LLVM_ARCH_PATH \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DBUILD_SHARED_LIBS:BOOL=ON \
|
||||||
|
$LLVM_SOURCE_DIR \
|
||||||
|
&& make -j $WM_NCOMPPROCS \
|
||||||
|
&& make install \
|
||||||
|
&& echo "Built: $llvmPACKAGE"
|
||||||
|
) || {
|
||||||
|
echo "Error building: $llvmPACKAGE"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user