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'
|
||||
for i in openmpi-* ADIOS-*
|
||||
for i in openmpi-* ADIOS-* metis-*
|
||||
do
|
||||
[ -d "$i" ] && (
|
||||
echo
|
||||
|
||||
11
README.org
11
README.org
@ -11,19 +11,18 @@
|
||||
* Description
|
||||
Scripts for building third-party packages.
|
||||
* 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.)
|
||||
+ makeCmake (if the system cmake version is < 2.8.8)
|
||||
+ makeParaView
|
||||
*** Optional Build Components:
|
||||
+ makeLLVM (Replaces makeGcc in the above description
|
||||
- to use clang as compiler)
|
||||
+ makeLLVM (Replaces makeGcc in the above description to use clang as compiler)
|
||||
+ makeADIOS (Only required for ADIOS support)
|
||||
+ makeCCMIO (Only required for conversion of STAR-CCM+ meshes)
|
||||
+ Allclean (Only required to save disk space)
|
||||
* Versions and locations to download the third party packages
|
||||
*** 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
|
||||
+ gmp http://gmplib.org/
|
||||
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
|
||||
+ mpc http://www.multiprecision.org/
|
||||
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
|
||||
***** Scotch
|
||||
+ Scotch/PtScotch: https://gforge.inria.fr/frs/download.php/file/34099/scotch_6.0.3.tar.gz
|
||||
|
||||
111
makeLLVM
111
makeLLVM
@ -52,7 +52,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# 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_PROJECT_DIR/etc/config.sh/functions
|
||||
@ -79,6 +79,8 @@ usage() {
|
||||
|
||||
usage: $Script [OPTION] [llvm-VERSION]
|
||||
options:
|
||||
-cmake PATH with cmake from the path given
|
||||
-gcc force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
|
||||
-help
|
||||
|
||||
* 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
|
||||
while [ "$#" -gt 0 ]
|
||||
@ -97,6 +103,15 @@ do
|
||||
-h | -help)
|
||||
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*)
|
||||
llvmPACKAGE="${1%%/}"
|
||||
;;
|
||||
@ -114,16 +129,16 @@ done
|
||||
buildBASE=$WM_THIRD_PARTY_DIR/build/$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
|
||||
@ -132,31 +147,63 @@ echo "---------------"
|
||||
if [ -d $LLVM_ARCH_PATH ]
|
||||
then
|
||||
echo "Already built: $llvmPACKAGE"
|
||||
else
|
||||
echo "Starting build: $llvmPACKAGE"
|
||||
elif [ -z "$CMAKE_PATH" ] && $LLVM_SOURCE_DIR/configure -help >/dev/null 2>&1
|
||||
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
|
||||
(
|
||||
cd $sourceDIR || exit 1
|
||||
make distclean 2>/dev/null
|
||||
(
|
||||
cd $LLVM_SOURCE_DIR || exit 1
|
||||
make distclean 2>/dev/null
|
||||
|
||||
buildDIR=$buildBASE/$llvmPACKAGE
|
||||
rm -rf $buildDIR
|
||||
mkdir -p $buildDIR
|
||||
cd $buildDIR
|
||||
rm -rf $LLVM_BINARY_DIR
|
||||
mkdir -p $LLVM_BINARY_DIR
|
||||
cd $LLVM_BINARY_DIR
|
||||
|
||||
set -x
|
||||
$LLVM_SOURCE_DIR/configure \
|
||||
--prefix=$LLVM_ARCH_PATH \
|
||||
--with-gcc-toolchain=$(which gcc | sed s%/bin/gcc%%) \
|
||||
--enable-optimized \
|
||||
--enable-shared \
|
||||
&& make -j $WM_NCOMPPROCS \
|
||||
&& make install \
|
||||
&& echo "Built: $llvmPACKAGE"
|
||||
) || {
|
||||
echo "Error building: $llvmPACKAGE"
|
||||
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
|
||||
}
|
||||
|
||||
set -x
|
||||
$sourceDIR/configure \
|
||||
--prefix=$LLVM_ARCH_PATH \
|
||||
--with-gcc-toolchain=$(which gcc | sed s%/bin/gcc%%) \
|
||||
--enable-optimized \
|
||||
--enable-shared \
|
||||
&& make -j $WM_NCOMPPROCS \
|
||||
&& make install \
|
||||
&& echo "Built: $llvmPACKAGE"
|
||||
) || {
|
||||
echo "Error building: $llvmPACKAGE"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user