From 5029d29ff6a15ed6f7f17b113cab8aba76824aac Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Thu, 15 Nov 2018 13:55:21 +0100 Subject: [PATCH] ENH: support -gcc option for foamConfigurePaths - simplifies things for legacyCompile --- bin/tools/foamConfigurePaths | 213 +++++++++++++++++++++-------------- etc/config.csh/settings | 2 +- etc/config.sh/settings | 2 +- 3 files changed, 128 insertions(+), 89 deletions(-) diff --git a/bin/tools/foamConfigurePaths b/bin/tools/foamConfigurePaths index b99f37986b8..718a1ce34bf 100755 --- a/bin/tools/foamConfigurePaths +++ b/bin/tools/foamConfigurePaths @@ -4,7 +4,7 @@ # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation -# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. +# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, licensed under GNU General Public License @@ -22,7 +22,9 @@ usage() { while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<<USAGE -usage: ${0##*/} +usage: ${0##*/} options + +Basic -foamInstall DIR specify installation directory (eg, /opt) -foamVersion VER specify project version (eg, 1612) -projectName NAME specify project directory name (eg, openfoam1612) @@ -30,13 +32,27 @@ usage: ${0##*/} -SP | -float32 specify 'WM_PRECISION_OPTION' -DP | -float64 specify 'WM_PRECISION_OPTION' -int32 | -int64 specify 'WM_LABEL_SIZE' + +Compiler -system NAME specify 'system' compiler to use (eg, Gcc, Icc,...) -third NAME specify 'ThirdParty' compiler to use (eg, Clang40,...) + -gcc VER specify 'gcc_version' for ThirdParty Gcc + -clang VER specify 'clang_version' for ThirdParty Clang + gmp-VERSION for ThirdParty gcc (gmp-system for system library) + mpfr-VERSION for ThirdParty gcc (mpfr-system for system library) + mpc-VERSION for ThirdParty gcc (mpc-system for system library) + +MPI + -mpi NAME specify 'WM_MPLIB' type (eg, INTELMPI, etc) + -openmpi VER use ThirdParty openmpi, with version for 'FOAM_MPI' + -openmpi-system use system openmpi + -openmpi-third use ThirdParty openmpi (using default version) + +Components -boost VER specify 'boost_version' -boost-path DIR specify 'BOOST_ARCH_PATH' -cgal ver specify 'cgal_version' -cgal-path DIR specify 'CGAL_ARCH_PATH' - -clang VER specify 'clang_version' for ThirdParty Clang -cmake VER specify 'cmake_version' -fftw VER specify 'fffw_version' -fftw-path DIR specify 'FFTW_ARCH_PATH' @@ -44,20 +60,17 @@ usage: ${0##*/} -kahip-path DIR specify 'KAHIP_ARCH_PATH' -metis ver specify 'METIS_VERSION' -metis-path DIR specify 'METIS_ARCH_PATH' + +Graphics -paraview VER specify 'ParaView_VERSION' (eg, 5.4.1) -paraview-path DIR specify 'ParaView_DIR' (eg, /opt/ParaView-5.4.1) - -mpi NAME specify 'WM_MPLIB' type (eg, FJMPI, INTELMPI, etc) - -openmpi VER specify ThirdParty openmpi version for 'FOAM_MPI' - -openmpi-system activate system openmpi - -openmpi-third activate ThirdParty openmpi (using default version) -scotch VER specify 'SCOTCH_VERSION' (eg, scotch_6.0.4) -scotch-path DIR specify 'SCOTCH_ARCH_PATH' (eg, /opt/OpenFOAM-scotch_6.0.4) -vtk VER specify 'vtk_version' (eg, VTK-7.1.0) -mesa VER specify 'mesa_version' (eg, mesa-13.0.1) + +Misc -sigfpe | -no-sigfpe [defunct - now under etc/controlDict] - gmp-VERSION for ThirdParty gcc (gmp-system for system library) - mpfr-VERSION for ThirdParty gcc (mpfr-system for system library) - mpc-VERSION for ThirdParty gcc (mpc-system for system library) * Adjust hardcoded versions and installation paths (for bash, POSIX shell). @@ -76,11 +89,6 @@ USAGE exit 1 } -# Check that it appears to be an OpenFOAM installation -[ -f etc/bashrc -a -d etc/config.sh ] || \ - usage "Please run from top-level directory of installation" - - # Report error and exit die() { @@ -94,6 +102,12 @@ die() exit 1 } +# ----------------------------------------------------------------------------- + +# Check that it appears to be an OpenFOAM installation +[ -f etc/bashrc -a -d etc/config.sh ] || \ + usage "Please run from top-level directory of installation" + # Check if argument matches the expected input. Respects case. # Uses sed for consistency with the replacement routines. @@ -178,6 +192,8 @@ do # Discard empty arguments ;; +## Basic ## + -foamInstall | --foamInstall) # Replace FOAM_INST_DIR=... [ "$#" -ge 2 ] || die "'$1' option requires an argument" @@ -260,85 +276,61 @@ do adjusted=true ;; - -system) - # Replace WM_COMPILER_TYPE=... and WM_COMPILER=... - [ "$#" -ge 2 ] || die "'$1' option requires an argument" - replace etc/bashrc WM_COMPILER_TYPE system WM_COMPILER "$2" - adjusted=true - shift - ;; - -third | -ThirdParty) - # Replace WM_COMPILER_TYPE=... and WM_COMPILER=... - [ "$#" -ge 2 ] || die "'$1' option requires an argument" - replace etc/bashrc WM_COMPILER_TYPE ThirdParty WM_COMPILER "$2" - adjusted=true - shift - ;; +## Compiler ## - -boost) - # Replace boost_version=... + -clang) + # Replace clang_version=... [ "$#" -ge 2 ] || die "'$1' option requires an argument" - replace etc/config.sh/CGAL boost_version "$2" + replace etc/config.sh/compiler clang_version "$2" adjusted=true shift ;; - -boost-path) - # Replace BOOST_ARCH_PATH=... + -gcc) + # Replace gcc_version=... [ "$#" -ge 2 ] || die "'$1' option requires an argument" - replace etc/config.sh/CGAL BOOST_ARCH_PATH "$2" + replace etc/config.sh/compiler gcc_version "$2" adjusted=true shift ;; - -cgal) - # Replace cgal_version=... + -system) + # Replace WM_COMPILER_TYPE=... and WM_COMPILER=... [ "$#" -ge 2 ] || die "'$1' option requires an argument" - replace etc/config.sh/CGAL cgal_version "$2" + replace etc/bashrc WM_COMPILER_TYPE system WM_COMPILER "$2" adjusted=true shift ;; - -cgal-path) - # Replace CGAL_ARCH_PATH=... + -third | -ThirdParty) + # Replace WM_COMPILER_TYPE=... and WM_COMPILER=... [ "$#" -ge 2 ] || die "'$1' option requires an argument" - replace etc/config.sh/CGAL CGAL_ARCH_PATH "$2" + replace etc/bashrc WM_COMPILER_TYPE ThirdParty WM_COMPILER "$2" adjusted=true shift ;; - -fftw) - # Replace fftw_version=... - [ "$#" -ge 2 ] || die "'$1' option requires an argument" - replace etc/config.sh/FFTW fftw_version "$2" + gmp-[4-9]* | gmp-system) + # gcc-related package + replace etc/config.sh/compiler gmp_version "$1" adjusted=true - shift ;; - -fftw-path) - # Replace FFTW_ARCH_PATH=... - [ "$#" -ge 2 ] || die "'$1' option requires an argument" - replace etc/config.sh/FFTW FFTW_ARCH_PATH "$2" + mpfr-[2-9]* | mpfr-system) + # gcc-related package + replace etc/config.sh/compiler mpfr_version "$1" adjusted=true - shift ;; - -clang) - # Replace clang_version=... - [ "$#" -ge 2 ] || die "'$1' option requires an argument" - replace etc/config.sh/compiler clang_version "$2" + mpc-[0-9]* | mpc-system) + # gcc-related package + replace etc/config.sh/compiler mpc_version "$1" adjusted=true - shift ;; - -cmake) - # Replace cmake_version=... - [ "$#" -ge 2 ] || die "'$1' option requires an argument" - replace etc/config.sh/paraview cmake_version "$2" - adjusted=true - shift - ;; + +## MPI ## -mpi) # Explicitly set WM_MPLIB=... @@ -381,21 +373,61 @@ do adjusted=true ;; - -paraview | -paraviewVersion | --paraviewVersion) - # Replace ParaView_VERSION=... - expected="[5-9][.0-9]*" + +## Components ## + + -boost) + # Replace boost_version=... [ "$#" -ge 2 ] || die "'$1' option requires an argument" - _matches "$2" "$expected" || die "'$1' option has bad value: '$2'" + replace etc/config.sh/CGAL boost_version "$2" + adjusted=true + shift + ;; - replace etc/config.sh/paraview ParaView_VERSION "$2" + -boost-path) + # Replace BOOST_ARCH_PATH=... + [ "$#" -ge 2 ] || die "'$1' option requires an argument" + replace etc/config.sh/CGAL BOOST_ARCH_PATH "$2" adjusted=true shift ;; - -paraview-path | -paraviewInstall | --paraviewInstall) - # Replace ParaView_DIR=... + -cgal) + # Replace cgal_version=... [ "$#" -ge 2 ] || die "'$1' option requires an argument" - replace etc/config.sh/paraview ParaView_DIR "$2" + replace etc/config.sh/CGAL cgal_version "$2" + adjusted=true + shift + ;; + + -cgal-path) + # Replace CGAL_ARCH_PATH=... + [ "$#" -ge 2 ] || die "'$1' option requires an argument" + replace etc/config.sh/CGAL CGAL_ARCH_PATH "$2" + adjusted=true + shift + ;; + + -fftw) + # Replace fftw_version=... + [ "$#" -ge 2 ] || die "'$1' option requires an argument" + replace etc/config.sh/FFTW fftw_version "$2" + adjusted=true + shift + ;; + + -fftw-path) + # Replace FFTW_ARCH_PATH=... + [ "$#" -ge 2 ] || die "'$1' option requires an argument" + replace etc/config.sh/FFTW FFTW_ARCH_PATH "$2" + adjusted=true + shift + ;; + + -cmake) + # Replace cmake_version=... + [ "$#" -ge 2 ] || die "'$1' option requires an argument" + replace etc/config.sh/paraview cmake_version "$2" adjusted=true shift ;; @@ -448,6 +480,28 @@ do shift ;; + +## Graphics ## + + -paraview | -paraviewVersion | --paraviewVersion) + # Replace ParaView_VERSION=... + expected="[5-9][.0-9]*" + [ "$#" -ge 2 ] || die "'$1' option requires an argument" + _matches "$2" "$expected" || die "'$1' option has bad value: '$2'" + + replace etc/config.sh/paraview ParaView_VERSION "$2" + adjusted=true + shift + ;; + + -paraview-path | -paraviewInstall | --paraviewInstall) + # Replace ParaView_DIR=... + [ "$#" -ge 2 ] || die "'$1' option requires an argument" + replace etc/config.sh/paraview ParaView_DIR "$2" + adjusted=true + shift + ;; + -vtk) # Replace vtk_version=... [ "$#" -ge 2 ] || die "'$1' option requires an argument" @@ -464,23 +518,8 @@ do shift ;; - gmp-[4-9]* | gmp-system) - # gcc-related package - replace etc/config.sh/compiler gmp_version "$1" - adjusted=true - ;; - mpfr-[2-9]* | mpfr-system) - # gcc-related package - replace etc/config.sh/compiler mpfr_version "$1" - adjusted=true - ;; - - mpc-[0-9]* | mpc-system) - # gcc-related package - replace etc/config.sh/compiler mpc_version "$1" - adjusted=true - ;; +## Misc ## -sigfpe | -no-sigfpe) echo "Enable/disable FOAM_SIGFPE now via controlDict" 1>&2 diff --git a/etc/config.csh/settings b/etc/config.csh/settings index 85bbff458db..60359e3b239 100644 --- a/etc/config.csh/settings +++ b/etc/config.csh/settings @@ -231,7 +231,7 @@ case Arm*: # Arm system compilers endsw # Clear prior to sourcing -unset gcc_version gmp_version mpfr_version mpc_version +unset gcc_version gmp_version mpfr_version mpc_version clang_version unsetenv GMP_ARCH_PATH MPFR_ARCH_PATH # Load pre-defined compiler versions diff --git a/etc/config.sh/settings b/etc/config.sh/settings index c03bcdb2308..c8aafccdb29 100644 --- a/etc/config.sh/settings +++ b/etc/config.sh/settings @@ -228,7 +228,7 @@ Arm*) # Arm system compilers esac # Clear prior to sourcing -unset gcc_version gmp_version mpfr_version mpc_version +unset gcc_version gmp_version mpfr_version mpc_version clang_version unset GMP_ARCH_PATH MPFR_ARCH_PATH # Load pre-defined compiler versions -- GitLab