Commit adfe2833 authored by Mark Olesen's avatar Mark Olesen
Browse files

CONFIG: additional llvm configuration for mesa build (#41)

parent 3fe5c2be
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
...@@ -34,7 +34,7 @@ cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { ...@@ -34,7 +34,7 @@ cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
. etc/tools/ThirdPartyFunctions . etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
unset vtk_version mesa_version # Purge current values unset vtk_version mesa_version mesa_llvm # Purge current values
# mesa version from OpenFOAM etc/config.sh file: # mesa version from OpenFOAM etc/config.sh file:
_foamConfig vtk _foamConfig vtk
...@@ -50,6 +50,7 @@ usage() { ...@@ -50,6 +50,7 @@ usage() {
usage: ${0##*/} [OPTION] mesa-VERSION [-- configure-options] usage: ${0##*/} [OPTION] mesa-VERSION [-- configure-options]
options: options:
-gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX -gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX
-llvm VER llvm version (in ThirdParty) or 'system' to use system
-help -help
* build Mesa with * build Mesa with
...@@ -60,14 +61,26 @@ USAGE ...@@ -60,14 +61,26 @@ USAGE
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset withLLVM
# Non-standard location for clang? # Non-standard location for clang?
case "$WM_COMPILER_TYPE-$WM_COMPILER" in case "$WM_COMPILER_TYPE-$WM_COMPILER" in
ThirdParty-Clang*) (ThirdParty-Clang*)
thirdPartyClang=true withLLVM=true # 'true' means find on path
;; ;;
*) (system-Clang*)
unset thirdPartyClang withLLVM=system # 'system' means find on path
;;
(*)
if _foamIsNone "$mesa_llvm"
then
withLLVM=false
elif _foamIsSystem "$mesa_llvm"
then
withLLVM=system # 'system' means find on path
else
withLLVM="$mesa_llvm" # Take value from mesa config
fi
;; ;;
esac esac
...@@ -80,12 +93,19 @@ do ...@@ -80,12 +93,19 @@ do
-h | -help) usage ;; -h | -help) usage ;;
-gcc) -gcc)
useGcc useGcc
unset thirdPartyClang unset withLLVM
;;
-llvm)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
withLLVM="$2"
shift
;;
llvm-*)
withLLVM="$1"
;; ;;
mesa-*) mesa-*)
mesaPACKAGE="${1%%/}" mesaPACKAGE="${1%%/}"
;; ;;
*) *)
die "unknown option/argument: '$1'" die "unknown option/argument: '$1'"
;; ;;
...@@ -108,27 +128,43 @@ fi ...@@ -108,27 +128,43 @@ fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Locate third-party clang as required # Locate third-party clang as required
if [ "$thirdPartyClang" = true ] case "$withLLVM" in
then (true | system)
thirdPartyClang=$(command -v clang) || { LLVM_ARCH_PATH="$(command -v clang)" || {
echo "Error: could not properly locate clang" echo "Error: could not properly locate llvm/clang"
exit 2 exit 2
} }
# Root installation directory # Root installation directory
thirdPartyClang=${thirdPartyClang%/bin/clang} LLVM_ARCH_PATH="${LLVM_ARCH_PATH%/bin/clang}"
[ -d "$thirdPartyClang" ] || { [ -d "$LLVM_ARCH_PATH" ] || {
echo "Error: could not properly locate clang" echo "Error: could not properly locate llvm/clang"
exit 2 exit 2
} }
fi ;;
('' | none | false)
withLLVM=none
echo "No llvm"
;;
(llvm-*)
echo "check llvm = $withLLVM"
LLVM_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH/$withLLVM"
[ -d "$LLVM_ARCH_PATH" ] || {
echo "Error: could not properly locate llvm/clang"
exit 2
}
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build MESA # Build MESA
# For 64-bit # For 64-bit
# - MESA itself will normally build into 'lib64'. # - MESA itself will normally build into 'lib64' (depends on autoconfig).
# #
# MESA_SOURCE_DIR : location of the original sources # MESA_SOURCE_DIR : location of the original sources
# MESA_ARCH_DIR : installation directory # MESA_ARCH_DIR : installation directory
...@@ -151,9 +187,9 @@ adjustMESA() ...@@ -151,9 +187,9 @@ adjustMESA()
# Configuration options: # Configuration options:
unset configOpt unset configOpt
if [ -d "$thirdPartyClang" ] if [ -d "$LLVM_ARCH_PATH" ]
then then
configOpt="$configOpt --with-llvm-prefix=$thirdPartyClang" configOpt="$configOpt --with-llvm-prefix=$LLVM_ARCH_PATH"
fi fi
# Additional configure options # Additional configure options
...@@ -178,11 +214,11 @@ adjustMESA() ...@@ -178,11 +214,11 @@ adjustMESA()
echo "----" echo "----"
echo "Building $mesaPACKAGE" echo "Building $mesaPACKAGE"
echo " Source : $MESA_SOURCE_DIR" echo " Source : $MESA_SOURCE_DIR"
echo " Target : $MESA_ARCH_PATH" echo " Target : $MESA_ARCH_PATH"
if [ -d "$thirdPartyClang" ] if [ -d "$LLVM_ARCH_PATH" ]
then then
echo " Clang : $thirdPartyClang" echo " llvm : $LLVM_ARCH_PATH"
fi fi
echo "----" echo "----"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment