82 Commits

Author SHA1 Message Date
dc217245ff WIP: makeUMPIRE 2025-04-28 15:24:00 +02:00
cf83f194a8 CONFIG: update some versions 2025-03-27 10:05:19 +01:00
1ed1f6471b CONFIG: update versions
|       v2312       |       v2406       |   comment     |
|-------------------|-------------------|---------------|
| ADIOS2-2.9.2      | ADIOS2-2.10.1     | updates       |
| ParaView-v5.11.2  | ParaView-v5.12.1  | updates       |
2024-06-12 17:54:21 +02:00
7ff69fa1a7 CONFIG: update versions
|       v2306       |       v2312       |   comment     |
|-------------------|-------------------|---------------|
| ADIOS2-2.8.3      | ADIOS2-2.9.2      | updates       |
| ParaView-v5.11.1  | ParaView-v5.11.2  | bugfix        |
2023-12-20 15:45:47 +01:00
1fdacf14dd ENH: separate basic CMakeFunctions from ParaViewFunctions
- allows more reuse of functionality
2023-12-12 19:34:33 +01:00
678ec1c8d0 CONFIG: update versions
|       v2212       |       v2306       |   comment     |
|-------------------|-------------------|---------------|
| ParaView-v5.10.1  | ParaView-v5.11.1  | bugfix        |
| kahip-3.14        | kahip-3.15        | minor fixes   |
2023-06-16 16:30:49 +02:00
7c72929887 COMP: update patch file for scotch 7.1.0, update SOURCES info 2022-12-20 11:14:11 +01:00
365730e5b7 COMP: define FLEX, BISON for scotch Makefiles 2022-12-12 12:07:22 +01:00
d5589614f4 DOC: adjust requirements with information for paraview ffmpeg support
- adjust info about min cmake
2022-06-22 18:10:12 +02:00
c30d606f52 CONFIG: update versions
|       v2112       |       v2206       |   comment     |
|-------------------|-------------------|---------------|
| ParaView-v5.10.0  | ParaView-v5.10.1  | bugfix        |
2022-06-09 16:50:27 +02:00
ad69b472e6 BUG: makeCGAL with specified version installs into the wrong directory
- was applied precision-specific information:
    * instead of linux64Gcc [correct]
    * was using  linux64GccInt32 [wrong]

  This problem does not the regular use where CGAL is defined from
  etc/config.sh/CGAL since the CGAL_ARCH_PATH specified there was properly
  respected.
2022-04-08 09:43:02 +02:00
525f3f4e67 COMP: use 'address-model=64' for boost mingw cross-compile
- a name clash since it tries to build both 32/64 bit versions

https://stackoverflow.com/questions/28398390/boost-build-breaks-name-clash-for-pstage-liblibboost-system-so-1-58-0
2021-12-16 15:23:23 +01:00
43606b62df CONFIG: update versions
|       v2106       |       v2112       |   comment     |
|-------------------|-------------------|---------------|
| ADIOS2-2.6.0      | ADIOS2-2.7.1      | latest        |
| CGAL-4.12.2       | CGAL-4.14.3       | latest without c++14 requirement |
| ParaView-v5.9.1   | ParaView-v5.10.0  | final or RC2  |
| boost_1_66_0      | boost_1_74_0      | gcc-4.8.5 problems with 1_77_0 |
| fftw-3.3.7        | fftw-3.3.10       | bugfix        |
| openmpi-4.0.3     | openmpi-4.1.2     | latest        |
| scotch_6.1.0      | scotch_6.1.0      | dgraph regression in 6.1.2 |
| kahip-2.12        | kahip-3.14        | latest        |
2021-12-15 17:26:08 +01:00
1054dd83cf CONFIG: adjust boost toolset for intel compiler (#62)
- improve handling of different gcc/clang versions

- support -toolset=none to bypass all internal logic and let boost do
  everything.
2021-12-09 17:39:20 +01:00
0d0f439dde ENH: reproducible build naming for openmpi
- configure with the arch + package only for the prefix.
  When OPAL_PREFIX is unset, yields this type of information:

      Prefix: /linux64Gcc/openmpi-4.0.3
      Libdir: /linux64Gcc/openmpi-4.0.3/lib

  This ensures that the final binaries do not have the original build
  location, which makes for more reliable testing before shipping.

ENH: improve handling of header-only CGAL

- test for existence now also checks our cached build information
  for header-only configuration

- cleanup build artifacts from boost (in-source build).
  Skip install of generated man, info, doc pages.
  These are usually browsed/searched elsewhere anyhow.
2021-12-09 16:30:28 +01:00
325e3e230d ENH: improve flexibility of make scripts
- the various make scripts now also search hierarchical sources,
  which makes it easier to organize sources. The secondary
  sub-directory is the lower-case value of the package stripped of
  trailing non-alphabet characters.

  For example, searching for ParaView-v5.9.1

    sources/
    |-- adios
    |   |-- ...
    |   |-- ADIOS2-2.7.1
    |   \-- adios-1.13.1
    |-- cgal
    |   |-- CGAL-4.12.2
    |   \-- CGAL-4.14.2
    |   ...
    |-- openmpi
    |   |-- openmpi-4.0.3
    |   \-- openmpi-4.1.1
    |-- paraview
    |   |-- ParaView-v5.6.1
    |   \-- ParaView-v5.9.1
    \-- scotch
        ...

- additional out-of-source build options

  FOAM_THIRD_PARTY_BUILDROOT :
     Replace WM_THIRD_PARTY_DIR as the root for build/ and platforms/

  FOAM_THIRD_PARTY_SOURCES :
     Alternative to WM_THIRD_PARTY_DIR/sources/

- rationalise internal package variable names for easier maintenance
2021-12-09 16:30:28 +01:00
f1fe6c9866 ENH: explictly set scotch INTSIZE. Tag scotch libs with -intNN ending
- Use WM_LABEL_SIZE to explicitly define INTSIZE32 or INTSIZE64, which
  ensures that SCOTCH_Num appears as (int32_t | int64_t) and avoids
  any ambiguity that a plain 'int' may have.

- Provide library symlinks to the respective label-size.
  Eg,  libscotch.so -> libscotch-int32.so

  This provides a unique library linkage name that avoids ambiguity
  with system-installed libraries.

- Use IDXSIZE64 (memory addressing width Fortran)

NOTE
  Unfortunately -DINT32 seems to fail if openmpi was built without Fortran!
  The MPI_INT32_T is interpreted as MPI_INTEGER4 which does not exist
  - needs more investigation

ENH: scotch - document Makefile.inc by copying into the source directory

ENH: update kahip build to use cmake for newer versions
2021-12-09 16:30:28 +01:00
1f6835794f ENH: add etc/tools support for hierarchically named sources 2021-12-09 16:30:28 +01:00
665437cf8c ENH: support explicit int-32/64 for metis, scotch
- simplifies creation of 64bit indexed libraries, for reuse
  (with widening) by various OpenFOAM label sizes

- add -bin/-no-bin for metis (as per scotch)
2021-09-02 10:38:07 +02:00
cd853a6270 DOC: update requirements and version information 2021-06-07 13:12:30 +02:00
2beb3cfbc9 CONFIG: respect existing value for WM_NUMCOMPPROCS (#59)
- avoids flooding a head-node during compilation.
2021-03-23 11:38:44 +01:00
c8542bd70d CONFIG: update MESA build script for meson
- also add LLVM_ARCH_PATH/bin into PATH (for finding llvm-config)
2021-03-23 11:38:13 +01:00
f84990e906 CONFIG: avoid deprecated CMake variables (ParaView)
- use MPI_ARCH_PATH to provide an MPI hint when making ParaView, VTK
  and ADIOS.

  This should align the detected MPI with what OpenFOAM itself is
  using.  Option -mpi-home to override.
2021-02-16 14:26:51 +01:00
ddfdec4cd9 CONFIG: update adios and petsc version information 2020-12-14 15:19:35 +01:00
834efe6dda COMP: handle forced use of gcc/g++ for wmake components
- does not change WM_OPTIONS or output directories, so that the target
  directories are correct.
2020-11-16 08:29:39 +01:00
69cff3b3d3 CONFIG: add detection of newer libadios2 libs
- prevent unneeded recompilation

DOC: add link for new scotch package
2020-11-04 20:45:06 +01:00
c3aa2a4bfe CONFIG: remove redundant petsc configure options, add '-debug' option 2020-09-11 13:35:27 +02:00
9a3938551a ENH: build petsc with debugging off (fixes #58)
- also permit petsc to determine its own hypre version (#58)
2020-09-07 15:56:42 +02:00
28f482b836 CONFIG: skip compilation of ADIOS2, METIS with mingw (#57)
- adios is out of scope for cross-compilation

- metis does not seem to support cross-compilation.
  Use scotch instead.
2020-08-12 16:45:17 +02:00
53a1736aad BUG: boost user-config.jam written into incorrect directory
- mistake introduced by 11e3723f10
2020-08-12 16:41:54 +02:00
f197c721c8 ENH: mingw cross-compile for FFTW (issue #57) 2020-08-11 16:21:26 +02:00
11e3723f10 ENH: improve test for existing libraries (fixes #56)
- check lib as well as lib64

- support -force option in a few more places
2020-08-10 15:10:31 +02:00
9a8a4852bc CONFIG: remove libz dependency for scotch (issue #55)
- reduces ThirdParty inter-dependency.
  Only useful for reading in graph files, which are not used
  internally by OpenFOAM.

- Was already removed for Mingw compilation.
2020-08-07 13:49:58 +02:00
507c01e485 CONFIG: add mpicc/mpicxx handling for Fujitsu MPI (issue #54)
- uses mpifcc/mpiFCC for mpicc/mpicxx, respectively
2020-08-07 13:49:45 +02:00
bdd4266e2f ENH: delay testing of FOAM_EXT_LIBBIN
- only test in the packages that actually require it.
  State as a requirement.

ENH: skip build of packages with known mingw issues

- primarily kahip and pt-scotch.
  Others may also have issues, but for these we tend to use system
  packages anyhow.

ENH: add '-force' option to various scripts

- overrides some _lazy_ build logic
2020-06-24 14:32:26 +02:00
36f89097d8 STYLE: fix typo in PETSc help, add download info for HYPRE 2020-06-22 12:25:09 +02:00
78819144d3 DOC: add hint about scotch gitlab repo and paraview requirements (#52)
- add download hints for -help of various make scripts
2020-06-19 00:38:03 +02:00
348b8cd4f4 CONFIG: support inplace petsc installations 2020-06-19 00:38:03 +02:00
b9ace75da8 DOC: update download links 2020-06-15 21:18:59 +02:00
aa2523ee63 DOC: update BUILD and SOURCES information 2020-06-15 20:41:05 +02:00
6e03e1ecb4 CONFIG: simplify version range
- accept [0-9]* instead of attempting more restrictive specifications

CONFIG: makePETSC without fortran
2020-06-15 20:30:22 +02:00
7958c7e4c1 BUG: shell syntax error in makePETSC 2020-06-05 15:02:17 +02:00
67093bfb2f CONFIG: add -with-lib options for makeCGAL
- if not otherwise specified:
  - OpenFOAM-v1912 and older are implicitly `-with-lib`
  - new versions are implicitly `-no-lib`
2020-06-05 14:06:39 +02:00
9de516d315 CONFIG: incremental improvement for scotch + mingw
- linkage errors for ptscotch not yet solved

CONFIG: add -I. for ThirdParty wmake Make/options

- some <headers> might otherwise be missed with the change to
  '-iquote' for general wmake rules
2020-05-14 16:16:40 +02:00
69de80cd08 ENH: use OpenFOAM etc/config.sh/cmake (if it exists) for finding cmake 2020-05-02 21:09:21 +02:00
60d3922681 ENH: support build of scotch executables
- improve library checks to avoid unnecessary rebuild when
  cross-compiling
2020-04-15 20:33:22 +02:00
a4ba6b72f5 CONFIG: support updated location of wmkdepend binaries
- initialise some commonly used variables

- add library function for checking library existence that also
  accounts for windows cross-compilation targets
2020-04-15 20:32:39 +02:00
0c7c86faa6 COMP: skip build of ADIOS2 examples
- may fail to find mpi.h with ThirdParty openmpi

- remove makeAdios1 (ADIOS1 considered defunct for our purposes)
2020-01-20 14:50:49 +01:00
cd811d9b28 BUG: shell quoting needed for dash (fixes #48)
- arguments passed to stripCompilerFlags caused the misbehaviour
2020-01-20 14:50:29 +01:00
03f529f3bd DOC: update list of software versions 2019-12-17 07:53:39 +01:00
cb75d01584 ENH: improve toolset naming
- if passed things like "clang-9", strip down to the base name "clang"
2019-12-15 13:54:12 +01:00
baae61e0ec DOC: update internal repo links 2019-12-09 13:15:26 +01:00
714cddd6ca DOC: update links and replicate patches for scotch 2019-11-20 12:32:05 +01:00
c8a7f46db2 STYLE: regularize quoting and exit on failed 'cd' 2019-11-19 16:17:01 +01:00
e51f92f2f1 COMP: add error code to makeAdios2 to cascade error information to caller 2019-11-12 16:51:02 +01:00
a0d0ee36af DOC: add note about LIBGL_DEBUG env variable 2019-11-11 11:53:51 +01:00
074481b2f0 CONFIG: updates for kahip and scotch 2019-10-28 12:56:09 +01:00
a856a5fcad STYLE: remove unused branch in makeAdios2 2019-10-28 11:51:29 +01:00
c41b591b30 COMP: adjust makeParaView for paraview-5.7.0 (uses python3) 2019-10-02 17:16:20 +02:00
a9f5058557 ENH: more forgiving if scotch is missing, provide download hints (#45)
- include makeAdios2 into the Allwmake list (as optional component)
2019-08-16 15:50:08 +02:00
54d6b7994d CONFIG: harmonize makeAdios1, makeAdios2 files
- remove old dependency of adios2 on the adios1 library
2019-07-31 16:16:10 +02:00
17a443a557 BUG: export minimal compiler flags for VTK, ParaView (fixes #44)
- in 1906, we changed the handling of compiler flags to include the
  exact values as used by OpenFOAM.

  While this is needed for compiling some external programs -- see
  https://develop.openfoam.com/Development/OpenFOAM-plus/issues/1256
  for the discussion -- it appears to bring in flags that upset
  some of the ParaView (and possibly VTK) compilation.

  The culprits are likely to be found in the various '-W' switches,
  but for now we simply extract a mininal set of compiler flags
  that include -std=c++11 -m64 -fPIC, but no optimization flags,
  additional warnings flags or OpenFOAM-specific defines.
2019-07-29 13:55:04 +02:00
b987703b3c STYLE: minor update for README, BUILD information 2019-06-28 09:31:25 +02:00
325f848dc1 CONFIG: makeGcc with -m32/-m64 option instead of old WM_ARCH_OPTION 2019-06-27 18:43:10 +02:00
4c4a11755a DOC: relocated OpenFOAM etc/README.md to doc/Config.md 2019-06-13 18:42:18 +02:00
3c852a8929 DOC: fix links 2019-06-09 19:09:46 +02:00
867d96ec54 DOC: update docs, add initial Requirements information 2019-06-07 13:31:19 +02:00
16b59832cc CONFIG: add comment for compile flags in makeMesa
- add links for newest khaip, scotch (untested)
2019-06-06 23:27:08 +02:00
ddd4176269 ENH: additional tweaks for building boost. Eg armclang 2019-04-29 21:26:31 +02:00
ae5b2326c0 ENH: provide separate makeSCOTCH script for independent use
- improve handling of scotch build toolchain

- relax the test for existence of libscotcherrexit, which can also be
  incorporated into libscotch itself
2019-04-29 18:51:05 +02:00
bbbc7b2953 COMP: force PROJECT_LIBS to be empty
- additional safety when using wmake to generate .so or exe files.
  These third-party libraries must not themselves have a link
  dependency on OpenFOAM.
2019-04-27 17:48:22 +02:00
5ac0e3624f STYLE: trim trailing slash from tested directories 2019-04-25 11:44:53 +02:00
a7c2a4bfb9 STYLE: use EXT_SO instead of SO for consistency with wmake internal naming 2019-04-25 10:46:45 +02:00
c6e6c0abbf COMP: add Makefile patches for scotch_6.0.6
- bypasses generation of executables
2019-04-25 10:46:45 +02:00
fbbb275862 COMP: make libscotch/libptscotch targets instead of scotch/ptscotch
- we do not generally need any of executables, just the libraries.
  This also avoids generating a libscotchmetis too.
2019-04-25 10:46:45 +02:00
770e22bf51 ENH: update handling of compiler and flags
- support use of wmake -show-xyz, as well as older WM_CC, WM_CFLAGS etc.

- add support for Makefile.inc for scotch

- add -toolset= option for making boost and use b2 instead of legacy
  bjam for configuration
2019-04-25 10:46:44 +02:00
830e92194a BOT: reformat headers 2019-04-12 08:54:50 +02:00
8df5d377e7 STYLE: update some examples for mesa-18.3.4
- still needs more testing to determine the best combination of versions
2019-03-11 11:54:02 +01:00
aa9fc0efd2 CONFIG: update makeMPICH and makeMVAPICH
- note: mpich now builds libmpi.so instead of libmpich.so
2019-02-14 18:11:33 +01:00
f968a67362 CONFIG: update link for openmpi 2019-01-21 14:18:15 +01:00
c8135cc48e CONFIG: update download links for adios + kahip 2019-01-21 10:24:41 +01:00
adfe28332e CONFIG: additional llvm configuration for mesa build (#41) 2019-01-21 10:24:15 +01:00
65 changed files with 6827 additions and 2863 deletions

10
.gitignore vendored
View File

@ -12,9 +12,13 @@
*.tgz *.tgz
*.gtgz *.gtgz
# Ignore build and platforms folders # Ignore standard input/output folders
build/ /build/
platforms/ /download/
/opt/
/platforms/
/sources/
/unpack/
# Generated files in the main directory # Generated files in the main directory
/*.html /*.html

266
Allclean
View File

@ -3,12 +3,14 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# Allclean # Allclean
@ -20,89 +22,179 @@
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only # Run from third-party directory only
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { cd "${0%/*}" || exit
wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
echo " Check your OpenFOAM environment and installation" echo " Check your OpenFOAM environment and installation"
exit 1 exit 1
} }
# . etc/tools/ThirdPartyFunctions . "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printHelp() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
Usage: ${0##*/} [OPTION] [<platform> [ ... <platformN> ]] Usage: ${0##*/} [OPTION]
options: options:
-all remove all platforms directories. -build Remove all 'build' directories
-current clean the current platform ($WM_OPTIONS). -current Clean the current platform ($WM_OPTIONS)
-help print the usage -platform=NAME Clean the named platform
-src | -sources Clean sources (eg, with make distclean)
-full Same as -build -src -current
-n | -dry-run Do not perform actions
-help Display usage help
Cleanup intermediate build directories. Cleanup intermediate build directories.
Optionally remove specified platform(s) from the ThirdParty platforms Optionally remove specified platform(s) from the ThirdParty platforms
directory $WM_THIRD_PARTY_DIR/platforms directory \$WM_THIRD_PARTY_DIR/platforms
USAGE USAGE
exit 1 exit 0 # Clean exit
} }
# Print help message #------------------------------------------------------------------------------
if [ "$1" = "-h" -o "$1" = "-help" ] unset optDryRun optCleanType optPlatformName
then
usage # Parse options
fi while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
--) shift; break;; # End option processing
(-h | -help*) printHelp ;;
(-n | -dry-run) optDryRun="(dry-run) " ;;
(-build)
optCleanType="${optCleanType}:build"
;;
(-src | -source*)
optCleanType="${optCleanType}:sources"
;;
(-full)
optCleanType="full"
;;
(-current)
optCleanType="${optCleanType}:current"
;;
(-platform=*)
optCleanType="${optCleanType}:platform"
optPlatformName="${1#*=}"
;;
*) echo "Ignore unknown option/argument" 1>&2 ;;
esac
shift
done
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
[ -n "$optCleanType" ] || die "No clean operation specified"
# Clean various packages via 'distclean' # sources
for i in \ case "$optCleanType" in (*full* | *source*)
openmpi-* metis-* adios-* ADIOS-* gperftools-* qt-* \
gmp-* mpfr-* mpc-* gcc-* llvm-* \ # Clean various packages via 'distclean'
; for dir in \
do $(etc/list-available -dirs \
[ -d "$i" ] && ( gcc \
echo gmp \
echo "${i%/*}" gperftools \
echo " make distclean" llvm \
echo metis \
cd $i && make distclean mpc \
mpfr \
openmpi \
qt \
) )
done do
if [ -n "$optDryRun" ]
then
echo "$dir : ${optDryRun}make distclean"
elif [ -d "$dir" ]
then
(
cd "$dir" 2>/dev/null || exit
echo
echo "$dir : make distclean"
echo
make distclean || true
)
fi
done
# Clean scotch (src) with 'realclean'
for dir in $(etc/list-available -dirs scotch)
do
dir="$dir/src" # Within the src directory!
# Clean various packages via 'realclean' if [ -n "$optDryRun" ]
for i in scotch*/src then
do echo "$dir : ${optDryRun}make realclean"
[ -d "$i" ] && ( elif [ -d "$dir" ]
then
(
cd "$dir" 2>/dev/null || exit
echo
echo "$dir : make realclean"
echo
make realclean || true
)
fi
done
# Clean various packages via 'wclean'
for dir in $(etc/list-available -dirs ccmio libccmio)
do
if [ -n "$optDryRun" ]
then
echo "$dir : ${optDryRun}wclean"
elif [ -f "$dir/Make/files" ]
then
(
cd "$dir" 2>/dev/null || exit
echo
echo "${dir}: wclean"
echo
wclean || true
)
fi
done
# Clean various packages via 'wclean'
for dir in $(etc/list-available -dirs kahip)
do
dir="$dir/lib"
if [ -n "$optDryRun" ]
then
echo "$dir : ${optDryRun}wclean"
elif [ -f "$dir/Make/files" ]
then
(
cd "$dir" 2>/dev/null || exit
echo
echo "${dir}: wclean"
echo
wclean || true
)
fi
done
esac
# -----------------------------------------------------------------------------
# build
case "$optCleanType" in (*full* | *build*)
# Clean out-of-source build directories
if [ -d build ]
then
echo echo
echo "${i%/*}" echo "${optDryRun}Remove build/ directory contents"
echo " make realclean" [ -z "$optDryRun" ] && rm -rf build/*
echo fi
cd $i && make realclean esac
)
done
# Clean various packages via 'wclean'
for i in libccmio*/Make kahip*/lib/Make
do
[ -d "$i" ] && (
echo
echo "${i%/Make}"
echo " wclean"
echo
cd ${i%/Make} && wclean
)
done
# Clean out-of-source build directories
if [ -d build ]
then
echo
echo "Clean build/ directory"
rm -rf build/*
fi
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# #
@ -111,45 +203,31 @@ fi
removePlatform() removePlatform()
{ {
local platform="$1" local platform="$1"
if [ -n "$platform" -a -d "platforms/$platform" ] if [ -n "$platform" ] && [ -d "platforms/$platform" ]
then then
echo echo
echo "Cleaning platform '$platform'" echo "${optDryRun}Cleaning platform '$platform'"
\rm -rf "platforms/$platform" [ -z "$optDryRun" ] && "platforms/$platform"
else else
echo echo
echo "Platform '$platform' not built" echo "${optDryRun}Platform '$platform' not built"
fi fi
} }
if [ "$#" -ge 1 ]
then
echo
echo "Clean platforms/sub-directories"
fi
# Optionally cleanup platforms specified from the arguments # -----------------------------------------------------------------------------
while [ "$#" -ge 1 ]
do
case "$1" in
-all)
echo
echo "Removing all platforms/sub-directories"
echo
\rm -rf platforms/*
break
;;
-current) # current platform
echo "Current platform '$WM_OPTIONS'" case "$optCleanType" in (*full* | *current*)
removePlatform "$WM_OPTIONS" echo "${optDryRun}Remove current platform: '$WM_OPTIONS'"
;; removePlatform "$WM_OPTIONS"
esac
*)
removePlatform "$1" # named platform
;; case "$optCleanType" in (*platform*)
esac echo "${optDryRun}Remove platform: '$optPlatformName'"
shift removePlatform "$optPlatformName"
done esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

251
Allwmake
View File

@ -3,15 +3,17 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2023 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# Allwmake # ThirdParty Allwmake
# #
# Description # Description
# Build script for ThirdParty applications/libraries # Build script for ThirdParty applications/libraries
@ -19,228 +21,47 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Dynamic library endings (default is .so)
[ "$(uname -s)" = Darwin ] && SO=dylib || SO=so
# Run from third-party directory only # Run from third-party directory only
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { cd "${0%/*}" || exit
wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
echo " Check your OpenFOAM environment and installation" echo " Check your OpenFOAM environment and installation"
exit 1 exit 1
} }
[ -n "$FOAM_EXT_LIBBIN" ] || { . "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
echo "Error (${0##*/}) : \$FOAM_EXT_LIBBIN not set for ThirdParty"
echo " Check your OpenFOAM environment and installation"
exit 1
}
. etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler true # Compiler info + flags for CMake/configure exportCompiler true # Compiler info + flags for CMake/configure
exportLinker # Linker flags for CMake/configure exportLinker # Linker flags for CMake/configure
useGccFlag $@ # Scan arguments for a '-gcc' option useGccFlag $@ # Scan arguments for a '-gcc' option
warnBuildIssues()
{
echo
echo " ---------------------------------------------------"
echo " Optional component ($1) had build issues"
echo " OpenFOAM will nonetheless remain largely functional"
echo " ---------------------------------------------------"
echo
}
warnNotFound()
{
echo "Optional component ($1) was not found"
}
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
echo echo
echo ======================================== echo ========================================
echo Start ThirdParty Allwmake echo Start ThirdParty Allwmake
echo ======================================== echo ========================================
echo "using: $CC $CFLAGS"
echo "using: $CXX $CXXFLAGS"
echo echo
echo ======================================== echo ========================================
echo Build MPI libraries if required echo Build MPI libraries if required
echo " $MPI_ARCH_PATH" echo " $MPI_ARCH_PATH"
case "$WM_MPLIB" in case "$WM_MPLIB" in
(OPENMPI | MPICH) (OPENMPI | MPICH)
./make$WM_MPLIB -test "$MPI_ARCH_PATH" || ./make$WM_MPLIB if ! ./make"$WM_MPLIB" -test "$MPI_ARCH_PATH"
then
./make"$WM_MPLIB"
fi
;; ;;
esac esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Building scotch on different platforms is still a bit of a pain
# Get SCOTCH_VERSION, SCOTCH_ARCH_PATH
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch)
then
. $settings
else
echo
echo "Error: no config.sh/scotch settings"
echo
fi
echo
echo ========================================
echo "Scotch decomposition ($SCOTCH_VERSION)"
echo " $SCOTCH_ARCH_PATH"
SCOTCH_SOURCE_DIR=$sourceBASE/$SCOTCH_VERSION
# Needs generalizing, but works fairly well
scotchMakefile=etc/makeFiles/scotch/Makefile.inc.OpenFOAM-"$(uname -s)".shlib
[ -f $scotchMakefile ] || \
scotchMakefile=${scotchMakefile%/*}/Makefile.inc.OpenFOAM-Linux.shlib
if [ -f $SCOTCH_ARCH_PATH/include/scotch.h \
-a -r $FOAM_EXT_LIBBIN/libscotch.$SO \
-a -r $FOAM_EXT_LIBBIN/libscotcherrexit.$SO ]
then
echo " scotch include: $SCOTCH_ARCH_PATH/include"
echo " scotch library: $FOAM_EXT_LIBBIN"
elif [ -d "$SCOTCH_SOURCE_DIR" ]
then
(
# Older versions ok, but scotch-6.0.5a cannot build in parallel.
# Force serial build
export WM_NCOMPPROCS=1
echo "*** building scotch in serial ***"
echo
cd $SCOTCH_SOURCE_DIR/src || exit 1
export GIT_DIR=$SCOTCH_SOURCE_DIR/.git # Mask seeing our own git-repo
rm -rf $SCOTCH_ARCH_PATH
applyPatch $SCOTCH_VERSION .. # patch at parent-level
prefixDIR=$SCOTCH_ARCH_PATH
incDIR=$SCOTCH_ARCH_PATH/include
libDIR=$FOAM_EXT_LIBBIN
mkdir -p $prefixDIR 2>/dev/null
mkdir -p $incDIR 2>/dev/null
mkdir -p $libDIR 2>/dev/null
# Makefile relative to this directory
scotchMakefile=../../$scotchMakefile
if [ -f $scotchMakefile ]
then
rm -f Makefile.inc
ln -s $scotchMakefile Makefile.inc
fi
[ -f Makefile.inc ] || {
echo " Error: scotch needs an appropriate Makefile.inc"
exit 1
}
export CCS="${CC:-$WM_CC}" # CCS (serial compiler) default=$(CC)
export CCP=$(whichMpicc) # CCP (parallel compiler) default=mpicc
# Consistency for Intel-MPI and non-icc compilers
[ -n "$I_MPI_CC" ] || export I_MPI_CC="${CC:-$WM_CC}"
make realclean 2>/dev/null # Extra safety
make -j $WM_NCOMPPROCS scotch \
&& make \
prefix=$prefixDIR \
includedir=$incDIR \
libdir=$libDIR \
install
make realclean 2>/dev/null || true # Failed cleanup is uncritical
) || warnBuildIssues SCOTCH
else
warnNotFound SCOTCH
fi
# Build ptscotch if MPI (ThirdParty or system) is available
# and normal scotch was built (has include and library)
if [ "${FOAM_MPI:-dummy}" != dummy ] && \
[ -f $SCOTCH_ARCH_PATH/include/scotch.h \
-a -r $FOAM_EXT_LIBBIN/libscotch.$SO ] || \
{
# Report that the above tests failed and pass-through the failure
echo
echo " WARNING: skipping pt-scotch - no mpi or <scotch.h> not found"
false
}
then
echo
echo ========================================
echo "pt-scotch decomposition ($SCOTCH_VERSION with $FOAM_MPI)"
echo " $SCOTCH_ARCH_PATH"
if [ -f $SCOTCH_ARCH_PATH/include/$FOAM_MPI/ptscotch.h \
-a -r $FOAM_EXT_LIBBIN/$FOAM_MPI/libptscotch.$SO \
-a -r $FOAM_EXT_LIBBIN/$FOAM_MPI/libptscotcherrexit.$SO ]
then
echo " ptscotch include: $SCOTCH_ARCH_PATH/include/$FOAM_MPI"
echo " ptscotch library: $FOAM_EXT_LIBBIN/$FOAM_MPI"
else
(
# Older versions ok, but scotch-6.0.5a cannot build in parallel.
# Force serial build
export WM_NCOMPPROCS=1
echo "*** building pt-scotch in serial ***"
cd $SCOTCH_SOURCE_DIR/src || exit 1
export GIT_DIR=$SCOTCH_SOURCE_DIR/.git # Mask seeing our own git-repo
echo
prefixDIR=$SCOTCH_ARCH_PATH
incDIR=$SCOTCH_ARCH_PATH/include/$FOAM_MPI
libDIR=$FOAM_EXT_LIBBIN/$FOAM_MPI
mkdir -p $prefixDIR 2>/dev/null
mkdir -p $incDIR 2>/dev/null
mkdir -p $libDIR 2>/dev/null
if [ -f $scotchMakefile ]
then
rm -f Makefile.inc
ln -s $scotchMakefile Makefile.inc
fi
[ -f Makefile.inc ] || {
echo " Error: ptscotch needs an appropriate Makefile.inc"
exit 1
}
export CCS="${CC:-$WM_CC}" # CCS (serial compiler) default=$(CC)
export CCP=$(whichMpicc) # CCP (parallel compiler) default=mpicc
# Consistency for Intel-MPI and non-icc compilers
[ -n "$I_MPI_CC" ] || export I_MPI_CC="${CC:-$WM_CC}"
make realclean 2>/dev/null # Extra safety
make -j $WM_NCOMPPROCS ptscotch \
&& make \
prefix=$prefixDIR \
includedir=$incDIR \
libdir=$libDIR \
install
make realclean 2>/dev/null || true # Failed cleanup is uncritical
) || warnBuildIssues PTSCOTCH
fi
# Verify existence of ptscotch include
[ -f $SCOTCH_ARCH_PATH/include/$FOAM_MPI/ptscotch.h ] || {
echo
echo " WARNING: required include file 'ptscotch.h' not found!"
}
fi
# Could now remove $SCOTCH_SOURCE_DIR/src/Makefile.inc
# Treat as optional, but really isn't if anyone wants parallel calculations
./makeSCOTCH || warnBuildIssues SCOTCH
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
echo echo
echo ======================================== echo ========================================
# Get KAHIP_ARCH_PATH # Get KAHIP_ARCH_PATH
@ -250,17 +71,16 @@ then
fi fi
if [ -n "$KAHIP_ARCH_PATH" ] if [ -n "$KAHIP_ARCH_PATH" ]
then then
echo KaHIP decomposition echo KAHIP decomposition
./makeKAHIP -test "$KAHIP_ARCH_PATH" || \ ./makeKAHIP -test "$KAHIP_ARCH_PATH" || \
./makeKAHIP || warnBuildIssues KAHIP ./makeKAHIP || warnBuildIssues KAHIP
else else
warnNotFound KAHIP # METIS is optional warnNotFound KAHIP # is optional
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
echo echo
echo ======================================== echo ========================================
# Get METIS_ARCH_PATH # Get METIS_ARCH_PATH
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/metis) if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/metis)
then then
@ -268,11 +88,11 @@ then
fi fi
if [ -n "$METIS_ARCH_PATH" ] if [ -n "$METIS_ARCH_PATH" ]
then then
echo Metis decomposition echo METIS decomposition
./makeMETIS -test "$METIS_ARCH_PATH" || \ ./makeMETIS -test "$METIS_ARCH_PATH" || \
./makeMETIS || warnBuildIssues METIS ./makeMETIS || warnBuildIssues METIS
else else
warnNotFound METIS # METIS is optional warnNotFound METIS # is optional
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -280,13 +100,14 @@ echo
echo ======================================== echo ========================================
if [ -n "$CGAL_ARCH_PATH" ] if [ -n "$CGAL_ARCH_PATH" ]
then then
echo "CGAL/boost" echo "cgal/boost"
./makeCGAL -test "$CGAL_ARCH_PATH" "$BOOST_ARCH_PATH" || \ ./makeCGAL -test "$CGAL_ARCH_PATH" "$BOOST_ARCH_PATH" || \
./makeCGAL || warnBuildIssues CGAL ./makeCGAL || warnBuildIssues CGAL
else else
warnNotFound CGAL # CGAL is optional warnNotFound CGAL # is optional
fi fi
#------------------------------------------------------------------------------
echo echo
echo ======================================== echo ========================================
if [ -n "$FFTW_ARCH_PATH" ] if [ -n "$FFTW_ARCH_PATH" ]
@ -295,9 +116,29 @@ then
./makeFFTW -test "$FFTW_ARCH_PATH" || \ ./makeFFTW -test "$FFTW_ARCH_PATH" || \
./makeFFTW || warnBuildIssues FFTW ./makeFFTW || warnBuildIssues FFTW
else else
warnNotFound FFTW # FFTW is optional warnNotFound FFTW # is optional
fi fi
#------------------------------------------------------------------------------
echo
echo ========================================
# Get ADIOS2_ARCH_PATH
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/adios2)
then
. $settings
fi
if [ -n "$ADIOS2_ARCH_PATH" ]
then
echo ADIOS2
./makeAdios2 -test "$ADIOS2_ARCH_PATH" || \
./makeAdios2 || warnBuildIssues ADIOS2
else
warnNotFound ADIOS2 # is optional
fi
#------------------------------------------------------------------------------
echo echo
echo ======================================== echo ========================================
echo Done ThirdParty Allwmake echo Done ThirdParty Allwmake

352
BUILD.md
View File

@ -1,24 +1,12 @@
<!--
|--------------------------------------------------------------------------|
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | |
| \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. |
| \\/ M anipulation | |
|--------------------------------------------------------------------------|
-->
---
# OpenFOAM&reg; ThirdParty Build # OpenFOAM&reg; ThirdParty Build
OpenFOAM depends to a certain extent on third-party libraries OpenFOAM depends to a certain extent on third-party libraries
(*opensource only*). It also provides some interfaces to *opensource* or (*opensource only*). It also provides some interfaces to *opensource* or
*proprietary* libraries. This third-party package contains configurations and *proprietary* libraries. This third-party collection contains configurations and
scripts for building third-party packages. It should normally only be used in scripts for building third-party packages. It will normally only be used in
conjunction with the corresponding OpenFOAM version. conjunction with the corresponding OpenFOAM version.
## Organization ## Directory Organization
The ThirdParty directory contains a number of build scripts as well as The ThirdParty directory contains a number of build scripts as well as
some directories: some directories:
@ -38,40 +26,45 @@ This approach avoids duplicate entries for the default versions and
ensures the best overall consistency between the OpenFOAM installation ensures the best overall consistency between the OpenFOAM installation
and its corresponding third-party installation. and its corresponding third-party installation.
Nonethess, the distributed make scripts can generally be used for a Nonetheless, the distributed make scripts can generally be used for a
variety of versions of the third-party libraries, with the software variety of versions of the third-party libraries, with the software
version specified on the command-line. For example, version specified on the command-line. For example,
```
$ ./makeFFTW -help $ ./makeFFTW -help
usage: makeFFTW [OPTION] [fftw-VERSION] Usage: makeFFTW [OPTION] [fftw-VERSION]
```
--- ---
## Before Starting ## Before Starting
0. Review the [system requirements](http://www.openfoam.com/documentation/system-requirements.php) 0. Review the [system requirements][link openfoam-require]
and decide on the following: and decide on the following:
* compiler type/version - if the system compiler is not relatively recent, - compiler type/version - if the system compiler is not relatively recent,
you will need a [third-party compiler](#makeGcc) installation. you will need a [third-party compiler](#makeGcc) installation.
* MPI type/version. - MPI type/version.
* ParaView type/version. - ParaView type/version.
* CMake type/version, ... - CMake type/version, ...
1. If you are using a system MPI (eg, openmpi), ensure that this environment 1. If you are using a system MPI (eg, openmpi), ensure that this environment
has also been properly activated for your user. has also been properly activated for your user.
Often (but not always) a `mpi-selector` command is available for this purpose. Often (but not always) a `mpi-selector` command is available for this purpose.
You may need to open a new shell afterwards for the change to take effect. You may need to open a new shell afterwards for the change to take effect.
Using the following command may help diagnosing things: Using the following command may help diagnosing things:
```
which mpicc which mpicc
```
2. Adjust the OpenFOAM `etc/bashrc`, `etc/config.sh/...` or equivalent 2. Adjust the OpenFOAM `etc/bashrc`, `etc/config.sh/...` or equivalent
`prefs.sh` files to reflect your preferred configuration. the `etc/prefs.{csh,sh}` files to reflect your preferred configuration.
For many config files, there are several configuration possibilities: For many config files, there are several configuration possibilities:
- Define a particular third-party version. - Define a particular third-party version.
- Use a system installation. - Use a system installation.
- Disable use of an optional component. - Disable use of an optional component.
- Define an alternative site-wide central location. - Define an alternative site-wide central location.
- After making the desired changes, use `wmRefresh` or equivalent to use the configurations.
See the [OpenFOAM configuration information][link openfoam-config]
for more details.
After making the desired changes, use the `wmRefresh` alias
or equivalent to enable the configuration.
--- ---
@ -117,18 +110,18 @@ Additionally, if you are using clang but with ThirdParty locations for
gmp/mpfr you will need some extra work. Here is an example: gmp/mpfr you will need some extra work. Here is an example:
* Compile a new ThirdParty clang version: * Compile a new ThirdParty clang version:
```
./makeLLVM llvm-4.0.1 ./makeLLVM llvm-4.0.1
```
* Now adjust the OpenFOAM `prefs.sh` to use the new compiler settings, * Now adjust the OpenFOAM `prefs.sh` to use the new compiler settings,
and update the OpenFOAM environment (eg, `wmRefresh`) and update the OpenFOAM environment (eg, `wmRefresh`)
* Next use (abuse) the `makeGcc` script to compile gmp/mpfr libraries. * Next use (abuse) the `makeGcc` script to compile gmp/mpfr libraries.
It is best to pass the desired versions explicitly, and necessary It is best to pass the desired versions explicitly, and necessary
to set the CC/CXX variables so that the correct compiler is used: to set the CC/CXX variables so that the correct compiler is used:
```
CC=clang CXX=clang++ ./makeGcc gmp-6.1.2 mpfr-4.0.0 gcc-system CC=clang CXX=clang++ ./makeGcc gmp-6.1.2 mpfr-4.0.0 gcc-system
```
specifying `gcc-system` effectively disables building of gcc, specifying `gcc-system` effectively disables building of gcc,
but will build the gmp/mpfr components. but will build the gmp/mpfr components.
@ -138,13 +131,12 @@ gmp/mpfr you will need some extra work. Here is an example:
The location to make these changes is in the `etc/config.sh/CGAL`, The location to make these changes is in the `etc/config.sh/CGAL`,
since this is the component that uses the mpfr library. since this is the component that uses the mpfr library.
For example, For example,
```
gmp_version=gmp-6.1.2 gmp_version=gmp-6.1.2
mpfr_version=mpfr-4.0.0 mpfr_version=mpfr-4.0.0
export GMP_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version
export GMP_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version export MPFR_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version
export GMP_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version ```
* Update update the OpenFOAM environment (eg, `wmRefresh`) again. * Update update the OpenFOAM environment (eg, `wmRefresh`) again.
@ -155,20 +147,16 @@ gmp/mpfr you will need some extra work. Here is an example:
can also be invoked directly to find possible build errors. can also be invoked directly to find possible build errors.
- Builds an mpi library (openmpi or mpich), scotch decomposition, boost, CGAL, FFTW. - Builds an mpi library (openmpi or mpich), scotch decomposition, boost, CGAL, FFTW.
- If the optional kahip or metis directories are found, they will also be compiled. - If the optional kahip or metis directories are found, they will also be compiled.
2. `makeParaView` *(optional but highly recommended)* 2. `makeParaView` *(optional)*
- This is optional, but extremely useful for visualization and for - Can be useful for visualization and for run-time post-processing function objects.
run-time post-processing function objects. You can build this at a later point in time, and rebuild the visualization modules.
You can build this at a later point in time, but then you should
remember to rebuild the post-processing function objects and the
reader module as well.
3. Make any additional optional components 3. Make any additional optional components
#### Optional Components #### Optional Components
`makeADIOS` `makeAdios2`
- Only required for [ADIOS](#parallel) support, - Only required for [ADIOS](#parallel) support.
which is currently staged in the [add-ons repository][link AddOns].
`makeCGAL` `makeCGAL`
- Builds [boost](#general-packages) and [CGAL](#general-packages). - Builds [boost](#general-packages) and [CGAL](#general-packages).
@ -185,11 +173,23 @@ gmp/mpfr you will need some extra work. Here is an example:
Automatically invoked from the ThirdParty `Allwmake`, Automatically invoked from the ThirdParty `Allwmake`,
but can be invoked directly to resolve possible build errors. but can be invoked directly to resolve possible build errors.
`makeOPENMPI`
- Builds [OPENMPI](#parallel) library.
`makePETSC`
- Only required for [PETSC](#general-packages) support.
`makeMETIS` `makeMETIS`
- Builds [METIS](#parallel) decomposition library. - Builds [METIS](#parallel) decomposition library.
Automatically invoked from the ThirdParty `Allwmake`, Automatically invoked from the ThirdParty `Allwmake`,
but can be invoked directly to resolve possible build errors. but can be invoked directly to resolve possible build errors.
`makeSCOTCH`
- Builds [scotch, ptscotch](#parallel) decomposition libraries.
Automatically invoked from the ThirdParty `Allwmake`,
but can be invoked directly for special configurations
or to resolve possible build errors.
`makeMGridGen` `makeMGridGen`
- Optional agglomeration routines. - Optional agglomeration routines.
@ -216,17 +216,17 @@ gmp/mpfr you will need some extra work. Here is an example:
Report in sorted order. Report in sorted order.
`Allclean` `Allclean`
- After building, this script may be used to remove intermediate build information - After building, this script may be used to remove intermediate build
and save some disk space. information and save some disk space.
## Build Notes ## Build Notes
### CGAL ### CGAL
- The zlib library and zlib development headers are required. - The [zlib][page zlib] library and development headers are required.
### Scotch ### Scotch
- The zlib library and zlib development headers are required. - The [zlib][page zlib] library and development headers are required.
### Mesa ### Mesa
@ -242,19 +242,22 @@ and save some disk space.
- Rather than downloading VTK separately, it is easy to reuse the VTK - Rather than downloading VTK separately, it is easy to reuse the VTK
sources that are bundled with ParaView. sources that are bundled with ParaView.
For example, by using a symbolic link: For example, by using a symbolic link:
```
ln -s ParaView-v5.6.0/VTK VTK-8.2.0 ln -s ParaView-v5.6.0/VTK VTK-8.2.0
```
The appropriate VTK version number can be found from the contents of The appropriate VTK version number can be found from the contents of
the `vtkVersion.cmake` file. the `vtkVersion.cmake` file.
For example, For example,
```
$ cat ParaView-v5.6.0/VTK/CMake/vtkVersion.cmake $ cat ParaView-v5.6.0/VTK/CMake/vtkVersion.cmake
```
# VTK version number components. contains this type of information
set(VTK_MAJOR_VERSION 8) ```
set(VTK_MINOR_VERSION 2) # VTK version number components.
set(VTK_BUILD_VERSION 0) set(VTK_MAJOR_VERSION 8)
set(VTK_MINOR_VERSION 2)
set(VTK_BUILD_VERSION 0)
```
### ParaView ### ParaView
- Building ParaView requires CMake, qmake and a `qt` development files. - Building ParaView requires CMake, qmake and a `qt` development files.
@ -272,11 +275,34 @@ use the ParaView-5.4 sources that were included in the ThirdParty-v1712
source pack. This, however, has never been tested in combination with source pack. This, however, has never been tested in combination with
the OpenFOAM Catalyst insitu visualization. the OpenFOAM Catalyst insitu visualization.
If you encounter problems starting paraview (eg, segmentation fault)
it could be related to the graphics libraries not being properly found.
The `LIBGL_DEBUG` environment variable can be used to obtain more
detailed information:
```
$ export LIBGL_DEBUG=verbose
```
The call to paraview now emits this information:
```
libGL: screen 0 does not appear to be DRI2 capable
libGL: OpenDriver: trying /usr/lib64/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/swrast_dri.so
...
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
```
Indicating that the drivers are probably not correctly installed.
The `/var/log/Xorg.0.log` file or the `dmesg` command may yield more
information to the cause.
In this particular case, the Nvidia drivers had a client/server
version mismatch.
#### 5.6.x, 5.5.x binary packages #### 5.6.x, 5.5.x binary packages
For general functionality, the paraview version distributed with For general functionality, the paraview version distributed with
the operating system or a [binary package][download ParaView]]) the operating system or a [binary package][download ParaView]
may be sufficient for your needs. may be sufficient for your needs.
- No known issues with the native OpenFOAM reader. - No known issues with the native OpenFOAM reader.
@ -301,15 +327,6 @@ may not be important for you):
#### 5.3.0 and older are neither recommended nor supported #### 5.3.0 and older are neither recommended nor supported
- Various compilation issues and known bugs. - Various compilation issues and known bugs.
### ADIOS
- The github release currently requires GNU autoconf tools (eg,
autoconf, autoheader, automake) for its configuration.
- Some inconsistency in directory names (ADIOS vs. adios) between releases.
- Optionally uses bzip2, zlib development headers (eg, libbz2-devel, zlib-devel)
for the corresponding compression tranforms.
- The [zfp floating point compression][page zfp] library is now included as
part of ADIOS.
### Making Qt <a name="makeQt"></a> ### Making Qt <a name="makeQt"></a>
- Building a third-party Qt installation (prior to building ParaView) requires - Building a third-party Qt installation (prior to building ParaView) requires
some additional effort, but should nonetheless work smoothly. some additional effort, but should nonetheless work smoothly.
@ -317,13 +334,13 @@ may not be important for you):
1. Download a [*qt-everywhere-opensource-src*][link Qt5] package and 1. Download a [*qt-everywhere-opensource-src*][link Qt5] package and
unpack in the third-party directory. unpack in the third-party directory.
2. Use the `makeQt` script with the QT version number. For example, 2. Use the `makeQt` script with the QT version number. For example,
```
./makeQt 5.9.3 ./makeQt 5.9.3
```
3. Build ParaView using this third-party QT. For example, 3. Build ParaView using this third-party QT. For example,
```
./makeParaView -qt-5.9.3 5.6.0 ./makeParaView -qt-5.9.3 5.6.0
```
- ParaView versions prior to 5.3.0 do not properly support QT5. - ParaView versions prior to 5.3.0 do not properly support QT5.
- If you relocate the third-party directory to another location - If you relocate the third-party directory to another location
@ -342,7 +359,7 @@ slightly older QT (eg, [qt-5.6.3][link Qt56]) instead.
### Gcc Compiler <a name="gcc-compiler"></a> ### Gcc Compiler <a name="gcc-compiler"></a>
The minimum version of gcc required is 4.8.0. The minimum version of gcc required is **4.8.5**
| Name | Location | Name | Location
|-------------------|-------------------------------------------- |-------------------|--------------------------------------------
@ -376,7 +393,7 @@ install the 32-bit development libraries by default.
### Clang Compiler <a name="clang-compiler"></a> ### Clang Compiler <a name="clang-compiler"></a>
The minimum version of clang required is 3.5. The minimum version of clang required is **3.7**
*Attention*: If you are building a newer version of clang, you may need to *Attention*: If you are building a newer version of clang, you may need to
update your CMake beforehand since GNU *configure* can only be used prior update your CMake beforehand since GNU *configure* can only be used prior
@ -402,6 +419,9 @@ you may have additional hurdles to using the newest versions of clang.
| [boost][page boost] | [download][link boost] | [boost][page boost] | [download][link boost]
| [CGAL][page CGAL] | [download][link CGAL] | [CGAL][page CGAL] | [download][link CGAL]
| [FFTW][page FFTW] | [download][link FFTW] | [FFTW][page FFTW] | [download][link FFTW]
| [HDF5][page HDF5] | [download][link HDF5]
| [PETSC][page PETSC] | [download][link PETSC]
| [HYPRE][page HYPRE] | [repo][repo HYPRE] or [download][link HYPRE]
| [ADF/CGNS][page CGNS], ccm | [link ccmio][link ccmio] | [ADF/CGNS][page CGNS], ccm | [link ccmio][link ccmio]
| gperftools | [repo][repo gperftools] or [download][link gperftools] | gperftools | [repo][repo gperftools] or [download][link gperftools]
@ -410,10 +430,10 @@ you may have additional hurdles to using the newest versions of clang.
| Name | Location | Name | Location
|-----------------------|------------------------ |-----------------------|------------------------
| [openmpi][page openmpi] | [download][link openmpi]. The newer [openmpi][newer openmpi] make exhibit stability issues. | [openmpi][page openmpi] | [download][link openmpi]. ***Some openmpi2/openmpi3 versions exhibit [stability issues](https://github.com/open-mpi/ompi/issues/5375)***
| [adios][page adios] | [repo][repo adios] or [github download][link adios] or [alt download][altlink adios] | [adios][page adios] | [repo][repo adios] or [github download][link adios]
| [scotch, ptscotch][page scotch] | [download][link scotch] or older: [6.0.3][link scotch603] | [scotch, ptscotch][page scotch] | [repo][repo scotch] or [download][link scotch] or [older][older scotch]
| [kahip][page kahip] | [download][link kahip] | [kahip][page kahip] | [download][link kahip] or [older][older kahip]
| [metis][page metis] | [download][link metis] | [metis][page metis] | [download][link metis]
@ -422,39 +442,61 @@ you may have additional hurdles to using the newest versions of clang.
| Name | Location | Name | Location
|-----------------------|------------------------ |-----------------------|------------------------
| [MESA][page mesa] | [download][link mesa] or [older 13][link mesa13], [older 11][link mesa11] | [MESA][page mesa] | [download][link mesa] or [older 13][link mesa13], [older 11][link mesa11]
| [ParaView][page ParaView] | [download][link ParaView] or [older paraview-55][link ParaView55], [older paraview-54][link ParaView54] or [binaries][download ParaView] | [ParaView][page ParaView] | [download][link ParaView] or older [paraview-56][link ParaView56] or [binaries][download ParaView]
| [Qt][page Qt] | [QT5][link Qt5] for ParaView-5.3.0 and later, or the [older qt-56][link Qt56] for older systems. | [Qt][page Qt] | [QT5][link Qt5] for ParaView-5.3.0 and later, or the [older qt-56][link Qt56] for older systems.
### CMake Minimum Requirements <a name="min-cmake"></a> ### CMake Minimum Requirements <a name="min-cmake"></a>
The minimum CMake requirements for building various components. The minimum CMake requirements for building various components.
```
2.8 llvm-3.4.2 2.8 llvm-3.4.2
2.8.11 CGAL-4.9 2.8.11 CGAL-4.9
2.8.11 CGAL-4.11 2.8.11 CGAL-4.11
2.8.12.2 llvm-3.7.0 3.1 CGAL-4.12 -> CGAL-4.14.3
2.8.12.2 llvm-3.8.0 2.8.12.2 llvm-3.7.0
2.8.4 cmake-3.6.0 2.8.12.2 llvm-3.8.0
3.3 ParaView-5.6.0 2.8.4 cmake-3.6.0
3.4.3 llvm-3.9.1 3.3 ParaView-5.6.3
3.4.3 llvm-4.0.0 - llvm-6.0.0 3.10 ParaView-5.7.0 - ParaView-5.8.0
3.6 ADIOS2 3.12 - 3.16 ParaView-5.9.0 - ParaView-5.10.1
3.4.3 llvm-3.9.1
3.4.3 llvm-4.0.0 - llvm-6.0.0
3.12 ADIOS2
```
### GCC Minimum Requirements <a name="min-gcc"></a> ### GCC Minimum Requirements <a name="min-gcc"></a>
The minimum gcc/g++ requirements for building various components. The minimum gcc/g++ requirements for building various components.
```
4.7 llvm-3.7.0 4.7 llvm-3.7.0
4.7 llvm-3.6.2 4.7 llvm-3.6.2
4.7 llvm-3.5.2 4.7 llvm-3.5.2
4.4 llvm-3.4.2 4.4 llvm-3.4.2
```
If your system gcc/g++ is too old to build the desired llvm/clang If your system gcc/g++ is too old to build the desired llvm/clang
version, you may need to build a lower llvm/clang version and then use version, you may need to build a lower llvm/clang version and then use
that clang compiler for building the newer llvm/clang version. that clang compiler for building the newer llvm/clang version.
<!-- OpenFOAM, Internal links -->
[link openfoam-readme]: https://develop.openfoam.com/Development/openfoam/blob/develop/README.md
[link openfoam-config]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Config.md
[link openfoam-build]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Build.md
[link openfoam-require]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Requirements.md
[link third-readme]: https://develop.openfoam.com/Development/ThirdParty-common/blob/develop/README.md
[link third-build]: https://develop.openfoam.com/Development/ThirdParty-common/blob/develop/BUILD.md
[link third-require]: https://develop.openfoam.com/Development/ThirdParty-common/blob/develop/Requirements.md
## Software Links
If you have access to this information file in its raw form, you will
note that most of the software pages and download links are listed as
a collection at the end of the file. This is designed to make it
easier to use `grep` and find the relevant pages and links.
<!-- gcc-related --> <!-- gcc-related -->
[page gcc]: http://gcc.gnu.org/releases.html [page gcc]: http://gcc.gnu.org/releases.html
@ -463,8 +505,8 @@ that clang compiler for building the newer llvm/clang version.
[page mpc]: http://www.multiprecision.org/ [page mpc]: http://www.multiprecision.org/
[link gcc]: http://gcc.gnu.org/releases.html [link gcc]: http://gcc.gnu.org/releases.html
[link gmp]: ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz [link gmp]: ftp://ftp.gnu.org/gnu/gmp/gmp-6.2.0.tar.xz
[link mpfr]: ftp://ftp.gnu.org/gnu/mpfr/mpfr-4.0.1.tar.xz [link mpfr]: ftp://ftp.gnu.org/gnu/mpfr/mpfr-4.0.2.tar.xz
[link mpc]: ftp://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz [link mpc]: ftp://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
@ -483,56 +525,96 @@ that clang compiler for building the newer llvm/clang version.
<!-- parallel --> <!-- parallel -->
[page adios]: https://www.olcf.ornl.gov/center-projects/adios/ [page adios]: https://csmd.ornl.gov/software/adios2
[repo adios]: https://github.com/ornladios/ADIOS [repo adios]: https://github.com/ornladios/ADIOS2
[link adios]: https://github.com/ornladios/ADIOS/archive/v1.13.0.tar.gz [link adios]: https://github.com/ornladios/ADIOS2/archive/v2.10.2.tar.gz
[altlink adios]: http://users.nccs.gov/%7Epnorbert/adios-1.13.0.tar.gz
[page hdf5]: https://www.hdfgroup.org
[repo hdf5]: https://github.com/HDFGroup/hdf5
[link hdf5]: https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5_1.14.4.3.tar.gz
[page zfp]: http://computation.llnl.gov/projects/floating-point-compression/zfp-versions [page zfp]: http://computation.llnl.gov/projects/floating-point-compression/zfp-versions
[page scotch]: https://www.labri.fr/perso/pelegrin/scotch/ [page scotch]: https://www.labri.fr/perso/pelegrin/scotch/
[link scotch603]: https://gforge.inria.fr/frs/download.php/file/34099/scotch_6.0.3.tar.gz [repo scotch]: https://gitlab.inria.fr/scotch/scotch
[link scotch605]: https://gforge.inria.fr/frs/download.php/file/37398/scotch_6.0.5a.tar.gz [link scotch]: https://gitlab.inria.fr/scotch/scotch/-/archive/v6.1.3/scotch-v6.1.3.tar.gz
[link scotch]: https://gforge.inria.fr/frs/download.php/file/37622/scotch_6.0.6.tar.gz [link scotch60_10]: https://gforge.inria.fr/frs/download.php/file/38350/scotch_6.0.10.tar.gz
[link scotch60_9]: https://gforge.inria.fr/frs/download.php/file/38187/scotch_6.0.9.tar.gz
[link scotch61_0]: https://gforge.inria.fr/frs/download.php/file/38352/scotch_6.1.0.tar.gz
[link scotch61_3]: https://gitlab.inria.fr/scotch/scotch/-/archive/v6.1.3/scotch-v6.1.3.tar.gz
[older scotch]: https://gforge.inria.fr/frs/download.php/file/38352/scotch_6.1.0.tar.gz
[newer scotch]: https://gitlab.inria.fr/scotch/scotch/-/archive/v7.0.1/scotch-v7.0.1.tar.gz
[newest scotch]: https://gitlab.inria.fr/scotch/scotch/-/archive/v7.0.6/scotch-v7.0.6.tar.gz
[page kahip]: http://algo2.iti.kit.edu/documents/kahip/ [page kahip]: http://algo2.iti.kit.edu/documents/kahip/
[link kahip]: http://algo2.iti.kit.edu/schulz/software_releases/KaHIP_2.00.tar.gz [older kahip]: https://github.com/KaHIP/KaHIP/archive/v3.15.tar.gz
[link kahip]: https://github.com/KaHIP/KaHIP/archive/v3.18.tar.gz
[page metis]: http://glaros.dtc.umn.edu/gkhome/metis/metis/overview [page metis]: http://glaros.dtc.umn.edu/gkhome/metis/metis/overview
[link metis]: http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz [link metis]: http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz
[page openmpi]: http://www.open-mpi.org/ [page openmpi]: http://www.open-mpi.org/
[link openmpi]: https://www.open-mpi.org/software/ompi/v1.10/downloads/openmpi-1.10.4.tar.bz2 [older openmpi]: https://download.open-mpi.org/release/open-mpi/v1.10/openmpi-1.10.7.tar.bz2
[newer openmpi]: https://www.open-mpi.org/software/ompi/v2.1/downloads/openmpi-2.1.1.tar.bz2 [link openmpi]: https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.2.tar.bz2
[page mpich]: http://www.mpich.org/
[older mpich]: http://www.mpich.org/static/downloads/3.4.2/mpich-3.4.2.tar.gz
[link mpich]: https://www.mpich.org/static/downloads/4.2.3/mpich-4.2.3.tar.gz
[page mvpapich]: http://mvapich.cse.ohio-state.edu/
[link mvpapich]: https://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-2.3.7-1.tar.gz
<!-- general --> <!-- general -->
[page cmake]: http://www.cmake.org/ [page cmake]: http://www.cmake.org/
[link cmake]: http://www.cmake.org/files/v3.5/cmake-3.5.2.tar.gz [link cmake]: https://cmake.org/files/v3.8/cmake-3.8.2.tar.gz
[page boost]: http://boost.org [page boost]: http://boost.org
[link boost]: https://sourceforge.net/projects/boost/files/boost/1.64.0/boost_1_64_0.tar.bz2 [link boost]: https://sourceforge.net/projects/boost/files/boost/1.87.0/boost_1_87_0.tar.bz2
[page CGAL]: http://cgal.org [page CGAL]: http://cgal.org
[link CGAL]: https://github.com/CGAL/cgal/releases/download/releases%2FCGAL-4.9.1/CGAL-4.9.1.tar.xz [old CGAL]: https://github.com/CGAL/cgal/releases/download/releases/CGAL-4.14.3/CGAL-4.14.3.tar.xz
[link CGAL]: https://github.com/CGAL/cgal/releases/download/v6.0.1/CGAL-6.0.1-library.tar.xz
[page FFTW]: http://www.fftw.org/ [page FFTW]: http://www.fftw.org/
[link FFTW]: http://www.fftw.org/fftw-3.3.7.tar.gz [link FFTW]: http://www.fftw.org/fftw-3.3.10.tar.gz
[page petsc]: https://petsc.org/
[link petsc]: https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-3.22.4.tar.gz
[page hypre]: https://computing.llnl.gov/projects/hypre-scalable-linear-solvers-multigrid-methods/
[repo hypre]: https://github.com/hypre-space/hypre/
[link hypre]: https://github.com/hypre-space/hypre/archive/v2.31.0.tar.gz
[page cgns]: http://cgns.github.io/ [page cgns]: http://cgns.github.io/
[link ccmio]: http://portal.nersc.gov/project/visit/third_party/libccmio-2.6.1.tar.gz (check usage conditions) [link ccmio]: http://portal.nersc.gov/project/visit/third_party/libccmio-2.6.1.tar.gz (check usage conditions)
[altlink ccmio]: http://portal.nersc.gov/svn/visit/trunk/third_party/libccmio-2.6.1.tar.gz (check usage conditions) [altlink ccmio]: https://sourceforge.net/projects/foam-extend/files/ThirdParty/libccmio-2.6.1.tar.gz (check usage conditions)
[repo gperftools]: https://github.com/gperftools/gperftools [repo gperftools]: https://github.com/gperftools/gperftools
[link gperftools]: https://github.com/gperftools/gperftools/releases/download/gperftools-2.5/gperftools-2.5.tar.gz [link gperftools]: https://github.com/gperftools/gperftools/releases/download/gperftools-2.5/gperftools-2.5.tar.gz
[page zlib]: https://www.zlib.net/
[link zlib]: https://sourceforge.net/projects/libpng/files/zlib/1.2.11/zlib-1.2.11.tar.xz
<!-- profiling -->
[link extrae]: https://github.com/bsc-performance-tools/extrae/archive/refs/tags/4.1.7.tar.gz
[link libunwind]: https://github.com/libunwind/libunwind/releases/download/v1.8.1/libunwind-1.8.1.tar.gz
[link papi]: http://icl.utk.edu/projects/papi/downloads/papi-7.0.1.tar.gz
<!-- Visualization --> <!-- Visualization -->
[page ParaView]: http://www.paraview.org/ [page ParaView]: http://www.paraview.org/
[download ParaView]: https://www.paraview.org/download/ [download ParaView]: https://www.paraview.org/download/
[link ParaView54]: http://www.paraview.org/files/v5.4/ParaView-v5.4.1.tar.gz [link ParaView56]: http://www.paraview.org/files/v5.6/ParaView-v5.6.3.tar.xz
[link ParaView55]: http://www.paraview.org/files/v5.5/ParaView-v5.5.2.tar.gz [link ParaView57]: http://www.paraview.org/files/v5.7/ParaView-v5.7.0.tar.xz
[link ParaView]: http://www.paraview.org/files/v5.6/ParaView-v5.6.0.tar.gz [link ParaView58]: http://www.paraview.org/files/v5.8/ParaView-v5.8.1.tar.xz
[link ParaView59]: http://www.paraview.org/files/v5.9/ParaView-v5.9.1.tar.xz
[link ParaView510]: http://www.paraview.org/files/v5.10/ParaView-v5.10.1.tar.xz
[link ParaView511]: http://www.paraview.org/files/v5.11/ParaView-v5.11.2.tar.xz
[link ParaView512]: http://www.paraview.org/files/v5.12/ParaView-v5.12.1.tar.xz
[link ParaView513]: http://www.paraview.org/files/v5.13/ParaView-v5.13.2.tar.xz
[link ParaView]: http://www.paraview.org/files/v5.13/ParaView-v5.13.2.tar.xz
[page mesa]: http://mesa3d.org/ [page mesa]: http://mesa3d.org/
[link mesa]: ftp://ftp.freedesktop.org/pub/mesa/mesa-17.1.1.tar.xz [link mesa]: ftp://ftp.freedesktop.org/pub/mesa/mesa-17.1.1.tar.xz
@ -544,24 +626,6 @@ that clang compiler for building the newer llvm/clang version.
[link Qt56]: http://download.qt.io/official_releases/qt/5.6/5.6.3/single/qt-everywhere-opensource-src-5.6.3.tar.xz [link Qt56]: http://download.qt.io/official_releases/qt/5.6/5.6.3/single/qt-everywhere-opensource-src-5.6.3.tar.xz
[link Qt5]: http://download.qt.io/official_releases/qt/5.9/5.9.3/single/qt-everywhere-opensource-src-5.9.3.tar.xz [link Qt5]: http://download.qt.io/official_releases/qt/5.9/5.9.3/single/qt-everywhere-opensource-src-5.9.3.tar.xz
<!-- OpenFOAM -->
[link AddOns]: https://develop.openfoam.com/Community/OpenFOAM-addOns
[link community-projects]: http://www.openfoam.com/community/projects.php
--- ---
<!-- Standard Footer --> Copyright 2016-2025 OpenCFD Ltd
## Additional OpenFOAM Links
- [Community AddOns][link AddOns] repository
- [Collaborative and Community-based Developments][link community-projects]
- [Download](http://www.openfoam.com/download) and
[installation instructions](http://www.openfoam.com/code/build-guide.php)
- [Documentation](http://www.openfoam.com/documentation)
- [Reporting bugs/issues](http://www.openfoam.com/code/bug-reporting.php) (including bugs/suggestions/feature requests) in OpenFOAM
- [Contacting OpenCFD](http://www.openfoam.com/contact)
---
Copyright 2016-2018 OpenCFD Ltd

77
Environ.md Normal file
View File

@ -0,0 +1,77 @@
## OpenFOAM&reg; ThirdParty Environment Variables
When using these scripts for building third-party libraries
various environment variables are required or expected.
### Mandatory
- **WM_THIRD_PARTY_DIR** : Location of third-party library sources etc
- **WM_PROJECT_DIR** : The OpenFOAM project directory. <br>
Used for `wmake` information, config files, etc
- **WM_ARCH** : The target architecture (eg, Linux64)
- **WM_OSTYPE** : The operating system type (eg, POSIX, MSwindows) <br>
Used as fallback for determining the ending for dynamic libraries.
Used for Windows-specific handling in scotch builds.
- **WM_COMPILER** : The compiler name (eg, Gcc, Clang)
- **WM_COMPILER_LIB_ARCH** : The target library ending (eg, 64). <br>
Typically used as `lib$WM_COMPILER_LIB_ARCH` to generate the name
`lib64`, for example.
- **WM_LABEL_SIZE** : The OpenFOAM size for `label` (eg, 32 for int32)
- **WM_PRECISION_OPTION** : The OpenFOAM representation for `scalar`
(eg, DP for double-precision)
- **FOAM_EXT_LIBBIN** : Common _pool_ for the library targets.
### MPI-related
- **FOAM_MPI** : The OpenFOAM MPI sub-directory name (eg, sys-openmpi)
- **WM_MPLIB** : The canonical OpenFOAM MPI name (eg, SYSTEMOPENMPI)
- **MPI_ARCH_PATH** : Location of the current MPI implementation.
Used for additional linkage, but primarily to set MPI_ROOT
for a cmake hint.
### Other
- **WM_CONTINUE_ON_ERROR** : Ignore build errors.
Mostly set internally from `wmake -k`.
- **WM_NCOMPPROCS** : The number of build processes to launch.
Often set internally from `wmake -j`.
- **WM_COMPILER_TYPE** : Used internally for a few build scripts.
Has values of `system` or `ThirdParty`.
## Output
Similar to OpenFOAM itself, the build and final output are separated
into different directories that contain a non-colliding hierarchy of
target names. However, in contrast to the OpenFOAM target names,
there are several different types of output targets:
- *ARCH* : (eg, `linux64`) <br>
Base infrastructure such as compiler and base libraries.
- *ARCH+COMPILER* : (eg, `linux64Gcc`) <br>
Compiler-specific libraries and applications.
- *ARCH+COMPILER+SIZING* : (eg, `linux64GccDPInt32`) <br>
Libraries and applications specific to a particular combination
of OpenFOAM scalar/label sizes. This is the same as the
***WM_OPTIONS*** value.
By default, the locations of the build and final targets are hard-coded
relative to the WM_THIRD_PARTY_DIR:
- WM_THIRD_PARTY_DIR<b>/build/</b> : intermediate build artifacts
- WM_THIRD_PARTY_DIR<b>/platforms/</b> : installation root
The expert user or sys-admin can influence these locations with the
following environment variables
- **FOAM_THIRD_PARTY_BUILDROOT** :
Replaces WM_THIRD_PARTY_DIR as the root for build/ and platforms/.<br>
***!! The specified build-root directory must exist !!***
- **FOAM_THIRD_PARTY_SOURCES** :
Provide alternative location to WM_THIRD_PARTY_DIR/sources
for finding source bundles.<br>
---

102
README.md
View File

@ -1,15 +1,3 @@
<!--
|--------------------------------------------------------------------------|
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | |
| \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. |
| \\/ M anipulation | |
|--------------------------------------------------------------------------|
-->
---
# OpenFOAM&reg; ThirdParty # OpenFOAM&reg; ThirdParty
OpenFOAM depends to a certain extent on third-party libraries OpenFOAM depends to a certain extent on third-party libraries
@ -34,14 +22,14 @@ version specified on the command-line.
## Before Starting ## Before Starting
0. Review the [system requirements](http://www.openfoam.com/documentation/system-requirements.php) 0. Review the [system requirements][link openfoam-require]
and decide on the following: and decide on the following:
* compiler type/version (you may need a third-party compiler installation). * compiler type/version (you may need a third-party compiler installation).
* MPI type/version. * MPI type/version.
* ParaView type/version. * ParaView type/version.
* CMake type/version, ... * CMake type/version, ...
1. Adjust the OpenFOAM `etc/bashrc`, `etc/config.sh/...` or equivalent 1. Adjust the OpenFOAM `etc/bashrc`, `etc/config.sh/...` or equivalent
`prefs.sh` files to reflect your preferred configuration. `prefs.sh` files to reflect your preferred [configuration][link openfoam-config].
2. Source the updated OpenFOAM environment 2. Source the updated OpenFOAM environment
--- ---
@ -53,38 +41,82 @@ automatically as part of the top-level OpenFOAM `Allwmake`.
Nonetheless it may be necessary or useful to build particular Nonetheless it may be necessary or useful to build particular
ThirdParty components prior to building OpenFOAM itself. ThirdParty components prior to building OpenFOAM itself.
### Build Sequence ### Sequence
1. `makeGcc` _or_ `makeLLVM` *(optional)* 1. `makeGcc` _or_ `makeLLVM` *(optional)*
2. `makeCmake` *(optional)* 2. `makeCmake` *(optional)*
3. `Allwmake` 3. `Allwmake`
- This will be automatically invoked by the top-level OpenFOAM `Allwmake`. - This will be automatically invoked by the top-level OpenFOAM `Allwmake`.
4. `makeParaView` *(optional but highly recommended)* 4. `makeParaView` *(optional)*
5. Any other additional optional components 5. Any other additional optional components
If the `Allwmake` is being invoked directly (not from the OpenFOAM `Allwmake`),
it may be necessary to bootstrap the binary parts of the `wmake` toolchain
manually before proceeding. This is done with the following command:
```
$WM_PROJECT_DIR/wmake/src/Allmake
```
### Build Details **It normally advisable to skip the ParaView compilation initially**.
More details can be found the ThirdParty BUILD.md information. Building ParaView from source tends to be the most difficult part of
any third-party compilation.
For general functionality, the paraview version distributed with
the operating system or a [binary package][download ParaView]
may be sufficient for your needs.
### Details
- More details can be found the [ThirdParty BUILD.md][link third-build] information.
- Some configuration details can be found in the
[OpenFOAM doc/Config.md][link openfoam-config] information.
### Other
When building other libraries directly, with autoconfig or cmake, it
will be useful or necessary to use the same compiler and compiler
settings as are used by OpenFOAM itself. These are obtained from the
`wmake` show options and can be used to set corresponding environment
variables. For example,
```
CC="$(wmake -show-c)" CFLAGS="$(wmake -show-cflags)" ./configure
```
Here is the correspondence to commonly used environment variables
| Env variable | Obtaining from wmake | Meaning |
|-------------------|---------------------------|-----------------------|
| CC | `wmake -show-c` | C compiler |
| CFLAGS | `wmake -show-cflags` | C compiler flags |
| CXX | `wmake -show-cxx` | C++ compiler |
| CXXFLAGS | `wmake -show-cxxflags` | C++ compiler flags |
| | `wmake -show-cflags-arch` | Architecture information when linking |
| | `wmake -show-cxxflags-arch` | Architecture information when linking |
In some situations it can also be useful to have the compiler and flags
together (similar to `mpicc -show` and `mpicxx -show`):
```
wmake -show-compile-c
wmake -show-compile-cxx
```
<!-- Quick links -->
[download ParaView]: https://www.paraview.org/download/
<!-- OpenFOAM --> <!-- OpenFOAM -->
[link AddOns]: https://develop.openfoam.com/Community/OpenFOAM-addOns [link openfoam-readme]: https://develop.openfoam.com/Development/openfoam/blob/develop/README.md
[link community-projects]: http://www.openfoam.com/community/projects.php [link openfoam-config]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Config.md
[link openfoam-build]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Build.md
[link openfoam-require]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Requirements.md
[link third-readme]: https://develop.openfoam.com/Development/ThirdParty-common/blob/develop/README.md
[link third-build]: https://develop.openfoam.com/Development/ThirdParty-common/blob/develop/BUILD.md
[link third-require]: https://develop.openfoam.com/Development/ThirdParty-common/blob/develop/Requirements.md
--- ---
Copyright 2016-2019 OpenCFD Ltd
<!-- Standard Footer -->
## Additional OpenFOAM Links
- [Community AddOns][link AddOns] repository
- [Collaborative and Community-based Developments][link community-projects]
- [Download](http://www.openfoam.com/download) and
[installation instructions](http://www.openfoam.com/code/build-guide.php)
- [Documentation](http://www.openfoam.com/documentation)
- [Reporting bugs/issues](http://www.openfoam.com/code/bug-reporting.php) (including bugs/suggestions/feature requests) in OpenFOAM
- [Contacting OpenCFD](http://www.openfoam.com/contact)
---
Copyright 2016-2017 OpenCFD Ltd

86
Requirements.md Normal file
View File

@ -0,0 +1,86 @@
## OpenFOAM&reg; ThirdParty System Requirements
For building some particular third-party libraries from source,
the normal [OpenFOAM System Requirements][link openfoam-require]
may not be sufficient.
This is most notably the case for ParaView and/or QT compilation.
As duly noted in [BUILD][link third-build] and [README][link third-readme] information,
building ParaView from source tends to be the most difficult part of
any third-party compilation.
For general functionality, the paraview version distributed with
the operating system or a [binary package][download ParaView]
is likely [fully adequate for your needs][FAQ ParaView].
***Please help us with keeping the information here up-to-date and accurate.***
### Ubuntu
The full dependency list for building ParaView can be found from the
corresponding [debian/control][debian control] file.
A ***quick*** way to get these dependencies on to your system is to
use the paraview development package:
```
sudo apt install paraview-dev
```
Depending on your setup, the following subset may also be enough:
```
sudo apt install cmake qtbase5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev libqt5x11extras5-dev libxt-dev
```
### openSUSE (eg, Leap-15.3)
The full dependency list for building ParaView can be found from the
corresponding [rpm spec][suse spec] file.
A ***quick*** way to get these dependencies on to your system is to
use the paraview development package:
```
sudo zypper install paraview-devel
```
Depending on your setup, the following subset may also be enough:
```
sudo zypper install Mesa-libEGL-devel
sudo zypper install libqt5-qtbase-devel libqt5-qtsvg-devel libqt5-qttools-devel libqt5-qtx11extras-devel
sudo zypper install libxcb-devel libXt-devel
```
For building paraview with ffmpeg support (components: avformat
avcodec avutil swscale), the packman repository may be required, with a
variety of additional packages:
```
sudo zypper install ffmpeg-3
sudo zypper install ffmpeg-3-libavcodec-devel
sudo zypper install ffmpeg-3-libavformat-devel
sudo zypper install ffmpeg-3-libavresample-devel
sudo zypper install ffmpeg-3-libavutil-devel
sudo zypper install ffmpeg-3-libswresample-devel
sudo zypper install ffmpeg-3-libswscale-devel
```
<!-- Quick links -->
[download ParaView]: https://www.paraview.org/download/
[debian control]: https://salsa.debian.org/science-team/paraview/-/blob/master/debian/control
[suse spec]: https://build.opensuse.org/package/view_file/science/paraview/paraview.spec
[FAQ ParaView]: https://discourse.paraview.org/t/i-want-to-visualize-my-openfoam-simulation-results-with-paraview-but-im-confused-which-version-should-i-use
<!-- OpenFOAM -->
[link openfoam-readme]: https://develop.openfoam.com/Development/openfoam/blob/develop/README.md
[link openfoam-config]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Config.md
[link openfoam-build]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Build.md
[link openfoam-require]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Requirements.md
[link third-readme]: https://develop.openfoam.com/Development/ThirdParty-common/blob/develop/README.md
[link third-build]: https://develop.openfoam.com/Development/ThirdParty-common/blob/develop/BUILD.md
[link third-require]: https://develop.openfoam.com/Development/ThirdParty-common/blob/develop/Requirements.md
---
Copyright 2019-2022 OpenCFD Ltd

221
SOURCES.md Normal file
View File

@ -0,0 +1,221 @@
Third-party software (shipped) versions according to OpenFOAM version
# OpenFOAM-2406, OpenFOAM-2412
- ADIOS2-2.10.1 *update*
- CGAL-4.14.3
- ParaView-v5.12.1 *update*
- boost_1_74_0
- fftw-3.3.10
- openmpi-4.1.2
- scotch_6.1.0
- kahip-3.15
# OpenFOAM-2312
- ADIOS2-2.9.2 *update*
- CGAL-4.14.3
- ParaView-v5.11.2 *update*
- boost_1_74_0
- fftw-3.3.10
- openmpi-4.1.2
- scotch_6.1.0
- kahip-3.15
# OpenFOAM-2306
- ADIOS2-2.8.3
- CGAL-4.14.3
- ParaView-v5.11.1 *update*
- boost_1_74_0
- fftw-3.3.10
- openmpi-4.1.2
- scotch_6.1.0
- kahip-3.15 *update*
# OpenFOAM-2212
- ADIOS2-2.8.3 *new*
- CGAL-4.14.3
- ParaView-v5.11.0 *new*
- boost_1_74_0
- fftw-3.3.10
- openmpi-4.1.2
- scotch_6.1.0
- kahip-3.14
# OpenFOAM-2206
- ADIOS2-2.7.1
- CGAL-4.14.3
- ParaView-v5.10.1 *update*
- boost_1_74_0
- fftw-3.3.10
- openmpi-4.1.2
- scotch_6.1.0
- kahip-3.14
# OpenFOAM-2112
- ADIOS2-2.7.1 *new*
- CGAL-4.14.3 *new*
- ParaView-v5.10.0 *new*
- boost_1_74_0 *new*
- fftw-3.3.10 *update*
- openmpi-4.1.2 *new*
- scotch_6.1.0
- kahip-3.14 *new*
# OpenFOAM-2106
- ADIOS2-2.6.0
- CGAL-4.12.2
- ParaView-v5.9.1 *update*
- boost_1_66_0
- fftw-3.3.7
- openmpi-4.0.3
- scotch_6.1.0 *update*
- kahip-2.12
# OpenFOAM-2012
- ADIOS2-2.6.0 *update*
- CGAL-4.12.2
- ParaView-v5.6.3
- boost_1_66_0
- fftw-3.3.7
- openmpi-4.0.3
- scotch_6.0.9
- kahip-2.12
# OpenFOAM-2006
- ADIOS2-2.4.0
- CGAL-4.12.2 *update*
- ParaView-v5.6.3
- boost_1_66_0 *update*
- fftw-3.3.7
- openmpi-4.0.3 *update*
- scotch_6.0.9
- kahip-2.12
# OpenFOAM-1912
- ADIOS2-2.4.0 *new*
- CGAL-4.9.1
- ParaView-v5.6.3 *minor*
- boost_1_64_0
- fftw-3.3.7
- openmpi-1.10.7 *minor*
- scotch_6.0.9 *minor*
- kahip-2.12 *update*
# OpenFOAM-1906
- CGAL-4.9.1
- ParaView-v5.6.0
- boost_1_64_0
- fftw-3.3.7
- openmpi-1.10.7 *minor*
- scotch_6.0.6
- kahip-2.00d
# OpenFOAM-1812
- CGAL-4.9.1
- ParaView-v5.6.0 *update*
- boost_1_64_0
- fftw-3.3.7
- openmpi-1.10.4
- scotch_6.0.6 *minor*
- kahip-2.00d
# OpenFOAM-1806
- CGAL-4.9.1
- ParaView-v5.5.2 *update*
- boost_1_64_0
- fftw-3.3.7
- openmpi-1.10.4
- scotch_6.0.3
- kahip-2.00d
# OpenFOAM-1712
- CGAL-4.9.1
- ParaView-v5.4.1 *minor*
- boost_1_64_0
- fftw-3.3.7 *minor*
- openmpi-1.10.4
- scotch_6.0.3
- kahip-2.00d *new*
# OpenFOAM-1706
- CGAL-4.9.1 *minor*
- ParaView-v5.4.0 *update*
- boost_1_64_0 *update*
- fftw-3.3.6-pl1 *minor*
- openmpi-1.10.4
- scotch_6.0.3
# OpenFOAM-1612
- CGAL-4.9 *update*
- ParaView-v5.0.1 *update*
- boost_1_62_0 *update*
- fftw-3.3.5 *minor*
- openmpi-1.10.4 *minor*
- scotch_6.0.3
# OpenFOAM-1606
- CGAL-4.8 *update*
- ParaView-v5.0.1 *update*
- boost_1_61_0 *new*
- fftw-3.3.4 *new*
- openmpi-1.10.2 *minor*
- scotch_6.0.3
# OpenFOAM-1601 (3.0+)
- CGAL-4.7 *update*
- ParaView-v4.4.0 *update*
- openmpi-1.10.0 *update*
- scotch_6.0.3
# OpenFOAM-2.4
- CGAL-4.6 *update*
- ParaView-v4.1.0
- openmpi-1.8.5 *update*
- scotch_6.0.3 *update*
# OpenFOAM-2.3
- CGAL-4.3
- ParaView-v4.1.0
- openmpi-1.6.5
- scotch_6.0.0
---

View File

@ -1,92 +0,0 @@
Short summary of third-party software versions for recent OpenFOAM versions.
OpenFOAM-1812
---------------
CGAL-4.9.1
ParaView-5.6.0 *update*
boost_1_64_0
fftw-3.3.7
openmpi-1.10.4
scotch_6.0.6 *minor*
kahip-2.00d
OpenFOAM-1806
---------------
CGAL-4.9.1
ParaView-5.5.2 *update*
boost_1_64_0
fftw-3.3.7
openmpi-1.10.4
scotch_6.0.3
kahip-2.00d
OpenFOAM-1712
---------------
CGAL-4.9.1
ParaView-5.4.1 *minor*
boost_1_64_0
fftw-3.3.7 *minor*
openmpi-1.10.4
scotch_6.0.3
kahip-2.00d *new*
OpenFOAM-1706
---------------
CGAL-4.9.1 *minor*
ParaView-5.4.0 *update*
boost_1_64_0 *update*
fftw-3.3.6-pl1 *minor*
openmpi-1.10.4
scotch_6.0.3
OpenFOAM-1612
---------------
CGAL-4.9 *update*
ParaView-5.0.1 *update*
boost_1_62_0 *update*
fftw-3.3.5 *minor*
openmpi-1.10.4 *minor*
scotch_6.0.3
OpenFOAM-1606
---------------
CGAL-4.8 *update*
ParaView-5.0.1 *update*
boost_1_61_0 *new*
fftw-3.3.4 *new*
openmpi-1.10.2 *minor*
scotch_6.0.3
OpenFOAM-3.0+
---------------
CGAL-4.7 *update*
ParaView-4.4.0 *update*
openmpi-1.10.0 *update*
scotch_6.0.3
OpenFOAM-2.4
---------------
CGAL-4.6 *update*
ParaView-4.1.0
openmpi-1.8.5 *update*
scotch_6.0.3 *update*
---------------
OpenFOAM-2.3
---------------
CGAL-4.3
ParaView-4.1.0
openmpi-1.6.5
scotch_6.0.0
---------------

86
etc/list-available Executable file
View File

@ -0,0 +1,86 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# etc/list-available
#
# Description
# List available unpacked source versions
#
# checks:
# - ThirdParty/PACKAGE
# - ThirdParty/sources/PACKAGE
# - ThirdParty/sources/canonical/PACKAGE
#
# Example usage
# etc/list-available paraview
#
#------------------------------------------------------------------------------
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------
printHelp() {
cat<<USAGE
Usage: ${0##*/} [OPTION] [package1 .. [packageN]]
Options:
-dirs List with relative source directories
-names List names only [default]
-full List with absolute source directories
-help Display usage help
List available (unpacked) source packages.
USAGE
exit 0 # Clean exit
}
#------------------------------------------------------------------------------
optOutput="-names"
# Process options/arguments
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help*) printHelp;;
# Resolve with (relative) dirs
-dir*)
optOutput="-dirs"
;;
# Resolve packages names only (without directory)
-name*)
optOutput="-names"
;;
# Resolve with full (absolute) dirs
-full | -long)
optOutput="-long"
;;
-*) echo "Ignore unknown option" 1>&2 ;;
*) break ;;
esac
shift
done
if [ "$#" -gt 0 ]
then
listPackageVersions $optOutput "$@"
else
die "Did not specify any package(s)"
fi
#------------------------------------------------------------------------------

62
etc/list-download Executable file
View File

@ -0,0 +1,62 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# etc/list-download
#
# Description
# List known download hints. Required BUILD.md
#
# Example usage
# etc/list-download paraview
#
#------------------------------------------------------------------------------
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------
printHelp() {
cat<<USAGE
Usage: ${0##*/} [OPTION] [package1 .. [packageN]]
Options:
-help Display usage help
List known download hints.
USAGE
exit 0 # Clean exit
}
#------------------------------------------------------------------------------
# Process options/arguments
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help*) printHelp;;
-*) echo "Ignore unknown option" 1>&2 ;;
*) break ;;
esac
shift
done
if [ "$#" -gt 0 ]
then
showDownloadHint "$@"
else
die "Did not specify any package(s)"
fi
#------------------------------------------------------------------------------

167
etc/list-sources Executable file
View File

@ -0,0 +1,167 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# etc/list-sources
#
# Description
# Extract package names from SOURCES.md and resolve their respective
# (unpacked) directory paths.
#
# The input source file is assumed to be Markdown formatted with
# sections for each OpenFOAM version, followed by a '-' bulleted
# list of the software package/versions.
#
# Example,
# # OpenFOAM-2106
#
# - ADIOS2-2.6.0
# - CGAL-4.12.2
# ...
#
#------------------------------------------------------------------------------
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------
printHelp() {
cat<<USAGE
Usage: ${0##*/} [OPTION]
Options:
-dirs Resolve source directories (relative dir names)
-full Resolve source directories (absolute dir names)
-file=FILE Alternative file to process (default: SOURCES.md)
-vDIGITS | -DIGITS
OpenFOAM version (eg, -v2106, -2106) to process.
The default is to process the first (latest) section.
-help
Extract package names from SOURCES.md and optionally
resolve their respective (unpacked) directory paths.
USAGE
exit 0 # Clean exit
}
#------------------------------------------------------------------------------
inputFile="SOURCES.md"
unset version optResolve
# Process options/arguments
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help*) printHelp;;
# Resolve (relative) directories
-dir*)
: "${optResolve:=-relative}"
;;
# Resolve (full) directories
-full)
optResolve="-absolute"
;;
-file=*)
inputFile="${1#*=}"
;;
-[0-9]*) version="${1#*-}" ;;
-v[0-9]*) version="${1#*-v}" ;;
-*) echo "Ignore unknown option" 1>&2 ;;
esac
shift
done
# Resolve file (if necessary)
file="$inputFile"
if [ ! -f "$file" ]
then
file="$WM_THIRD_PARTY_DIR/$inputFile"
[ -f "$file" ] || die "No such file: $inputFile"
fi
## echo "processing: $file" 1>&2
# Parse this type of input:
#
# # OpenFOAM-2106
#
# - ADIOS2-2.6.0
# - CGAL-4.12.2
# - ParaView-v5.9.1 *update*
# - boost_1_66_0
# - fftw-3.3.7
# - openmpi-4.0.3
# - scotch_6.1.0 *update*
# - kahip-2.12
# By default use the top section, unless '$version' is specified
unset active section
while read -r line
do
case "$line" in
('#'*)
# A markdown section
if [ -n "$active" ]
then
break # Done
elif [ -z "$version" ]
then
active=true # No version: take the first section
else
# Match version (eg, '2106') vs these types of input:
# - '## OpenFOAM-2106'
# - '## OpenFOAM-v2106 update1'
item="$(echo "$line" | sed 's/^#*.*-v*//')"
case "$item" in
("$version"*) active=true;;
esac
fi
continue
;;
esac
# Strip leading space
line="$(echo "$line" | sed 's/^ *//')"
case "$line" in
([-*]' '*)
# A markdown list item. Extract first after the bullet
item="$(echo "$line" | sed 's/^[-*] *//;s/ .*$//')"
if [ "$active" != true ] || [ -z "$item" ]
then
continue
elif [ -n "$optResolve" ]
then
dir="$(findSourceDir "$optResolve" "$item" 2>/dev/null)"
if [ -n "$dir" ]
then
echo "$dir"
else
echo "missing: $item" 1>&2
fi
else
echo "$item" # Report item without resolving
fi
;;
esac
done < "$file"
#------------------------------------------------------------------------------

View File

@ -1,4 +1,6 @@
/* NOTE: make any changes to this file in etc/wmakeFiles/ */ /*
* NOTE: make any changes to this file in ThirdParty etc/wmakeFiles/
*/
interface/kaHIP_interface.cpp interface/kaHIP_interface.cpp
@ -66,5 +68,4 @@ algorithms/cycle_search.cpp
partition/uncoarsening/refinement/cycle_improvements/cycle_refinement.cpp partition/uncoarsening/refinement/cycle_improvements/cycle_refinement.cpp
partition/uncoarsening/refinement/tabu_search/tabu_search.cpp partition/uncoarsening/refinement/tabu_search/tabu_search.cpp
LIB = $(KAHIP_LIB_DIR)/libkahip
LIB = $(FOAM_EXT_LIBBIN)/libkahip

View File

@ -1,5 +1,5 @@
/* /*
* NOTE: make any changes to this file in etc/wmakeFiles/ * NOTE: make any changes to this file in ThirdParty etc/wmakeFiles/
* Must use -DNDEBUG to disable kahip debug mode. * Must use -DNDEBUG to disable kahip debug mode.
* Using -DMODE_NODESEP is not strictly required for building the library. * Using -DMODE_NODESEP is not strictly required for building the library.
*/ */
@ -8,8 +8,14 @@ EXE_INC = \
${c++LESSWARN} \ ${c++LESSWARN} \
${COMP_OPENMP} \ ${COMP_OPENMP} \
-DNDEBUG -DMODE_NODESEP \ -DNDEBUG -DMODE_NODESEP \
-I$(KAHIP_LIB_SRC) \ -I. \
-I$(KAHIP_LIB_SRC)/partition \ -I./partition \
-I$(KAHIP_LIB_SRC)/partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement -I./partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement
LIB_LIBS = LIB_LIBS =
PROJECT_LIBS =
/* failsafe location */
ifeq (,$(strip $(KAHIP_LIB_DIR)))
KAHIP_LIB_DIR = $(FOAM_EXT_LIBBIN)
endif

View File

@ -1,4 +1,6 @@
/* NOTE: make any changes to this file in etc/makeFiles/ */ /*
* NOTE: make any changes to this file in ThirdParty etc/makeFiles/
*/
libadf/ADF_interface.c libadf/ADF_interface.c
libadf/ADF_internals.c libadf/ADF_internals.c
@ -19,4 +21,4 @@ libccmio/ccmioversion.c
libcgns/cgnslib.c libcgns/cgnslib.c
*/ */
LIB = $(FOAM_EXT_LIBBIN)/libccmio LIB = $(CCMIO_LIB_DIR)/libccmio

View File

@ -1,3 +1,10 @@
/* NOTE: make any changes to this file in etc/makeFiles/ */ /* NOTE: make any changes to this file in ThirdParty etc/wmakeFiles/ */
/* EXE_INC = */ EXE_INC = -I.
LIB_LIBS =
PROJECT_LIBS =
/* failsafe location */
ifeq (,$(strip $(CCMIO_LIB_DIR)))
CCMIO_LIB_DIR = $(FOAM_EXT_LIBBIN)
endif

View File

@ -0,0 +1,68 @@
#-------------------------------*- makefile -*---------------------------------
#
# Prior to OpenFOAM-v1906, these were always part of the environment
#
# - WM_CFLAGS : with -m32 / -m64 and -fPIC
# - WM_LDFLAGS : with -m32 / -m64
#
# With OpenFOAM-v1906 and later
#
# - wmake -show-cflags : with -m32 / -m64
# - wmake -show-cflags-arch : with -m32 / -m64
#
# Pass these in via the environment since using '$(shell ...)' here does not
# always work well.
#
# Notes:
# - compiled without pthread
#
# Normally set CCS, CCP by caller
#------------------------------------------------------------------------------
EXE =
LIB = .dylib
OBJ = .o
AR = $(CC)
ARFLAGS = $(WM_CFLAGS) -dynamiclib -undefined dynamic_lookup -o
CCS ?= $(CC)
CCP ?= mpicc
CCD = $(CCP)
CFLAGS = $(WM_CFLAGS) -fPIC -O3 \
-UCOMMON_FILE_COMPRESS \
-DCOMMON_RANDOM_FIXED_SEED \
-DSCOTCH_DETERMINISTIC \
-DSCOTCH_RENAME \
-DIDXSIZE64 \
-Drestrict=__restrict
# Use 32/64-bit integers
# ---------------
# Unfortunately -DINT32 seems to fail when openmpi is build without
# Fortran! The MPI_INT32_T is interpreted as MPI_INTEGER4 which does
# not exist
# ---------------
# ifeq ($(WM_LABEL_SIZE),32)
# CFLAGS += -DINTSIZE32
# endif
ifeq ($(WM_LABEL_SIZE),64)
CFLAGS += -DINTSIZE64
endif
CLIBFLAGS =
LDFLAGS = $(WM_LDFLAGS) -lm
MAKE = make
CP = cp
CAT = cat
LN = ln
MKDIR = mkdir
MV = mv
RANLIB = echo
FLEX = flex "-Pscotchyy$(SCOTCH_NAME_SUFFIX)" -olex.yy.c
BISON = bison "-pscotchyy$(SCOTCH_NAME_SUFFIX)" -y -b y
LEX = $(FLEX)
YACC = $(BISON)
#------------------------------------------------------------------------------

View File

@ -0,0 +1,85 @@
#-------------------------------*- makefile -*---------------------------------
#
# Prior to OpenFOAM-v1906, these were always part of the environment
#
# - WM_CFLAGS : with -m32 / -m64 and -fPIC
# - WM_LDFLAGS : with -m32 / -m64
#
# With OpenFOAM-v1906 and later
#
# - wmake -show-cflags : with -m32 / -m64
# - wmake -show-cflags-arch : with -m32 / -m64
#
# Pass these in via the environment since using '$(shell ...)' here does not
# always work well.
#
# Notes:
# - compiled without pthread
#
# Normally set CCS, CCP by caller
#------------------------------------------------------------------------------
EXE =
LIB = .dll
OBJ = .o
# Separate the cross-compilation flags from regular CFLAGS to ensure that
# system gcc does not use them for the scotch build toolchain
# cross-compile broken for scotch-v7
CFLAGS_CROSS = -DCOMMON_STUB_FORK -DCOMMON_WINDOWS
# Flags for including windows MPI information (MSMPI)
CFLAGS_WINMPI = -I$(MPI_ARCH_PATH)/include \
-DMSMPI_NO_SAL -DMSMPI_NO_DEPRECATE_20 \
-D_MPICH_DLL_
AR = x86_64-w64-mingw32-gcc
ARFLAGS = $(CFLAGS) -shared -Wl,--output-def,libscotch.def,--out-implib,libscotch.a,--enable-auto-import,--strip-all -o
CC = x86_64-w64-mingw32-gcc $(CFLAGS_CROSS)
CCS = x86_64-w64-mingw32-gcc $(CFLAGS_WINMPI)
CCP = x86_64-w64-mingw32-gcc $(CFLAGS_WINMPI)
CCD = gcc $(CFLAGS_WINMPI)
CFLAGS = $(WM_CFLAGS) -fPIC -O3 \
-DCOMMON_PTHREAD_FILE -DSCOTCH_PTHREAD \
-UCOMMON_FILE_COMPRESS \
-DCOMMON_RANDOM_FIXED_SEED \
-DSCOTCH_DETERMINISTIC \
-DSCOTCH_RENAME \
-DIDXSIZE64 \
-Drestrict=__restrict
# Use 32/64-bit integers
# ---------------
# Unfortunately -DINT32 seems to fail when openmpi is build without
# Fortran! The MPI_INT32_T is interpreted as MPI_INTEGER4 which does
# not exist
# ---------------
# ifeq ($(WM_LABEL_SIZE),32)
# CFLAGS += -DINTSIZE32
# endif
ifeq ($(WM_LABEL_SIZE),64)
CFLAGS += -DINTSIZE64
endif
# Non-standard "__stdcall" in MSMPI <mpi.h>
CCDFLAGS = $(CFLAGS) -D__stdcall=''
CLIBFLAGS = -shared
LDFLAGS =
MAKE = make
CP = cp
CAT = cat
LN = ln
MKDIR = mkdir
MV = mv
RANLIB = echo
FLEX = flex "-Pscotchyy$(SCOTCH_NAME_SUFFIX)" -olex.yy.c
BISON = bison "-pscotchyy$(SCOTCH_NAME_SUFFIX)" -y -b y
LEX = $(FLEX)
YACC = $(BISON)
#------------------------------------------------------------------------------

View File

@ -0,0 +1,68 @@
#-------------------------------*- makefile -*---------------------------------
#
# Prior to OpenFOAM-v1906, these were always part of the environment
#
# - WM_CFLAGS : with -m32 / -m64 and -fPIC
# - WM_LDFLAGS : with -m32 / -m64
#
# With OpenFOAM-v1906 and later
#
# - wmake -show-cflags : with -m32 / -m64
# - wmake -show-cflags-arch : with -m32 / -m64
#
# Pass these in via the environment since using '$(shell ...)' here does not
# always work well.
#
# Notes:
# - compiled without pthread
#
# Normally set CCS, CCP by caller
#------------------------------------------------------------------------------
EXE =
LIB = .so
OBJ = .o
AR = $(CC)
ARFLAGS = $(WM_CFLAGS) -shared -o
CCS ?= $(CC)
CCP ?= mpicc
CCD = $(CCP)
CFLAGS = $(WM_CFLAGS) -fPIC -O3 \
-UCOMMON_FILE_COMPRESS \
-DCOMMON_RANDOM_FIXED_SEED \
-DSCOTCH_DETERMINISTIC \
-DSCOTCH_RENAME \
-DIDXSIZE64 \
-Drestrict=__restrict
# Use 32/64-bit integers
# ---------------
# Unfortunately -DINT32 seems to fail when openmpi is build without
# Fortran! The MPI_INT32_T is interpreted as MPI_INTEGER4 which does
# not exist
# ---------------
# ifeq ($(WM_LABEL_SIZE),32)
# CFLAGS += -DINTSIZE32
# endif
ifeq ($(WM_LABEL_SIZE),64)
CFLAGS += -DINTSIZE64
endif
CLIBFLAGS = -shared
LDFLAGS = -Xlinker --no-as-needed $(WM_LDFLAGS) -lm -lrt
MAKE = make
CP = cp
CAT = cat
LN = ln
MKDIR = mkdir
MV = mv
RANLIB = echo
FLEX = flex "-Pscotchyy$(SCOTCH_NAME_SUFFIX)" -olex.yy.c
BISON = bison "-pscotchyy$(SCOTCH_NAME_SUFFIX)" -y -b y
LEX = $(FLEX)
YACC = $(BISON)
#------------------------------------------------------------------------------

View File

@ -1,45 +0,0 @@
#-------------------------------*- makefile -*---------------------------------
# OpenFOAM notes:
#
# WM_CFLAGS, WM_LDFLAGS contain "-m32 -fPIC" etc
# WM_LABEL_SIZE == 64 for 'long' instead of 'int' for OpenFOAM labels
#
# - compiled without pthread
#
# Normally set CCS, CCP by caller
EXE =
LIB = .dylib
OBJ = .o
AR = $(CC)
ARFLAGS = $(WM_CFLAGS) -dynamiclib -undefined dynamic_lookup -o
CCS ?= $(CC)
CCP ?= mpicc
CCD = $(CCP)
CFLAGS = $(WM_CFLAGS) -O3 \
-DCOMMON_FILE_COMPRESS_GZ \
-DCOMMON_RANDOM_FIXED_SEED \
-DSCOTCH_DETERMINISTIC \
-DSCOTCH_RENAME \
-Drestrict=__restrict
# 32-bit vs. 64-bit labels
ifeq ($(WM_LABEL_SIZE),64)
CFLAGS += -DINTSIZE64
endif
CLIBFLAGS =
LDFLAGS = $(WM_LDFLAGS) -lz -lm
MAKE = make
CP = cp
CAT = cat
LN = ln
MKDIR = mkdir
MV = mv
RANLIB = echo
LEX = flex -Pscotchyy -olex.yy.c
YACC = bison -pscotchyy -y -b y
#------------------------------------------------------------------------------

View File

@ -1,45 +0,0 @@
#-------------------------------*- makefile -*---------------------------------
# OpenFOAM notes:
#
# WM_CFLAGS, WM_LDFLAGS contain "-m32 -fPIC" etc
# WM_LABEL_SIZE == 64 for 'long' instead of 'int' for OpenFOAM labels
#
# - compiled without pthread
#
# Normally set CCS, CCP by caller
EXE =
LIB = .so
OBJ = .o
AR = $(CC)
ARFLAGS = $(WM_CFLAGS) -shared -o
CCS ?= $(CC)
CCP ?= mpicc
CCD = $(CCP)
CFLAGS = $(WM_CFLAGS) -O3 \
-DCOMMON_FILE_COMPRESS_GZ \
-DCOMMON_RANDOM_FIXED_SEED \
-DSCOTCH_DETERMINISTIC \
-DSCOTCH_RENAME \
-Drestrict=__restrict
# 32-bit vs. 64-bit labels
ifeq ($(WM_LABEL_SIZE),64)
CFLAGS += -DINTSIZE64
endif
CLIBFLAGS = -shared
LDFLAGS = -Xlinker --no-as-needed $(WM_LDFLAGS) -lz -lm -lrt
MAKE = make
CP = cp
CAT = cat
LN = ln
MKDIR = mkdir
MV = mv
RANLIB = echo
LEX = flex -Pscotchyy -olex.yy.c
YACC = bison -pscotchyy -y -b y
#------------------------------------------------------------------------------

48
etc/patches/scotch-v7.0.1 Normal file
View File

@ -0,0 +1,48 @@
--- scotch_6.0.6/src/libscotch/Makefile.orig 2019-04-29 14:59:53.957103493 +0200
+++ scotch_6.0.6/src/libscotch/Makefile 2019-04-29 18:50:42.560080675 +0200
@@ -51,6 +51,12 @@
.PHONY : ptscotch scotch ptinstall install clean realclean
+ifeq ($(WM_OSTYPE),MSwindows)
+
+libscotch : libscotch$(LIB) scotch.h
+
+endif
+
scotch :
$(MAKE) CC="$(CCS)" CCD="$(CCS)" \
scotch.h \
@@ -438,6 +444,11 @@
wgraph_part_zr$(OBJ) \
wgraph_store$(OBJ)
+ifeq ($(WM_OSTYPE),MSwindows)
+## Add into libscotch instead of having a separate library
+LIBSCOTCHDEPS += library_error_exit$(OBJ)
+endif
+
##
## Todo list.
##
--- scotch_6.0.6/src/Makefile.orig 2018-07-14 17:24:49.000000000 +0200
+++ scotch_6.0.6/src/Makefile 2019-04-29 18:39:16.365132864 +0200
@@ -89,9 +89,18 @@
$(mandir)/man1 : $(mandir)
-$(MKDIR) $(mandir)/man1
+ifeq ($(WM_OSTYPE),MSwindows)
+
+libscotch : required
+ (cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) libscotch && $(MAKE) install)
+
+else
+
libscotch : required
(cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install)
+endif
+
scotch : libscotch
(cd scotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install)
(cd libscotchmetis ; $(MAKE) scotch && $(MAKE) install)

48
etc/patches/scotch_6.0.6 Normal file
View File

@ -0,0 +1,48 @@
--- scotch_6.0.6/src/libscotch/Makefile.orig 2019-04-29 14:59:53.957103493 +0200
+++ scotch_6.0.6/src/libscotch/Makefile 2019-04-29 18:50:42.560080675 +0200
@@ -51,6 +51,12 @@
.PHONY : ptscotch scotch ptinstall install clean realclean
+ifeq ($(WM_OSTYPE),MSwindows)
+
+libscotch : libscotch$(LIB) scotch.h
+
+endif
+
scotch :
$(MAKE) CC="$(CCS)" CCD="$(CCS)" \
scotch.h \
@@ -438,6 +444,11 @@
wgraph_part_zr$(OBJ) \
wgraph_store$(OBJ)
+ifeq ($(WM_OSTYPE),MSwindows)
+## Add into libscotch instead of having a separate library
+LIBSCOTCHDEPS += library_error_exit$(OBJ)
+endif
+
##
## Todo list.
##
--- scotch_6.0.6/src/Makefile.orig 2018-07-14 17:24:49.000000000 +0200
+++ scotch_6.0.6/src/Makefile 2019-04-29 18:39:16.365132864 +0200
@@ -89,9 +89,18 @@
$(mandir)/man1 : $(mandir)
-$(MKDIR) $(mandir)/man1
+ifeq ($(WM_OSTYPE),MSwindows)
+
+libscotch : required
+ (cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) libscotch && $(MAKE) install)
+
+else
+
libscotch : required
(cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install)
+endif
+
scotch : libscotch
(cd scotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install)
(cd libscotchmetis ; $(MAKE) scotch && $(MAKE) install)

48
etc/patches/scotch_6.0.7 Normal file
View File

@ -0,0 +1,48 @@
--- scotch_6.0.6/src/libscotch/Makefile.orig 2019-04-29 14:59:53.957103493 +0200
+++ scotch_6.0.6/src/libscotch/Makefile 2019-04-29 18:50:42.560080675 +0200
@@ -51,6 +51,12 @@
.PHONY : ptscotch scotch ptinstall install clean realclean
+ifeq ($(WM_OSTYPE),MSwindows)
+
+libscotch : libscotch$(LIB) scotch.h
+
+endif
+
scotch :
$(MAKE) CC="$(CCS)" CCD="$(CCS)" \
scotch.h \
@@ -438,6 +444,11 @@
wgraph_part_zr$(OBJ) \
wgraph_store$(OBJ)
+ifeq ($(WM_OSTYPE),MSwindows)
+## Add into libscotch instead of having a separate library
+LIBSCOTCHDEPS += library_error_exit$(OBJ)
+endif
+
##
## Todo list.
##
--- scotch_6.0.6/src/Makefile.orig 2018-07-14 17:24:49.000000000 +0200
+++ scotch_6.0.6/src/Makefile 2019-04-29 18:39:16.365132864 +0200
@@ -89,9 +89,18 @@
$(mandir)/man1 : $(mandir)
-$(MKDIR) $(mandir)/man1
+ifeq ($(WM_OSTYPE),MSwindows)
+
+libscotch : required
+ (cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) libscotch && $(MAKE) install)
+
+else
+
libscotch : required
(cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install)
+endif
+
scotch : libscotch
(cd scotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install)
(cd libscotchmetis ; $(MAKE) scotch && $(MAKE) install)

48
etc/patches/scotch_6.0.8 Normal file
View File

@ -0,0 +1,48 @@
--- scotch_6.0.6/src/libscotch/Makefile.orig 2019-04-29 14:59:53.957103493 +0200
+++ scotch_6.0.6/src/libscotch/Makefile 2019-04-29 18:50:42.560080675 +0200
@@ -51,6 +51,12 @@
.PHONY : ptscotch scotch ptinstall install clean realclean
+ifeq ($(WM_OSTYPE),MSwindows)
+
+libscotch : libscotch$(LIB) scotch.h
+
+endif
+
scotch :
$(MAKE) CC="$(CCS)" CCD="$(CCS)" \
scotch.h \
@@ -438,6 +444,11 @@
wgraph_part_zr$(OBJ) \
wgraph_store$(OBJ)
+ifeq ($(WM_OSTYPE),MSwindows)
+## Add into libscotch instead of having a separate library
+LIBSCOTCHDEPS += library_error_exit$(OBJ)
+endif
+
##
## Todo list.
##
--- scotch_6.0.6/src/Makefile.orig 2018-07-14 17:24:49.000000000 +0200
+++ scotch_6.0.6/src/Makefile 2019-04-29 18:39:16.365132864 +0200
@@ -89,9 +89,18 @@
$(mandir)/man1 : $(mandir)
-$(MKDIR) $(mandir)/man1
+ifeq ($(WM_OSTYPE),MSwindows)
+
+libscotch : required
+ (cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) libscotch && $(MAKE) install)
+
+else
+
libscotch : required
(cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install)
+endif
+
scotch : libscotch
(cd scotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install)
(cd libscotchmetis ; $(MAKE) scotch && $(MAKE) install)

48
etc/patches/scotch_6.0.9 Normal file
View File

@ -0,0 +1,48 @@
--- scotch_6.0.6/src/libscotch/Makefile.orig 2019-04-29 14:59:53.957103493 +0200
+++ scotch_6.0.6/src/libscotch/Makefile 2019-04-29 18:50:42.560080675 +0200
@@ -51,6 +51,12 @@
.PHONY : ptscotch scotch ptinstall install clean realclean
+ifeq ($(WM_OSTYPE),MSwindows)
+
+libscotch : libscotch$(LIB) scotch.h
+
+endif
+
scotch :
$(MAKE) CC="$(CCS)" CCD="$(CCS)" \
scotch.h \
@@ -438,6 +444,11 @@
wgraph_part_zr$(OBJ) \
wgraph_store$(OBJ)
+ifeq ($(WM_OSTYPE),MSwindows)
+## Add into libscotch instead of having a separate library
+LIBSCOTCHDEPS += library_error_exit$(OBJ)
+endif
+
##
## Todo list.
##
--- scotch_6.0.6/src/Makefile.orig 2018-07-14 17:24:49.000000000 +0200
+++ scotch_6.0.6/src/Makefile 2019-04-29 18:39:16.365132864 +0200
@@ -89,9 +89,18 @@
$(mandir)/man1 : $(mandir)
-$(MKDIR) $(mandir)/man1
+ifeq ($(WM_OSTYPE),MSwindows)
+
+libscotch : required
+ (cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) libscotch && $(MAKE) install)
+
+else
+
libscotch : required
(cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install)
+endif
+
scotch : libscotch
(cd scotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install)
(cd libscotchmetis ; $(MAKE) scotch && $(MAKE) install)

48
etc/patches/scotch_6.1.0 Normal file
View File

@ -0,0 +1,48 @@
--- scotch_6.0.6/src/libscotch/Makefile.orig 2019-04-29 14:59:53.957103493 +0200
+++ scotch_6.0.6/src/libscotch/Makefile 2019-04-29 18:50:42.560080675 +0200
@@ -51,6 +51,12 @@
.PHONY : ptscotch scotch ptinstall install clean realclean
+ifeq ($(WM_OSTYPE),MSwindows)
+
+libscotch : libscotch$(LIB) scotch.h
+
+endif
+
scotch :
$(MAKE) CC="$(CCS)" CCD="$(CCS)" \
scotch.h \
@@ -438,6 +444,11 @@
wgraph_part_zr$(OBJ) \
wgraph_store$(OBJ)
+ifeq ($(WM_OSTYPE),MSwindows)
+## Add into libscotch instead of having a separate library
+LIBSCOTCHDEPS += library_error_exit$(OBJ)
+endif
+
##
## Todo list.
##
--- scotch_6.0.6/src/Makefile.orig 2018-07-14 17:24:49.000000000 +0200
+++ scotch_6.0.6/src/Makefile 2019-04-29 18:39:16.365132864 +0200
@@ -89,9 +89,18 @@
$(mandir)/man1 : $(mandir)
-$(MKDIR) $(mandir)/man1
+ifeq ($(WM_OSTYPE),MSwindows)
+
+libscotch : required
+ (cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) libscotch && $(MAKE) install)
+
+else
+
libscotch : required
(cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install)
+endif
+
scotch : libscotch
(cd scotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install)
(cd libscotchmetis ; $(MAKE) scotch && $(MAKE) install)

View File

@ -3,12 +3,13 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2017-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# etc/pkgconfigAdjust # etc/pkgconfigAdjust
@ -33,29 +34,27 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party (parent) directory only # Run from third-party directory only
wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
echo "Error (${0##*/}) : current directory is not \$WM_THIRD_PARTY_DIR" echo "Error (${0##*/}) : current directory is not \$WM_THIRD_PARTY_DIR"
echo " Check your OpenFOAM environment and installation" echo " Check your OpenFOAM environment and installation"
exit 1 exit 1
} }
. etc/tools/ThirdPartyFunctions . "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printHelp() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [directory1 [... directoryN]] Usage: ${0##*/} [OPTION] [dir1 [... dirN]]
options: options:
-help -help
Adjust pkgconfig files after relocating third-party files. Adjust pkgconfig files after relocating third-party files.
Locates pkgconfig files under the lib/ or lib64/ directories and adjusts them Locates pkgconfig files under the lib/ or lib64/ directories and adjusts them
to use '${prefix}' instead of absolute directory paths where possible. to use '\${prefix}' instead of absolute directory paths where possible.
USAGE USAGE
exit 1 exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -64,7 +63,8 @@ while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help*) printHelp;;
-*) echo "Ignore unknown option" 1>&2 ;;
*) *)
pkgconfigAdjust "$1" pkgconfigAdjust "$1"

View File

@ -3,12 +3,13 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2017-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# etc/pkgconfigPrefix # etc/pkgconfigPrefix
@ -26,25 +27,23 @@
# #
# This allows this type of shell command # This allows this type of shell command
# #
# etc/pkgconfigPrefix $(find platforms -type d -name pkgconfig) # etc/pkgconfigPrefix $(find platforms -name pkgconfig -type d)
# #
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party (parent) directory only # Run from third-party directory only
wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
echo "Error (${0##*/}) : current directory is not \$WM_THIRD_PARTY_DIR" echo "Error (${0##*/}) : current directory is not \$WM_THIRD_PARTY_DIR"
echo " Check your OpenFOAM environment and installation" echo " Check your OpenFOAM environment and installation"
exit 1 exit 1
} }
. etc/tools/ThirdPartyFunctions . "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printHelp() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [directory1 [... directoryN]] Usage: ${0##*/} [OPTION] [dir1 [... dirN]]
options: options:
-help -help
@ -52,7 +51,7 @@ Set the 'prefix=' entry for pkgconfig files.
The pkgconfig files are located under lib/pkgconfig or lib64/pkgconfig. The pkgconfig files are located under lib/pkgconfig or lib64/pkgconfig.
USAGE USAGE
exit 1 exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -61,7 +60,7 @@ while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help*) printHelp;;
*) *)
pkgconfigNewPrefix "$1" pkgconfigNewPrefix "$1"

View File

@ -3,12 +3,14 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# etc/relocateQt # etc/relocateQt
@ -19,21 +21,19 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party (parent) directory only # Run from third-party directory only
wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
echo "Error (${0##*/}) : current directory is not \$WM_THIRD_PARTY_DIR" echo "Error (${0##*/}) : current directory is not \$WM_THIRD_PARTY_DIR"
echo " Check your OpenFOAM environment and installation" echo " Check your OpenFOAM environment and installation"
exit 1 exit 1
} }
. etc/tools/ThirdPartyFunctions . "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
. etc/tools/QtFunctions . "${WM_THIRD_PARTY_DIR:?}"/etc/tools/QtFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printHelp() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [qt-VERSION] Usage: ${0##*/} [OPTION] [qt-VERSION]
options: options:
-force Create qt.conf and edit pkgconfig to use \${prefix} -force Create qt.conf and edit pkgconfig to use \${prefix}
-help -help
@ -44,7 +44,7 @@ with a QT installation.
* adjust relocation prefix for $qtVERSION * adjust relocation prefix for $qtVERSION
USAGE USAGE
exit 1 exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
unset optForce unset optForce
@ -54,12 +54,12 @@ while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help*) printHelp;;
-f | -force) -f | -force)
optForce=true optForce=true
;; ;;
-qt-[1-9]* | [1-9]* | qt-*) -qt-[0-9]* | [0-9]* | qt-*)
# -qt-VERSION, VERSION, qt-VERSION, qt-everywhere-opensource-src-VERSION # -qt-VERSION, VERSION, qt-VERSION, qt-everywhere-opensource-src-VERSION
qtVERSION="${1%%/}"; qtVERSION="${1%%/}";
qtVERSION="${qtVERSION##*-}" qtVERSION="${qtVERSION##*-}"
@ -72,16 +72,17 @@ do
done done
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
QT_ARCH_PATH=$installBASE/qt-$qtVERSION
[ -n "$qtVERSION" ] || die "No QT version specified" PKG_PREFIX="$installBASE/qt-$qtVERSION"
[ -d "$QT_ARCH_PATH" ] || die "No QT installation"
[ -n "$qtVERSION" ] || die "No QT version specified"
[ -d "$PKG_PREFIX" ] || die "No QT installation"
if [ "${optForce:-false}" = true ] if [ "${optForce:-false}" = true ]
then then
# Create qt.conf and adjust locations to use '${prefix}' internally # Create qt.conf and adjust locations to use '${prefix}' internally
finalizeQt finalizeQt "$PKG_PREFIX"
fi fi
pkgconfigNewPrefix $QT_ARCH_PATH pkgconfigNewPrefix "$PKG_PREFIX"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

46
etc/testThirdPartyFunctions Executable file
View File

@ -0,0 +1,46 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2019-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# etc/testThirdPartyFunctions
#
# Description
# Simple ad hoc tests of etc/tools/ThirdPartyFunctions
#
#------------------------------------------------------------------------------
echo ========================================
echo "Calling environment"
echo "CC=$CC"
echo "CXX=$CXX"
echo
echo ========================================
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------
echo "CC=$(whichCC)"
echo "CXX=$(whichCXX)"
echo "mpicc=$(whichMpicc)"
echo "mpicxx=$(whichMpicxx)"
exportCompiler
echo ========================================
echo "using: $CC $CFLAGS"
echo "using: $CXX $CXXFLAGS"
echo
echo ========================================
#------------------------------------------------------------------------------

57
etc/tools/CMakeFunctions Normal file
View File

@ -0,0 +1,57 @@
#---------------------------------*- sh -*-------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2023 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/tools/CMakeFunction
#
# Description
# CMake make/install helper functions
#
#------------------------------------------------------------------------------
# Variables referenced by the functions. Initialization at the end of the file.
unset CMAKE_VARIABLES
unset withVERBOSE
BUILD_TYPE=Release # The cmake build type
#------------------------------------------------------------------------------
#
# Set CMake cache variables.
# Automatically adds -D prefix it needed
#
addCMakeVariable()
{
local i
for i
do
case "$i" in
('') ;; # empty
(-*) CMAKE_VARIABLES="${CMAKE_VARIABLES} ${i}" ;;
(*) CMAKE_VARIABLES="${CMAKE_VARIABLES} -D${i}" ;;
esac
done
}
#
# Verbose makefiles
#
addVerbosity()
{
if [ "${withVERBOSE:=false}" = true ]
then
addCMakeVariable "CMAKE_VERBOSE_MAKEFILE=TRUE"
fi
}
#------------------------------------------------------------------------------

View File

@ -2,22 +2,24 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2023 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# File # File
# etc/tools/ParaViewFunctions # etc/tools/ParaViewFunctions
# #
# Description # Description
# ParaView make/install helper functions # ParaView make/install helper functions
# To be loaded *after* etc/tools/CMakeFunctions
# #
# Note # Note
# Obtaining paths via 'python-config' is possible, but may not always # Obtaining paths via 'python-config' may not always resolve properly:
# resolve properly:
# #
# python-config --includes # python-config --includes
# >> # >>
@ -36,6 +38,7 @@ unset withMPI MPI_MAX_PROCS
unset withQT QT_VERSION QMAKE_PATH unset withQT QT_VERSION QMAKE_PATH
unset withMESA MESA_INCLUDE MESA_LIBRARY withOSMESA unset withMESA MESA_INCLUDE MESA_LIBRARY withOSMESA
unset withPYTHON PYTHON_INCLUDE PYTHON_LIBRARY unset withPYTHON PYTHON_INCLUDE PYTHON_LIBRARY
unset withPYTHON3
unset withGL2 unset withGL2
BUILD_TYPE=Release # The cmake build type BUILD_TYPE=Release # The cmake build type
@ -47,43 +50,62 @@ BUILD_TYPE=Release # The cmake build type
# Where things are or should be put # Where things are or should be put
# ParaView_VERSION and ParaView_MAJOR should already have been set # ParaView_VERSION and ParaView_MAJOR should already have been set
# #
# ParaView_SOURCE_DIR : location of the original sources # PARAVIEW_SOURCEDIR : location of the original sources
# ParaView_BUILD_DIR : location of the build # PARAVIEW_BUILDDIR : location of the build
# ParaView_DIR : location of the installed program # ParaView_DIR : location of the installed program
# #
setParaViewDirs() setParaViewDirs()
{ {
set -- "ParaView-$ParaView_VERSION" "ParaView-v$ParaView_VERSION" set -- "ParaView-$ParaView_VERSION" "ParaView-v$ParaView_VERSION"
unset PARAVIEW_SOURCEDIR PARAVIEW_BUILDDIR
unset ParaView_SOURCE_DIR # search
for i # - ThirdParty/PACKAGE
# - ThirdParty/sources/PACKAGE
# - ThirdParty/sources/paraview/PACKAGE
# - ThirdParty/sources/vtk/PACKAGE
for package in "$@"
do do
ParaView_SOURCE_DIR="$sourceBASE/$i" for check in \
[ -d "$ParaView_SOURCE_DIR" ] && break "$package" \
"sources/$package" \
"sources/paraview/$package" \
"sources/vtk/$package" \
;
do
if [ -d "$sourceBASE/$check" ]
then
echo "Found sources: $check" 1>&2
PARAVIEW_SOURCEDIR="$sourceBASE/$check"
break 2
fi
done
done done
[ -d "$ParaView_SOURCE_DIR" ] || { [ -d "$PARAVIEW_SOURCEDIR" ] || {
echo "Did not locate ParaView version:" echo "Did not locate ParaView version:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo echo
echo "In the directory:" echo "In the directory:"
echo " $sourceBASE" echo " $sourceBASE"
echo " \-- sources/paraview"
echo " |-- paraview"
echo " \\-- vtk"
echo echo
echo "abort build" echo "abort build"
exit 1 exit 1
} }
ParaView_BUILD_DIR=$buildBASE/ParaView-$ParaView_VERSION$BUILD_SUFFIX PARAVIEW_BUILDDIR="$buildBASE/ParaView-$ParaView_VERSION$BUILD_SUFFIX"
ParaView_DIR=$installBASE/ParaView-$ParaView_VERSION$BUILD_SUFFIX ParaView_DIR="$installBASE/ParaView-$ParaView_VERSION$BUILD_SUFFIX"
export GIT_DIR="$PARAVIEW_SOURCEDIR/.git" # Avoid seeing our own git-repo
export ParaView_SOURCE_DIR ParaView_BUILD_DIR ParaView_DIR export PARAVIEW_SOURCEDIR PARAVIEW_BUILDDIR ParaView_DIR
echo echo
echo "ParaView_SOURCE_DIR=$ParaView_SOURCE_DIR"
echo "ParaView_BUILD_DIR=$ParaView_BUILD_DIR"
echo "ParaView_DIR=$ParaView_DIR" echo "ParaView_DIR=$ParaView_DIR"
echo "PARAVIEW_SOURCEDIR=$PARAVIEW_SOURCEDIR"
export GIT_DIR=$ParaView_SOURCE_DIR/.git # Mask seeing our own git-repo echo "PARAVIEW_BUILDDIR=$PARAVIEW_BUILDDIR"
} }
@ -111,27 +133,20 @@ setParaViewVersion()
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# # addCMakeVariable : defined in etc/tools/CMakeFunctions
# Set CMake cache variables # addVerbosity : defined in etc/tools/CMakeFunctions
#
addCMakeVariable()
{
local i
for i
do
[ -n "$i" ] && CMAKE_VARIABLES="$CMAKE_VARIABLES -D$i"
done
}
# #
# Verbose makefiles # General settings (version-dependent)
# #
addVerbosity() addGeneral()
{ {
if [ "${withVERBOSE:=false}" = true ] if printf "${ParaView_MAJOR}"'\n%s\n' 5.6 | sort -V -C
then then
addCMakeVariable "CMAKE_VERBOSE_MAKEFILE=TRUE" # Paraview 5.6 and older
addCMakeVariable "BUILD_SHARED_LIBS=ON"
else
addCMakeVariable "PARAVIEW_BUILD_SHARED_LIBS=ON"
fi fi
} }
@ -151,6 +166,10 @@ addMpiSupport()
then then
addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS" addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS"
fi fi
echo "----"
echo "MPI information:"
echo " home : $MPI_HOME"
} }
@ -164,9 +183,17 @@ addPythonSupport()
return return
fi fi
local pythonBin pythonConfig pythonMajor local pythonBin="python"
local pythonConfig="python-config"
local pythonMajor
pythonBin=$(which python 2>/dev/null) || { if [ "$withPYTHON3" = true ]
then
pythonBin="python3"
pythonConfig="python3-config"
fi
pythonBin=$(which "$pythonBin" 2>/dev/null) || {
echo "*** Error: python not found" echo "*** Error: python not found"
echo "*** Deactivate python support by not using the -python " echo "*** Deactivate python support by not using the -python "
echo "*** option" echo "*** option"
@ -185,7 +212,7 @@ addPythonSupport()
# Fallback: get PYTHON_LIBRARY from dynamically linked binary # Fallback: get PYTHON_LIBRARY from dynamically linked binary
PYTHON_LIBRARY=$(ldd $pythonBin | \ PYTHON_LIBRARY=$(ldd "$pythonBin" | \
sed -ne '/libpython/s/^.* => \(.*\) (.*/\1/p') sed -ne '/libpython/s/^.* => \(.*\) (.*/\1/p')
[ -e "$PYTHON_LIBRARY" ] || { [ -e "$PYTHON_LIBRARY" ] || {
@ -203,7 +230,7 @@ addPythonSupport()
} }
# Guess major from library # Guess major from library
pythonMajor=$(echo $PYTHON_LIBRARY | sed 's/.*libpython\(.*\)\.so.*/\1/') pythonMajor=$(echo "$PYTHON_LIBRARY" | sed 's/.*libpython\(.*\)\.so.*/\1/')
if [ -n "$PYTHON_INCLUDE" ] if [ -n "$PYTHON_INCLUDE" ]
then then
@ -213,12 +240,12 @@ addPythonSupport()
echo "*** Error: Python.h not found at location specified " \ echo "*** Error: Python.h not found at location specified " \
"by -python-include : PYTHON_INCLUDE=$PYTHON_INCLUDE" "by -python-include : PYTHON_INCLUDE=$PYTHON_INCLUDE"
elif pythonConfig=$(which python-config 2>/dev/null) elif pythonConfig=$(which "$pythonConfig" 2>/dev/null)
then then
# Guess from python-config # Guess from python-config
# parse '-I/usr/include/python2.7 -I/usr/include/python2.7' # parse '-I/usr/include/python2.7 -I/usr/include/python2.7'
# -> '/usr/include/python2.7' # -> '/usr/include/python2.7'
PYTHON_INCLUDE=$(python-config --includes | sed -ne 's/^-I\([^ ][^ ]*\).*$/\1/p') PYTHON_INCLUDE=$("$pythonConfig" --includes | sed -ne 's/^-I\([^ ][^ ]*\).*$/\1/p')
else else
@ -234,7 +261,13 @@ addPythonSupport()
exit 1 exit 1
} }
addCMakeVariable "PARAVIEW_ENABLE_PYTHON=ON" if printf "${ParaView_MAJOR}"'\n%s\n' 5.7 | sort -V -C
then
# Paraview 5.7 and older
addCMakeVariable "PARAVIEW_ENABLE_PYTHON=ON"
else
addCMakeVariable "PARAVIEW_USE_PYTHON=ON"
fi
addCMakeVariable "PYTHON_INCLUDE_DIRS=$PYTHON_INCLUDE" addCMakeVariable "PYTHON_INCLUDE_DIRS=$PYTHON_INCLUDE"
addCMakeVariable "PYTHON_LIBRARY=$PYTHON_LIBRARY" addCMakeVariable "PYTHON_LIBRARY=$PYTHON_LIBRARY"
@ -257,7 +290,7 @@ addMesaSupport()
return return
fi fi
if [ -d "$MESA_INCLUDE" -a -f "$MESA_LIBRARY" ] if [ -d "$MESA_INCLUDE" ] && [ -f "$MESA_LIBRARY" ]
then then
addCMakeVariable "VTK_OPENGL_HAS_OSMESA=ON" addCMakeVariable "VTK_OPENGL_HAS_OSMESA=ON"
addCMakeVariable "OSMESA_INCLUDE_DIR=$MESA_INCLUDE" addCMakeVariable "OSMESA_INCLUDE_DIR=$MESA_INCLUDE"
@ -294,20 +327,27 @@ addQtSupport()
QT_VERSION=none QT_VERSION=none
: ${withQT:=true} # default is on : ${withQT:=true} # default is on
local qmake qtLib
local cmakeVarName="PARAVIEW_USE_QT"
if printf "${ParaView_MAJOR}"'\n%s\n' 5.7 | sort -V -C
then
# Paraview 5.7 and older
cmakeVarName="PARAVIEW_BUILD_QT_GUI"
fi
if [ "$withQT" = false ] if [ "$withQT" = false ]
then then
# Explicitly disabled # Explicitly disabled
addCMakeVariable "PARAVIEW_BUILD_QT_GUI=OFF" addCMakeVariable "$cmakeVarName=OFF"
return return
fi fi
local qmake qtLib
# Check qmake can be found and handle version differences # Check qmake can be found and handle version differences
qmake=$(findQMake) qmake=$(findQMake)
if QT_VERSION=$($qmake -query QT_VERSION 2>/dev/null) if QT_VERSION=$($qmake -query QT_VERSION 2>/dev/null)
then then
addCMakeVariable "PARAVIEW_BUILD_QT_GUI=ON" addCMakeVariable "$cmakeVarName=ON"
case "$QT_VERSION" in case "$QT_VERSION" in
(3.* | 4.[0-4]*) (3.* | 4.[0-4]*)
@ -364,7 +404,7 @@ ERROR
# #
patchParaView() patchParaView()
{ {
applyPatch "paraview-$ParaView_VERSION" "$ParaView_SOURCE_DIR" applyPatch "paraview-$ParaView_VERSION" "$PARAVIEW_SOURCEDIR"
} }
@ -376,17 +416,17 @@ configParaView()
local cmake=$(findCMake) local cmake=$(findCMake)
# Remove any existing build folder and recreate # Remove any existing build folder and recreate
if [ -d $ParaView_BUILD_DIR ] if [ -d "$PARAVIEW_BUILDDIR" ]
then then
echo "removing old build directory" echo "removing old build directory"
echo " $ParaView_BUILD_DIR" echo " $PARAVIEW_BUILDDIR"
rm -rf $ParaView_BUILD_DIR rm -rf "$PARAVIEW_BUILDDIR"
fi fi
mkdir -p $ParaView_BUILD_DIR mkdir -p "$PARAVIEW_BUILDDIR"
addCMakeVariable "CMAKE_BUILD_TYPE=$BUILD_TYPE" addCMakeVariable "CMAKE_BUILD_TYPE=$BUILD_TYPE"
cd $ParaView_BUILD_DIR || exit 1 # Change to build folder cd "$PARAVIEW_BUILDDIR" || exit # Change to build folder
echo "----" echo "----"
echo "Configuring paraview-$ParaView_VERSION (major version: $ParaView_MAJOR)" echo "Configuring paraview-$ParaView_VERSION (major version: $ParaView_MAJOR)"
@ -395,26 +435,26 @@ configParaView()
echo " MESA support : ${withMESA:-false}" echo " MESA support : ${withMESA:-false}"
echo " GL2 rendering : ${withGL2:-false}" echo " GL2 rendering : ${withGL2:-false}"
echo " QT dev support : ${withQT:-true}" echo " QT dev support : ${withQT:-true}"
echo " Source : $ParaView_SOURCE_DIR" echo " Source : $PARAVIEW_SOURCEDIR"
echo " Build : $ParaView_BUILD_DIR" echo " Build : $PARAVIEW_BUILDDIR"
echo " Target : $ParaView_DIR" echo " Target : $ParaView_DIR"
echo " cmake : $cmake" echo " cmake : $cmake"
echo " Build suffix : ${BUILD_SUFFIX:-none}" echo " Build suffix : ${BUILD_SUFFIX:-none}"
echo "----" echo "----"
echo echo
echo "$cmake" \ echo "$cmake" \
-DCMAKE_INSTALL_PREFIX=$ParaView_DIR \ -DCMAKE_INSTALL_PREFIX="$ParaView_DIR" \
$CMAKE_VARIABLES \ $CMAKE_VARIABLES \
$ParaView_SOURCE_DIR "$PARAVIEW_SOURCEDIR"
echo echo
echo "----" echo "----"
echo echo
# Run cmake to create Makefiles # Run cmake to create Makefiles
$cmake \ $cmake \
-DCMAKE_INSTALL_PREFIX=$ParaView_DIR \ -DCMAKE_INSTALL_PREFIX="$ParaView_DIR" \
$CMAKE_VARIABLES \ $CMAKE_VARIABLES \
$ParaView_SOURCE_DIR "$PARAVIEW_SOURCEDIR"
} }
@ -424,7 +464,7 @@ configParaView()
# #
makeParaView() makeParaView()
{ {
cd $ParaView_BUILD_DIR || exit 1 # Change to build folder cd "$PARAVIEW_BUILDDIR" || exit # Change to build folder
echo " Starting make" echo " Starting make"
time make -j $WM_NCOMPPROCS time make -j $WM_NCOMPPROCS
echo " Done make" echo " Done make"
@ -443,7 +483,7 @@ makeParaView()
# #
installParaView() installParaView()
{ {
cd $ParaView_BUILD_DIR || exit 1 # Change to build folder cd "$PARAVIEW_BUILDDIR" || exit # Change to build folder
echo " Installing ParaView to $ParaView_DIR" echo " Installing ParaView to $ParaView_DIR"
make install make install
@ -469,7 +509,7 @@ INFO
# Non-system installation of QT? # Non-system installation of QT?
case "$qtLib" in (/usr/lib | /usr/lib64) unset qtLib ;; esac case "$qtLib" in (/usr/lib | /usr/lib64) unset qtLib ;; esac
if [ "${qmake%/*}" != /usr/bin -a -d "$qtLib" ] if [ "${qmake%/*}" != /usr/bin ] && [ -d "$qtLib" ]
then then
/bin/cat<<INFO /bin/cat<<INFO
@ -485,7 +525,9 @@ INFO
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Start with these general settings # Start with these general settings
addCMakeVariable "BUILD_SHARED_LIBS=ON" "BUILD_TESTING=OFF"
# No testing
addCMakeVariable "BUILD_TESTING=OFF"
# Include development files in "make install" # Include development files in "make install"
addCMakeVariable "PARAVIEW_INSTALL_DEVELOPMENT_FILES=ON" addCMakeVariable "PARAVIEW_INSTALL_DEVELOPMENT_FILES=ON"

View File

@ -2,12 +2,14 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# File # File
# etc/tools/QtFunction # etc/tools/QtFunction
@ -31,18 +33,17 @@ unset qtVERSION # No default version
# #
createQtConf() createQtConf()
{ {
local confFile="$QT_ARCH_PATH/bin/qt.conf" local prefix="$1"
if [ -n "$prefix" ] && [ -d "$prefix/bin" ]
if [ -n "$QT_ARCH_PATH" -a -d "$QT_ARCH_PATH/bin" ]
then then
/bin/cat << QT_CONF > $confFile /bin/cat << QT_CONF > "$prefix/bin/qt.conf"
[Paths] [Paths]
Prefix=$QT_ARCH_PATH Prefix="$prefix"
QT_CONF QT_CONF
echo " created qt.conf" echo " created qt.conf"
else else
echo "Error: QT_ARCH_PATH not correctly set" echo "Error: qt-prefix <$prefix> not correctly set"
fi fi
} }
@ -54,9 +55,10 @@ QT_CONF
# #
finalizeQt() finalizeQt()
{ {
local prefix="$1"
echo "Create/Edit files to ease later relocation of a QT installation" echo "Create/Edit files to ease later relocation of a QT installation"
createQtConf createQtConf "$prefix"
pkgconfigAdjust $QT_ARCH_PATH pkgconfigAdjust "$prefix"
} }

View File

@ -2,12 +2,14 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# File # File
# etc/tools/ThirdPartyFunctions # etc/tools/ThirdPartyFunctions
@ -17,7 +19,16 @@
# #
# Define the standard buildBASE and installBASE for the platform # Define the standard buildBASE and installBASE for the platform
# Define WM_NCOMPPROCS always. # Define WM_NCOMPPROCS always.
#
# Compiler and flags are managed via the 'wmake -show-c, -show-cflags, ..'
# but also with WM_CC, WM_CFLAGS,... env variables
#
# Files
# Uses OpenFOAM/etc/config.sh/cmake (if it exists) for the
# CMAKE_ARCH_PATH that may specify a possible cmake/bin directory.
#
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
umask 0022 # Created files to be readable by all
# The normal locations for source, build and installation (prefix-dir) # The normal locations for source, build and installation (prefix-dir)
sourceBASE="$WM_THIRD_PARTY_DIR" sourceBASE="$WM_THIRD_PARTY_DIR"
@ -27,50 +38,274 @@ installBASE="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER"
# Synthetic value combining precision and label size (Eg, DPInt32) # Synthetic value combining precision and label size (Eg, DPInt32)
WM_SIZE_OPTIONS="${WM_PRECISION_OPTION}Int${WM_LABEL_SIZE}" WM_SIZE_OPTIONS="${WM_PRECISION_OPTION}Int${WM_LABEL_SIZE}"
# Dynamic library endings (default is .so) #------------------------------------------------------------------------------
[ "$(uname -s)" = Darwin ] && SO=dylib || SO=so # Make adjustments for non-standard build locations
# Specified a build-root
if [ -n "$FOAM_THIRD_PARTY_BUILDROOT" ]
then
if [ ! -d "$FOAM_THIRD_PARTY_BUILDROOT" ]
then
dir="$(dirname "$FOAM_THIRD_PARTY_BUILDROOT")"
if [ -d "$dir" ] && [ -w "$dir" ]
then
mkdir -m 0755 -p "$FOAM_THIRD_PARTY_BUILDROOT"
fi
# Also checks for failure of previous mkdir
if [ ! -d "$FOAM_THIRD_PARTY_BUILDROOT" ]
then
echo "Build-root: $FOAM_THIRD_PARTY_BUILDROOT" 1>&2
echo "Has invalid parent: $dir" 1>&2
exit 2
fi
fi
echo "Using build-root: $FOAM_THIRD_PARTY_BUILDROOT" 1>&2
# build/
_buildDir="${FOAM_THIRD_PARTY_BUILDROOT}/build"
mkdir -m 0755 -p "$_buildDir"
# Fully resolved
dir="$(cd "$_buildDir" 2>/dev/null && pwd -L)"
if [ -n "$dir" ]
then
buildBASE="$dir/$WM_ARCH$WM_COMPILER"
echo "Using build-dir: $dir" 1>&2
else
echo "Invalid build-dir: $_buildDir" 1>&2
exit 2
fi
# platforms/
_platformsDir="${FOAM_THIRD_PARTY_BUILDROOT}/platforms"
mkdir -m 0755 -p "$_platformsDir"
# Fully resolved
dir="$(cd "$_platformsDir" 2>/dev/null && pwd -L)"
if [ -n "$dir" ]
then
installBASE="$dir/$WM_ARCH$WM_COMPILER"
echo "Using platforms-dir: $dir" 1>&2
else
echo "Invalid platforms-dir: $_platformsDir" 1>&2
exit 2
fi
# Installation with non-standard platforms location
nonStandardPlatforms() { true; }
else
# Installation with standard platforms location
nonStandardPlatforms() { false; }
fi
# sources/
if [ -n "$FOAM_THIRD_PARTY_SOURCES" ]
then
# Fully resolved
dir="$(cd "$FOAM_THIRD_PARTY_SOURCES" 2>/dev/null && pwd -L)"
if [ -n "$dir" ]
then
sourceBASE="$dir"
echo "Using sources-dir: $dir" 1>&2
else
echo "Invalid sources-dir: $FOAM_THIRD_PARTY_SOURCES" 1>&2
exit 2
fi
fi
#------------------------------------------------------------------------------
# Dynamic library ending (default is .so)
EXT_SO="$(wmake -show-ext-so 2>/dev/null)"
if [ -z "$EXT_SO" ]
then
EXT_SO=.so
case "$WM_OSTYPE" in
*windows)
EXT_SO=.dll
;;
*)
[ Darwin = "$(uname -s 2>/dev/null)" ] && EXT_SO=.dylib
;;
esac
fi
# True if OS is <darwin>.
# Test EXT_SO for ".dylib" - avoid repeated uname system call
isDarwin()
{
[ "$EXT_SO" = .dylib ]
}
# Fallback values, needed for our scotch Makefile which uses
# WM_CFLAGS and WM_LDFLAGS for arch information
if [ -z "$WM_CFLAGS" ]
then
export WM_CFLAGS="$(wmake -show-cflags 2>/dev/null)"
fi
if [ -z "$WM_LDFLAGS" ]
then
export WM_LDFLAGS="$(wmake -show-cflags-arch 2>/dev/null)"
fi
unset BUILD_SUFFIX unset BUILD_SUFFIX
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Export WM compiler settings (and flags) for CMake/configure # Check for existence of shared library (without .so extension)
# $1 = true: export compiler flags too #
# $1 = The path and library stem
#
haveLibso()
{
if [ -z "$1" ]
then
return 1
elif [ -r "$1$EXT_SO" ]
then
return 0
elif [ "$EXT_SO" = .dll ] && [ -r "$1.dll.a" ]
then
# Including cross-compiling
return 0
fi
return 2
}
#------------------------------------------------------------------------------
# Service routine to strip out OpenFOAM-specific portions from the compiler
# flags (ie, everything after and including "-DOPENFOAM=...")
# while retaining '-fPIC'
#
# $1 = all flags concatenated as a single string
#
stripCompilerFlags()
{
local flags="${1%-DOPENFOAM=*}" # Strip out OpenFOAM-specific
flags="${flags## }" # Trim leading space
flags="${flags%% }" # Trim trailing space
# Retain -fPIC though
case "$flags" in
(*-fPIC*)
# -fPIC already included
;;
(*)
case "$1" in
(*-fPIC*)
# Add -fPIC back in (was after -DOPENFOAM=... content)
flags="$flags${flags+ }-fPIC"
;;
esac
;;
esac
echo "$flags"
}
# Export compiler settings (and flags) for CMake/configure
# based on the values from wmake -show-compile-*
#
# Since "wmake -show-XX" is only available after 1904, continue to support
# the previous env variables method (WM_CC, WM_CFLAGS, WM_CXX, WM_CXXFLAGS)
#
# $1 = "basic|minimal|strip" (optional)
#
# If the option 'basic' is provided, the OpenFOAM-specific portions of
# the flags are stripped out. Ie, everything after "-DOPENFOAM=..."
# but retaining '-fPIC'
#
exportCompiler() exportCompiler()
{ {
if test -n "$WM_CC" && command -v "$WM_CC" >/dev/null local option="$1"
local comp flag
# C compiler and flags
if ! comp="$(wmake -show-c 2>/dev/null)" \
|| ! flag="$(wmake -show-cflags 2>/dev/null)"
then then
export CC="$WM_CC" comp="$WM_CC"
if [ "$1" = true -a -n "$WM_CFLAGS" ] flag="$WM_CFLAGS"
fi
if test -n "$comp" && command -v "$comp" >/dev/null
then
export CC="$comp"
if [ -n "$flag" ]
then then
export CFLAGS="$WM_CFLAGS" case "$option" in
(basic | minimal | strip)
flag="$(stripCompilerFlags "$flag")"
;;
esac
export CFLAGS="$flag"
fi fi
fi fi
if test -n "$WM_CXX" && command -v "$WM_CXX" >/dev/null # C++ compiler and flags
if ! comp="$(wmake -show-cxx 2>/dev/null)" \
|| ! flag="$(wmake -show-cxxflags 2>/dev/null)"
then then
export CXX="$WM_CXX" comp="$WM_CXX"
if [ "$1" = true -a -n "$WM_CXXFLAGS" ] flag="$WM_CXXFLAGS"
fi
if test -n "$comp" && command -v "$comp" >/dev/null
then
export CXX="$comp"
if [ -n "$flag" ]
then then
export CXXFLAGS="$WM_CXXFLAGS" case "$option" in
(basic | minimal | strip)
flag="$(stripCompilerFlags "$flag")"
;;
esac
export CXXFLAGS="$flag"
fi fi
fi fi
} }
# Export WM linker settings for CMake/configure
# Export linker settings for CMake/configure
exportLinker() exportLinker()
{ {
if [ -n "$WM_LDFLAGS" ] local flag
# Linker flags, actually just the machine arch
flag="$(wmake -show-cflags-arch 2>/dev/null)" || flag="$WM_LDFLAGS"
if test -n "$flag"
then then
export LDFLAGS="$WM_LDFLAGS" export LDFLAGS="$flag"
fi fi
} }
# Force use of gcc/g++
# Force use of gcc/g++, but the values of CFLAGS, CXXFLAGS may be incorrect
useGcc() useGcc()
{ {
export CC=gcc export CC=gcc
export CXX=g++ export CXX=g++
} }
# Force use of system gcc/g++ (wmake compilation) without changing the
# WM_OPTIONS or output directories
useGccWmake()
{
export WM_COMPILER=Gcc
export WM_COMPILER_TYPE=system
}
# Scan arguments for a '-gcc' option, forcing gcc/g++ when found # Scan arguments for a '-gcc' option, forcing gcc/g++ when found
useGccFlag() useGccFlag()
{ {
@ -84,60 +319,145 @@ useGccFlag()
done done
} }
# Return <mpicc> by default or <mpiicc> if possible for INTELMPI. # Return current value of $CC if set or obtain from 'wmake -show-c',
# Cray doesn't have <mpicc>, but its <cc> manages mpi paths directly. # using $WM_CC (older env variable) as the first level fallback.
# NOTE: could further refine based on $CC or $WM_CC, but not yet needed # Final fallback is <gcc>
whichMpicc() whichCC()
{ {
local mpicc=$(command -v mpicc) local fallback='gcc'
case "$WM_MPLIB" in local comp="$CC"
(INTELMPI) local warn
mpicc=$(command -v mpiicc) # Intel <mpiicc> available?
;; if [ -z "$comp" ]
(CRAY-MPI*) then
: ${mpicc:=cc} # Cray <cc> if there is no <mpicc> comp="$(wmake -show-c 2>/dev/null)" || comp="$WM_CC"
;; if [ -n "$comp" ]
esac then
echo "${mpicc:-mpicc}" if ! command -v "$comp" >/dev/null
then
warn="C compiler '$comp' not found in path."
unset comp
fi
else
warn="No C compiler found via wmake."
fi
if [ -n "$warn" ]
then
echo "${warn} Defaulting to '${fallback}'" 1>&2
fi
fi
echo "${comp:-$fallback}"
} }
# Return <mpicc> by default or <mpiicc> if possible for INTELMPI. # Return current value of $CXX if set or obtain from 'wmake -show-cxx',
# Cray doesn't have <mpicc>, but its <cc> manages mpi paths directly. # using $WM_CXX (older env variable) as the first level fallback.
# NOTE: could further refine based on $CC or $WM_CC, but not yet needed # Final fallback is <g++>
whichMpicxx() whichCXX()
{ {
local mpicxx=$(command -v mpicxx) local fallback='g++'
local comp="$CXX"
local warn
if [ -z "$comp" ]
then
comp="$(wmake -show-cxx 2>/dev/null)" || comp="$WM_CXX"
if [ -n "$comp" ]
then
if ! command -v "$comp" >/dev/null
then
warn="CXX compiler '$comp' not found in path."
unset comp
fi
else
warn="No CXX compiler found via wmake."
fi
if [ -n "$warn" ]
then
echo "${warn} Defaulting to '${fallback}'" 1>&2
fi
fi
echo "${comp:-$fallback}"
}
# Return
# <mpicc> by default
# <mpifcc> for FJMPI (if possible)
# <mpiicc> for INTELMPI (if possible)
#
# Cray doesn't have <mpicc>, but its <cc> manages mpi paths directly.
# NOTE: could further refine based on "wmake -show-c", but not yet needed
whichMpicc()
{
local fallback='mpicc'
local comp="$(command -v $fallback)"
case "$WM_MPLIB" in case "$WM_MPLIB" in
(FJMPI)
comp="$(command -v mpifcc)" # Fujitsu <mpifcc> available?
;;
(INTELMPI) (INTELMPI)
mpicxx=$(command -v mpiicpc) # Intel <mpiicpc> available? comp="$(command -v mpiicc)" # Intel <mpiicc> available?
;; ;;
(CRAY-MPI*) (CRAY-MPI*)
: ${mpicxx:=CC} # Cray <CC> if there is no <mpicc> : "${comp:=cc}" # Cray <cc> if there is no <mpicc>
;; ;;
esac esac
echo "${mpicxx:-mpicxx}" echo "${comp:-$fallback}"
}
# Return
# <mpicxx> by default
# <mpiFCC> for FJMPI (if possible)
# <mpiicpc> for INTELMPI (if possible)
#
# Cray doesn't have <mpicxx>, but its <CC> manages mpi paths directly.
# NOTE: could further refine based on "wmake -show-cxx", but not yet needed
whichMpicxx()
{
local fallback='mpicxx'
local comp="$(command -v $fallback)"
case "$WM_MPLIB" in
(FJMPI)
comp="$(command -v mpiFCC)" # Fujitsu <mpiFCC> available?
;;
(INTELMPI)
comp="$(command -v mpiicpc)" # Intel <mpiicpc> available?
;;
(CRAY-MPI*)
: "${comp:=CC}" # Cray <CC> if there is no <mpicxx>
;;
esac
echo "${comp:-$fallback}"
} }
# Require wmkdepend etc when building with wmake # Require wmkdepend etc when building with wmake
# before 2020-04-03: wmake/platforms/linux64Gcc
# after 2020-04-03: platforms/tools/linux64Gcc
requireWMakeToolchain() requireWMakeToolchain()
{ {
local archName="$WM_ARCH$WM_COMPILER"
local wmDir="${WM_DIR:-$WM_PROJECT_DIR/wmake}" local wmDir="${WM_DIR:-$WM_PROJECT_DIR/wmake}"
local archDir="$wmDir/platforms/$WM_ARCH$WM_COMPILER" local archDir1="$wmDir/platforms/$archName"
local archDir2="$WM_PROJECT_DIR/platforms/tools/$archName"
if [ -x "$archDir/wmkdepend" ] || [ -x "$archDir/wmkdep" ] if [ -x "$archDir1/wmkdepend" ] || [ -x "$archDir1/wmkdep" ] || \
[ -x "$archDir2/wmkdepend" ] || [ -x "$archDir2/wmkdep" ]
then then
echo "Appear to have {wmkdepend,wmkdep} binary" 1>&2 echo "Appear to have {wmkdepend,wmkdep} binary" 1>&2
else else
echo "Warning: appear to be missing {wmkdepend,wmkdep} binary ... building" 1>&2 echo "Warning: appear to be missing {wmkdepend,wmkdep} binary ... building" 1>&2
( cd "$wmDir/src" && make -s ) ( cd "$wmDir/src" && make -s )
[ -x "$archDir/wmkdepend" ] || [ -x "$archDir/wmkdep" ] || { [ -x "$archDir1/wmkdepend" ] || [ -x "$archDir1/wmkdep" ] || \
[ -x "$archDir2/wmkdepend" ] || [ -x "$archDir2/wmkdep" ] || {
exec 1>&2 exec 1>&2
echo echo
echo "Error: cannot use wmake build for '${0##*/}" echo "Error: cannot use wmake build for '${0##*/}"
echo " Missing {wmkdepend,wmkdep} binary" echo " Missing {wmkdepend,wmkdep} binary"
echo " Please try run the top-level OpenFOAM Allwmake first" echo " Please run the top-level OpenFOAM Allwmake first"
echo " or top-level wmake/src/Allmake"
echo echo
exit 1 exit 1
} }
@ -145,6 +465,186 @@ requireWMakeToolchain()
} }
# Require FOAM_EXT_LIBBIN for some compilations
requireExtLibBin()
{
[ -n "$FOAM_EXT_LIBBIN" ] || {
exec 1>&2
echo
echo "Error: \$FOAM_EXT_LIBBIN not set for '${0##*/}"
echo " Check your OpenFOAM environment and installation"
echo
exit 1
}
}
# grep for package http or ftp entries in BUILD.md
# Should be of the form "[link xx]: http://..."
showDownloadHint()
{
local package
if [ -f "$WM_THIRD_PARTY_DIR/BUILD.md" ]
then
for package in "$@"
do
echo "Possible download locations for $package :" 1>&2
if [ -f "$WM_THIRD_PARTY_DIR/BUILD.md" ]
then
grep -i "$package" "$WM_THIRD_PARTY_DIR/BUILD.md" | \
grep -E '(http|ftp)' | sed -ne 's/^ *\[.*\]: */ /p' | \
uniq
fi
done
else
echo "No BUILD.md available" 1>&2
fi
}
#
# Resolve the appropriate source directory for the given PACKAGE
#
# checks:
# - ThirdParty/PACKAGE
# - ThirdParty/sources/PACKAGE
# - ThirdParty/sources/canonical/PACKAGE
#
# Where the 'canonical' name is simply the lowercase version of PACKAGE
# without any version information.
# Eg, "ParaView-5.9.0" -> "paraview"
# but also accept "0config-v1.2" -> "0config"
#
# Optional flags:
# -absolute : report absolute path [default]
# -relative : report path relative to sourceBASE (ThirdParty)
#
findSourceDir()
{
local package subdir optRelative
case "$1" in
(-abs*)
optRelative=false
shift
;;
(-rel*)
optRelative=true
shift
;;
esac
for package in "$@"
do
subdir="$(basename "$package" | tr '[:upper:]' '[:lower:]' |\
sed -ne 's#^\([0-9]*[a-z]*\).*#\1#p')"
for check in \
"$package" \
"$subdir/$package" \
"sources/$package" \
"sources/$subdir/$package" \
;
do
if [ -d "$sourceBASE/$check" ]
then
echo "Found sources: $check" 1>&2
if [ "${optRelative:-false}" = true ]
then
echo "$check"
else
echo "$sourceBASE/$check"
fi
return 0
fi
done
done
# Fallback. Report if missing (unless none or system)
case "${1##*-}" in
(none | system)
;;
(*)
echo "Did not find ... $@" 1>&2
esac
echo "$sourceBASE/${1:-missing-package-name}"
}
# List available unpacked source versions
#
# checks:
# - ThirdParty/PACKAGE
# - ThirdParty/sources/PACKAGE
# - ThirdParty/sources/canonical/PACKAGE
#
# Output style
# -dirs : report the names with relative directory
# -names : report the names only (without directory)
# -long : report the names with full (absolute) directory
listPackageVersions()
{
local package
local optOutput=short
case "$1" in
(-long | -full)
optOutput=long
shift
;;
(-dirs | -short)
optOutput=dirs
shift
;;
(-names)
optOutput=names
shift
;;
esac
if [ "$#" -gt 0 ]
then
(
cd "$sourceBASE" 2>/dev/null || exit
for package in "$@"
do
# Canonical short name
package="$(basename "$package" | tr '[:upper:]' '[:lower:]' |\
sed -ne 's#^\([0-9]*[a-z]*\).*$#\1#p')"
[ -n "$package" ] || continue
for dir in . ./"$package" sources sources/"$package"
do
# Find package-version (ie, when it has separators)
find "$dir" -maxdepth 1 \
-iname "${package}*[-_]*" -type d 2>/dev/null | \
sed -e 's#^[./]*##' | sort
done | \
case "$optOutput" in
(long)
sed -e "s#^#$sourceBASE/#" # Add source-dir prefix
;;
(names)
# Basenames only. Squash out potential duplicates
sed -e 's#^.*/##' | sort | uniq
;;
(*)
# Relative - no change
sed -e ''
;;
esac
done
)
fi
}
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Some functions as per OpenFOAM etc/config.sh/functions # Some functions as per OpenFOAM etc/config.sh/functions
@ -191,12 +691,15 @@ setBuildSuffix()
# #
# Mostly building without wmake # Mostly building without wmake
# - disable wmakeScheduler variables # - disable wmakeScheduler variables
# - use max number of cores for building # - use max number of cores for building, unless already defined
# #
unset WM_HOSTS WM_SCHEDULER unset WM_HOSTS WM_SCHEDULER
WM_NCOMPPROCS=$(getconf _NPROCESSORS_ONLN 2>/dev/null) || WM_NCOMPPROCS=1 if [ -z "$WM_NCOMPPROCS" ]
: ${WM_NCOMPPROCS:=1} then
WM_NCOMPPROCS=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
: "${WM_NCOMPPROCS:=1}"
fi
export WM_NCOMPPROCS export WM_NCOMPPROCS
@ -220,6 +723,24 @@ die()
exit 1 exit 1
} }
# Warn
warnBuildIssues()
{
echo
echo " ---------------------------------------------------"
echo " Optional component ($1) had build issues"
echo " OpenFOAM will nonetheless remain largely functional"
echo " ---------------------------------------------------"
echo
}
# Warn
warnNotFound()
{
echo "Optional component ($1) was not found"
}
# Test if it matches "*-none" # Test if it matches "*-none"
_foamIsNone() _foamIsNone()
{ {
@ -242,6 +763,7 @@ _foamIsSystem()
unset CMAKE_PATH # clear when first loaded unset CMAKE_PATH # clear when first loaded
findCMake() findCMake()
{ {
local config="config.sh/cmake"
local candidate foundExe local candidate foundExe
if [ -n "$CMAKE_PATH" ] if [ -n "$CMAKE_PATH" ]
@ -250,13 +772,13 @@ findCMake()
if [ -d "$CMAKE_PATH" ] if [ -d "$CMAKE_PATH" ]
then then
for candidate in \ for candidate in \
$CMAKE_PATH/cmake \ "$CMAKE_PATH"/cmake \
$CMAKE_PATH/bin/cmake \ "$CMAKE_PATH"/bin/cmake \
; ;
do do
if [ -f "$candidate" -a -x "$candidate" ] if [ -f "$candidate" ] && [ -x "$candidate" ]
then then
foundExe=$candidate foundExe="$candidate"
break break
fi fi
done done
@ -266,14 +788,14 @@ findCMake()
if [ -z "$foundExe" ] if [ -z "$foundExe" ]
then then
for candidate in \ for candidate in \
$CMAKE_PATH \ "$CMAKE_PATH" \
$installBASE/$CMAKE_PATH/bin/cmake \ "$installBASE/$CMAKE_PATH"/bin/cmake \
$installBASE/cmake-$CMAKE_PATH/bin/cmake \ "$installBASE/cmake-$CMAKE_PATH"/bin/cmake \
; ;
do do
if [ -f "$candidate" -a -x "$candidate" ] if [ -f "$candidate" ] && [ -x "$candidate" ]
then then
foundExe=$candidate foundExe="$candidate"
break break
fi fi
done done
@ -287,26 +809,45 @@ findCMake()
foundExe="$(cd ${foundExe%/cmake} 2>/dev/null && pwd)/cmake" foundExe="$(cd ${foundExe%/cmake} 2>/dev/null && pwd)/cmake"
fi fi
echo "Using cmake=$foundExe" 1>&2 echo "Using cmake=$foundExe" 1>&2
echo $foundExe echo "$foundExe"
return 0 return 0
else else
cat << NOT_FOUND 1>&2 cat << NOT_FOUND 1>&2
'cmake' not found under specified CMAKE_PATH 'cmake' not found under specified CMAKE_PATH
CMAKE_PATH=$CMAKE_PATH CMAKE_PATH=$CMAKE_PATH
reverting to using command from path reverting to using command from $config or from PATH
NOT_FOUND NOT_FOUND
fi fi
fi fi
unset cmake_version CMAKE_ARCH_PATH
if candidate="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config" 2>/dev/null)"
then
. "$candidate"
for candidate in \
"$CMAKE_ARCH_PATH"/bin/cmake \
"$installBASE/$cmake_version"/bin/cmake \
;
do
if [ -f "$candidate" ] && [ -x "$candidate" ]
then
echo "Using cmake=$candidate" 1>&2
echo "$candidate"
return 0
fi
done
fi
# Default to use the path, try resolving (so we know what we are using). # Default to use the path, try resolving (so we know what we are using).
for candidate in cmake for candidate in cmake
do do
foundExe=$(command -v $candidate 2>/dev/null) && break foundExe="$(command -v "$candidate" 2>/dev/null)" && break
done done
: ${foundExe:=false} : "${foundExe:=false}"
echo "Using cmake=$foundExe" 1>&2 echo "Using cmake=$foundExe" 1>&2
echo $foundExe echo "$foundExe"
} }
@ -327,13 +868,13 @@ findQMake()
if [ -d "$QMAKE_PATH" ] if [ -d "$QMAKE_PATH" ]
then then
for candidate in \ for candidate in \
$QMAKE_PATH/qmake \ "$QMAKE_PATH"/qmake \
$QMAKE_PATH/bin/qmake \ "$QMAKE_PATH"/bin/qmake \
; ;
do do
if [ -f "$candidate" -a -x "$candidate" ] if [ -f "$candidate" ] && [ -x "$candidate" ]
then then
foundExe=$candidate foundExe="$candidate"
break break
fi fi
done done
@ -343,14 +884,14 @@ findQMake()
if [ -z "$foundExe" ] if [ -z "$foundExe" ]
then then
for candidate in \ for candidate in \
$QMAKE_PATH \ "$QMAKE_PATH" \
$installBASE/$QMAKE_PATH/bin/qmake \ "$installBASE/$QMAKE_PATH"/bin/qmake \
$installBASE/qt-$QMAKE_PATH/bin/qmake \ "$installBASE/qt-$QMAKE_PATH"/bin/qmake \
; ;
do do
if [ -f "$candidate" -a -x "$candidate" ] if [ -f "$candidate" ] && [ -x "$candidate" ]
then then
foundExe=$candidate foundExe="$candidate"
break break
fi fi
done done
@ -364,13 +905,13 @@ findQMake()
foundExe="$(cd ${foundExe%/qmake} 2>/dev/null && pwd)/qmake" foundExe="$(cd ${foundExe%/qmake} 2>/dev/null && pwd)/qmake"
fi fi
echo "Using qmake=$foundExe" 1>&2 echo "Using qmake=$foundExe" 1>&2
echo $foundExe echo "$foundExe"
return 0 return 0
else else
cat << NOT_FOUND 1>&2 cat << NOT_FOUND 1>&2
'qmake' not found under specified QMAKE_PATH 'qmake' not found under specified QMAKE_PATH
QMAKE_PATH=$QMAKE_PATH QMAKE_PATH=$QMAKE_PATH
reverting to using command from path reverting to using command from PATH
NOT_FOUND NOT_FOUND
fi fi
fi fi
@ -379,9 +920,9 @@ NOT_FOUND
# Some systems have qmake-qt5 as well as qmake # Some systems have qmake-qt5 as well as qmake
for candidate in qmake-qt5 qmake for candidate in qmake-qt5 qmake
do do
foundExe=$(command -v $candidate 2>/dev/null) && break foundExe="$(command -v "$candidate" 2>/dev/null)" && break
done done
: ${foundExe:=false} : "${foundExe:=false}"
echo "Using qmake=$foundExe" 1>&2 echo "Using qmake=$foundExe" 1>&2
echo $foundExe echo $foundExe
@ -395,7 +936,7 @@ pkgconfigNewPrefix()
{ {
local dir="${1%%/}" local dir="${1%%/}"
if [ -n "$dir" -a -d "$dir" ] if [ -n "$dir" ] && [ -d "$dir" ]
then then
# Require absolute path, but use logical (not physical) location # Require absolute path, but use logical (not physical) location
[ "${dir}" != "${dir#/}" ] || dir=$(cd $dir 2>/dev/null && /bin/pwd -L) [ "${dir}" != "${dir#/}" ] || dir=$(cd $dir 2>/dev/null && /bin/pwd -L)
@ -421,7 +962,7 @@ pkgconfigNewPrefix()
[ -d "$dir/$libdir" ] || continue [ -d "$dir/$libdir" ] || continue
for i in $dir/$libdir/*.pc for i in $dir/$libdir/*.pc
do do
if [ -f "$i" -a ! -L "$i" ] if [ -f "$i" ] && [ ! -L "$i" ]
then then
nfiles="x$nfiles" nfiles="x$nfiles"
sed -i~ -e 's@^\(prefix=\).*$@\1'"$dir@" $i sed -i~ -e 's@^\(prefix=\).*$@\1'"$dir@" $i
@ -443,7 +984,7 @@ pkgconfigAdjust()
{ {
local dir="${1%%/}" local dir="${1%%/}"
if [ -n "$dir" -a -d "$dir" ] if [ -n "$dir" ] && [ -d "$dir" ]
then then
# Require absolute path, but use logical (not physical) location # Require absolute path, but use logical (not physical) location
[ "${dir}" != "${dir#/}" ] || dir=$(cd $dir 2>/dev/null && /bin/pwd -L) [ "${dir}" != "${dir#/}" ] || dir=$(cd $dir 2>/dev/null && /bin/pwd -L)
@ -469,7 +1010,7 @@ pkgconfigAdjust()
[ -d "$dir/$libdir" ] || continue [ -d "$dir/$libdir" ] || continue
for i in $dir/$libdir/*.pc for i in $dir/$libdir/*.pc
do do
if [ -f "$i" -a ! -L "$i" ] if [ -f "$i" ] && [ ! -L "$i" ]
then then
nfiles="x$nfiles" nfiles="x$nfiles"
sed -i~ \ sed -i~ \
@ -514,23 +1055,23 @@ downloadFile()
# $2 = TARGET DIRECTORY (optional) # $2 = TARGET DIRECTORY (optional)
cpMakeFiles() cpMakeFiles()
{ {
[ "$#" -eq 1 -o "$#" -eq 2 ] || { [ "$#" -eq 1 ] || [ "$#" -eq 2 ] || {
echo "cpMakeFiles called with incorrect number of arguments $@" echo "cpMakeFiles called with incorrect number of arguments $@"
return 1 return 1
} }
local pkg=$1 local pkg="$1"
local dst="${2:-.}" local dst="${2:-.}"
echo "cpMakeFiles" $pkg $dst echo "cpMakeFiles" "$pkg" "$dst"
wmakeFiles=$WM_THIRD_PARTY_DIR/etc/makeFiles/$pkg wmakeFiles="$WM_THIRD_PARTY_DIR/etc/makeFiles/$pkg"
for i in $(cd $wmakeFiles && find . -type f) for i in $(cd $wmakeFiles && find . -type f)
do do
d=${i%/*} # dirname d="${i%/*}" # dirname
b=${i##*/} # basename b="${i##*/}" # basename
mkdir -p $dst/$d/Make 2>/dev/null mkdir -p "$dst/$d"/Make 2>/dev/null
# NOTE the behaviour of '-nt' can cause problems # NOTE the behaviour of '-nt' can cause problems
# #
@ -540,9 +1081,9 @@ cpMakeFiles()
# - dash, zsh (and maybe others) # - dash, zsh (and maybe others)
# False, if file1 or file2 does not exist # False, if file1 or file2 does not exist
# #
if [ ! -e $dst/$d/Make/$b -o $wmakeFiles/$i -nt $dst/$d/Make/$b ] if [ ! -e "$dst/$d/Make/$b" -o "$wmakeFiles/$i" -nt "$dst/$d/Make/$b" ]
then then
cp $wmakeFiles/$i $dst/$d/Make/$b cp "$wmakeFiles/$i" "$dst/$d/Make/$b"
fi fi
done done
} }
@ -570,7 +1111,7 @@ applyPatch()
if [ -r "$patch" ] if [ -r "$patch" ]
then then
( (
cd $dst || exit 1 cd "$dst" || exit
if [ -f "$sentinel" ] if [ -f "$sentinel" ]
then then
echo "patch for $pkg was already applied" echo "patch for $pkg was already applied"

View File

@ -2,19 +2,20 @@
# ========= | # ========= |
# \\ / 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 | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2016-2023 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# File # File
# etc/tools/vtkFunctions # etc/tools/vtkFunctions
# #
# Description # Description
# VTK (library) make/install helper functions. # VTK (library) make/install helper functions.
# To be loaded *after* etc/tools/ParaViewFunctions # To be loaded *after* etc/tools/CMakeFunctions, ParaViewFunctions
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -29,43 +30,62 @@ unset CMAKE_VARIABLES
# Where things are or should be put # Where things are or should be put
# VTK_VERSION and VTK_MAJOR should already have been set # VTK_VERSION and VTK_MAJOR should already have been set
# #
# VTK_SOURCE_DIR : location of the original sources # VTK_SOURCEDIR : location of the original sources
# VTK_BUILD_DIR : location of the build # VTK_BUILDDIR : location of the build
# VTK_DIR : location of the installed program # VTK_DIR : location of the installed program
# #
setVtkDirs() setVtkDirs()
{ {
set -- "VTK-$VTK_VERSION" "VTK-v$VTK_VERSION" set -- "VTK-$VTK_VERSION" "VTK-v$VTK_VERSION"
unset VTK_SOURCE_DIR unset VTK_SOURCEDIR VTK_BUILDDIR
for i # search
# - ThirdParty/PACKAGE
# - ThirdParty/sources/PACKAGE
# - ThirdParty/sources/vtk/PACKAGE
# - ThirdParty/sources/paraview/PACKAGE
for package in "$@"
do do
VTK_SOURCE_DIR="$sourceBASE/$i" for check in \
[ -d "$VTK_SOURCE_DIR" ] && break "$package" \
"sources/$package" \
"sources/vtk/$package" \
"sources/paraview/$package" \
;
do
if [ -d "$sourceBASE/$check" ]
then
echo "Found sources: $check" 1>&2
VTK_SOURCEDIR="$sourceBASE/$check"
break 2
fi
done
done done
[ -d "$VTK_SOURCE_DIR" ] || { [ -d "$VTK_SOURCEDIR" ] || {
echo "Did not locate VTK version:" echo "Did not locate VTK version:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo echo
echo "In the directory:" echo "In the directory:"
echo " $sourceBASE" echo " $sourceBASE"
echo " \-- sources/paraview"
echo " |-- vtk"
echo " \\-- paraview"
echo echo
echo "abort build" echo "abort build"
exit 1 exit 1
} }
VTK_BUILD_DIR=$buildBASE/VTK-$VTK_VERSION$BUILD_SUFFIX VTK_BUILDDIR="$buildBASE/VTK-$VTK_VERSION$BUILD_SUFFIX"
VTK_DIR=$installBASE/VTK-$VTK_VERSION$BUILD_SUFFIX VTK_DIR="$installBASE/VTK-$VTK_VERSION$BUILD_SUFFIX"
export GIT_DIR="$VTK_SOURCEDIR/.git" # Avoid seeing our own git-repo
export VTK_SOURCE_DIR VTK_BUILD_DIR VTK_DIR export VTK_SOURCEDIR VTK_BUILDDIR VTK_DIR
echo echo
echo "VTK_SOURCE_DIR=$VTK_SOURCE_DIR"
echo "VTK_BUILD_DIR=$VTK_BUILD_DIR"
echo "VTK_DIR=$VTK_DIR" echo "VTK_DIR=$VTK_DIR"
echo "VTK_SOURCEDIR=$VTK_SOURCEDIR"
export GIT_DIR=$VTK_SOURCE_DIR/.git # Mask seeing our own git-repo echo "VTK_BUILDDIR=$VTK_BUILDDIR"
} }
@ -98,7 +118,7 @@ setVtkVersion()
# #
patchVTK() patchVTK()
{ {
applyPatch "vtk-$VTK_VERSION" "$VTK_SOURCE_DIR" applyPatch "vtk-$VTK_VERSION" "$VTK_SOURCEDIR"
} }
@ -110,41 +130,41 @@ configVTK()
local cmake=$(findCMake) local cmake=$(findCMake)
# Remove any existing build folder and recreate # Remove any existing build folder and recreate
if [ -d $VTK_BUILD_DIR ] if [ -d "$VTK_BUILDDIR" ]
then then
echo "removing old build directory" echo "removing old build directory"
echo " $VTK_BUILD_DIR" echo " $VTK_BUILDDIR"
rm -rf $VTK_BUILD_DIR rm -rf "$VTK_BUILDDIR"
fi fi
mkdir -p $VTK_BUILD_DIR mkdir -p "$VTK_BUILDDIR"
addCMakeVariable "CMAKE_BUILD_TYPE=$BUILD_TYPE" addCMakeVariable "CMAKE_BUILD_TYPE=$BUILD_TYPE"
cd $VTK_BUILD_DIR || exit 1 # change to build folder cd "$VTK_BUILDDIR" || exit # Change to build folder
echo "----" echo "----"
echo "Configuring VTK-$VTK_VERSION" echo "Configuring VTK-$VTK_VERSION"
echo " MESA support : ${withMESA:-false}" echo " MESA support : ${withMESA:-false}"
echo " Source : $VTK_SOURCE_DIR" echo " Source : $VTK_SOURCEDIR"
echo " Build : $VTK_BUILD_DIR" echo " Build : $VTK_BUILDDIR"
echo " Target : $VTK_DIR" echo " Target : $VTK_DIR"
echo " cmake : $cmake" echo " cmake : $cmake"
echo " Build suffix : ${BUILD_SUFFIX:-none}" echo " Build suffix : ${BUILD_SUFFIX:-none}"
echo "----" echo "----"
echo echo
echo "$cmake" \ echo "$cmake" \
-DCMAKE_INSTALL_PREFIX=$VTK_DIR \ -DCMAKE_INSTALL_PREFIX="$VTK_DIR" \
$CMAKE_VARIABLES \ $CMAKE_VARIABLES \
$VTK_SOURCE_DIR "$VTK_SOURCEDIR"
echo echo
echo "----" echo "----"
echo echo
# Run cmake to create Makefiles # Run cmake to create Makefiles
$cmake \ $cmake \
-DCMAKE_INSTALL_PREFIX=$VTK_DIR \ -DCMAKE_INSTALL_PREFIX="$VTK_DIR" \
$CMAKE_VARIABLES \ $CMAKE_VARIABLES \
$VTK_SOURCE_DIR "$VTK_SOURCEDIR"
} }
@ -167,6 +187,10 @@ addMpiSupport()
then then
addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS" addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS"
fi fi
echo "----"
echo "MPI information:"
echo " home : $MPI_HOME"
} }
@ -176,7 +200,7 @@ addMpiSupport()
# #
makeVTK() makeVTK()
{ {
cd $VTK_BUILD_DIR || exit 1 # Change to build folder cd "$VTK_BUILDDIR" || exit # Change to build folder
echo " Starting make" echo " Starting make"
time make -j $WM_NCOMPPROCS time make -j $WM_NCOMPPROCS
@ -193,7 +217,7 @@ makeVTK()
# #
installVTK() installVTK()
{ {
cd $VTK_BUILD_DIR || exit 1 # Change to build folder cd "$VTK_BUILDDIR" || exit # Change to build folder
echo " Installing VTK to $VTK_DIR" echo " Installing VTK to $VTK_DIR"
make install make install

358
makeADIOS
View File

@ -1,358 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# Script
# makeADIOS
#
# Description
# Build script for ADIOS
#
# ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------
# Run from third-party directory only
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
#------------------------------------------------------------------------------
# ADIOS version from OpenFOAM etc/config.sh file:
_foamConfig ADIOS
adiosPACKAGE=${adios_version:-adios-none}
#------------------------------------------------------------------------------
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/} [OPTION] [adios-VERSION] [-- configure-options]
options:
-cmake PATH With cmake from the path given
-gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX
-help
* Build ADIOS
$adiosPACKAGE
USAGE
exit 1
}
#------------------------------------------------------------------------------
exportCompiler true # Compiler info + flags for CMake/configure
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
--) break;; # Extra configure options (leave on $@ for later detection)
-h | -help) usage ;;
-gcc) useGcc ;;
-cmake)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
CMAKE_PATH="${2%%/}"
shift
;;
ADIOS-[1-9]* | adios-[1-9]* | ADIOS-git* | adios-git*)
adiosPACKAGE="${1%%/}"
;;
*)
die "unknown option/argument: '$1'"
;;
esac
shift
done
[ -n "$adiosPACKAGE" ] || die "The adios-VERSION was not specified"
# Nothing to build
if _foamIsNone "$adiosPACKAGE"
then
echo "Using adios-none (skip ThirdParty build of ADIOS)"
exit 0
elif _foamIsSystem "$adiosPACKAGE"
then
echo "Using adios-system"
exit 0
fi
#------------------------------------------------------------------------------
#
# Build ADIOS
# ADIOS_SOURCE_DIR : location of the original sources
# ADIOS_ARCH_PATH : installation directory
ADIOS_SOURCE_DIR=$sourceBASE/$adiosPACKAGE
ADIOS_ARCH_PATH=$installBASE/$adiosPACKAGE
: ${FOAM_MPI:=dummy}
echo
echo ========================================
echo "Build adios library $adiosPACKAGE for $FOAM_MPI"
echo
#
# Manual adjustments to adios config
#
adjustADIOS()
{
# Rename libraries according to FOAM_MPI
(
cd $ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH || exit 1
if [ "$FOAM_MPI" != dummy ]
then
\mv -f libadios.a libadios_$FOAM_MPI.a
\mv -f libadiosread.a libadiosread_$FOAM_MPI.a
fi
\mv -f libadios_nompi.a libadios_dummy.a
\mv -f libadiosread_nompi.a libadiosread_dummy.a
echo
echo "ADIOS library renamed to libadios_$FOAM_MPI"
echo
)
# We don't need/use XML things
\rm -f $ADIOS_ARCH_PATH/bin/adios_lint
# Replace resolved paths with variables
echo "Adjust prefix for ADIOS"
for i in \
$ADIOS_ARCH_PATH/bin/adios_config \
$ADIOS_ARCH_PATH/etc/adios_config.flags \
;
do
[ -f "$i" ] || {
echo " no such file - '$i'"
continue
}
if sed -i -e 's|'"$WM_THIRD_PARTY_DIR"'|$WM_THIRD_PARTY_DIR|g' $i
then
echo " '$i'"
else
echo " problems with '$i'"
fi
done
# Adjust the config flags file:
# * Remove references to Fortran libraries (disabled in configure)
# * Remove references to deprecated version 1 API
# * Cleanup excessive whitespace
# * Handle renamed libraries:
# - libadios -> libadios_$FOAM_MPI
# - libadios_nompi -> libadios_dummy
#
echo "Adjust library names for ADIOS"
for i in \
$ADIOS_ARCH_PATH/etc/adios_config.flags \
;
do
[ -f "$i" ] || {
echo " no such file - '$i'"
continue
}
if sed -i \
-e '/_FLIB=/d' \
-e '/_V1_INC=/d' \
-e 's| *| |g' \
-e 's|\(-ladios[a-z]*_\)nompi |\1dummy |g' \
$i
then
echo " '$i'"
else
echo " problems with '$i'"
fi
if [ "$FOAM_MPI" != dummy ]
then
sed -i -e 's|\(-ladios[a-z]*\) |\1_'"$FOAM_MPI |g" $i || \
echo " problems with '$i'"
fi
done
}
#
# List ADIOS methods/configuration
#
listMethods()
{
[ -f $ADIOS_ARCH_PATH/bin/adios_config ] || {
echo "Warning: no adios_config"
return 1
}
echo "==============="
# May have problems listing parallel methods (eg, transport key missing)
if $ADIOS_ARCH_PATH/bin/adios_config -m >/dev/null 2>&1
then
$ADIOS_ARCH_PATH/bin/adios_config -m 2>/dev/null
else
echo "Warning: could not list parallel methods"
# Fallback to serial methods
$ADIOS_ARCH_PATH/bin/adios_config -s -m 2>/dev/null
fi || echo "Warning: could not list configured methods"
echo "==============="
}
# Needs future adjustment
# - for shared library
# - for mpi-specific library locations
if [ -f $ADIOS_ARCH_PATH/include/adios.h \
-a -r $ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libadios_${FOAM_MPI}.a ]
then
echo " ADIOS header in $ADIOS_ARCH_PATH/include"
### echo " ADIOS libs in $FOAM_EXT_LIBBIN" # dynamic
echo " ADIOS libs in $ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" # static
listMethods
elif [ -z "$CMAKE_PATH" ]
then
echo "Starting build: $adiosPACKAGE (using configure)"
echo
(
# Configuration options:
unset configOpt
# Add InfiniBand support
ibDir=/usr/local/ofed
if [ -d "$ibDir" -a "$FOAM_MPI" != dummy ]
then
configOpt="$configOpt --with-infiniband=$ibDir"
fi
# Transport layers
if [ -f /usr/include/bzlib.h ]
then
configOpt="$configOpt --with-bzip2"
fi
if [ -f /usr/include/zlib.h ]
then
configOpt="$configOpt --with-zlib"
fi
# Other types of support
## configOpt="$configOpt --with-hdf5=..."
## configOpt="$configOpt --with-lustre=..."
## configOpt="$configOpt --enable-research-transports"
# Additional configure options
if [ "$1" = "--" ]
then
shift
configOpt="$configOpt $@"
fi
# End of configuration options
# ----------------------------
buildDIR=$buildBASE/$adiosPACKAGE
cd $ADIOS_SOURCE_DIR || exit 1
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
[ -e Makefile ] && make distclean 2>/dev/null
applyPatch $adiosPACKAGE $ADIOS_SOURCE_DIR
# Remove any existing build folder and recreate
rm -rf $ADIOS_ARCH_DIR
rm -rf $buildDIR 2>/dev/null
mkdir -p $buildDIR
[ -f configure ] || {
echo "no configure for $adiosPACKAGE ... trying autogen"
./autogen.sh
}
# May not work properly with FOAM_MPI = dummy
if [ "$FOAM_MPI" = dummy ]
then
configOpt="$configOpt --without-mpi"
else
CC=mpicc
CXX=mpicxx
fi
# Install into lib64/
cd $buildDIR && $ADIOS_SOURCE_DIR/configure \
--prefix=$ADIOS_ARCH_PATH \
--libdir=$ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
--disable-fortran \
--with-pic \
--without-fastbit \
$configOpt \
&& make -j $WM_NCOMPPROCS all \
&& make install \
&& echo "Built: $adiosPACKAGE" \
&& adjustADIOS \
&& listMethods
) || {
echo "Error building: $adiosPACKAGE"
}
else
# CMake options often lag the configure ones
echo "Starting build: $adiosPACKAGE (using cmake)"
echo
(
buildDIR=$buildBASE/$adiosPACKAGE
cd $ADIOS_SOURCE_DIR || exit 1
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
applyPatch $adiosPACKAGE $ADIOS_SOURCE_DIR
# Remove any existing build folder and recreate
rm -rf $ADIOS_ARCH_DIR
rm -rf $buildDIR 2>/dev/null
mkdir -p $buildDIR
# May not work properly with FOAM_MPI = dummy
if [ "$FOAM_MPI" = dummy ]
then
configOpt="$configOpt --without-mpi"
else
CC=mpicc
CXX=mpicxx
fi
cmake=$(findCMake)
# Install into lib64/
cd $buildDIR && $cmake \
-DCMAKE_INSTALL_PREFIX=$ADIOS_ARCH_PATH \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_FORTRAN=FALSE \
${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \
$ADIOS_SOURCE_DIR \
&& make -j $WM_NCOMPPROCS all \
&& make install \
&& echo "Built: $adiosPACKAGE" \
&& adjustADIOS \
&& listMethods
) || {
echo "Error building: $adiosPACKAGE"
}
fi
# -----------------------------------------------------------------------------

View File

@ -1,163 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# This file is part of OpenFOAM, licensed under the GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# Script
# makeADIOS2
#
# Description
# Build script for ADIOS2
#
# ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------
# Run from third-party directory only
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
#------------------------------------------------------------------------------
# ADIOS2 version from OpenFOAM etc/config.sh file:
_foamConfig ADIOS2
adios2PACKAGE=${adios2_version:-adios-none}
#------------------------------------------------------------------------------
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/} [OPTION] [adios-VERSION]
options:
-cmake PATH With cmake from the path given
-gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX
-help
* Build ADIOS2
$adios2PACKAGE
USAGE
exit 1
}
#------------------------------------------------------------------------------
exportCompiler true # Compiler info + flags for CMake/configure
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help) usage ;;
-gcc) useGcc ;;
-cmake)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
CMAKE_PATH="${2%%/}"
shift
;;
ADIOS2-[1-9]* | adios2-[1-9]* | ADIOS2-git* | adios2-git*)
adios2PACKAGE="${1%%/}"
;;
*)
die "unknown option/argument: '$1'"
;;
esac
shift
done
[ -n "$adios2PACKAGE" ] || die "The adios2-VERSION was not specified"
# nothing to build
if _foamIsNone "$adios2PACKAGE"
then
echo "Using adios-none (skip ThirdParty build of ADIOS)"
exit 0
elif _foamIsSystem "$adios2PACKAGE"
then
echo "Using adios-system"
exit 0
fi
#------------------------------------------------------------------------------
#
# Build ADIOS
# ADIOS2_SOURCE_DIR : location of the original sources
# ADIOS2_ARCH_PATH : installation directory
ADIOS2_SOURCE_DIR=$sourceBASE/$adios2PACKAGE
ADIOS2_ARCH_PATH=$installBASE/$adios2PACKAGE
: ${FOAM_MPI:=dummy}
echo
echo ========================================
echo "Build adios library $adiosPACKAGE for $FOAM_MPI"
echo
# Needs future adjustment
# - for shared library
# - for mpi-specific library locations
if [ -f $ADIOS2_ARCH_PATH/include/adios.h \
-a -r $ADIOS2_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libadios_${FOAM_MPI}.a ]
then
echo " ADIOS2 header in $ADIOS2_ARCH_PATH/include"
### echo " ADIOS2 libs in $FOAM_EXT_LIBBIN" # dynamic
echo " ADIOS2 libs in $ADIOS2_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" # static
else
# CMake options often lag the configure ones
echo "Starting build: $adios2PACKAGE (using cmake)"
echo
(
buildDIR=$buildBASE/$adios2PACKAGE
cd $ADIOS2_SOURCE_DIR || exit 1
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
applyPatch $adios2PACKAGE $ADIOS2_SOURCE_DIR
# Remove any existing build folder and recreate
rm -rf $ADIOS2_ARCH_DIR
rm -rf $buildDIR 2>/dev/null
mkdir -p $buildDIR
# May not work properly with FOAM_MPI = dummy
if [ "$FOAM_MPI" = dummy ]
then
configOpt="$configOpt --without-mpi"
else
CC=mpicc
CXX=mpicxx
fi
# HACK
export ADIOS1_ROOT=/local/home/mark/openfoam/ThirdParty-plus/platforms/linux64Gcc/ADIOS-1.12.0
cmake=$(findCMake)
# Install into lib64/
cd $buildDIR && $cmake \
-DCMAKE_INSTALL_PREFIX=$ADIOS2_ARCH_PATH \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_FORTRAN=FALSE \
-DADIOS1_USE_STATIC_LIBS=TRUE \
${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \
$ADIOS2_SOURCE_DIR \
&& make -j $WM_NCOMPPROCS all \
&& make install \
&& echo "Built: $adios2PACKAGE"
) || {
echo "Error building: $adios2PACKAGE"
}
fi
# -----------------------------------------------------------------------------

232
makeAdios2 Executable file
View File

@ -0,0 +1,232 @@
#!/bin/sh
#------------------------------------------------------------------------------
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2023 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# makeAdios2
#
# Description
# Build script for ADIOS2
#
# ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------
# Dynamic library ending (default is .so)
[ "$(uname -s)" = Darwin ] && EXT_SO=.dylib || EXT_SO=.so
# Short-circuit test for an installation
if [ "$1" = "-test" ]
then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH
[ -d "$dir/include" ] || exit 2
package="adios2"
libName="libadios2"
libName2="libadios2_cxx11_mpi"
for lib in \
"$dir/lib/$libName$EXT_SO" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
"$dir/lib/$libName2$EXT_SO" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName2$EXT_SO" \
;
do
if [ -r "$lib" ]
then
echo " $package include: $dir/include"
echo " $package library: ${lib%/*}"
exit 0
fi
done
exit 2
fi
#------------------------------------------------------------------------------
if : # Run from third-party directory
then
cd "${0%/*}" || exit
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
}
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/CMakeFunctions
#------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
_foamConfig adios2
PACKAGE="${adios2_version:-none}"
# Hint for cmake findMPI
if [ -d "$MPI_ARCH_PATH" ]
then
export MPI_HOME="$MPI_ARCH_PATH"
fi
#------------------------------------------------------------------------------
printVersions() { listPackageVersions adios; exit 0; }
printHelp() {
cat<<USAGE
Usage: ${0##*/} [OPTION] [adios-VERSION]
options:
-force Force compilation, even if include/library already exists
-gcc Force use of gcc/g++
-cmake PATH With cmake from the given path
-mpi-home PATH With hint for MPI_HOME
-DNAME=VALUE add cmake variable
-list List available unpacked source versions
-help Display usage help
* Build ADIOS2
${PACKAGE:-[unspecified]}
USAGE
showDownloadHint adios2
exit 0 # Clean exit
}
#------------------------------------------------------------------------------
exportCompiler minimal # Minimal compiler info for CMake/configure
unset optForce
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;;
-force) optForce=true ;;
-cmake)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
CMAKE_PATH="${2%%/}"
shift
;;
-mpi-home) # mpi with hint
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
export MPI_HOME="${2%%/}"
case "${MPI_HOME:-none}" in (false|none) unset MPI_HOME;; esac
shift
;;
adios/* | sources/ADIOS* | sources/adios* | \
ADIOS2-[0-9]* | ADIOS2-git* | ADIOS-[0-9]* | ADIOS-git* | \
adios2-[0-9]* | adios2-git* | adios-[0-9]* | adios-git*)
PACKAGE="${1%%/}"
;;
-D[A-Z]*=* | [A-Z]*=*) # cmake variables
addCMakeVariable "$1"
;;
*)
die "unknown option/argument: '$1'"
;;
esac
shift
done
if [ -z "$PACKAGE" ]
then
die "The ADIOS package/version not specified"
elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
then
echo "Using none/system (skip ThirdParty build of ADIOS)"
exit 0
fi
# Known build issues for mingw (various things)
case "$WM_COMPILER" in
(Mingw*)
if [ "$optForce" = true ]
then
echo "Warning: adios2 - known compilation issues with $WM_COMPILER"
else
echo "Skipping adios2 - known compilation issues with $WM_COMPILER"
exit 0
fi
;;
esac
#------------------------------------------------------------------------------
#
# Build ADIOS
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
PKG_SOURCE="$(findSourceDir "$PACKAGE")"
PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
: "${FOAM_MPI:=dummy}"
echo
echo ========================================
echo "Build adios library $PACKAGE for $FOAM_MPI"
echo
# Needs future adjustment
# - for mpi-specific library locations
if [ -z "$optForce" ] \
&& [ -f "$PKG_PREFIX/include/adios2.h" ] \
&& {
[ -r "$PKG_PREFIX/lib/libadios2$EXT_SO" ] \
|| [ -r "$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH/libadios2$EXT_SO" ]
}
then
echo " ADIOS2 already built : $PKG_PREFIX"
else
# CMake options often lag the configure ones
echo "Starting build: $PACKAGE (using cmake)"
echo
(
PKG_BUILD="$buildBASE/$PACKAGE"
cd "$PKG_SOURCE" || exit
applyPatch "$PACKAGE" "$PKG_SOURCE"
# Remove any existing build folder and recreate
rm -rf "$PKG_PREFIX"
rm -rf "$PKG_BUILD"
mkdir -p "$PKG_BUILD"
# May not work properly with FOAM_MPI = dummy
if [ "$FOAM_MPI" != dummy ]
then
CC=mpicc
CXX=mpicxx
fi
cmake=$(findCMake)
# Installs into lib64/
cd "$PKG_BUILD" && set -x && \
${cmake:?} \
-DCMAKE_INSTALL_PREFIX="$PKG_PREFIX" \
-DCMAKE_BUILD_TYPE=Release \
-DADIOS2_USE_Fortran=FALSE \
-DADIOS2_BUILD_EXAMPLES=FALSE \
${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \
"$PKG_SOURCE" \
&& make -j $WM_NCOMPPROCS all \
&& make install \
&& echo "Built: $PACKAGE"
) || {
echo "Error building: $PACKAGE"
exit 1
}
fi
# -----------------------------------------------------------------------------

128
makeCCMIO
View File

@ -3,12 +3,14 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeCCMIO # makeCCMIO
@ -19,55 +21,51 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Dynamic library endings (default is .so) if : # Run from third-party directory
[ "$(uname -s)" = Darwin ] && SO=dylib || SO=so then
cd "${0%/*}" || exit
# Run from third-party directory only wmakeCheckPwd "$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 "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" echo " Check your OpenFOAM environment and installation"
echo " Check your OpenFOAM environment and installation" exit 1
exit 1 }
} fi
[ -n "$FOAM_EXT_LIBBIN" ] || { . "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
echo "Error (${0##*/}) : \$FOAM_EXT_LIBBIN not set"
echo " Check your OpenFOAM environment and installation"
exit 1
}
. etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# libccmio version from OpenFOAM etc/config.sh file: # libccmio version from OpenFOAM etc/config.sh file:
_foamConfig ccmio _foamConfig ccmio
ccmioPACKAGE=${ccmio_version:-libccmio-2.6.1} PACKAGE="${ccmio_version:-libccmio-2.6.1}"
targetType=lib # Default is static linkage targetType=lib # Default is static linkage
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() printVersions() { listPackageVersions ccmio libccmio; exit 0; }
{ printHelp() {
exec 1>&2 cat<<USAGE
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
/bin/cat<<USAGE
Usage: ${0##*/} [OPTION] [lib|libso] [libccmio-VERSION] Usage: ${0##*/} [OPTION] [lib|libso] [libccmio-VERSION]
options: options:
-gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX -gcc Force use of gcc/g++
-help -list List available unpacked source versions
-help Display usage help
* Compile the proprietary libccmio library * Compile the proprietary libccmio library
$ccmioPACKAGE $PACKAGE
Users wishing to obtain the library should contact Siemens PLM (cd-adapco) Users wishing to obtain the library should contact Siemens PLM (cd-adapco)
for terms of use. for terms of use.
After obtaining the $ccmioPACKAGE library, place in folder After obtaining the $PACKAGE library, place in folder
$WM_THIRD_PARTY_DIR/$ccmioPACKAGE/ $sourceBASE/$PACKAGE/
or $sourceBASE/sources/$PACKAGE/
prior to running this script. prior to running this script.
USAGE USAGE
exit 1 showDownloadHint ccmio
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -76,14 +74,17 @@ while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help*) printHelp;;
-gcc) useGcc ;; -list) printVersions;;
-gcc) useGccWmake ;;
lib|libso) lib|libso)
targetType="$1" targetType="$1"
;; ;;
libccmio-[1-9]*)
ccmioPACKAGE="${1%%/}" libccmio/* | sources/libccmio* | \
libccmio-[0-9]*)
PACKAGE="${1%%/}"
;; ;;
*) *)
die "unknown option/argument: '$1'" die "unknown option/argument: '$1'"
@ -93,58 +94,67 @@ do
done done
requireWMakeToolchain requireWMakeToolchain
requireExtLibBin
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build LIBCCMIO # Build LIBCCMIO
# # *PACKAGE : name-version of the package
CCMIO_SOURCE_DIR=$sourceBASE/$ccmioPACKAGE # *SOURCE : location of original sources
CCMIO_ARCH_PATH=$installBASE/$ccmioPACKAGE # *PREFIX : installation directory
PKG_SOURCE="$(findSourceDir "$PACKAGE")"
PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
# Sources must be available # Sources must be available
[ -d "$CCMIO_SOURCE_DIR" ] || die "Missing sources: '$ccmioPACKAGE'" [ -d "$PKG_SOURCE" ] || die "Missing sources: '$PACKAGE'"
# #
# Manual installation # Manual installation
# #
install() install()
{ {
# Ensure a clean build next time local incdir="$PKG_PREFIX"/include/libccmio
# Remove build artifacts from the source directory
# (for a clean build next time)
wclean wclean
local incdir=$CCMIO_ARCH_PATH/include/libccmio echo
echo "Adjusting installation"
echo "Installing headers: $incdir"
# Make headers available: # Make headers available
mkdir -m 0755 -p $incdir mkdir -m 0755 -p "$incdir"
/bin/cp -pv "$PKG_SOURCE"/libccmio/ccmio*.h "$incdir"
/bin/cp -pv libccmio/ccmio*.h $incdir
} }
echo "Starting build: $ccmioPACKAGE ($targetType)" echo "Starting build: $PACKAGE ($targetType)"
echo echo
( (
cd $CCMIO_SOURCE_DIR || exit 1 cd "$PKG_SOURCE" || exit
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo rm -rf "$PKG_PREFIX"
rm -f "$FOAM_EXT_LIBBIN/libccmio$EXT_SO"
rm -rf $CCMIO_ARCH_PATH
rm -f $FOAM_EXT_LIBBIN/libccmio.$SO
libdir=$CCMIO_ARCH_PATH/lib
cpMakeFiles libccmio 2>/dev/null cpMakeFiles libccmio 2>/dev/null
# Place static libraries in sub-directory: # Static libraries in sub-directory
if [ "$targetType" = lib ] export CCMIO_LIB_DIR="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH"
# Dynamic libraries directly into FOAM_EXT_LIBBIN
if [ "$targetType" = libso ]
then then
mkdir -m 0755 -p $libdir 2>/dev/null CCMIO_LIB_DIR="$FOAM_EXT_LIBBIN"
export FOAM_EXT_LIBBIN=$libdir
fi fi
mkdir -m 0755 -p "$CCMIO_LIB_DIR" 2>/dev/null
wmake -j $WM_NCOMPPROCS -s $targetType \ wmake -j $WM_NCOMPPROCS -s $targetType \
&& echo "Built: ccmio" \ && echo "Built: $PACKAGE" \
&& install && install
) || { ) || {
echo "Error building: ccmio" echo "Error building: $PACKAGE"
exit 1 exit 1
} }

592
makeCGAL
View File

@ -3,12 +3,14 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2012-2016 OpenFOAM Foundation
# Copyright (C) 2016-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeCGAL # makeCGAL
@ -25,75 +27,119 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Dynamic library endings (default is .so) # Dynamic library ending (default is .so)
[ "$(uname -s)" = Darwin ] && SO=dylib || SO=so [ "$(uname -s)" = Darwin ] && EXT_SO=.dylib || EXT_SO=.so
# Short-circuit test for an installation # Short-circuit test for an installation
if [ "$1" = "-test" ] if [ "$1" = "-test" ]
then then
[ "$#" -eq 3 ] || { echo "${0##*/} -test : needs 2 argument"; exit 1; } [ "$#" -eq 3 ] || { echo "${0##*/} -test : needs 2 argument"; exit 1; }
dir="$2" # <- CGAL_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" -a -r "$dir/lib$WM_COMPILER_LIB_ARCH/libCGAL.$SO" ] [ -d "$dir/include" ] || exit 2
# CGAL
[ -f "$dir"/include/CGAL/version.h ] || exit 2
unset _my_cgal_libdir
_cacheinfo="$dir"/share/openfoam-build
if [ -f "$_cacheinfo" ]
then then
echo " CGAL include: $dir/include" _my_cgal_libdir="$(sed -ne 's#^CGAL_HEADER_ONLY=##p' "$_cacheinfo" 2>/dev/null)"
echo " CGAL library: $dir/lib$WM_COMPILER_LIB_ARCH" if [ "$_my_cgal_libdir" = true ]
# Additional information about boost then
dir="$3" # <- BOOST_ARCH_PATH _my_cgal_libdir=header
for root in "$dir" /usr fi
fi
if [ "$_my_cgal_libdir" != header ]
then
unset _my_cgal_libdir
libName="libCGAL"
for libdirName in "lib$WM_COMPILER_LIB_ARCH" lib
do do
if [ -d "$root/include/boost" \ if [ -r "$dir/$libdirName/$libName$EXT_SO" ]
-a -r "$root/lib$WM_COMPILER_LIB_ARCH/libboost_system.$SO" ]
then then
echo " boost include: $root/include" _my_cgal_libdir="$dir/$libdirName"
echo " boost library: $root/lib$WM_COMPILER_LIB_ARCH"
break break
fi fi
done done
exit 0
else
exit 2
fi fi
[ -n "$_my_cgal_libdir" ] || exit 2
echo " CGAL include: $dir/include"
echo " CGAL library: $_my_cgal_libdir"
# Additional information about boost
dir="${3%/}" # <- BOOST_ARCH_PATH
libName="libboost_system"
for root in "$dir" /usr
do
[ -d "$root/include/boost" ] || continue
for libdirName in "lib$WM_COMPILER_LIB_ARCH" lib
do
if [ -r "$root/$libdirName/$libName$EXT_SO" ]
then
echo " boost include: $root/include"
echo " boost library: $root/$libdirName"
exit 0 # Success
break 2
fi
done
done
exit 2
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only if : # Run from third-party directory
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { then
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " Check your OpenFOAM environment and installation" wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
exit 1 echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
} echo " Check your OpenFOAM environment and installation"
. etc/tools/ThirdPartyFunctions exit 1
}
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
unset BOOST_ARCH_PATH CGAL_ARCH_PATH GMP_ARCH_PATH MPFR_ARCH_PATH # Purge old unset BOOST_ARCH_PATH CGAL_ARCH_PATH GMP_ARCH_PATH MPFR_ARCH_PATH # Purge old
unset GMP_DIR MPFR_DIR # Purge hints used by CGAL cmake
# CGAL, boost and gmp/mpfr versions from OpenFOAM etc/config.sh files. # CGAL, boost and gmp/mpfr versions from OpenFOAM etc/config.sh files.
# Get compiler first and let CGAL config override GMP and MPFR # Get compiler first and let CGAL config override GMP and MPFR
_foamConfig compiler _foamConfig compiler
_foamConfig CGAL _foamConfig CGAL
boostPACKAGE=${boost_version:-boost-system} BOOST_PACKAGE="${boost_version:-boost-system}"
gmpPACKAGE=${gmp_version:-gmp-system} GMP_PACKAGE="${gmp_version:-gmp-system}"
mpfrPACKAGE=${mpfr_version:-mpfr-system} MPFR_PACKAGE="${mpfr_version:-mpfr-system}"
cgalPACKAGE=$cgal_version CGAL_PACKAGE="$cgal_version"
if nonStandardPlatforms # Possibly unreliable inherited values
then
unset BOOST_ARCH_PATH CGAL_ARCH_PATH
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions boost cgal; exit 0; }
exec 1>&2 printHelp() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [CGAL-VERSION] [boost-VERSION] [gmp-VERSION] [mpfr-VERSION] Usage: ${0##*/} [OPTION] [CGAL-VERSION] [boost-VERSION] [gmp-VERSION] [mpfr-VERSION]
options: options:
-cmake PATH with cmake from the path given -gcc Force use of gcc/g++
-gcc force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX -cmake PATH Use cmake from the given path
-no-lib compile CGAL for use in headers only mode (since CGAL 4.9) -no-lib Configure CGAL for headers-only mode (default OpenFOAM >= 2006)
-system use system versions for boost/gmp/mpfr -with-lib Configure CGAL with library
-help -toolset=NAME Use named toolset in bootstrap
(use 'none' to let boost determine everything).
-system Use system versions for boost/gmp/mpfr
-list List available unpacked source versions
-help Display usage help
* build CGAL with * build CGAL with
${cgalPACKAGE:-'unspecified CGAL version'} ${CGAL_PACKAGE:-[cgal unspecified]}
$boostPACKAGE ${BOOST_PACKAGE:-[boost unspecified]}
$gmpPACKAGE ${GMP_PACKAGE:-[gmp unspecified]}
$mpfrPACKAGE ${MPFR_PACKAGE:-[mpfr unspecified]}
Normally builds against ThirdParty boost and gmp/mpfr when possible. Normally builds against ThirdParty boost and gmp/mpfr when possible.
To override this behaviour (and use the system boost and/or gmp/mpfr), To override this behaviour (and use the system boost and/or gmp/mpfr),
@ -103,48 +149,63 @@ simply specify a 'system' version. For example,
Use gmp-none to disable use of gmp/mpfr (eg, not available) Use gmp-none to disable use of gmp/mpfr (eg, not available)
USAGE USAGE
exit 1 showDownloadHint boost
showDownloadHint cgal
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset optHeadersOnly unset optForce optHeadersOnly optToolset
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) optForce=true ;;
-cmake) -cmake)
[ "$#" -ge 2 ] || die "'$1' option requires an argument" [ "$#" -ge 2 ] || die "'$1' option requires an argument"
CMAKE_PATH="${2%%/}" CMAKE_PATH="${2%%/}"
shift shift
;; ;;
-toolset=*)
optToolset="${1#*=}"
;;
-sys*) -sys*)
gmpPACKAGE="gmp-system" GMP_PACKAGE="gmp-system"
mpfrPACKAGE="mpfr-system" MPFR_PACKAGE="mpfr-system"
boostPACKAGE="boost-system" BOOST_PACKAGE="boost-system"
unset BOOST_ARCH_PATH GMP_ARCH_PATH MPFR_ARCH_PATH unset BOOST_ARCH_PATH GMP_ARCH_PATH MPFR_ARCH_PATH
;; ;;
-no-lib) -no-lib)
optHeadersOnly=true optHeadersOnly=true
;; ;;
gmp-[4-9]* | gmp-system | gmp-none) -with-lib)
gmpPACKAGE="${1%%/}" optHeadersOnly=false
;;
gmp-[0-9]* | gmp-system | gmp-none)
GMP_PACKAGE="${1%%/}"
unset GMP_ARCH_PATH unset GMP_ARCH_PATH
;; ;;
mpfr-[2-9]* | mpfr-system | mpfr-none) mpfr-[0-9]* | mpfr-system | mpfr-none)
mpfrPACKAGE="${1%%/}" MPFR_PACKAGE="${1%%/}"
unset MPFR_ARCH_PATH unset MPFR_ARCH_PATH
;; ;;
boost/* | sources/boost* | \
boost-[0-9]* | boost_[0-9]* | boost-system ) boost-[0-9]* | boost_[0-9]* | boost-system )
boostPACKAGE="${1%%/}" BOOST_PACKAGE="${1%%/}"
unset BOOST_ARCH_PATH unset BOOST_ARCH_PATH
;; ;;
cgal/* | sources/cgal* | \
CGAL-[0-9]*) CGAL-[0-9]*)
cgalPACKAGE="${1%%/}" CGAL_PACKAGE="${1%%/}"
unset CGAL_ARCH_PATH unset CGAL_ARCH_PATH
;; ;;
*) *)
@ -154,38 +215,64 @@ do
shift shift
done done
[ -n "$cgalPACKAGE" ] || die "The cgal-VERSION was not specified" [ -n "$CGAL_PACKAGE" ] || die "The cgal-VERSION was not specified"
# Nothing to build # Nothing to build
if _foamIsNone $boostPACKAGE if _foamIsNone "$BOOST_PACKAGE"
then then
echo "Using boost-none (skip ThirdParty build of BOOST/CGAL)" echo "Using boost-none (skip ThirdParty build of BOOST/CGAL)"
exit 0 exit 0
fi fi
if _foamIsNone $cgalPACKAGE if _foamIsNone "$CGAL_PACKAGE"
then then
echo "Using cgal-none (skip ThirdParty build of CGAL)" echo "Using cgal-none (skip ThirdParty build of CGAL)"
exit 0 exit 0
fi fi
# For OpenFOAM 1912 and earlier, no predefined default.
# Force headers-only *after* starting with OpenFOAM-v2006
if [ -z "$optHeadersOnly" ] && foamVersion=$(wmake -version 2>/dev/null)
then
if [ "${foamVersion:-0}" -gt 1912 ]
then
optHeadersOnly=true
fi
fi
# Headers-only - might be able to avoid gmp/mpfr?
## if [ "${optHeadersOnly:-false}" = true ]
## then
## GMP_PACKAGE=none
## MPFR_PACKAGE=none
## unset GMP_ARCH_PATH MPFR_ARCH_PATH
## fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build Boost # Build Boost
# BOOST_ARCH_PATH : installation directory (as per config file)
#
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
#
# For 64-bit: # For 64-bit:
# - system is normally built into 'lib64' # - system is normally built into 'lib64'
# - use Third-Party 'lib64' for consistency. # - use Third-Party 'lib64' for consistency.
# Boost 1_62_0 and older normally build into 'lib'. # Boost 1_62_0 and older normally build into 'lib'.
#
# BOOST_ARCH_PATH : installation directory
# BOOST_SOURCE_DIR : location of the original sources
BOOST_SOURCE_DIR=$sourceBASE/$boostPACKAGE BOOST_SOURCE="$(findSourceDir "$BOOST_PACKAGE")"
: ${BOOST_ARCH_PATH:=$installBASE/$boostPACKAGE} # Fallback BOOST_PACKAGE="$(basename "$BOOST_PACKAGE")"
BOOST_PREFIX="$installBASE/$BOOST_PACKAGE"
boostInc="$BOOST_ARCH_PATH/include" # Override as per config file (if any)
boostLib="$BOOST_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" [ -n "$BOOST_ARCH_PATH" ] && BOOST_PREFIX="$BOOST_ARCH_PATH"
if _foamIsSystem $boostPACKAGE boostInc="$BOOST_PREFIX/include"
boostLib="$BOOST_PREFIX/lib$WM_COMPILER_LIB_ARCH"
if _foamIsSystem "$BOOST_PACKAGE"
then then
echo "Using boost-system (skip ThirdParty build of BOOST)" echo "Using boost-system (skip ThirdParty build of BOOST)"
@ -193,16 +280,16 @@ then
if [ -d "$boostInc" ] if [ -d "$boostInc" ]
then then
if BOOST_ARCH_PATH=$(cd $BOOST_ARCH_PATH 2>/dev/null && pwd -P) if BOOST_PREFIX=$(cd "$BOOST_PREFIX" 2>/dev/null && pwd -P)
then then
boostPACKAGE=${BOOST_ARCH_PATH##*/} BOOST_PACKAGE="$(basename "$BOOST_PREFIX")"
else else
echo "ERROR: bad path for BOOST_ARCH_PATH" echo "ERROR: bad path for BOOST_PREFIX"
echo "stopping build" echo "stopping build"
exit 1 exit 1
fi fi
libdir="$BOOST_ARCH_PATH/lib" libdir="$BOOST_PREFIX/lib"
else else
boostInc="/usr/include" boostInc="/usr/include"
boostLib="/usr/lib$WM_COMPILER_LIB_ARCH" boostLib="/usr/lib$WM_COMPILER_LIB_ARCH"
@ -210,43 +297,147 @@ then
fi fi
# Use lib/ when lib64/ does not exist # Use lib/ when lib64/ does not exist
[ ! -d "$boostLib" -a -d "$libdir" ] && boostLib="$libdir" [ -d "$libdir" -a ! -d "$boostLib" ] && boostLib="$libdir"
elif [ -f "$boostInc/boost/version.hpp" ] elif [ -z "$optForce" ] \
&& [ -f "$boostInc/boost/version.hpp" ]
then then
echo "Using $boostPACKAGE" echo "Using $BOOST_PACKAGE"
libdir="$BOOST_ARCH_PATH/lib" libdir="$BOOST_PREFIX/lib"
# Use lib when lib64 does not exist # Use lib when lib64 does not exist
[ ! -d "$boostLib" -a -d "$libdir" ] && boostLib="$libdir" [ -d "$libdir" -a ! -d "$boostLib" ] && boostLib="$libdir"
else else
echo "Starting build: $boostPACKAGE" echo "Starting build: $BOOST_PACKAGE"
echo echo
# Absolute path for --libdir # Absolute path for --libdir
( (
cd $BOOST_SOURCE_DIR || exit 1 # Write user-config.jam into source directory
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo # this is not great, but project-config.jam is written there too
cd "$BOOST_SOURCE" || exit
export GIT_DIR="$PWD/.git" # Avoid seeing our own git-repo
rm -rf $BOOST_ARCH_PATH # Configuration options:
unset buildOpt
if [ "$optToolset" = none ]
then
# Let boost determine everything
unset optToolset
elif [ -n "$optToolset" ]
then
# Assume same toolset for bootstrap and build
buildOpt="toolset=$optToolset"
else
# No toolset specified, attempt some guesses
c_compiler="$(whichCC)"
# Compiler-specific adjustments
case "$WM_COMPILER" in
(Arm*)
optToolset=gcc # For boostrap
# For build
echo "using clang : arm : ${c_compiler} ;" > user-config.jam
echo "using mpi ;" >> user-config.jam
buildOpt="--user-config=user-config.jam toolset=clang"
;;
(Mingw*)
optToolset=gcc # For boostrap
# For build
echo "using gcc : mingw : ${c_compiler} ;" > user-config.jam
buildOpt="--user-config=user-config.jam toolset=gcc"
buildOpt="$buildOpt address-model=64 target-os=windows release"
;;
(*)
# For gcc-8, clang-9 etc.
case "${c_compiler}" in
(clang*)
optToolset=clang # For boostrap
# For build
echo "using clang : : ${c_compiler} ;" > user-config.jam
buildOpt="--user-config=user-config.jam toolset=clang"
;;
(gcc* | g++*)
optToolset=gcc # For boostrap
# For build
echo "using gcc : : ${c_compiler} ;" > user-config.jam
buildOpt="--user-config=user-config.jam toolset=gcc"
;;
(ic[cx]* | icp[cx]*) # intel
optToolset=gcc # For boostrap
# For build
echo "using intel : : ${c_compiler} ;" > user-config.jam
buildOpt="--user-config=user-config.jam toolset=intel"
;;
esac
;;
esac
fi
# End of configuration options
# ----------------------------
rm -rf "$BOOST_PREFIX"
./bootstrap.sh \ ./bootstrap.sh \
--prefix=$BOOST_ARCH_PATH \ --prefix="$BOOST_PREFIX" \
--libdir=$boostLib \ --libdir="$boostLib" \
--with-libraries=thread \ --with-libraries=thread \
--with-libraries=system \ --with-libraries=system \
&& ./bjam toolset=$WM_CC -j $WM_NCOMPPROCS install \ ${optToolset:+--with-toolset="$optToolset"} \
&& echo "Built: boost" && ./b2 $buildOpt -j $WM_NCOMPPROCS install \
&& echo "Built: $BOOST_PACKAGE"
) || { ) || {
echo "Error building: boost" echo "Error building: $BOOST_PACKAGE"
exit 1 exit 1
} }
# Cleanup in-source build artifacts
(
set +e # Ignore errors
cd "$BOOST_SOURCE" 2>/dev/null || exit 0
echo "Cleanup in-source build artifacts: $BOOST_PACKAGE"
rm -f project-config.jam* user-config.jam*
rm -f b2 bjam bootstrap.log
rm -rf \
bin.v2 stage \
libs/config/checks/architecture/bin \
tools/build/src/engine/bootstrap \
tools/build/src/engine/bin.* \
;
true
)
# Unneeded generated files
for dir in share/doc share/info share/man
do
if [ -d "$BOOST_PREFIX/$dir" ]
then
echo "Discard $dir files to save space: $BOOST_PACKAGE"
rm -rf "$BOOST_PREFIX/$dir"
fi
done
rmdir "$BOOST_PREFIX"/share 2>/dev/null || true
fi fi
# Nothing left to build # Nothing left to build
if _foamIsSystem $cgalPACKAGE if _foamIsSystem "$CGAL_PACKAGE"
then then
echo "Using cgal-system (skip ThirdParty build of CGAL)" echo "Using cgal-system (skip ThirdParty build of CGAL)"
exit 0 exit 0
@ -274,32 +465,37 @@ fi
# - use Third-Party 'lib64' for consistency. # - use Third-Party 'lib64' for consistency.
# CGAL-4.9 normally builds into 'lib64', older versions into 'lib'. # CGAL-4.9 normally builds into 'lib64', older versions into 'lib'.
# #
# CGAL_SOURCE_DIR : location of the original sources # *PACKAGE : name-version of the package
# CGAL_BUILD_DIR : location of the build # *SOURCE : location of original sources
# CGAL_ARCH_PATH : installation directory # *PREFIX : installation directory
# CGAL_ARCH_PATH : installation directory (as per config file)
CGAL_SOURCE="$(findSourceDir "$CGAL_PACKAGE")"
CGAL_PACKAGE="$(basename "$CGAL_PACKAGE")"
CGAL_PREFIX="$installBASE/$CGAL_PACKAGE"
# Override as per config file (if any)
[ -n "$CGAL_ARCH_PATH" ] && CGAL_PREFIX="$CGAL_ARCH_PATH"
CGAL_SOURCE_DIR=$sourceBASE/$cgalPACKAGE
CGAL_BUILD_DIR=$buildBASE/$cgalPACKAGE
: ${CGAL_ARCH_PATH:=$installBASE/$cgalPACKAGE} # Fallback
# gmp/mpfr are installed without compiler name # gmp/mpfr are installed without compiler name
mpfrBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH archBASE="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH"
# Enable/disable gmp/mpfr together # Enable/disable gmp/mpfr together
if _foamIsNone $gmpPACKAGE || _foamIsNone $mpfrPACKAGE if _foamIsNone "$GMP_PACKAGE" || _foamIsNone "$MPFR_PACKAGE"
then then
GMP_ARCH_PATH=none GMP_ARCH_PATH=none
MPFR_ARCH_PATH=none MPFR_ARCH_PATH=none
elif _foamIsSystem $gmpPACKAGE || _foamIsSystem $mpfrPACKAGE elif _foamIsSystem "$GMP_PACKAGE" || _foamIsSystem "$MPFR_PACKAGE"
then then
# May really be system, but could also by a central installation # May really be system, but could also by a central installation
# Ensure everything is accurately recorded. Resolve paths etc. # Ensure everything is accurately recorded. Resolve paths etc.
if [ -d "$GMP_ARCH_PATH" ] if [ -d "$GMP_ARCH_PATH" ]
then then
if GMP_ARCH_PATH=$(cd $GMP_ARCH_PATH 2>/dev/null && pwd -P) if GMP_ARCH_PATH=$(cd "$GMP_ARCH_PATH" 2>/dev/null && pwd -P)
then then
gmpPACKAGE=${GMP_ARCH_PATH##*/} GMP_PACKAGE="${GMP_ARCH_PATH##*/}"
else else
echo "ERROR: bad path for GMP_ARCH_PATH" echo "ERROR: bad path for GMP_ARCH_PATH"
echo "stopping build" echo "stopping build"
@ -311,9 +507,9 @@ then
if [ -d "$MPFR_ARCH_PATH" ] if [ -d "$MPFR_ARCH_PATH" ]
then then
if MPFR_ARCH_PATH=$(cd $MPFR_ARCH_PATH 2>/dev/null && pwd -P) if MPFR_ARCH_PATH=$(cd "$MPFR_ARCH_PATH" 2>/dev/null && pwd -P)
then then
mpfrPACKAGE=${MPFR_ARCH_PATH##*/} MPFR_PACKAGE="${MPFR_ARCH_PATH##*/}"
else else
echo "ERROR: bad path for MPFR_ARCH_PATH" echo "ERROR: bad path for MPFR_ARCH_PATH"
echo "stopping build" echo "stopping build"
@ -323,8 +519,10 @@ then
MPFR_ARCH_PATH=system MPFR_ARCH_PATH=system
fi fi
else else
GMP_ARCH_PATH=$mpfrBASE/$gmpPACKAGE
MPFR_ARCH_PATH=$mpfrBASE/$mpfrPACKAGE # Respect the *ARCH_PATH if set
[ -d "$GMP_ARCH_PATH" ] || GMP_ARCH_PATH="$archBASE/$GMP_PACKAGE"
[ -d "$MPFR_ARCH_PATH" ] || MPFR_ARCH_PATH="$archBASE/$MPFR_PACKAGE"
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -332,35 +530,57 @@ fi
cat<<SUMMARY cat<<SUMMARY
CGAL configuration CGAL configuration
------------------ ------------------
CGAL = $cgalPACKAGE CGAL = $CGAL_PACKAGE
BOOST = $boostPACKAGE BOOST = $BOOST_PACKAGE
GMP = $gmpPACKAGE GMP = $GMP_PACKAGE
MPFR = $mpfrPACKAGE MPFR = $MPFR_PACKAGE
------------------ ------------------
SUMMARY SUMMARY
# #
# build information recorded for later use # build information recorded for later use
# #
buildInfoFile=$CGAL_ARCH_PATH/share/openfoam-build buildInfoFile="$CGAL_PREFIX"/share/openfoam-build
recordCGALinfo() recordCGALinfo()
{ {
CGAL_VERSION=$(sed -ne 's/^ *# *define *CGAL_VERSION_NR *\([0-9][0-9]*\).*$/\1/p' $CGAL_ARCH_PATH/include/CGAL/version.h 2>/dev/null) CGAL_VERSION=$(sed -ne 's/^ *# *define *CGAL_VERSION_NR *\([0-9][0-9]*\).*$/\1/p' $CGAL_PREFIX/include/CGAL/version.h 2>/dev/null)
cat<<BUILD_INFO > $buildInfoFile # which libdirName?
_my_cgal_libdir=unknown
for libdirName in "lib$WM_COMPILER_LIB_ARCH" lib
do
if [ -d "$CGAL_PREFIX/$libdirName" ]
then
_my_cgal_libdir="$libdirName"
break
fi
done
# which libdirName?
_my_boost_libdir=unknown
for libdirName in "lib$WM_COMPILER_LIB_ARCH" lib
do
if [ -d "$BOOST_PREFIX/$libdirName" ]
then
_my_boost_libdir="$libdirName"
break
fi
done
cat<<BUILD_INFO > "$buildInfoFile"
# Information from OpenFOAM build on '$(date)' # Information from OpenFOAM build on '$(date)'
# #
CGAL=${CGAL_ARCH_PATH##*/} CGAL=${CGAL_PREFIX##*/}
BOOST=${BOOST_ARCH_PATH##*/} BOOST=${BOOST_PREFIX##*/}
GMP=${GMP_ARCH_PATH##*/} GMP=${GMP_ARCH_PATH##*/}
MPFR=${MPFR_ARCH_PATH##*/} MPFR=${MPFR_ARCH_PATH##*/}
CGAL_VERSION=$CGAL_VERSION CGAL_VERSION=$CGAL_VERSION
BOOST_VERSION=$BOOST_VERSION BOOST_VERSION=$BOOST_VERSION
CGAL_lib=lib$WM_COMPILER_LIB_ARCH CGAL_lib=$_my_cgal_libdir
BOOST_lib=lib$WM_COMPILER_LIB_ARCH BOOST_lib=$_my_boost_libdir
CGAL_HEADER_ONLY=${optHeadersOnly:-false} CGAL_HEADER_ONLY=${optHeadersOnly:-default}
BUILD_INFO BUILD_INFO
} }
@ -388,13 +608,16 @@ cgalIsCurrent()
local info=$(sed -n -e '/^[A-Z]/p' $buildInfoFile 2>/dev/null) local info=$(sed -n -e '/^[A-Z]/p' $buildInfoFile 2>/dev/null)
[ -n "$info" ] || return 1 [ -n "$info" ] || return 1
# Check of lib/ vs lib64/ could be spurious...
local libDirName="lib$WM_COMPILER_LIB_ARCH" local libDirName="lib$WM_COMPILER_LIB_ARCH"
echo "checking information from existing build ..." echo "checking information from existing build ..."
echo " ${CGAL_ARCH_PATH}" echo " ${CGAL_PREFIX}"
infoValueEq CGAL "${CGAL_ARCH_PATH##*/}" "$info" || return 1 [ -f "$CGAL_PREFIX"/include/CGAL/version.h ] || return 1
infoValueEq BOOST "${BOOST_ARCH_PATH##*/}" "$info" || return 1
infoValueEq CGAL "${CGAL_PREFIX##*/}" "$info" || return 1
infoValueEq BOOST "${BOOST_PREFIX##*/}" "$info" || return 1
infoValueEq GMP "${GMP_ARCH_PATH##*/}" "$info" || return 1 infoValueEq GMP "${GMP_ARCH_PATH##*/}" "$info" || return 1
infoValueEq MPFR "${MPFR_ARCH_PATH##*/}" "$info" || return 1 infoValueEq MPFR "${MPFR_ARCH_PATH##*/}" "$info" || return 1
infoValueEq BOOST_VERSION "${BOOST_VERSION}" "$info" || return 1 infoValueEq BOOST_VERSION "${BOOST_VERSION}" "$info" || return 1
@ -405,85 +628,82 @@ cgalIsCurrent()
} }
if cgalIsCurrent if [ -z "$optForce" ] \
&& cgalIsCurrent
then then
echo " ${CGAL_ARCH_PATH##*/} build appears to be up-to-date - skipping" echo " ${CGAL_PREFIX##*/} build appears to be up-to-date - skipping"
echo echo
exit 0 exit 0
fi else
( (
# Remove any existing build folder and recreate export GIT_DIR="$CGAL_SOURCE/.git"
if [ -d $CGAL_BUILD_DIR ] PKG_BUILD="$buildBASE/$CGAL_PACKAGE"
then
echo "removing old build directory"
echo " $CGAL_BUILD_DIR"
rm -rf $CGAL_BUILD_DIR
fi
mkdir -p $CGAL_BUILD_DIR
cd $CGAL_BUILD_DIR || exit 1 # Remove existing build
export GIT_DIR=$CGAL_SOURCE_DIR/.git # Mask seeing our own git-repo rm -rf "$PKG_BUILD"
mkdir -p "$PKG_BUILD"
cd "$PKG_BUILD" || exit
unset configBoost configGmp configMpfr unset configBoost configGmp configMpfr
echo "----" echo "----"
echo "Configuring $cgalPACKAGE with boost $BOOST_VERSION" echo "Configuring $CGAL_PACKAGE with boost $BOOST_VERSION"
echo " Source : $CGAL_SOURCE_DIR" echo " Source : $CGAL_SOURCE"
echo " Build : $CGAL_BUILD_DIR" echo " Build : $CGAL_BUILD"
echo " Target : $CGAL_ARCH_PATH" echo " Target : $CGAL_PREFIX"
# See http://doc.cgal.org/latest/Manual/installation.html # See http://doc.cgal.org/latest/Manual/installation.html
if _foamIsSystem $boostPACKAGE if _foamIsSystem "$BOOST_PACKAGE"
then then
# Tagged as 'system' but could actually point to a central location # Tagged as 'system' but could actually point to a central location
if [ -d "$BOOST_ARCH_PATH/include" ] if [ -d "$BOOST_PREFIX/include" ]
then then
echo " boost : ${BOOST_ARCH_PATH##*/}" echo " boost : ${BOOST_PREFIX##*/}"
configBoost="-DBOOST_ROOT=$BOOST_ARCH_PATH" configBoost="-DBOOST_ROOT=$BOOST_PREFIX"
else else
echo " boost : system" echo " boost : system"
fi fi
## For system - possible that /usr/lib64 not being found? ## For system - possible that /usr/lib64 not being found?
## configBoost="-DBoost_LIBRARY_DIRS=$boostLib" ## configBoost="-DBoost_LIBRARY_DIRS=$boostLib"
elif [ -d "$BOOST_ARCH_PATH" ] elif [ -d "$BOOST_PREFIX" ]
then then
echo " boost : $boostPACKAGE" echo " boost : $BOOST_PACKAGE"
configBoost=$(cat <<CMAKE_OPTIONS configBoost=$(cat <<CMAKE_OPTIONS
-DBoost_INCLUDE_DIR=$boostInc -DBoost_INCLUDE_DIR=$boostInc
-DBoost_LIBRARY_DIRS=$boostLib -DBoost_LIBRARY_DIRS=$boostLib
-DBoost_THREAD_LIBRARY=$boostLib/libboost_thread.$SO -DBoost_THREAD_LIBRARY=$boostLib/libboost_thread$EXT_SO
-DBoost_THREAD_LIBRARY_RELEASE=$boostLib/libboost_thread.$SO -DBoost_THREAD_LIBRARY_RELEASE=$boostLib/libboost_thread$EXT_SO
-DBoost_SYSTEM_LIBRARY=$boostLib/libboost_system.$SO -DBoost_SYSTEM_LIBRARY=$boostLib/libboost_system$EXT_SO
-DBoost_SYSTEM_LIBRARY_RELEASE=$boostLib/libboost_system.$SO -DBoost_SYSTEM_LIBRARY_RELEASE=$boostLib/libboost_system$EXT_SO
-DBoost_VERSION=$BOOST_VERSION -DBoost_VERSION=$BOOST_VERSION
CMAKE_OPTIONS CMAKE_OPTIONS
) )
fi fi
if _foamIsSystem $GMP_ARCH_PATH if _foamIsSystem "$GMP_ARCH_PATH"
then then
echo " gmp : system" echo " gmp : system"
elif _foamIsNone $GMP_ARCH_PATH elif _foamIsNone "$GMP_ARCH_PATH"
then then
echo " gmp : disabled" echo " gmp : disabled"
configGmp="-DCGAL_DISABLE_GMP=TRUE" # Also used for mpfr configGmp="-DCGAL_DISABLE_GMP=TRUE" # Also used for mpfr
elif [ -d "$GMP_ARCH_PATH" ] elif [ -d "$GMP_ARCH_PATH" ]
then then
echo " gmp : $gmpPACKAGE" echo " gmp : $GMP_PACKAGE"
# Alternative: export GMP_DIR=... hint
for libdir in \ for libdir in \
$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ "$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" \
$GMP_ARCH_PATH/lib \ "$GMP_ARCH_PATH"/lib \
; ;
do do
if [ -f "$libdir/libgmp.$SO" ] if [ -f "$libdir/libgmp$EXT_SO" ]
then then
configGmp=$(cat <<CMAKE_OPTIONS configGmp=$(cat <<CMAKE_OPTIONS
-DGMP_INCLUDE_DIR=$GMP_ARCH_PATH/include -DGMP_INCLUDE_DIR=$GMP_ARCH_PATH/include
-DGMP_LIBRARIES_DIR=$libdir -DGMP_LIBRARIES_DIR=$libdir
-DGMP_LIBRARIES=$libdir/libgmp.$SO -DGMP_LIBRARIES=$libdir/libgmp$EXT_SO
CMAKE_OPTIONS CMAKE_OPTIONS
) )
break break
@ -493,28 +713,29 @@ CMAKE_OPTIONS
echo " system : gmp (did not find $GMP_ARCH_PATH)" echo " system : gmp (did not find $GMP_ARCH_PATH)"
fi fi
if _foamIsSystem $MPFR_ARCH_PATH if _foamIsSystem "$MPFR_ARCH_PATH"
then then
echo " mpfr : system" echo " mpfr : system"
elif _foamIsNone $MPFR_ARCH_PATH elif _foamIsNone "$MPFR_ARCH_PATH"
then then
echo " mpfr : disabled" echo " mpfr : disabled"
configGmp="-DCGAL_DISABLE_GMP=TRUE" # Also used for mpfr configGmp="-DCGAL_DISABLE_GMP=TRUE" # Also used for mpfr
elif [ -d "$MPFR_ARCH_PATH" ] elif [ -d "$MPFR_ARCH_PATH" ]
then then
echo " mpfr : $mpfrPACKAGE" echo " mpfr : $MPFR_PACKAGE"
# Alternative: export MPFR_DIR=... hint
for libdir in \ for libdir in \
$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ "$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" \
$MPFR_ARCH_PATH/lib \ "$MPFR_ARCH_PATH/lib" \
; ;
do do
if [ -f "$libdir/libmpfr.$SO" ] if [ -f "$libdir/libmpfr$EXT_SO" ]
then then
configMpfr=$(cat <<CMAKE_OPTIONS configMpfr=$(cat <<CMAKE_OPTIONS
-DMPFR_INCLUDE_DIR=$MPFR_ARCH_PATH/include -DMPFR_INCLUDE_DIR=$MPFR_ARCH_PATH/include
-DMPFR_LIBRARIES_DIR=$libdir -DMPFR_LIBRARIES_DIR=$libdir
-DMPFR_LIBRARIES=$libdir/libmpfr.$SO -DMPFR_LIBRARIES=$libdir/libmpfr$EXT_SO
CMAKE_OPTIONS CMAKE_OPTIONS
) )
break break
@ -526,44 +747,75 @@ CMAKE_OPTIONS
cmake=$(findCMake) cmake=$(findCMake)
unset cmakeDefs
# Compiler-specific adjustments
case "$WM_COMPILER" in
(Mingw*)
cmakeDefs="$cmakeDefs -DCMAKE_SYSTEM_NAME=Windows"
cmakeDefs="$cmakeDefs -DCMAKE_C_COMPILER=$(wmake -show-c)"
cmakeDefs="$cmakeDefs -DCMAKE_CXX_COMPILER=$(wmake -show-cxx)"
;;
esac
# Headers/library decision
case "$optHeadersOnly" in
(true | false)
cmakeDefs="$cmakeDefs -DCGAL_HEADER_ONLY=${optHeadersOnly}"
;;
esac
# For CGAL < 4.9, for installation into lib64/, not lib/ # For CGAL < 4.9, for installation into lib64/, not lib/
# Name only (not path) for CGAL_INSTALL_LIB_DIR # Name only (not path) for CGAL_INSTALL_LIB_DIR
echo "----" echo "----"
set -x rm -rf "$CGAL_PREFIX"
$cmake \ set -x && \
-DCMAKE_INSTALL_PREFIX=$CGAL_ARCH_PATH \ ${cmake:?} \
-DCGAL_INSTALL_LIB_DIR=lib$WM_COMPILER_LIB_ARCH \ -DCMAKE_INSTALL_PREFIX="$CGAL_PREFIX" \
-DCGAL_INSTALL_LIB_DIR="lib$WM_COMPILER_LIB_ARCH" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DWITH_CGAL_Core=OFF \ -DWITH_CGAL_Core=OFF \
-DWITH_CGAL_ImageIO=OFF \ -DWITH_CGAL_ImageIO=OFF \
-DWITH_CGAL_Qt5=OFF \ -DWITH_CGAL_Qt5=OFF \
${optHeadersOnly:+-DCGAL_HEADER_ONLY=TRUE} \ $cmakeDefs \
$configBoost $configGmp $configMpfr \ $configBoost $configGmp $configMpfr \
${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \ ${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \
$CGAL_SOURCE_DIR \ "$CGAL_SOURCE" \
&& set +x \
&& make -j $WM_NCOMPPROCS \ && make -j $WM_NCOMPPROCS \
&& set +x \
&& make install || exit 1 && make install || exit 1
echo "----" echo "----"
echo "create '\$CGAL_ARCH_PATH/share/files'" echo "create '\$CGAL_ARCH_PATH/share/files'"
echo "----" echo "----"
mkdir -p $CGAL_ARCH_PATH/share/src mkdir -p "$CGAL_PREFIX"/share/src
rm -f $CGAL_ARCH_PATH/share/files rm -f "$CGAL_PREFIX"/share/files
for i in assertions.cpp io.cpp MP_Float.cpp Random.cpp for i in assertions.cpp io.cpp MP_Float.cpp Random.cpp
do do
if [ -e "$CGAL_SOURCE_DIR/src/CGAL/$i" ] if [ -e "$CGAL_SOURCE/src/CGAL/$i" ]
then then
\cp $CGAL_SOURCE_DIR/src/CGAL/$i $CGAL_ARCH_PATH/share/src/ \cp "$CGAL_SOURCE/src/CGAL/$i" "$CGAL_PREFIX"/share/src/
echo "\${CGAL_ARCH_PATH}/share/src/$i" >> $CGAL_ARCH_PATH/share/files echo "\${CGAL_PREFIX}/share/src/$i" >> "$CGAL_PREFIX"/share/files
fi fi
done done
# Unneeded generated files
for dir in share/doc share/info share/man
do
if [ -d "$CGAL_PREFIX/$dir" ]
then
echo "Discard $dir files to save space: $CGAL_PACKAGE"
rm -rf "$CGAL_PREFIX/$dir"
fi
done
## Leave: rmdir "$CGAL_PREFIX"/share 2>/dev/null || true
# Record our build-status # Record our build-status
recordCGALinfo recordCGALinfo
echo "Done CGAL" echo "Done CGAL"
) )
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

126
makeCmake
View File

@ -3,12 +3,14 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeCmake # makeCmake
@ -22,53 +24,60 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only if : # Run from third-party directory
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { then
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " Check your OpenFOAM environment and installation" wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
exit 1 echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
} echo " Check your OpenFOAM environment and installation"
. etc/tools/ThirdPartyFunctions exit 1
}
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Special purpose script - no default version. # Special purpose script - no default version
unset cmakePACKAGE unset PACKAGE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions cmake; exit 0; }
exec 1>&2 printHelp() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] cmake-VERSION Usage: ${0##*/} [OPTION] cmake-VERSION
options: options:
-gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX -force Force compilation, even if binary already exists
-gcc Force use of gcc/g++
-link Create additional symlink as 'cmake-system' -link Create additional symlink as 'cmake-system'
-help -list List available unpacked source versions
-help Display usage help
* build cmake * Build cmake
${cmakePACKAGE:-'unspecified'} ${PACKAGE:-[unspecified]}
USAGE USAGE
exit 1 showDownloadHint cmake
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset optLink unset optForce optLink
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) optForce=true ;;
-link) optLink=true ;;
-link) cmake/* | sources/cmake* | \
optLink=true cmake-[0-9]*)
;; PACKAGE="${1%%/}"
cmake-[1-9]*)
cmakePACKAGE="${1%%/}"
;; ;;
*) *)
die "unknown option/argument: '$1'" die "unknown option/argument: '$1'"
@ -77,53 +86,60 @@ do
shift shift
done done
[ -n "$cmakePACKAGE" ] || die "The cmake-VERSION was not specified" if [ -z "$PACKAGE" ]
if _foamIsSystem "$cmakePACKAGE"
then then
unset optLink # basic sanity - cannot die "The CMAKE package/version not specified"
fi
if _foamIsSystem "$PACKAGE"
then
unset optLink # basic sanity - cannot create a link
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build CMAKE # Build CMAKE
# CMAKE_SOURCE_DIR : location of the original sources # *PACKAGE : name-version of the package
# CMAKE_ARCH_PATH : installation directory # *SOURCE : location of original sources
# *PREFIX : installation directory
CMAKE_SOURCE_DIR=$sourceBASE/$cmakePACKAGE PKG_SOURCE="$(findSourceDir "$PACKAGE")"
CMAKE_ARCH_PATH=$installBASE/$cmakePACKAGE PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
if [ -d "$CMAKE_ARCH_PATH" -a -r "$CMAKE_ARCH_PATH/bin/cmake" ]
if [ -z "$optForce" ] \
&& [ -d "$PKG_PREFIX" ] \
&& [ -r "$PKG_PREFIX/bin/cmake" ]
then then
echo "Already built: $cmakePACKAGE" echo "Already built: $PACKAGE"
else else
echo "Starting build: $cmakePACKAGE" echo "Starting build: $PACKAGE"
( (
buildDIR=$buildBASE/$cmakePACKAGE PKG_BUILD="$buildBASE/$PACKAGE"
cd "$PKG_SOURCE" || exit
make distclean 2>/dev/null || true
cd $CMAKE_SOURCE_DIR || exit 1 rm -rf "$PKG_BUILD"
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo mkdir -p "$PKG_BUILD"
make distclean 2>/dev/null
rm -rf $buildDIR cd "$PKG_BUILD" && \
mkdir -p $buildDIR "$PKG_SOURCE"/bootstrap \
cd $buildDIR --prefix="$PKG_PREFIX" \
$CMAKE_SOURCE_DIR/bootstrap \
--prefix=$CMAKE_ARCH_PATH \
&& time make -j $WM_NCOMPPROCS \ && time make -j $WM_NCOMPPROCS \
&& make install \ && make install \
&& echo "Built: $cmakePACKAGE" && echo "Built: $PACKAGE"
) || { ) || {
echo "Error building: $cmakePACKAGE" echo "Error building: $PACKAGE"
exit 1 exit 1
} }
fi fi
if [ "$optLink" = true -a -x "$CMAKE_ARCH_PATH/bin/cmake" ] if [ "$optLink" = true ] && [ -x "$PKG_PREFIX/bin/cmake" ]
then then
( (
cd ${CMAKE_ARCH_PATH%/*} || exit 1 cd "${PKG_PREFIX%/*}" || exit
if [ -L cmake-system ] if [ -L cmake-system ]
then then
rm cmake-system rm cmake-system
@ -131,7 +147,7 @@ then
then then
exit 2 exit 2
fi fi
ln -svf $cmakePACKAGE cmake-system ln -svf "$PACKAGE" cmake-system
) )
fi fi

179
makeFFTW
View File

@ -3,12 +3,13 @@
# ========= | # ========= |
# \\ / 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 | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeFFTW # makeFFTW
@ -19,69 +20,87 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Dynamic library endings (default is .so) # Dynamic library ending (default is .so)
[ "$(uname -s)" = Darwin ] && SO=dylib || SO=so [ "$(uname -s)" = Darwin ] && EXT_SO=.dylib || EXT_SO=.so
# Short-circuit test for an installation # Short-circuit test for an installation
if [ "$1" = "-test" ] if [ "$1" = "-test" ]
then then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } [ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="$2" # <- FFTW_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" -a -r "$dir/lib$WM_COMPILER_LIB_ARCH/libfftw3.$SO" ] [ -d "$dir/include" ] || exit 2
then
echo " fftw include: $dir/include" package="fftw"
echo " fftw library: $dir/lib$WM_COMPILER_LIB_ARCH" libName="libfftw3"
exit 0 for lib in \
else "$dir/lib/$libName$EXT_SO" \
exit 2 "$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
fi ;
do
if [ -r "$lib" ]
then
echo " $package include: $dir/include"
echo " $package library: ${lib%/*}"
exit 0
fi
done
exit 2
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only if : # Run from third-party directory
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { then
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " Check your OpenFOAM environment and installation" wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
exit 1 echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
} echo " Check your OpenFOAM environment and installation"
. etc/tools/ThirdPartyFunctions exit 1
}
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
# FFTW version from OpenFOAM etc/config.sh file:
_foamConfig FFTW _foamConfig FFTW
fftwPACKAGE=${fftw_version:-fftw-system} PACKAGE="${fftw_version:-none}"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions fftw; exit 0; }
exec 1>&2 printHelp() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [fftw-VERSION] [-- configure-options] Usage: ${0##*/} [OPTION] [fftw-VERSION] [-- configure-options]
options: options:
-gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX -force Force compilation, even if include/library already exists
-help -gcc Force use of gcc/g++
-list List available unpacked source versions
-help Display usage help
* build FFTW with * build FFTW with
${fftwPACKAGE:-'unspecified FFTW version'} ${PACKAGE:-[unspecified]}
USAGE USAGE
exit 1 showDownloadHint fftw
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset optForce
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
--) break;; # Extra configure options (leave on $@ for later detection) --) break;; # Extra configure options (leave on $@ for later detection)
-h | -help) usage ;; -h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) optForce=true ;;
fftw/* | sources/fftw* | \
fftw-[0-9]* | fftw_[0-9]* | fftw-system ) fftw-[0-9]* | fftw_[0-9]* | fftw-system )
fftwPACKAGE="${1%%/}" PACKAGE="${1%%/}"
;; ;;
*) *)
die "unknown option/argument: '$1'" die "unknown option/argument: '$1'"
@ -90,45 +109,61 @@ do
shift shift
done done
[ -n "$fftwPACKAGE" ] || die "The fftw-VERSION was not specified" if [ -z "$PACKAGE" ]
# Nothing to build
if _foamIsNone "$fftwPACKAGE"
then then
echo "Using fftw-none (skip ThirdParty build of FFTW)" die "The FFTW package/version not specified"
exit 0 elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
elif _foamIsSystem "$fftwPACKAGE"
then then
echo "Using fftw-system (skip ThirdParty build of FFTW)" echo "Using none/system (skip ThirdParty build of FFTW)"
exit 0 exit 0
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build FFTW # Build FFTW
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
#
# For 64-bit # For 64-bit
# - FFTW itself will normally build into 'lib64', # - FFTW itself will normally build into 'lib64',
# but provide --libdir on configure to be 100% certain
# - Third-Party builds into 'lib64'
# - system is normally built into 'lib64'
#
# FFTW_SOURCE_DIR : location of the original sources
# FFTW_ARCH_PATH : installation directory
FFTW_SOURCE_DIR=$sourceBASE/$fftwPACKAGE PKG_SOURCE="$(findSourceDir "$PACKAGE")"
FFTW_ARCH_PATH=$installBASE/$fftwPACKAGE PACKAGE="$(basename "$PKG_SOURCE")"
PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
if [ -r "$FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libfftw3.$SO" ] if [ -z "$optForce" ] \
&& {
[ -r "$PKG_PREFIX/lib/libfftw3$EXT_SO" ] \
|| [ -r "$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH/libfftw3$EXT_SO" ] \
|| [ -r "$PKG_PREFIX/bin/libfftw3-3$EXT_SO" ] # Windows
}
then then
echo "Already has FFTW shared library" echo "FFTW already built : $PKG_PREFIX"
else else
echo "Starting build: FFTW ($fftwPACKAGE)" echo "Starting build: FFTW ($PACKAGE)"
echo echo
( (
# Configuration options: # Configuration options:
unset configOpt unset configOpt
# Compiler-specific adjustments
case "$WM_COMPILER" in
(Mingw*)
# Cross-compiling
# See http://www.fftw.org/install/windows.html
configOpt="
--host=x86_64-w64-mingw32
--with-our-malloc
--enable-threads --with-combined-threads
--enable-sse2
--with-incoming-stack-boundary=2
"
;;
esac
# Additional configure options # Additional configure options
if [ "$1" = "--" ] if [ "$1" = "--" ]
then then
@ -138,32 +173,40 @@ else
# End of configuration options # End of configuration options
# ---------------------------- # ----------------------------
buildDIR=$buildBASE/$fftwPACKAGE PKG_BUILD="$buildBASE/$PACKAGE"
cd "$PKG_SOURCE" || exit
cd $FFTW_SOURCE_DIR || exit 1 rm -rf "$PKG_PREFIX"
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo rm -rf "$PKG_BUILD"
mkdir -p "$PKG_BUILD"
rm -rf $FFTW_ARCH_PATH cd "$PKG_BUILD" && set -x && \
rm -rf $buildDIR "$PKG_SOURCE"/configure \
mkdir -p $buildDIR --prefix="$PKG_PREFIX" \
cd $buildDIR
set -x
$FFTW_SOURCE_DIR/configure \
--prefix=$FFTW_ARCH_PATH \
--libdir=$FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
--enable-shared --disable-static \ --enable-shared --disable-static \
--disable-fortran \ --disable-fortran \
$configOpt \ $configOpt \
&& set +x \ && set +x \
&& make -j $WM_NCOMPPROCS \ && make -j $WM_NCOMPPROCS \
&& make install \ && make install \
&& echo "Built $fftwPACKAGE" \ && echo "Built: $PACKAGE" \
&& pkgconfigAdjust $FFTW_ARCH_PATH && pkgconfigAdjust "$PKG_PREFIX"
) || { ) || {
echo "Error building: FFTW" echo "Error building: $PACKAGE"
exit 1 exit 1
} }
# Unneeded generated files
for dir in share/doc share/info share/man
do
if [ -d "$PKG_PREFIX/$dir" ]
then
echo "Discard $dir files to save space: $PACKAGE"
rm -rf "$PKG_PREFIX/$dir"
fi
done
rmdir "$PKG_PREFIX"/share 2>/dev/null || true
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

330
makeGcc
View File

@ -3,12 +3,14 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeGcc # makeGcc
@ -31,13 +33,16 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only if : # Run from third-party directory
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { then
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " Check your OpenFOAM environment and installation" wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
exit 1 echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
} echo " Check your OpenFOAM environment and installation"
. etc/tools/ThirdPartyFunctions exit 1
}
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
unset GMP_ARCH_PATH MPFR_ARCH_PATH # Purge old unset GMP_ARCH_PATH MPFR_ARCH_PATH # Purge old
@ -47,36 +52,43 @@ WM_COMPILER_TYPE=ThirdParty # Ensure we get the correct settings
# Default GCC, mpfr, gmp and mpc versions from OpenFOAM etc/config.sh file: # Default GCC, mpfr, gmp and mpc versions from OpenFOAM etc/config.sh file:
_foamConfig compiler _foamConfig compiler
gmpPACKAGE=${gmp_version:-gmp-system} GMP_PACKAGE="${gmp_version:-gmp-system}"
mpfrPACKAGE=${mpfr_version:-mpfr-system} MPFR_PACKAGE="${mpfr_version:-mpfr-system}"
mpcPACKAGE=${mpc_version:-mpc-system} MPC_PACKAGE="${mpc_version:-mpc-system}"
gccPACKAGE=$gcc_version GCC_PACKAGE="$gcc_version"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions gcc gmp mpfr mpc; exit 0; }
exec 1>&2 printHelp() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [gcc-VERSION] [gmp-VERSION] [mpfr-VERSION] [mpc-VERSION] Usage: ${0##*/} [OPTION] [gcc-VERSION] [gmp-VERSION] [mpfr-VERSION] [mpc-VERSION]
options: options:
-clang Force clang/clang++ for building -clang Force clang/clang++ for building
-m32 | -m64 32-bit or 64-bit (default) ABI
-multilib for 64-bit systems with 32-bit support required -multilib for 64-bit systems with 32-bit support required
-no-multilib for 64-bit systems without 32-bit support (DEFAULT) -no-multilib for 64-bit systems without 32-bit support (DEFAULT)
-no-threadsafe disable mpfr thread-safe (default is auto-detect) -no-threadsafe disable mpfr thread-safe (default is auto-detect)
-system use system versions for gmp/mpfr/mpc -system use system versions for gmp/mpfr/mpc
-help -list List available unpacked source versions
-help Display usage help
* build combinations of gmp, mpfr, mpc and gcc * Build combinations of gmp, mpfr, mpc and gcc
$gmpPACKAGE ${GMP_PACKAGE:-[gmp unspecified]}
$mpfrPACKAGE ${MPFR_PACKAGE:-[mpfr unspecified]}
$mpcPACKAGE ${MPC_PACKAGE:-[mpc unspecified]}
${gccPACKAGE:-'unspecified GCC version'} ${GCC_PACKAGE:-[gcc unspecified]}
USAGE USAGE
exit 1 showDownloadHint gcc
showDownloadHint gmp
showDownloadHint mpfr
showDownloadHint mpc
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
optArch=64 # Use 64-bit ABI
# Build 32-bit libraries on 64-bit systems (normally not needed) # Build 32-bit libraries on 64-bit systems (normally not needed)
optMultilib=disable optMultilib=disable
unset optThreadSafe # unset=auto unset optThreadSafe # unset=auto
@ -86,12 +98,16 @@ while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help*) printHelp;;
-list) printVersions;;
-clang) # Force use of clang/clang++ for building -clang) # Force use of clang/clang++ for building
export CC=clang export CC=clang
export CXX=clang++ export CXX=clang++
;; ;;
-m32 | -m64)
optArch="${1#*m}"
;;
-multi*) -multi*)
optMultilib=enable optMultilib=enable
;; ;;
@ -102,24 +118,35 @@ do
optThreadSafe=disable optThreadSafe=disable
;; ;;
-sys*) -sys*)
gmpPACKAGE="gmp-system" GMP_PACKAGE="gmp-system"
mpfrPACKAGE="mpfr-system" MPFR_PACKAGE="mpfr-system"
mpcPACKAGE="mpc-system" MPC_PACKAGE="mpc-system"
unset GMP_ARCH_PATH MPFR_ARCH_PATH unset GMP_ARCH_PATH MPFR_ARCH_PATH
;; ;;
gmp-[4-9]* | gmp-system)
gmpPACKAGE="${1%%/}" gmp/* | sources/gmp* |\
gmp-[0-9]* | gmp-system)
GMP_PACKAGE="${1%%/}"
unset GMP_ARCH_PATH unset GMP_ARCH_PATH
;; ;;
mpfr-[2-9]* | mpfr-system)
mpfrPACKAGE="${1%%/}" mpfr/* | sources/mpfr* |\
mpfr-[0-9]* | mpfr-system)
MPFR_PACKAGE="${1%%/}"
unset MPFR_ARCH_PATH unset MPFR_ARCH_PATH
;; ;;
mpc/* | sources/mpc* |\
mpc-[0-9]* | mpc-system) mpc-[0-9]* | mpc-system)
mpcPACKAGE="${1%%/}" MPC_PACKAGE="${1%%/}"
;; ;;
gcc-[4-9]* | gcc-system)
gccPACKAGE="${1%%/}" gcc/* | sources/gcc* |\
gcc-[0-9]* | gcc-system)
GCC_PACKAGE="${1%%/}"
;;
[0-9]*)
GCC_PACKAGE="gcc-${1%%/}"
;; ;;
*) *)
die "unknown option/argument: '$1'" die "unknown option/argument: '$1'"
@ -128,47 +155,58 @@ do
shift shift
done done
[ -n "$gccPACKAGE" ] || die "The gcc-VERSION was not specified" [ -n "$GCC_PACKAGE" ] || die "The gcc-VERSION was not specified"
cat<<SUMMARY cat<<SUMMARY
GCC configuration GCC configuration
------------------ ------------------
GCC = $gccPACKAGE ABI = $optArch
GMP = $gmpPACKAGE GCC = $GCC_PACKAGE
MPFR = $mpfrPACKAGE GMP = $GMP_PACKAGE
MPC = $mpcPACKAGE MPFR = $MPFR_PACKAGE
MPC = $MPC_PACKAGE
------------------ ------------------
Using CC = $CC $CFLAGS Using CC = $CC $CFLAGS
Using CXX = $CXX $CXXFLAGS Using CXX = $CXX $CXXFLAGS
SUMMARY SUMMARY
# Set 32 or 64 bit ABI
case "$WM_ARCH_OPTION" in
32 | 64)
ABI=$WM_ARCH_OPTION
;;
*)
die "The WM_ARCH_OPTION ($WM_ARCH_OPTION) must be 32 or 64"
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Build/install without compiler name # !Build/install locations with arch name only (NO compiler name)!
buildBASE=$WM_THIRD_PARTY_DIR/build/$WM_ARCH$WM_COMPILER_ARCH buildBASE="$(dirname "$buildBASE")/$WM_ARCH$WM_COMPILER_ARCH"
installBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH installBASE="$(dirname "$installBASE")/$WM_ARCH$WM_COMPILER_ARCH"
# gcc
GCC_SOURCE="$(findSourceDir "$GCC_PACKAGE")"
GCC_PACKAGE="$(basename "$GCC_PACKAGE")"
GCC_PREFIX="$installBASE/$GCC_PACKAGE"
# gmp
GMP_SOURCE="$(findSourceDir "$GMP_PACKAGE")"
GMP_PACKAGE="$(basename "$GMP_PACKAGE")"
GMP_PREFIX="$installBASE/$GMP_PACKAGE"
# mpc
MPC_SOURCE="$(findSourceDir "$MPC_PACKAGE")"
MPC_PACKAGE="$(basename "$MPC_PACKAGE")"
MPC_PREFIX="$installBASE/$MPC_PACKAGE"
# mpfr
MPFR_SOURCE="$(findSourceDir "$MPFR_PACKAGE")"
MPFR_PACKAGE="$(basename "$MPFR_PACKAGE")"
MPFR_PREFIX="$installBASE/$MPFR_PACKAGE"
# Override as per config file (if any)
[ -n "$GMP_ARCH_PATH" ] && GMP_PREFIX="$GMP_ARCH_PATH"
[ -n "$MPFR_ARCH_PATH" ] && MPFR_PREFIX="$MPFR_ARCH_PATH"
GCC_ARCH_PATH=$installBASE/$gccPACKAGE
GMP_ARCH_PATH=$installBASE/$gmpPACKAGE
MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE
MPC_ARCH_PATH=$installBASE/$mpcPACKAGE
# Prefix <dir> to LD_LIBRARY_PATH, if it exists. 0 on success, 1 on failure # Prefix <dir> to LD_LIBRARY_PATH, if it exists. 0 on success, 1 on failure
addLib() addLib()
{ {
if [ -d "$1" ] if [ -d "$1" ]
then then
export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH export LD_LIBRARY_PATH="$1:$LD_LIBRARY_PATH"
return 0 return 0
else else
return 1 return 1
@ -180,47 +218,47 @@ addLib()
# Build GMP # Build GMP
# ================ # ================
echo "---------------" echo "---------------"
if [ -d "$GMP_ARCH_PATH" ] if [ -d "$GMP_PREFIX" ]
then then
echo "Already built: $gmpPACKAGE" echo "Already built: $GMP_PREFIX"
elif _foamIsSystem $GMP_ARCH_PATH elif _foamIsSystem "$GMP_PREFIX"
then then
echo "Using gmp-system" echo "Using system gmp"
else else
echo "Starting build: $gmpPACKAGE" echo "Starting build: $GMP_PACKAGE"
echo echo
( (
sourceDIR=$sourceBASE/$gmpPACKAGE PKG_SOURCE="$GMP_SOURCE"
buildDIR=$buildBASE/$gmpPACKAGE PKG_PREFIX="$GMP_PREFIX"
PKG_BUILD="$buildBASE/$GMP_PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
cd $sourceDIR || exit 1 cd "$PKG_SOURCE" || exit
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo make distclean 2>/dev/null || true
make distclean 2>/dev/null
rm -rf $buildDIR rm -rf "$PKG_BUILD"
mkdir -p $buildDIR mkdir -p "$PKG_BUILD"
cd $buildDIR
set -x cd "$PKG_BUILD" && set -x && \
$sourceDIR/configure ABI=$ABI \ "$PKG_SOURCE"/configure ABI="$optArch" \
--prefix=$GMP_ARCH_PATH \ --prefix="$PKG_PREFIX" \
--libdir=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ --libdir="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH" \
--enable-cxx \ --enable-cxx \
&& set +x \ && set +x \
&& make -j $WM_NCOMPPROCS \ && make -j $WM_NCOMPPROCS \
&& make install \ && make install \
&& echo "Built: $gmpPACKAGE" && echo "Built: $GMP_PACKAGE"
) || { ) || {
echo "Error building: $gmpPACKAGE" echo "Error building: $GMP_PACKAGE"
exit 1 exit 1
} }
fi fi
if addLib "$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" if addLib "$GMP_PREFIX/lib$WM_COMPILER_LIB_ARCH"
then then
configGMP=$(cat <<CONFIG_OPTIONS configGMP=$(cat <<CONFIG_OPTIONS
--with-gmp-include=$GMP_ARCH_PATH/include --with-gmp-include=$GMP_PREFIX/include
--with-gmp-lib=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH --with-gmp-lib=$GMP_PREFIX/lib$WM_COMPILER_LIB_ARCH
CONFIG_OPTIONS CONFIG_OPTIONS
) )
else else
@ -232,51 +270,51 @@ fi
# Build MPFR # Build MPFR
# ================ # ================
echo "---------------" echo "---------------"
if [ -d $MPFR_ARCH_PATH ] if [ -d "$MPFR_PREFIX" ]
then then
echo "Already built: $mpfrPACKAGE" echo "Already built: $MPFR_PACKAGE"
elif _foamIsSystem $MPFR_ARCH_PATH elif _foamIsSystem "$MPFR_PREFIX"
then then
echo "Using mpfr-system" echo "Using system mpfr"
else else
echo "Starting build: $mpfrPACKAGE" echo "Starting build: $MPFR_PACKAGE"
echo echo
( (
sourceDIR=$sourceBASE/$mpfrPACKAGE PKG_SOURCE="$MPFR_SOURCE"
buildDIR=$buildBASE/$mpfrPACKAGE PKG_PREFIX="$MPFR_PREFIX"
PKG_BUILD="$buildBASE/$MPFR_PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
cd $sourceDIR || exit 1 cd "$PKG_SOURCE" || exit
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo make distclean 2>/dev/null || true
make distclean 2>/dev/null
rm -rf $buildDIR rm -rf "$PKG_BUILD"
mkdir -p $buildDIR mkdir -p "$PKG_BUILD"
cd $buildDIR
unset configOpt unset configOpt
# explicitly enable/disable thread-safe # explicitly enable/disable thread-safe
[ -n "$optThreadSafe" ] && configOpt="--${optThreadSafe}-thread-safe" [ -n "$optThreadSafe" ] && configOpt="--${optThreadSafe}-thread-safe"
set -x cd "$PKG_BUILD" && set -x && \
$sourceDIR/configure ABI=$ABI \ "$PKG_SOURCE"/configure ABI="$optArch" \
--prefix=$MPFR_ARCH_PATH \ --prefix="$PKG_PREFIX" \
--libdir=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ --libdir="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH" \
$configGMP $configOpt \ $configGMP $configOpt \
&& set +x \ && set +x \
&& make -j $WM_NCOMPPROCS \ && make -j $WM_NCOMPPROCS \
&& make install \ && make install \
&& echo "Built: $mpfrPACKAGE" && echo "Built: $MPFR_PACKAGE"
) || { ) || {
echo "Error building: $mpfrPACKAGE" echo "Error building: $MPFR_PACKAGE"
exit 1 exit 1
} }
fi fi
if addLib "$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" if addLib "$MPFR_PREFIX/lib$WM_COMPILER_LIB_ARCH"
then then
configMPFR=$(cat <<CONFIG_OPTIONS configMPFR=$(cat <<CONFIG_OPTIONS
--with-mpfr-include=$MPFR_ARCH_PATH/include \ --with-mpfr-include=$MPFR_PREFIX/include \
--with-mpfr-lib=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH --with-mpfr-lib=$MPFR_PREFIX/lib$WM_COMPILER_LIB_ARCH
CONFIG_OPTIONS CONFIG_OPTIONS
) )
else else
@ -288,47 +326,47 @@ fi
# Build MPC # Build MPC
# ================ # ================
echo "---------------" echo "---------------"
if [ -d $MPC_ARCH_PATH ] if [ -d "$MPC_PREFIX" ]
then then
echo "Already built: $mpcPACKAGE" echo "Already built: $MPC_PACKAGE"
elif _foamIsSystem $MPC_ARCH_PATH elif _foamIsSystem "$MPC_PREFIX"
then then
echo "Using mpc-system" echo "Using system mpc"
else else
echo "Starting build: $mpcPACKAGE" echo "Starting build: $MPC_PACKAGE"
echo echo
( (
sourceDIR=$sourceBASE/$mpcPACKAGE PKG_SOURCE="$MPC_SOURCE"
buildDIR=$buildBASE/$mpcPACKAGE PKG_PREFIX="$MPC_PREFIX"
PKG_BUILD="$buildBASE/$MPC_PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
cd $sourceDIR || exit 1 cd "$PKG_SOURCE" || exit
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo make distclean 2>/dev/null || true
make distclean 2>/dev/null
rm -rf $buildDIR rm -rf "$PKG_BUILD"
mkdir -p $buildDIR mkdir -p "$PKG_BUILD"
cd $buildDIR
set -x cd "$PKG_BUILD" && set -x && \
$sourceDIR/configure ABI=$ABI \ "$PKG_SOURCE"/configure ABI="$optArch" \
--prefix=$MPC_ARCH_PATH \ --prefix="$PKG_PREFIX" \
--libdir=$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ --libdir="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH" \
$configGMP $configMPFR \ $configGMP $configMPFR \
&& set +x \ && set +x \
&& make -j $WM_NCOMPPROCS \ && make -j $WM_NCOMPPROCS \
&& make install \ && make install \
&& echo "Built: $mpcPACKAGE" && echo "Built: $MPC_PACKAGE"
) || { ) || {
echo "Error building: $mpcPACKAGE" echo "Error building: $MPC_PACKAGE"
exit 1 exit 1
} }
fi fi
if addLib "$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" if addLib "$MPC_PREFIX/lib$WM_COMPILER_LIB_ARCH"
then then
configMPC=$(cat <<CONFIG_OPTIONS configMPC=$(cat <<CONFIG_OPTIONS
--with-mpc-include=$MPC_ARCH_PATH/include \ --with-mpc-include=$MPC_PREFIX/include \
--with-mpc-lib=$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH --with-mpc-lib=$MPC_PREFIX/lib$WM_COMPILER_LIB_ARCH
CONFIG_OPTIONS CONFIG_OPTIONS
) )
else else
@ -344,35 +382,35 @@ fi
# or specify -no-multilib on the command-line # or specify -no-multilib on the command-line
# #
echo "---------------" echo "---------------"
if [ -d $GCC_ARCH_PATH ] if [ -d "$GCC_PREFIX" ]
then then
echo "Already built: $gccPACKAGE" echo "Already built: $GCC_PACKAGE"
elif _foamIsSystem $GCC_ARCH_PATH elif _foamIsSystem "$GCC_PREFIX"
then then
echo "Using gcc-system" echo "Using system gcc"
else else
echo "Starting build: $gccPACKAGE" echo "Starting build: $GCC_PACKAGE"
echo echo
( (
sourceDIR=$sourceBASE/$gccPACKAGE PKG_SOURCE="$GCC_SOURCE"
buildDIR=$buildBASE/$gccPACKAGE PKG_PREFIX="$GCC_PREFIX"
PKG_BUILD="$buildBASE/$GCC_PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
cd $sourceDIR || exit 1 cd "$PKG_SOURCE" || exit
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo make distclean 2>/dev/null || true
make distclean 2>/dev/null
rm -rf $buildDIR rm -rf "$PKG_BUILD"
mkdir -p $buildDIR mkdir -p "$PKG_BUILD"
cd $buildDIR
unset configOpt unset configOpt
# with/without multi-lib (32-bit support on 64-bit systems) # with/without multi-lib (32-bit support on 64-bit systems)
[ -n "$optMultilib" ] && configOpt="--${optMultilib}-multilib" [ -n "$optMultilib" ] && configOpt="--${optMultilib}-multilib"
set -x cd "$PKG_BUILD" && set -x && \
$sourceDIR/configure \ "$PKG_SOURCE"/configure \
--prefix=$GCC_ARCH_PATH \ --prefix="$PKG_PREFIX" \
--with-pkgversion=OpenFOAM \ --with-pkgversion=www.openfoam.com \
--enable-languages=c,c++ \ --enable-languages=c,c++ \
--enable-__cxa_atexit \ --enable-__cxa_atexit \
--enable-libstdcxx-allocator=new \ --enable-libstdcxx-allocator=new \
@ -382,9 +420,9 @@ else
&& set +x \ && set +x \
&& make -j $WM_NCOMPPROCS \ && make -j $WM_NCOMPPROCS \
&& make install \ && make install \
&& echo "Built: $gccPACKAGE" && echo "Built: $GCC_PACKAGE"
) || { ) || {
echo "Error building: $gccPACKAGE" echo "Error building: $GCC_PACKAGE"
exit 1 exit 1
} }
fi fi

View File

@ -3,12 +3,14 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2012 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeGperftools # makeGperftools
@ -19,50 +21,59 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only if : # Run from third-party directory
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { then
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " Check your OpenFOAM environment and installation" wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
exit 1 echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
} echo " Check your OpenFOAM environment and installation"
. etc/tools/ThirdPartyFunctions exit 1
}
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
# Gperftools version from OpenFOAM etc/config.sh file:
_foamConfig gperftools _foamConfig gperftools
gperftoolsPACKAGE=${gperftools_version:-gperftools-system} PACKAGE="${gperftools_version:-none}"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions gperf; exit 0; }
exec 1>&2 printHelp() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [gperftools-VERSION] Usage: ${0##*/} [gperftools-VERSION]
options: options:
-gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX -force Force compilation, even if include/library already exists
-help -gcc Force use of gcc/g++
-list List available unpacked source versions
-help Display usage help
* build gperftools * Build gperftools
$gperftoolsPACKAGE ${PACKAGE:-[unspecified]}
USAGE USAGE
exit 1 showDownloadHint gperftools
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset optForce
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) optForce=true ;;
gperftools/* | sources/gperftools* |\
gperftools-[0-9]* | gperftools-svn* | gperftools-git) gperftools-[0-9]* | gperftools-svn* | gperftools-git)
gperftoolsPACKAGE="${1%%/}" PACKAGE="${1%%/}"
;; ;;
*) *)
die "unknown option/argument: '$1'" die "unknown option/argument: '$1'"
@ -71,55 +82,67 @@ do
shift shift
done done
[ -n "$gperftoolsPACKAGE" ] || die "The gperftools-VERSION was not specified" if [ -z "$PACKAGE" ]
# Nothing to build
if _foamIsNone $gperftoolsPACKAGE
then then
echo "Using gperftools-none (skip ThirdParty build of gperftools)" die "The GPERFTOOLS package/version not specified"
exit 0 elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
elif _foamIsSystem $gperftoolsPACKAGE
then then
echo "Using gperftools-system (skip ThirdParty build of gperftools)" echo "Using none/system (skip ThirdParty build of GPERFTOOLS)"
exit 0 exit 0
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build gperftools # Build gperftools
# # *PACKAGE : name-version of the package
GPERFTOOLS_SOURCE_DIR=$sourceBASE/$gperftoolsPACKAGE # *SOURCE : location of original sources
GPERFTOOLS_ARCH_PATH=$installBASE/$gperftoolsPACKAGE # *PREFIX : installation directory
PKG_SOURCE="$(findSourceDir "$PACKAGE")"
PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
echo "---------------" echo "---------------"
if [ -d "$GPERFTOOLS_ARCH_PATH" ] if [ -z "$optForce" ] \
&& [ -d "$PKG_PREFIX" ]
then then
echo "Already built: $gperftoolsPACKAGE" echo "Already built: $PACKAGE"
else else
echo "Starting build: $gperftoolsPACKAGE" echo "Starting build: $PACKAGE"
( (
buildDIR=$buildBASE/$gperftoolsPACKAGE PKG_BUILD="$buildBASE/$PACKAGE"
cd "$PKG_SOURCE" || exit
cd $GPERFTOOLS_SOURCE_DIR || exit 1 make distclean 2>/dev/null || true
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
[ -e Makefile ] && make distclean 2>/dev/null
rm -rf $GPERFTOOLS_ARCH_PATH rm -rf "$PKG_PREFIX"
rm -rf $buildDIR rm -rf "$PKG_BUILD"
mkdir -p $buildDIR mkdir -p "$PKG_BUILD"
cd $buildDIR
set -x cd "$PKG_BUILD" && set -x && \
$GPERFTOOLS_SOURCE_DIR/configure \ "$PKG_SOURCE"/configure \
--prefix=$GPERFTOOLS_ARCH_PATH \ --prefix="$PKG_PREFIX" \
&& set +x \ && set +x \
&& make -j $WM_NCOMPPROCS \ && make -j $WM_NCOMPPROCS \
&& make install \ && make install \
&& echo "Built: $gperftoolsPACKAGE" \ && echo "Built: $PACKAGE" \
) || { ) || {
echo "Error building: $gperftoolsPACKAGE" echo "Error building: $PACKAGE"
exit 1 exit 1
} }
# Unneeded generated files
for dir in share/doc share/info share/man
do
if [ -d "$PKG_PREFIX/$dir" ]
then
echo "Discard $dir files to save space: $PACKAGE"
rm -rf "$PKG_PREFIX/$dir"
fi
done
rmdir "$PKG_PREFIX"/share 2>/dev/null || true
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

235
makeHDF5 Executable file
View File

@ -0,0 +1,235 @@
#!/bin/sh
#------------------------------------------------------------------------------
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# makeHDF5
#
# Description
# Build script for HDF5
#
# ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------
# Dynamic library ending (default is .so)
[ "$(uname -s)" = Darwin ] && EXT_SO=.dylib || EXT_SO=.so
# Short-circuit test for an installation
if [ "$1" = "-test" ]
then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH
[ -d "$dir/include" ] || exit 2
package="hdf5"
libName="hdf5"
for lib in \
"$dir/lib/$libName$EXT_SO" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
;
do
if [ -r "$lib" ]
then
echo " $package include: $dir/include"
echo " $package library: ${lib%/*}"
exit 0
fi
done
exit 2
fi
#------------------------------------------------------------------------------
if : # Run from third-party directory
then
cd "${0%/*}" || exit
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
}
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/CMakeFunctions
#------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
_foamConfig hdf5
PACKAGE="${hdf5_version:-none}"
# Hint for cmake findMPI
if [ -d "$MPI_ARCH_PATH" ]
then
export MPI_HOME="$MPI_ARCH_PATH"
fi
#------------------------------------------------------------------------------
printVersions() { listPackageVersions hdf5; exit 0; }
printHelp() {
cat<<USAGE
Usage: ${0##*/} [OPTION] [HDF5-VERSION]
options:
-force Force compilation, even if include/library already exists
-gcc Force use of gcc/g++
-cmake PATH With cmake from the given path
-mpi-home PATH With hint for MPI_HOME
-DNAME=VALUE add cmake variable
-list List available unpacked source versions
-help Display usage help
* Build HDF5
${PACKAGE:-[unspecified]}
USAGE
showDownloadHint hdf5
exit 0 # Clean exit
}
#------------------------------------------------------------------------------
exportCompiler minimal # Minimal compiler info for CMake/configure
unset optForce
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;;
-force) optForce=true ;;
-cmake)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
CMAKE_PATH="${2%%/}"
shift
;;
-mpi-home) # mpi with hint
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
export MPI_HOME="${2%%/}"
case "${MPI_HOME:-none}" in (false|none) unset MPI_HOME;; esac
shift
;;
hdf/* | hdf5/* | sources/hdf* | \
hdf5[-_][0-9]* | hdf5-git* )
PACKAGE="${1%%/}"
;;
-D[A-Z]*=* | [A-Z]*=*) # cmake variables
addCMakeVariable "$1"
;;
*)
die "unknown option/argument: '$1'"
;;
esac
shift
done
if [ -z "$PACKAGE" ]
then
die "The HDF5 package/version not specified"
elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
then
echo "Using none/system (skip ThirdParty build of HDF5)"
exit 0
fi
# Known build issues for mingw (various things)
case "$WM_COMPILER" in
(Mingw*)
if [ "$optForce" = true ]
then
echo "Warning: hdf5 - likely compilation issues with $WM_COMPILER"
else
echo "Skipping hdf5 - likely compilation issues with $WM_COMPILER"
exit 0
fi
;;
esac
#------------------------------------------------------------------------------
#
# Build HDF5
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
PKG_SOURCE="$(findSourceDir "$PACKAGE")"
PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
: "${FOAM_MPI:=dummy}"
# FUTURE:
#
# Manual installation of parallel libraries
# from libdir to -> $FOAM_EXT_LIBBIN/$FOAM_MPI
#
echo
echo ========================================
echo "Build hdf5 library $PACKAGE for $FOAM_MPI"
echo
# Needs future adjustment
# - for mpi-specific library locations
if [ -z "$optForce" ] \
&& [ -f "$PKG_PREFIX/include/hdf5.h" ] \
&& {
[ -r "$PKG_PREFIX/lib/libhdf5$EXT_SO" ] \
|| [ -r "$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH/libhdf5$EXT_SO" ]
}
then
echo " HDF5 already built : $PKG_PREFIX"
else
# CMake options often lag the configure ones
echo "Starting build: $PACKAGE (using cmake)"
echo
(
PKG_BUILD="$buildBASE/$PACKAGE"
cd "$PKG_SOURCE" || exit
applyPatch "$PACKAGE" "$PKG_SOURCE"
# Remove any existing build folder and recreate
rm -rf "$PKG_PREFIX"
rm -rf "$PKG_BUILD"
mkdir -p "$PKG_BUILD"
# May not work properly with FOAM_MPI = dummy
if [ "$FOAM_MPI" != dummy ]
then
CC=mpicc
CXX=mpicxx
fi
cmake=$(findCMake)
# Installs into lib64/
cd "$PKG_BUILD" && set -x && \
${cmake:?} \
-DCMAKE_INSTALL_PREFIX="$PKG_PREFIX" \
-DCMAKE_BUILD_TYPE=Release \
-DHDF5_BUILD_FORTRAN=FALSE \
-DHDF5_BUILD_TESTING=FALSE \
-DHDF5_BUILD_STATIC_LIBS=FALSE \
${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \
"$PKG_SOURCE" \
&& make -j $WM_NCOMPPROCS all \
&& make install \
&& echo "Built: $PACKAGE"
) || {
echo "Error building: $PACKAGE"
exit 1
}
fi
# -----------------------------------------------------------------------------

153
makeHYPRE
View File

@ -3,12 +3,13 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeHYPRE # makeHYPRE
@ -19,87 +20,70 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Dynamic library endings (default is .so) if : # Run from third-party directory
[ "$(uname -s)" = Darwin ] && SO=dylib || SO=so
# Short-circuit test for an installation
if [ "$1" = "-test" ]
then then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } cd "${0%/*}" || exit
dir="$2" # <- HYPRE_ARCH_PATH wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
if [ -d "$dir/include" ] echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
then echo " Check your OpenFOAM environment and installation"
for lib in \ exit 1
$FOAM_EXT_LIBBIN/libhypre.$SO \ }
$dir/lib/libhypre.a \
$dir/lib/libhypre.$SO \
$dir/lib$WM_COMPILER_LIB_ARCH/libhypre.a \
$dir/lib$WM_COMPILER_LIB_ARCH/libhypre.$SO \
;
do
if [ -r "$lib" ]
then
echo " hypre include: $dir/include"
echo " hypre library: ${lib%/*}"
exit 0
fi
done
fi
exit 2
fi fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only # Obtain version from etc/config.sh file:
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
}
[ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Error (${0##*/}) : \$FOAM_EXT_LIBBIN not set"
echo " Check your OpenFOAM environment and installation"
exit 1
}
. etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------
_foamConfig hypre _foamConfig hypre
hyprePACKAGE=${hypre_version:-hypre-system} PACKAGE="${hypre_version:-none}"
targetType=libso targetType=libso
if nonStandardPlatforms # Possibly unreliable inherited values
then
unset HYPRE_ARCH_PATH
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions hypre; exit 0; }
exec 1>&2 printHelp() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [lib|libso] [HYPRE-VERSION] Usage: ${0##*/} [OPTION] [lib|libso] [HYPRE-VERSION] [-- configure-options]
options: options:
-gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX -force Force compilation, even if include/library already exists
-help -gcc Force use of gcc/g++
-list List available unpacked source versions
-help Display usage help
* build HYPRE with * Build HYPRE with
${hyprePACKAGE:-'unspecified hypre version'} ${PACKAGE:-[unspecified]}
USAGE USAGE
exit 1 showDownloadHint hypre
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset optForce
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; --) break;; # Extra configure options (leave on $@ for later detection)
-h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) optForce=true ;;
lib|libso) lib|libso)
targetType="$1" targetType="$1"
;; ;;
hypre-[0-9]*) hypre/* | sources/hypre* |\
hyprePACKAGE="${1%%/}" hypre-[0-9]* | hypre-git)
PACKAGE="${1%%/}"
unset HYPRE_ARCH_PATH # Avoid inconsistency unset HYPRE_ARCH_PATH # Avoid inconsistency
;; ;;
*) *)
@ -109,16 +93,12 @@ do
shift shift
done done
[ -n "$hyprePACKAGE" ] || die "The hypre-VERSION was not specified" if [ -z "$PACKAGE" ]
# Nothing to build
if _foamIsNone $hyprePACKAGE
then then
echo "Using hypre-none (skip ThirdParty build of HYPRE)" die "The HYPRE package/version not specified"
exit 0 elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
elif _foamIsSystem $hyprePACKAGE
then then
echo "Using hypre-system" echo "Using none/system (skip ThirdParty build of HYPRE)"
exit 0 exit 0
fi fi
@ -126,14 +106,23 @@ fi
# #
# Build HYPRE # Build HYPRE
# #
# HYPRE_ARCH_PATH : installation directory # HYPRE_ARCH_PATH : installation directory (as per config file)
# HYPRE_SOURCE_DIR : location of the original sources #
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
HYPRE_SOURCE_DIR=$sourceBASE/$hyprePACKAGE PKG_SOURCE="$(findSourceDir "$PACKAGE")"
: ${HYPRE_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$hyprePACKAGE} PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
[ -d "$HYPRE_SOURCE_DIR" ] || { # Override as per config file (if any)
echo "Missing sources: '$hyprePACKAGE'" [ -n "$HYPRE_ARCH_PATH" ] && PKG_PREFIX="$HYPRE_ARCH_PATH"
[ -d "$PKG_SOURCE" ] || {
echo "Missing sources: '$PACKAGE'"
showDownloadHint hypre
exit 1 exit 1
} }
@ -142,31 +131,37 @@ HYPRE_SOURCE_DIR=$sourceBASE/$hyprePACKAGE
CC="$(whichMpicc)" CC="$(whichMpicc)"
CXX="$(whichMpicxx)" CXX="$(whichMpicxx)"
echo "Starting build: $hyprePACKAGE ($targetType)" echo "Starting build: $PACKAGE ($targetType)"
echo echo
( (
# Configuration options: # Configuration options
unset configOpt unset configOpt
cd $HYPRE_SOURCE_DIR/src || exit 1 # Additional configure options
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo if [ "$1" = "--" ]
then
shift
configOpt="$configOpt $@"
fi
rm -rf $HYPRE_ARCH_PATH cd "$PKG_SOURCE/src" || exit
[ -e Makefile ] && make distclean 2>/dev/null
rm -rf "$PKG_PREFIX"
make distclean 2>/dev/null || true
set -x && \
./configure \ ./configure \
--prefix=$HYPRE_ARCH_PATH \ --prefix="$PKG_PREFIX" \
--disable-fortran \ --disable-fortran \
--enable-shared \ --enable-shared \
$configOpt \ $configOpt \
&& make -j $WM_NCOMPPROCS \ && make -j $WM_NCOMPPROCS \
&& echo "Built: hypre" \ && echo "Built: hypre" \
&& make install \ && make install \
&& echo "Installed: hypre" && echo "Installed: $PACKAGE"
) || { ) || {
echo "Error building: hypre" echo "Error building: $PACKAGE"
exit 1 exit 1
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

515
makeKAHIP
View File

@ -3,12 +3,13 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2017-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeKAHIP # makeKAHIP
@ -19,87 +20,130 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Dynamic library endings (default is .so) # Dynamic library ending (default is .so)
[ "$(uname -s)" = Darwin ] && SO=dylib || SO=so [ "$(uname -s)" = Darwin ] && EXT_SO=.dylib || EXT_SO=.so
# Short-circuit test for an installation # Short-circuit test for an installation
if [ "$1" = "-test" ] if [ "$1" = "-test" ]
then then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } [ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="$2" # <- KAHIP_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" ] [ -d "$dir/include" ] || exit 2
then
for lib in \ package="kahip"
$FOAM_EXT_LIBBIN/libkahip.$SO \ libName="libkahip"
$dir/lib/libkahip.a \ for lib in \
$dir/lib/libkahip.$SO \ "$FOAM_EXT_LIBBIN/$libName$EXT_SO" \
$dir/lib$WM_COMPILER_LIB_ARCH/libkahip.a \ "$dir/lib/$libName.a" \
$dir/lib$WM_COMPILER_LIB_ARCH/libkahip.$SO \ "$dir/lib/$libName$EXT_SO" \
; "$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
do "$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
if [ -r "$lib" ] ;
then do
echo " kahip include: $dir/include" if [ -r "$lib" ]
echo " kahip library: ${lib%/*}" then
exit 0 echo " $package include: $dir/include"
fi echo " $package library: ${lib%/*}"
done exit 0
fi fi
done
exit 2 exit 2
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only if : # Run from third-party directory
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { then
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " Check your OpenFOAM environment and installation" wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
exit 1 echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
} echo " Check your OpenFOAM environment and installation"
[ -n "$FOAM_EXT_LIBBIN" ] || { exit 1
echo "Error (${0##*/}) : \$FOAM_EXT_LIBBIN not set" }
echo " Check your OpenFOAM environment and installation" fi
exit 1 . "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
}
. etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
_foamConfig kahip _foamConfig kahip
kahipPACKAGE=${KAHIP_VERSION:-kahip-system} PACKAGE="${KAHIP_VERSION:-system}"
targetType=libso targetType=libso
# Hint for cmake findMPI
if [ -d "$MPI_ARCH_PATH" ]
then
export MPI_HOME="$MPI_ARCH_PATH"
fi
if nonStandardPlatforms # Possibly unreliable inherited values
then
unset KAHIP_ARCH_PATH
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() printVersions() { listPackageVersions kahip; exit 0; }
{ printHelp() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
/bin/cat<<USAGE /bin/cat<<USAGE
Usage: ${0##*/} [OPTION] [lib|libso] [kahip-VERSION] Usage: ${0##*/} [OPTION] [lib|libso] [kahip-VERSION]
options: options:
-gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX -gcc Force use of gcc/g++
-help -force Force build attempt (mingw)
-cmake PATH With cmake from the given path
-bin Create kahip binaries as well
-no-bin Suppress creation of kahip binaries (default)
-mpi-home PATH With hint for MPI_HOME
-no-mpi Compile without MPI
-list List available unpacked source versions
-help Display usage help
* Compile KaHIP * Build kahip (int32_t only)
$kahipPACKAGE ${PACKAGE:-[unspecified]}
USAGE USAGE
exit 1 showDownloadHint kahip
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler minimal # Minimal compiler info for CMake/configure
unset optForce optNoExtlib
optBinaries=false
optWithMPI=true
optLabelSize="${WM_LABEL_SIZE:-32}"
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help*) printHelp;;
-gcc) useGcc ;; -list) printVersions;;
-gcc) useGccWmake ;;
-force) optForce=true ;;
-int32 | -int64) echo "ignoring $1" ;;
-bin) optBinaries=true ;;
-no-bin) optBinaries=false ;;
-no-mpi) optWithMPI=false ;;
-no-extlib) optNoExtlib=true ;; # Hidden option (experimental)
-cmake)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
CMAKE_PATH="${2%%/}"
shift
;;
-mpi-home) # mpi with hint
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
export MPI_HOME="${2%%/}"
case "${MPI_HOME:-none}" in (false|none) unset MPI_HOME;; esac
shift
;;
lib|libso) lib|libso)
targetType="$1" targetType="$1"
;; ;;
kahip-[1-9]* | kahip-git) kahip/* | sources/kahip* | sources/KaHIP* |\
kahipPACKAGE="${1%%/}" kahip-[0-9]* | kahip-git | KaHIP_* | KaHIP-[0-9]*)
PACKAGE="${1%%/}"
unset KAHIP_ARCH_PATH # Avoid inconsistency unset KAHIP_ARCH_PATH # Avoid inconsistency
;; ;;
*) *)
@ -109,90 +153,323 @@ do
shift shift
done done
[ -n "$kahipPACKAGE" ] || die "The kahip-VERSION was not specified" if [ -z "$PACKAGE" ]
# Nothing to build
if _foamIsNone $kahipPACKAGE
then then
echo "Using kahip-none (skip ThirdParty build of KAHIP)" die "The KAHIP package/version not specified"
exit 0 elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
elif _foamIsSystem $kahipPACKAGE
then then
echo "Using kahip-system" echo "Using none/system (skip ThirdParty build of KAHIP)"
exit 0 exit 0
fi fi
requireWMakeToolchain # Known build issues for mingw (uses some non-portable headers)
case "$WM_COMPILER" in
(Mingw*)
if [ "$optForce" = true ]
then
echo "Warning: kahip - known compilation issues with $WM_COMPILER"
else
echo "Skipping kahip - known compilation issues with $WM_COMPILER"
exit 0
fi
;;
esac
if [ "$optNoExtlib" = true ]
then
unset FOAM_EXT_LIBBIN
else
requireExtLibBin
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build KaHIP # Build KaHIP
# #
# KAHIP_ARCH_PATH : installation directory # KAHIP_ARCH_PATH : installation directory (as per config file)
# KAHIP_SOURCE_DIR : location of the original sources
KAHIP_SOURCE_DIR=$sourceBASE/$kahipPACKAGE
KAHIP_ARCH_PATH=$installBASE/$kahipPACKAGE
[ -d "$KAHIP_SOURCE_DIR" ] || {
echo "Missing sources: '$kahipPACKAGE'"
exit 1
}
# #
# Manual installation # *PACKAGE : name-version of the package
# # *SOURCE : location of original sources
install() # *PREFIX : installation directory
{
# Ensure a clean build next time
wclean
local bindir=$KAHIP_ARCH_PATH/bin PKG_SOURCE="$(findSourceDir "$PACKAGE")"
local incdir=$KAHIP_ARCH_PATH/include PACKAGE="$(basename "$PACKAGE")"
local libdir=$KAHIP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH # Future: PKG_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PACKAGE"
PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
mkdir -m 0755 -p $incdir # Override as per config file (if any)
[ -n "$KAHIP_ARCH_PATH" ] && PKG_PREFIX="$KAHIP_ARCH_PATH"
/bin/cp -pv \ [ -d "$PKG_SOURCE" ] || {
$KAHIP_SOURCE_DIR/interface/kaHIP_interface.h \ echo "Missing sources: '$PACKAGE'"
$incdir showDownloadHint kahip
} exit 2
echo "Starting build: $kahipPACKAGE ($targetType)"
echo
(
cd $KAHIP_SOURCE_DIR/lib || exit 1
export GIT_DIR=$KAHIP_SOURCE_DIR/.git # Mask seeing our own git-repo
rm -rf $KAHIP_ARCH_PATH
rm -f $FOAM_EXT_LIBBIN/libkahip.$SO
libdir=$KAHIP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
cpMakeFiles kahip 2>/dev/null
if [ -e ../interface -a ! -e interface ]
then
ln -s ../interface interface
fi
# Place static libraries in sub-directory:
if [ "$targetType" = lib ]
then
mkdir -m 0755 -p $libdir 2>/dev/null
export FOAM_EXT_LIBBIN=$libdir
fi
# Location of lib sources for wmake
export KAHIP_LIB_SRC=$PWD
wmake -j $WM_NCOMPPROCS -s $targetType \
&& echo "Built: kahip" \
&& install
) || {
echo "Error building: kahip"
exit 1
} }
#------------------------------------------------------------------------------
# - newer versions use CMake.
# - intermediate versions (eg, kahip-2.11) had CMakeLists but didn't install
# include/ which means the scons workaround is probably better.
# - very old versions only had scons.
# NB: the flags for 64bit indices in the header seem to be missing.
unset useWmakeWorkaround
if [ -f "$PKG_SOURCE/SConstruct" ]
then
# Use wmake for old scons builds
echo "Using wmake for the build..."
useWmakeWorkaround=true
requireWMakeToolchain
fi
#
# Manual installation of serial libraries
# from libdir to -> $FOAM_EXT_LIBBIN
#
install()
{
local bindir="$PKG_PREFIX"/bin
local libdir_source="$1"
local libdir_serial="$FOAM_EXT_LIBBIN"
local libdir_parallel="$FOAM_EXT_LIBBIN/$FOAM_MPI"
local libname_suffix="-int$WM_LABEL_SIZE"
[ -n "$FOAM_EXT_LIBBIN" ] || unset libdir_serial libdir_parallel
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
echo
echo "Adjusting installation"
if [ "$optBinaries" = false ]
then
echo "Removing binaries: $bindir"
rm -rf "$bindir" 2>/dev/null # Failed removal is uncritical
fi
if [ -z "$libdir_source" ]
then
libdir_source="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH"
if [ ! -d "$libdir_source" ]
then
libdir_source="$PKG_PREFIX/lib"
fi
fi
# Before kahip-v3.12 built 'libinterface'. Rename this to 'libkahip'
(
cd "$libdir_source" || exit
libname="libkahip"
for name in libinterface
do
if [ -f "$name$EXT_SO" ]
then
rm -f "$libname$EXT_SO" "$libname$libname_suffix$EXT_SO"
mv "$name$EXT_SO" "$libname$EXT_SO"
echo "Renamed $name -> $libname"
break
fi
done
)
# Rename lib as xxx-intNN qualified library names (non-windows)
if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
then
(
cd "$libdir_source" || exit
echo "Tagging libraries with $libname_suffix"
for name in libkahip libparhip_interface
do
if [ -f "$name$EXT_SO" ]
then
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
fi
done
)
fi
local libdir_target
# Serial
libdir_target="$libdir_serial"
if [ -n "$libdir_target" ]
then
# Remove old libraries/links
for name in libkahip libkahip_interface libparhip_interface
do
rm -f "$libdir_target/$name$EXT_SO"
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
done
mkdir -p "$libdir_target"
echo "Relocating serial libraries"
# echo "Installing: $libdir_target/libkahip$libname_suffix"
mv -f "$libdir_source"/libkahip*"$EXT_SO" "$libdir_target" 2>/dev/null
fi
# Parallel
libdir_target="$libdir_parallel"
if [ -n "$libdir_target" ]
then
# Remove old libraries/links
for name in libkahip libkahip_interface libparhip_interface
do
rm -f "$libdir_target/$name$EXT_SO"
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
done
mkdir -p "$libdir_target"
echo "Relocating parallel libraries"
# echo "Installing: $libdir_target/libparhip$libname_suffix"
mv -f "$libdir_source"/libparhip*"$EXT_SO" "$libdir_target" 2>/dev/null
fi
rmdir "$libdir_source" 2>/dev/null # Failed rmdir is uncritical
return 0
}
#
# Manual installation
#
install_wmake()
{
local bindir="$PKG_PREFIX"/bin
local incdir="$PKG_PREFIX"/include
local libdir_source="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH"
local libdir_target="$FOAM_EXT_LIBBIN"
local libname_suffix="-int$WM_LABEL_SIZE"
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
# Leave static libraries in sub-directory
if [ "$targetType" = lib ] || [ -z "$FOAM_EXT_LIBBIN" ]
then
unset libdir_target
fi
# Remove build artifacts from the source directory
# (for a clean build next time)
wclean
echo
echo "Adjusting installation"
echo "Installing headers: $incdir"
mkdir -m 0755 -p "$incdir"
/bin/cp -pv \
"$PKG_SOURCE"/interface/kaHIP_interface.h \
"$incdir"
# Rename lib as xxx-intNN qualified library names (non-windows)
if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
then
(
cd "$libdir_source" || exit
echo "Tagging libraries with $libname_suffix"
for name in libkahip libparhip_interface
do
if [ -f "$name$EXT_SO" ]
then
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
fi
done
)
fi
if [ -n "$libdir_target" ]
then
# Remove old libraries/links
for name in libkahip libkahip_interface libparhip_interface
do
rm -f "$libdir_target/$name$EXT_SO"
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
done
mkdir -p "$libdir_target"
echo "Relocating serial libraries"
# echo "Installing: $libdir_target/libkahip$libname_suffix"
mv -f "$libdir_source"/libkahip*"$EXT_SO" "$libdir_target" 2>/dev/null
fi
rmdir "$libdir_source" 2>/dev/null # Failed rmdir is uncritical
return 0
}
if [ "${useWmakeWorkaround:-false}" = false ]
then
(
echo "Starting build: $PACKAGE using cmake"
echo
PKG_BUILD="$buildBASE/$PACKAGE"
cd "$PKG_SOURCE" || exit
# Remove any existing build folder and recreate
rm -rf "$PKG_PREFIX"
rm -rf "$PKG_BUILD"
mkdir -p "$PKG_BUILD"
unset buildOpt
if [ "$optWithMPI" = false ]
then
buildOpt="${buildOpt} -DPARHIP=OFF"
fi
cmake=$(findCMake)
cd "$PKG_BUILD" && set -x && \
${cmake:?} \
-B "$PKG_BUILD" \
-S "$PKG_SOURCE" \
-DCMAKE_INSTALL_PREFIX="$PKG_PREFIX" \
-DCMAKE_BUILD_TYPE=Release \
$buildOpt \
${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \
&& set +x \
&& make -j $WM_NCOMPPROCS \
&& make install \
&& install \
&& echo "Built: $PACKAGE"
) || {
echo "Error building: $PACKAGE"
exit 1
}
elif true
then
(
echo "Starting build: $PACKAGE ($targetType) using wmake"
echo
cd "$PKG_SOURCE/lib" || exit
rm -rf "$PKG_PREFIX"
rm -f "$FOAM_EXT_LIBBIN/libkahip"*
export KAHIP_LIB_DIR="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH"
mkdir -m 0755 -p "$KAHIP_LIB_DIR" 2>/dev/null
cpMakeFiles kahip 2>/dev/null
if [ -e ../interface ] && [ ! -e interface ]
then
ln -s ../interface interface
fi
wmake -j $WM_NCOMPPROCS -s $targetType \
&& echo "Built: $PACKAGE" \
&& install_wmake
) || {
echo "Error building: $PACKAGE"
exit 1
}
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

149
makeLLVM
View File

@ -3,12 +3,14 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeLLVM # makeLLVM
@ -37,13 +39,16 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only if : # Run from third-party directory
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { then
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " Check your OpenFOAM environment and installation" wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
exit 1 echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
} echo " Check your OpenFOAM environment and installation"
. etc/tools/ThirdPartyFunctions exit 1
}
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
[ "${WM_COMPILER#Clang}" = "$WM_COMPILER" ] && WM_COMPILER=Clang # Force clang [ "${WM_COMPILER#Clang}" = "$WM_COMPILER" ] && WM_COMPILER=Clang # Force clang
@ -52,25 +57,26 @@ WM_COMPILER_TYPE=ThirdParty # Ensure we get the correct settings
# LLVM/Clang version from OpenFOAM etc/config.sh file: # LLVM/Clang version from OpenFOAM etc/config.sh file:
_foamConfig compiler _foamConfig compiler
llvmPACKAGE=$clang_version PACKAGE="$clang_version"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions llvm; exit 0; }
exec 1>&2 printHelp() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [llvm-VERSION] Usage: ${0##*/} [OPTION] [llvm-VERSION]
options: options:
-cmake PATH with cmake from the path given -gcc Force use of gcc/g++
-gcc force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX -cmake PATH with cmake from the given path
-help -list List available unpacked source versions
-help Display usage help
* build llvm/clang * Build llvm/clang
${llvmPACKAGE:-'unspecified LLVM version'} ${PACKAGE:-[unspecified]}
USAGE USAGE
exit 1 showDownloadHint llvm
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
@ -80,7 +86,8 @@ while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;; -gcc) useGcc ;;
-cmake) -cmake)
@ -88,11 +95,13 @@ do
CMAKE_PATH="${2%%/}" CMAKE_PATH="${2%%/}"
shift shift
;; ;;
llvm/* | sources/llvm* |\
llvm-[0-9]* | llvm-svn*) llvm-[0-9]* | llvm-svn*)
llvmPACKAGE="${1%%/}" PACKAGE="${1%%/}"
;; ;;
[1-9]*) [0-9]*)
llvmPACKAGE="llvm-${1%%/}" PACKAGE="llvm-${1%%/}"
;; ;;
*) *)
die "unknown option/argument: '$1'" die "unknown option/argument: '$1'"
@ -101,97 +110,97 @@ do
shift shift
done done
[ -n "$llvmPACKAGE" ] || die "The llvm-VERSION was not specified" if [ -z "$PACKAGE" ]
then
die "The LLVM package/version not specified"
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Build/install locations without a compiler name # !Build/install locations with arch name only (NO compiler name)!
buildBASE=$WM_THIRD_PARTY_DIR/build/$WM_ARCH$WM_COMPILER_ARCH buildBASE="$(dirname "$buildBASE")/$WM_ARCH$WM_COMPILER_ARCH"
installBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH installBASE="$(dirname "$installBASE")/$WM_ARCH$WM_COMPILER_ARCH"
# Build LLVM (clang) # Build LLVM (clang)
# LLVM_SOURCE_DIR : location of the original sources # *PACKAGE : name-version of the package
# LLVM_BUILD_DIR : location of the build # *SOURCEDIR : location of original sources
# LLVM_ARCH_PATH : location of the installed program # *PREFIXDIR : installation directory
# - Strip any trailing '.src' from the proper names # Note: strip trailing '.src' from package name
LLVM_SOURCE_DIR=$sourceBASE/$llvmPACKAGE PKG_SOURCE="$(findSourceDir "$PACKAGE")"
LLVM_BUILD_DIR=$buildBASE/${llvmPACKAGE%%.src} PACKAGE="$(basename "$PACKAGE" .src)" # Strip of trailing .src
LLVM_ARCH_PATH=$installBASE/${llvmPACKAGE%%.src} PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git" # Avoid seeing our own git-repo
#
# Build LLVM # Building...
#
echo "---------------" echo "---------------"
if [ -d $LLVM_ARCH_PATH ] if [ -d "$PKG_PREFIX" ]
then then
echo "Already built: $llvmPACKAGE" echo "Already built: $PACKAGE"
elif [ -z "$CMAKE_PATH" ] && $LLVM_SOURCE_DIR/configure -help >/dev/null 2>&1 elif [ -z "$CMAKE_PATH" ] && "$PKG_SOURCE"/configure -help >/dev/null 2>&1
then then
# configure can be used prior to 3.9.0 # configure can be used prior to 3.9.0
# but use cmake if someone explicitly mentioned -cmake on the command-line # but use cmake if someone explicitly mentioned -cmake on the command-line
echo "Starting build: $llvmPACKAGE (using configure)" echo "Starting build: $PACKAGE (using configure)"
echo echo
( (
cd $LLVM_SOURCE_DIR || exit 1 PKG_BUILD="$buildBASE/$PACKAGE"
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo cd "$PKG_SOURCE" || exit
make distclean 2>/dev/null make distclean 2>/dev/null || true
rm -rf $LLVM_BUILD_DIR rm -rf "$PKG_BUILD"
mkdir -p $LLVM_BUILD_DIR mkdir -p "$PKG_BUILD"
cd $LLVM_BUILD_DIR
set -x cd "$PKG_BUILD" && set -x && \
$LLVM_SOURCE_DIR/configure \ "$PKG_SOURCE"/configure \
--prefix=$LLVM_ARCH_PATH \ --prefix="$PKG_PREFIX" \
--with-gcc-toolchain=$(which gcc | sed s%/bin/gcc%%) \ --with-gcc-toolchain="$(command -v gcc | sed 's%/bin/gcc%%')" \
--enable-optimized \ --enable-optimized \
--enable-shared \ --enable-shared \
&& set +x \ && set +x \
&& make -j $WM_NCOMPPROCS \ && make -j $WM_NCOMPPROCS \
&& make install \ && make install \
&& echo "Built: $llvmPACKAGE" && echo "Built: $PACKAGE"
) || { ) || {
echo "Error building: $llvmPACKAGE" echo "Error building: $PACKAGE"
exit 1 exit 1
} }
else else
# CMake used with 3.9.0 and later # CMake used with 3.9.0 and later
echo "Starting build: $llvmPACKAGE (using cmake)" echo "Starting build: $PACKAGE (using cmake)"
echo echo
( (
PKG_BUILD="$buildBASE/$PACKAGE"
cd "$PKG_SOURCE" || exit
# Configuration options: # Configuration options:
unset configOpt unset configOpt
cd $LLVM_SOURCE_DIR || exit 1
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
if [ -f tools/openmp/CMakeLists.txt ] if [ -f tools/openmp/CMakeLists.txt ]
then then
configOpt="$configOpt -DLLVM_TOOL_OPENMP_BUILD=ON" configOpt="$configOpt -DLLVM_TOOL_OPENMP_BUILD=ON"
fi fi
rm -rf $LLVM_BUILD_DIR rm -rf "$PKG_BUILD"
mkdir -p $LLVM_BUILD_DIR mkdir -p "$PKG_BUILD"
cd $LLVM_BUILD_DIR
cmake=$(findCMake) cmake=$(findCMake)
set -x cd "$PKG_BUILD" && set -x && \
$cmake \ ${cmake:?} \
-DCMAKE_INSTALL_PREFIX=$LLVM_ARCH_PATH \ -DCMAKE_INSTALL_PREFIX="$PKG_PREFIX" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \ -DBUILD_SHARED_LIBS=ON \
$configOpt \ $configOpt \
$LLVM_SOURCE_DIR \ "$PKG_SOURCE" \
&& set +x \ && set +x \
&& make -j $WM_NCOMPPROCS \ && make -j $WM_NCOMPPROCS \
&& make install \ && make install \
&& echo "Built: $llvmPACKAGE" && echo "Built: $PACKAGE"
) || { ) || {
echo "Error building: $llvmPACKAGE" echo "Error building: $PACKAGE"
exit 1 exit 1
} }

245
makeMETIS
View File

@ -3,12 +3,13 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2017-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeMETIS # makeMETIS
@ -19,87 +20,110 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Dynamic library endings (default is .so) # Dynamic library ending (default is .so)
[ "$(uname -s)" = Darwin ] && SO=dylib || SO=so [ "$(uname -s)" = Darwin ] && EXT_SO=.dylib || EXT_SO=.so
# Short-circuit test for an installation # Short-circuit test for an installation
if [ "$1" = "-test" ] if [ "$1" = "-test" ]
then then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } [ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="$2" # <- METIS_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" ] [ -d "$dir/include" ] || exit 2
then
for lib in \ package="metis"
$FOAM_EXT_LIBBIN/libmetis.$SO \ libName="libmetis"
$dir/lib/libmetis.a \ for lib in \
$dir/lib/libmetis.$SO \ "$FOAM_EXT_LIBBIN/$libName$EXT_SO" \
$dir/lib$WM_COMPILER_LIB_ARCH/libmetis.a \ "$dir/lib/$libName.a" \
$dir/lib$WM_COMPILER_LIB_ARCH/libmetis.$SO \ "$dir/lib/$libName$EXT_SO" \
; "$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
do "$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
if [ -r "$lib" ] ;
then do
echo " metis include: $dir/include" if [ -r "$lib" ]
echo " metis library: ${lib%/*}" then
exit 0 echo " $package include: $dir/include"
fi echo " $package library: ${lib%/*}"
done exit 0
fi fi
done
exit 2 exit 2
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only if : # Run from third-party directory
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { then
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " Check your OpenFOAM environment and installation" wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
exit 1 echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
} echo " Check your OpenFOAM environment and installation"
[ -n "$FOAM_EXT_LIBBIN" ] || { exit 1
echo "Error (${0##*/}) : \$FOAM_EXT_LIBBIN not set" }
echo " Check your OpenFOAM environment and installation" fi
exit 1 . "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
}
. etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
_foamConfig metis _foamConfig metis
metisPACKAGE=${METIS_VERSION:-metis-system} PACKAGE="${METIS_VERSION:-system}"
targetType=libso targetType=libso
if nonStandardPlatforms # Possibly unreliable inherited values
then
unset METIS_ARCH_PATH
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions metis; exit 0; }
printHelp() {
exec 1>&2 exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [lib|libso] [METIS-VERSION] Usage: ${0##*/} [OPTION] [lib|libso] [METIS-VERSION]
options: options:
-gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX -gcc Force use of gcc/g++
-help -int32 Use IDXTYPEWIDTH 32
-int64 Use IDXTYPEWIDTH 64
-bin Create metis binaries as well
-no-bin Suppress creation of metis binaries (default)
-list List available unpacked source versions
-help Display usage help
* build METIS with * Build METIS (default: -int${WM_LABEL_SIZE:-32}) with
${metisPACKAGE:-'unspecified metis version'} ${PACKAGE:-[unspecified]}
USAGE USAGE
exit 1 showDownloadHint metis
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset optForce optNoExtlib
optBinaries=false
optLabelSize="${WM_LABEL_SIZE:-32}"
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) echo "ignoring $1" ;;
-int32 | -int64) optLabelSize="${1#-int}" ;;
-bin) optBinaries=true ;;
-no-bin) optBinaries=false ;;
-no-extlib) optNoExtlib=true ;; # Hidden option (experimental)
lib|libso) lib|libso)
targetType="$1" targetType="$1"
;; ;;
metis/* | sources/metis* | \
metis-[0-9]*) metis-[0-9]*)
metisPACKAGE="${1%%/}" PACKAGE="${1%%/}"
unset METIS_ARCH_PATH # Avoid inconsistency unset METIS_ARCH_PATH # Avoid inconsistency
;; ;;
*) *)
@ -109,32 +133,54 @@ do
shift shift
done done
[ -n "$metisPACKAGE" ] || die "The metis-VERSION was not specified" if [ -z "$PACKAGE" ]
then
die "The METIS package/version not specified"
elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
then
echo "Using none/system (skip ThirdParty build of METIS)"
exit 0
fi
# Nothing to build # Known build issues for mingw (various things)
if _foamIsNone $metisPACKAGE case "$WM_COMPILER" in
(Mingw*)
if :
then
echo "Skipping metis - known compilation issues with $WM_COMPILER"
exit 0
fi
;;
esac
if [ "$optNoExtlib" = true ]
then then
echo "Using metis-none (skip ThirdParty build of METIS)" unset FOAM_EXT_LIBBIN
exit 0 else
elif _foamIsSystem $metisPACKAGE requireExtLibBin
then
echo "Using metis-system"
exit 0
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build METIS # Build METIS
# METIS_ARCH_PATH : installation directory (as per config file)
# #
# METIS_ARCH_PATH : installation directory # *PACKAGE : name-version of the package
# METIS_SOURCE_DIR : location of the original sources # *SOURCE : location of original sources
# *PREFIX : installation directory
METIS_SOURCE_DIR=$sourceBASE/$metisPACKAGE PKG_SOURCE="$(findSourceDir "$PACKAGE")"
: ${METIS_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$metisPACKAGE} PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
[ -d "$METIS_SOURCE_DIR" ] || { # Override as per config file (if any)
echo "Missing sources: '$metisPACKAGE'" [ -n "$METIS_ARCH_PATH" ] && PKG_PREFIX="$METIS_ARCH_PATH"
exit 1
[ -d "$PKG_SOURCE" ] || {
echo "Missing sources: '$PACKAGE'"
showDownloadHint metis
exit 2
} }
# #
@ -142,19 +188,70 @@ METIS_SOURCE_DIR=$sourceBASE/$metisPACKAGE
# #
install() install()
{ {
local libdir=$METIS_ARCH_PATH/lib local bindir="$PKG_PREFIX"/bin
local libdir="$PKG_PREFIX"/lib
local libdir_target="$FOAM_EXT_LIBBIN"
local libname_suffix="-int$WM_LABEL_SIZE"
[ -n "$FOAM_EXT_LIBBIN" ] || unset libdir_target
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
echo
echo "Adjusting installation"
if [ "$optBinaries" = false ]
then
echo "Removing binaries: $bindir"
rm -rf "$bindir" 2>/dev/null # Failed removal is uncritical
fi
if [ "$targetType" = libso ] if [ "$targetType" = libso ]
then then
\mv $libdir/libmetis.$SO $FOAM_EXT_LIBBIN # Rename lib as xxx-intNN qualified library names (non-windows)
rmdir $libdir 2>/dev/null # Failed rmdir is uncritical if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
then
(
cd "$libdir" || exit
echo "Tagging libraries with $libname_suffix"
for name in libmetis
do
if [ -f "$name$EXT_SO" ]
then
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
fi
done
)
fi
echo "Installing: $FOAM_EXT_LIBBIN/libmetis.$SO" if [ -n "$libdir_target" ]
then
# Remove old libraries and links
for name in libmetis
do
rm -f "$libdir_target/$name$EXT_SO"
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
done
mkdir -p "$libdir_target"
echo "Relocating serial libraries"
# echo "Installing: $libdir_target/libmetis"
mv -f "$libdir"/libmetis* "$libdir_target"
fi
fi fi
rmdir "$libdir" 2>/dev/null # Failed rmdir is uncritical
return 0 return 0
} }
echo "Starting build: $metisPACKAGE ($targetType)"
echo "Starting build: $PACKAGE ($targetType)"
if [ "$optLabelSize" != "$WM_LABEL_SIZE" ]
then
echo "Using int-$optLabelSize instead of int-$WM_LABEL_SIZE"
fi
export WM_LABEL_SIZE="$optLabelSize"
echo echo
( (
# Configuration options: # Configuration options:
@ -164,20 +261,18 @@ echo
configOpt="shared=1" configOpt="shared=1"
fi fi
cd $METIS_SOURCE_DIR || exit 1 cd "$PKG_SOURCE" || exit
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo rm -rf "$PKG_PREFIX"
rm -f "$FOAM_EXT_LIBBIN"/libmetis*
rm -rf $METIS_ARCH_PATH # Adjust metis IDXTYPEWIDTH (integer size)
rm -f $FOAM_EXT_LIBBIN/libmetis.$SO sed -i -e 's=\(#define IDXTYPEWIDTH\).*=\1 '"$optLabelSize"'=' \
# Adjust metis integer size to match OpenFOAM label-size
sed -i -e 's=\(#define IDXTYPEWIDTH\).*=\1 '$WM_LABEL_SIZE'=' \
include/metis.h include/metis.h
# No config option for the library location. # No config option for the library location.
# - build normally and use mv to relocate it # - build normally and use mv to relocate it
make config $configOpt prefix=$METIS_ARCH_PATH \ make config $configOpt prefix="$PKG_PREFIX" \
&& make -j $WM_NCOMPPROCS install \ && make -j $WM_NCOMPPROCS install \
&& echo "Built: metis" \ && echo "Built: metis" \
&& install && install

View File

@ -3,12 +3,13 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2017-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeMGridGen # makeMGridGen
@ -19,54 +20,60 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from ThirdParty directory only if : # Run from third-party directory
wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || { then
echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " The environment variables are inconsistent with the installation." wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
echo " Check the OpenFOAM entries in your dot-files and source them." echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
exit 1 echo " Check your OpenFOAM environment and installation"
} exit 1
. etc/tools/ThirdPartyFunctions }
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
# mgridgen version from OpenFOAM etc/config.sh file:
_foamConfig mgridgen _foamConfig mgridgen
mgridgenPACKAGE=${MGRIDGEN_VERSION:-mgridgen-none} PACKAGE="${MGRIDGEN_VERSION:-none}"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions mgridgen parmgridgen; exit 0; }
exec 1>&2 printHelp() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [mgridgen-VERSION] Usage: ${0##*/} [OPTION] [mgridgen-VERSION]
options: options:
-gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX -force Force compilation, even if include/library already exists
-help -gcc Force use of gcc/g++
-list List available unpacked source versions
-help Display usage help
* Build MGridGen * Build MGridGen with
$mgridgenPACKAGE ${PACKAGE:-[unspecified]}
USAGE USAGE
exit 1 # showDownloadHint gridgen
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset optForce
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
-h | -help) '') ;; # Ignore empty
usage -h | -help*) printHelp;;
;; -list) printVersions;;
-gcc) -gcc) useGcc ;;
useGcc # Use gcc/g++ -force) optForce=true ;;
;;
mgridgen-[1-9]* | MGridGen-[1-9]* | parmgridgen-[1-9]* | ParMGridGen-[1-9]*) mgridgen/* | sources/*gridgen* | sources/*GridGen* | \
mgridgenPACKAGE="${1%%/}" mgridgen-[0-9]* | MGridGen-[0-9]* | \
parmgridgen-[0-9]* | ParMGridGen-[0-9]*)
PACKAGE="${1%%/}"
;; ;;
*) *)
die "unknown option/argument: '$1'" die "unknown option/argument: '$1'"
@ -75,34 +82,32 @@ do
shift shift
done done
[ -n "$mgridgenPACKAGE" ] || die "The mgridgen-VERSION was not specified" if [ -z "$PACKAGE" ]
# Nothing to build
if _foamIsNone "$mgridgenPACKAGE"
then then
echo "Using mgridgen-none (skip ThirdParty build of MGridGen)" die "The MGRIDGEN package/version not specified"
exit 0 elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
elif _foamIsSystem "$mgridgenPACKAGE"
then then
echo "Using mgridgen-system" echo "Using none/system (skip ThirdParty build of MGRIDGEN)"
exit 0 exit 0
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build MGridGen # Build MGridGen
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
# MGRIDGEN_SOURCE_DIR : location of the original sources PKG_SOURCE="$(findSourceDir "$PACKAGE")"
# MGRIDGEN_ARCH_PATH : installation directory PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
MGRIDGEN_SOURCE_DIR=$WM_THIRD_PARTY_DIR/$mgridgenPACKAGE : "${FOAM_MPI:=dummy}"
MGRIDGEN_ARCH_PATH=$installBASE$WM_SIZE_OPTIONS/$mgridgenPACKAGE
: ${FOAM_MPI:=dummy}
echo echo
echo ======================================== echo ========================================
echo "Build mgridgen library $mgridgenPACKAGE" echo "Build mgridgen library $PACKAGE"
echo echo
# #
@ -110,45 +115,47 @@ echo
# #
install() install()
{ {
echo "Install into $MGRIDGEN_ARCH_PATH" echo "Install into $PKG_PREFIX"
local bindir=$MGRIDGEN_ARCH_PATH/bin local bindir="$PKG_PREFIX"/bin
local incdir=$MGRIDGEN_ARCH_PATH/include local incdir="$PKG_PREFIX"/include
local libdir=$MGRIDGEN_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH local libdir="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH"
for dir in $MGRIDGEN_ARCH_PATH $bindir $incdir $libdir for dir in "$PKG_PREFIX" "$bindir" "$incdir" "$libdir"
do do
mkdir -m 0755 -p $dir mkdir -m 0755 -p "$dir"
done done
cp -vf mgridgen.h $incdir cp -vf mgridgen.h "$incdir"
cp -vf libmgrid.a $libdir cp -vf libmgrid.a "$libdir"
cp -vf mgridgen $bindir cp -vf mgridgen "$bindir"
chmod -R 0644 $incdir/* $libdir/* chmod -R 0644 "$incdir"/* "$libdir"/*
chmod -R 0755 $bindir/* chmod -R 0755 "$bindir"/*
} }
# Needs future adjustment # Needs future adjustment
# - for shared library # - for shared library
# - for mpi-specific library locations # - for mpi-specific library locations
if [ -f $MGRIDGEN_ARCH_PATH/include/mgridgen.h \ if [ -z "$optForce" ] \
-a -r $MGRIDGEN_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmgrid.a ] && [ -f "$PKG_PREFIX/include/mgridgen.h" ] \
&& {
[ -r "$PKG_PREFIX/lib/libmgrid.a" ] \
|| [ -r "$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH/libmgrid.a" ]
}
then then
echo " MGridGen header in $MGRIDGEN_ARCH_PATH/include" echo " MGridGen already built : $PKG_PREFIX"
echo " MGridGen libs in $MGRIDGEN_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" # static
echo
else else
( (
cd $MGRIDGEN_SOURCE_DIR || exit 1 cd "$PKG_SOURCE" || exit
[ -e Makefile ] && make realclean 2>/dev/null [ -e Makefile ] && make realclean 2>/dev/null
# Remove any existing build folder and recreate # Remove any existing build folder and recreate
rm -rf $MGRIDGEN_ARCH_PATH rm -rf "$PKG_PREFIX"
serial="${CC:-$WM_CC}" # CC (serial compiler) default=cc serial="$(whichCC)" # CC (serial compiler) default=gcc
# parallel=$(whichMpicc) # PARCC (parallel compiler) default=mpicc # parallel=$(whichMpicc) # PARCC (parallel compiler) default=mpicc
# PARCC=$parallel # PARCC=$parallel
# PARLD=$parallel # PARLD=$parallel
# PARLIBS="-L../.. -lparmgrid -lmgrid -lm" # PARLIBS="-L../.. -lparmgrid -lmgrid -lm"
@ -156,16 +163,17 @@ else
make \ make \
COPTIONS="-fPIC" \ COPTIONS="-fPIC" \
LDOPTIONS="-fPIC" \ LDOPTIONS="-fPIC" \
CC=$serial \ CC="$serial" \
LD=$serial \ LD="$serial" \
LIBDIR="-L../.." \ LIBDIR="-L../.." \
LIBS="-L../.. -lmgrid -lm" \ LIBS="-L../.. -lmgrid -lm" \
make=make \ make=make \
serial \ serial \
&& install \ && install \
&& echo "Built: $mgridgenPACKAGE" && echo "Built: $PACKAGE"
) || { ) || {
echo "Error building: $mgridgenPACKAGE" echo "Error building: $PACKAGE"
exit 1
} }
fi fi

192
makeMPICH
View File

@ -3,96 +3,110 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2017-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeMPICH # makeMPICH
# #
# Description # Description
# Build script for mpich - legacy (unmaintained) build code! # Build script for mpich [unmaintained]
# #
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Dynamic library endings (default is .so) # Dynamic library ending (default is .so)
[ "$(uname -s)" = Darwin ] && SO=dylib || SO=so [ "$(uname -s)" = Darwin ] && EXT_SO=.dylib || EXT_SO=.so
# Short-circuit test for an installation # Short-circuit test for an installation
if [ "$1" = "-test" ] if [ "$1" = "-test" ]
then then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } [ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="$2" # <- MPI_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpich.$SO" ]
then package="mpich"
echo "Have mpich shared library (${dir##*/})" libName="libmpi"
exit 0 for lib in \
elif [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpich.a" ] "$dir/lib/$libName.a" \
then "$dir/lib/$libName$EXT_SO" \
echo "Have mpich static library (${dir##*/})" "$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
exit 0 "$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
else ;
echo "No mpich libraries found: ${dir:-not-specified}" do
exit 2 if [ -r "$lib" ]
fi then
echo "Have $package shared library (${dir##*/})"
exit 0
fi
done
echo "No $package libraries found: ${dir:-not-specified}"
exit 2
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only if : # Run from third-party directory
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { then
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " Check your OpenFOAM environment and installation" wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
exit 1 echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
} echo " Check your OpenFOAM environment and installation"
. etc/tools/ThirdPartyFunctions exit 1
}
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
# Transition # Transition
# ~~~~~~~~~~
_foamAddLib() { true; } _foamAddLib() { true; }
_foamAddMan() { true; } _foamAddMan() { true; }
_foamAddPath() { true; } _foamAddPath() { true; }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
WM_MPLIB=MPICH # Ensure we get the correct MPI WM_MPLIB=MPICH # Ensure we get the correct MPI
# mpich version from OpenFOAM etc/config.sh file:
_foamConfig mpi _foamConfig mpi
mpiPACKAGE=${FOAM_MPI:-mpich-system} PACKAGE="${FOAM_MPI:-system}"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions mpich; exit 0; }
exec 1>&2 printHelp() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [mpich-VERSION] [-- configure-options] Usage: ${0##*/} [OPTION] [mpich-VERSION] [-- configure-options]
options: options:
-gcc force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX -force Force compilation, even if include/library already exists
-help -gcc Force use of gcc/g++
-list List available unpacked source versions
-help Display usage help
* build mpich with * build mpich with
${mpiPACKAGE:-'unspecified mpich version'} ${PACKAGE:-[unspecified]}
USAGE USAGE
exit 1 showDownloadHint mpich
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset optForce
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
--) break;; # Extra configure options (leave on $@ for later detection) --) break;; # Extra configure options (leave on $@ for later detection)
-h | -help) usage ;; -h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) optForce=true ;;
mpich/* | sources/mpich* | \
mpich*) mpich*)
mpiPACKAGE="${1%%/}" PACKAGE="${1%%/}"
;; ;;
*) *)
@ -102,37 +116,43 @@ do
shift shift
done done
[ -n "$mpiPACKAGE" ] || die "The mpich-VERSION was not specified" if [ -z "$PACKAGE" ]
# Nothing to build
if _foamIsNone "$mpiPACKAGE"
then then
echo "Using mpich-none (skip ThirdParty build of mpich)" die "The MPICH package/version not specified"
exit 0 elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
elif _foamIsSystem "$mpiPACKAGE"
then then
echo "Using mpich-system (skip ThirdParty build of mpich)" echo "Using none/system (skip ThirdParty build of MPICH)"
exit 0 exit 0
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build mpich # Build MPICH
# # *PACKAGE : name-version of the package
# MPI_SOURCE_DIR : location of the original sources # *SOURCE : location of original sources
# MPI_ARCH_PATH : installation directory # *PREFIX : installation directory
MPI_SOURCE_DIR=$sourceBASE/$mpiPACKAGE PKG_SOURCE="$(findSourceDir "$PACKAGE")"
MPI_ARCH_PATH=$installBASE/$mpiPACKAGE PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
if [ -r "$MPI_ARCH_PATH/lib_ARCH/libmpi.$SO" ] if [ -z "$optForce" ] \
&& {
[ -r "$PKG_PREFIX/lib/libmpi$EXT_SO" ] \
|| [ -r "$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
}
then then
echo "Already has shared library" echo "Already has shared library: $PKG_PREFIX"
elif [ -r "$MPI_ARCH_PATH/lib/libmpi.a" ] elif [ -z "$optForce" ] \
&& {
[ -r "$PKG_PREFIX/lib/libmpi.a" ] \
|| [ -r "$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
}
then then
echo "Already has static library" echo "Already has static library: $PKG_PREFIX"
else else
echo "Starting build: $WM_MPLIB ($mpiPACKAGE)" echo "Starting build: $WM_MPLIB ($PACKAGE)"
echo echo
( (
@ -149,31 +169,51 @@ else
# End of configuration options # End of configuration options
# ---------------------------- # ----------------------------
cd $MPI_SOURCE_DIR || exit 1 PKG_BUILD="$buildBASE/$PACKAGE"
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
[ -e Makefile ] && make distclean 2>/dev/null
rm -rf $MPI_ARCH_PATH cd "$PKG_SOURCE" || exit
rm -rf $buildDIR make distclean 2>/dev/null || true
mkdir -p $buildDIR
cd $buildDIR
set -x rm -rf "$PKG_PREFIX"
$MPI_SOURCE_DIR/configure \ rm -rf "$PKG_BUILD"
--prefix=$MPI_ARCH_PATH \ mkdir -p "$PKG_BUILD"
# reproducible build naming
local_destdir="$(dirname $PKG_PREFIX)"
local_prefix="/$(basename $local_destdir)/$(basename $PKG_PREFIX)"
local_destdir="$(dirname $local_destdir)"
echo
echo "configured prefix: $local_prefix"
echo "install directory: $local_destdir"
echo
cd "$PKG_BUILD" && set -x && \
"$PKG_SOURCE"/configure \
--prefix="$local_prefix" \
--disable-fortran --disable-g \ --disable-fortran --disable-g \
--libdir=$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
--enable-shared --disable-static \ --enable-shared --disable-static \
$configOpt \ $configOpt \
&& set +x \ && set +x \
&& make -j $WM_NCOMPPROCS \ && make -j $WM_NCOMPPROCS \
&& make install \ && make install DESTDIR="$local_destdir" \
&& echo "Built: $mpiPACKAGE" \ && echo "Built: $PACKAGE"
&& pkgconfigAdjust $MPI_ARCH_PATH
) || { ) || {
echo "Error building: $mpiPACKAGE" echo "Error building: $PACKAGE"
exit 1 exit 1
} }
# Unneeded generated files
for dir in share/doc share/info share/man
do
if [ -d "$PKG_PREFIX/$dir" ]
then
echo "Discard $dir files to save space: $PACKAGE"
rm -rf "$PKG_PREFIX/$dir"
fi
done
rmdir "$PKG_PREFIX"/share 2>/dev/null || true
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

202
makeMVAPICH Executable file
View File

@ -0,0 +1,202 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2019-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# makeMVAPICH2
#
# Description
# Build script for mvapich2 [unmaintained]
#
# ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------
# Dynamic library ending (default is .so)
[ "$(uname -s)" = Darwin ] && EXT_SO=.dylib || EXT_SO=.so
# Short-circuit test for an installation
if [ "$1" = "-test" ]
then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH
package="mvapich"
libName="libmpi"
for lib in \
"$dir/lib/$libName.a" \
"$dir/lib/$libName$EXT_SO" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
;
do
if [ -r "$lib" ]
then
echo "Have $package library (${dir##*/})"
exit 0
fi
done
echo "No $package libraries found: ${dir:-not-specified}"
exit 2
fi
#------------------------------------------------------------------------------
if : # Run from third-party directory
then
cd "${0%/*}" || exit
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
}
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
# Transition
_foamAddLib() { true; }
_foamAddMan() { true; }
_foamAddPath() { true; }
#------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
WM_MPLIB=MVA2MPI # Ensure we get the correct MPI
_foamConfig mpi
PACKAGE="${FOAM_MPI:-system}"
#------------------------------------------------------------------------------
printVersions() { listPackageVersions mvapich; exit 0; }
printHelp() {
cat<<USAGE
Usage: ${0##*/} [OPTION] [mvapich2-VERSION] [-- configure-options]
options:
-force Force compilation, even if include/library already exists
-gcc Force use of gcc/g++
-list List available unpacked source versions
-help Display usage help
* build mvapich2 with
${PACKAGE:-[unspecified]}
The additional configure-options could include, for example,
${0##*/} -- --disable-mcast
USAGE
showDownloadHint mvapich
exit 0 # Clean exit
}
#------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure
unset optForce
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
--) break;; # Extra configure options (leave on $@ for later detection)
-h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;;
-force) optForce=true ;;
mvapich/* | sources/mvapich* | \
mvapich*)
PACKAGE="${1%%/}"
;;
*)
die "unknown option/argument: '$1'"
;;
esac
shift
done
if [ -z "$PACKAGE" ]
then
die "The MVAPICH package/version not specified"
elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
then
echo "Using none/system (skip ThirdParty build of MVAPICH)"
exit 0
fi
#------------------------------------------------------------------------------
#
# Build MVAPICH
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
PKG_SOURCE="$(findSourceDir "$PACKAGE")"
PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
if [ -z "$optForce" ] \
&& {
[ -r "$PKG_PREFIX/lib/libmpi$EXT_SO" ] \
|| [ -r "$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
}
then
echo "Already has shared library: $PKG_PREFIX"
elif [ -z "$optForce" ] \
&& {
[ -r "$PKG_PREFIX/lib/libmpi.a" ] \
|| [ -r "$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
}
then
echo "Already has static library: $PKG_PREFIX"
else
echo "Starting build: $WM_MPLIB ($PACKAGE)"
echo
(
# Configuration options:
unset configOpt
# Additional configure options
if [ "$1" = "--" ]
then
shift
configOpt="$configOpt $@"
fi
# End of configuration options
# ----------------------------
PKG_BUILD="$buildBASE/$PACKAGE"
cd "$PKG_SOURCE" || exit
make distclean 2>/dev/null || true
rm -rf "$PKG_PREFIX"
rm -rf "$PKG_BUILD"
mkdir -p "$PKG_BUILD"
cd "$PKG_BUILD" && set -x && \
"$PKG_SOURCE"/configure \
--prefix="$PKG_PREFIX" \
--disable-fortran --disable-g \
--enable-shared --disable-static \
$configOpt \
&& set +x \
&& make -j $WM_NCOMPPROCS \
&& make install \
&& echo "Built: $PACKAGE" \
&& pkgconfigAdjust "$PKG_PREFIX"
) || {
echo "Error building: $PACKAGE"
exit 1
}
fi
#------------------------------------------------------------------------------

304
makeMesa
View File

@ -3,18 +3,19 @@
# ========= | # ========= |
# \\ / 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 | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeMesa # makeMesa
# #
# Description # Description
# Build script for Mesa # Build script for MESA
# #
# Note # Note
# Building with mesa-12.x.x fails to create an include/GL directory and # Building with mesa-12.x.x fails to create an include/GL directory and
@ -22,52 +23,75 @@
# #
# Building with mesa-11.x, mesa-13.x and mesa-17.x seems to be okay. # Building with mesa-11.x, mesa-13.x and mesa-17.x seems to be okay.
# #
# Known dependencies (likely incomplete)
#
# openSUSE 15.2:
#
# dri2proto-devel
# glproto-devel
# libxshmfence-devel
#
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only if : # Run from third-party directory
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { then
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " Check your OpenFOAM environment and installation" wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
exit 1 echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
} echo " Check your OpenFOAM environment and installation"
. etc/tools/ThirdPartyFunctions exit 1
}
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
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:
_foamConfig vtk _foamConfig vtk
mesaPACKAGE=$mesa_version PACKAGE="$mesa_version"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions mesa; exit 0; }
exec 1>&2 printHelp() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<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 use of gcc/g++
-help -llvm VER llvm version (in ThirdParty) or 'system' to use system
-list List available unpacked source versions
-help Display usage help
* build Mesa with * build MESA with
${mesaPACKAGE:-'unspecified MESA version'} ${PACKAGE:-[unspecified]}
USAGE USAGE
exit 1 showDownloadHint mesa
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
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
@ -77,15 +101,25 @@ do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
--) break;; # Extra configure options (leave on $@ for later detection) --) break;; # Extra configure options (leave on $@ for later detection)
-h | -help) usage ;; -h | -help*) printHelp;;
-list) printVersions;;
-gcc) -gcc)
useGcc useGcc
unset thirdPartyClang unset withLLVM
;; ;;
mesa-*) -llvm)
mesaPACKAGE="${1%%/}" [ "$#" -ge 2 ] || die "'$1' option requires an argument"
withLLVM="$2"
shift
;;
llvm-*)
withLLVM="$1"
;; ;;
mesa/* | sources/mesa* |\
mesa-*)
PACKAGE="${1%%/}"
;;
*) *)
die "unknown option/argument: '$1'" die "unknown option/argument: '$1'"
;; ;;
@ -93,67 +127,100 @@ do
shift shift
done done
[ -n "$mesaPACKAGE" ] || die "The mesa-VERSION was not specified" if [ -z "$PACKAGE" ]
# Nothing to build
if _foamIsNone "$mesaPACKAGE"
then then
echo "Using mesa-none (skip ThirdParty build of MESA)" die "The MESA package/version not specified"
exit 0 elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
elif _foamIsSystem "$mesaPACKAGE"
then then
echo "Using mesa-system (skip ThirdParty build of MESA)" echo "Using none/system (skip ThirdParty build of MESA)"
exit 0 exit 0
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Locate third-party clang as required # Locate third-party clang as required
if [ "$thirdPartyClang" = true ] case "$withLLVM" in
then ('' | none | false)
thirdPartyClang=$(command -v clang) || { withLLVM=none
echo "Error: could not properly locate clang" echo "Without llvm"
;;
(true | system)
LLVM_ARCH_PATH="$(command -v 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" ] || { if [ -d "$LLVM_ARCH_PATH" ]
echo "Error: could not properly locate clang" then
# Add to path (for llvm-config)
PATH="$LLVM_ARCH_PATH/bin:$PATH"
else
echo "Error: could not properly locate llvm/clang"
exit 2 exit 2
} fi
fi ;;
(llvm-*)
echo "check llvm = $withLLVM"
LLVM_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH/$withLLVM"
if [ -d "$LLVM_ARCH_PATH" ]
then
# Add to path (for llvm-config)
PATH="$LLVM_ARCH_PATH/bin:$PATH"
else
echo "Error: could not properly locate llvm/clang"
exit 2
fi
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build MESA # Build MESA
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
#
# 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 PKG_SOURCE="$(findSourceDir "$PACKAGE")"
# MESA_ARCH_DIR : installation directory PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
MESA_SOURCE_DIR=$sourceBASE/$mesaPACKAGE
MESA_ARCH_PATH=$installBASE/$mesaPACKAGE
#
# Manual adjustments to mesa # Manual adjustments to mesa
# - avoid GLES (GLES1) since <GLES/gl.h> may mask the <GL/gl.h> header # - avoid GLES (GLES1) since <GLES/gl.h> may mask the <GL/gl.h> header
adjustMESA() adjustMESA()
{ {
pkgconfigAdjust $MESA_ARCH_PATH pkgconfigAdjust "$PKG_PREFIX"
\rm -rf $MESA_ARCH_PATH/include/GLES $MESA_ARCH_PATH/include/GLES1 rm -rf "$PKG_PREFIX"/include/GLES "$PKG_PREFIX"/include/GLES1
echo "removed all gles1 includes" echo "removed all gles1 includes"
} }
# Old MESA with autoconfig
if [ -e "$PKG_SOURCE"/configure ]
then
( (
# Configuration options: # Configuration options:
unset configOpt unset configOpt compFlags
if [ -d "$thirdPartyClang" ] # Sometimes for LLVM issues
# compFlags="-D_GLIBCXX_USE_CXX11_ABI=0"
# Possibly for older mesa versions (see paraview wiki)
# compFlags="-O2 -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
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
@ -165,35 +232,35 @@ adjustMESA()
# End of configuration options # End of configuration options
# ---------------------------- # ----------------------------
buildDIR=$buildBASE/$mesaPACKAGE PKG_BUILD="$buildBASE/$PACKAGE"
cd $MESA_SOURCE_DIR || exit 1 cd "$PKG_SOURCE" || exit
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
# Remove any existing build
rm -rf $MESA_ARCH_PATH
rm -rf $buildDIR
mkdir -p $buildDIR
cd $buildDIR
echo "----" echo "----"
echo "Building $mesaPACKAGE" echo "Building $PACKAGE (with autoconf)"
echo " Source : $MESA_SOURCE_DIR" echo " Source : $PKG_SOURCE"
echo " Target : $MESA_ARCH_PATH" echo " Target : $PKG_PREFIX"
if [ -d "$thirdPartyClang" ] if [ -d "$LLVM_ARCH_PATH" ]
then then
echo " Clang : $thirdPartyClang" echo " llvm : $LLVM_ARCH_PATH"
fi fi
echo "----" echo "----"
# Possibly for older mesa versions (see paraview wiki) if [ -n "$compFlags" ]
# CXXFLAGS="-O2 -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \ then
# CFLAGS="-O2 -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \ CFLAGS="$CFLAGS $compFlags"
CXXFLAGS="$CXXFLAGS $compFlags"
fi
## autoreconf -fi ## autoreconf -fi
set -x
$MESA_SOURCE_DIR/configure \ rm -rf "$PKG_PREFIX"
--prefix=$MESA_ARCH_PATH \ rm -rf "$PKG_BUILD"
mkdir -p "$PKG_BUILD"
cd "$PKG_BUILD" && set -x && \
"$PKG_SOURCE"/configure \
--prefix="$PKG_PREFIX" \
--disable-xvmc \ --disable-xvmc \
--disable-glx \ --disable-glx \
--disable-dri \ --disable-dri \
@ -206,11 +273,82 @@ adjustMESA()
&& set +x \ && set +x \
&& make -j $WM_NCOMPPROCS \ && make -j $WM_NCOMPPROCS \
&& make install \ && make install \
&& echo "Built $mesaPACKAGE" \ && echo "Built $PACKAGE" \
&& adjustMESA && adjustMESA
) || { ) || {
echo "Error building: MESA" echo "Error building: MESA"
exit 1 exit 1
} }
elif [ -e "$PKG_SOURCE"/meson.build ]
then
(
# Configuration options:
unset configOpt compFlags
# Sometimes for LLVM issues
# compFlags="-D_GLIBCXX_USE_CXX11_ABI=0"
# Possibly for older mesa versions (see paraview wiki)
# compFlags="-O2 -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
# Additional configure options
if [ "$1" = "--" ]
then
shift
configOpt="$configOpt $@"
fi
# End of configuration options
# ----------------------------
PKG_BUILD="$buildBASE/$PACKAGE"
cd "$PKG_SOURCE" || exit
echo "----"
echo "Building $PACKAGE (with meson)"
echo " Source : $PKG_SOURCE"
echo " Target : $PKG_PREFIX"
if [ -d "$LLVM_ARCH_PATH" ]
then
echo " llvm : $LLVM_ARCH_PATH"
fi
echo "----"
if [ -n "$compFlags" ]
then
CFLAGS="$CFLAGS $compFlags"
CXXFLAGS="$CXXFLAGS $compFlags"
fi
# Needs c++14 not c++11
CXXFLAGS="$(echo "$CXXFLAGS" | sed 's/c++11/c++14/')"
rm -rf "$PKG_PREFIX"
rm -rf "$PKG_BUILD"
mkdir -p "$PKG_BUILD"
cd "$PKG_SOURCE" && set -x && \
meson "$PKG_BUILD" \
--prefix="$PKG_PREFIX" \
-Dplatforms=x11 \
-Dosmesa=gallium \
-Dgallium-drivers=swrast \
-Ddri-drivers=[] \
-Dvulkan-drivers=[] \
$configOpt \
&& set +x \
&& ninja -j $WM_NCOMPPROCS -C "$PKG_BUILD" \
&& ninja -C "$PKG_BUILD" install \
&& echo "Built $PACKAGE" \
&& adjustMESA
) || {
echo "Error building: MESA"
exit 1
}
else
echo "Error building: MESA. Not autoconfig or meson?"
exit 1
fi
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

12
makeMesa.example Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
# An example for building mesa with llvm
mesa=mesa-18.3.4
llvm=llvm-4.0.1
set -x
./makeMesa \
$mesa $llvm
"$@"
#------------------------------------------------------------------------------

View File

@ -3,12 +3,13 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2017-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeOPENMPI # makeOPENMPI
@ -19,73 +20,81 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Dynamic library endings (default is .so) # Dynamic library ending (default is .so)
[ "$(uname -s)" = Darwin ] && SO=dylib || SO=so [ "$(uname -s)" = Darwin ] && EXT_SO=.dylib || EXT_SO=.so
# Short-circuit test for an installation # Short-circuit test for an installation
if [ "$1" = "-test" ] if [ "$1" = "-test" ]
then then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } [ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="$2" # <- MPI_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpi.$SO" ]
then package="openmpi"
echo " Have openmpi shared library (${dir##*/})" libName="libmpi"
exit 0 for lib in \
elif [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ] "$dir/lib/$libName.a" \
then "$dir/lib/$libName$EXT_SO" \
echo " Have openmpi static library (${dir##*/})" "$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
exit 0 "$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
else ;
echo "No openmpi libraries found: ${dir:-not-specified}" do
exit 2 if [ -r "$lib" ]
fi then
echo "Have $package library (${dir##*/})"
exit 0
fi
done
echo "No $package libraries found: ${dir:-not-specified}"
exit 2
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only if : # Run from third-party directory
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { then
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " Check your OpenFOAM environment and installation" wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
exit 1 echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
} echo " Check your OpenFOAM environment and installation"
. etc/tools/ThirdPartyFunctions exit 1
}
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
# Transition # Transition
# ~~~~~~~~~~
_foamAddLib() { true; } _foamAddLib() { true; }
_foamAddMan() { true; } _foamAddMan() { true; }
_foamAddPath() { true; } _foamAddPath() { true; }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
WM_MPLIB=OPENMPI # Ensure we get the correct MPI WM_MPLIB=OPENMPI # Ensure we get the correct MPI
# openmpi version from OpenFOAM etc/config.sh file:
_foamConfig mpi _foamConfig mpi
mpiPACKAGE=${FOAM_MPI:-openmpi-system} PACKAGE="${FOAM_MPI:-system}"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions openmpi; exit 0; }
exec 1>&2 printHelp() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [openmpi-VERSION] [-- configure-options] Usage: ${0##*/} [OPTION] [openmpi-VERSION] [-- configure-options]
options: options:
-gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX -force Force compilation, even if include/library already exists
-gcc Force use of gcc/g++
-memcheck Configure with --enable-memcheck (requires valgrind.h) -memcheck Configure with --enable-memcheck (requires valgrind.h)
-threaded Configure with --enable-mpi-thread-multiple -threaded Configure with --enable-mpi-thread-multiple
-no-threaded Configure with --disable-mpi-thread-multiple -no-threaded Configure with --disable-mpi-thread-multiple
-help -list List available unpacked source versions
-help Display usage help
* build openmpi with * build openmpi with
${mpiPACKAGE:-'unspecified openmpi version'} ${PACKAGE:-[unspecified]}
USAGE USAGE
exit 1 showDownloadHint openmpi
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset optMemchecker optThreaded unset optForce optMemchecker optThreaded
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
@ -93,14 +102,17 @@ do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
--) break;; # Extra configure options (leave on $@ for later detection) --) break;; # Extra configure options (leave on $@ for later detection)
-h | -help) usage ;; -h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) optForce=true ;;
-memcheck*) optMemchecker=true ;; -memcheck*) optMemchecker=true ;;
-thread*) optThreaded=enable ;; -thread*) optThreaded=enable ;;
-no-thread*) optThreaded=disable ;; -no-thread*) optThreaded=disable ;;
openmpi/* | sources/openmpi* | \
openmpi-[0-9]* | openmpi_[0-9]* | openmpi-system ) openmpi-[0-9]* | openmpi_[0-9]* | openmpi-system )
mpiPACKAGE="${1%%/}" PACKAGE="${1%%/}"
;; ;;
*) *)
@ -110,37 +122,43 @@ do
shift shift
done done
[ -n "$mpiPACKAGE" ] || die "The openmpi-VERSION was not specified" if [ -z "$PACKAGE" ]
# Nothing to build
if _foamIsNone "$mpiPACKAGE"
then then
echo "Using openmpi-none (skip ThirdParty build of openmpi)" die "The OPENMPI package/version not specified"
exit 0 elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
elif _foamIsSystem "$mpiPACKAGE"
then then
echo "Using openmpi-system (skip ThirdParty build of openmpi)" echo "Using none/system (skip ThirdParty build of OPENMPI)"
exit 0 exit 0
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build openmpi # Build OPENMPI
# # *PACKAGE : name-version of the package
# MPI_SOURCE_DIR : location of the original sources # *SOURCE : location of original sources
# MPI_ARCH_PATH : installation directory # *PREFIX : installation directory
MPI_SOURCE_DIR=$sourceBASE/$mpiPACKAGE PKG_SOURCE="$(findSourceDir "$PACKAGE")"
MPI_ARCH_PATH=$installBASE/$mpiPACKAGE PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
if [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi.$SO" ] if [ -z "$optForce" ] \
&& {
[ -r "$PKG_PREFIX/lib/libmpi$EXT_SO" ] \
|| [ -r "$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
}
then then
echo "Already has shared library: $MPI_ARCH_PATH" echo "Already has shared library: $PKG_PREFIX"
elif [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ] elif [ -z "$optForce" ] \
&& {
[ -r "$PKG_PREFIX/lib/libmpi.a" ] \
|| [ -r "$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
}
then then
echo "Already has static library: $MPI_ARCH_PATH" echo "Already has static library: $PKG_PREFIX"
else else
echo "Starting build: $WM_MPLIB ($mpiPACKAGE)" echo "Starting build: $WM_MPLIB ($PACKAGE)"
echo echo
( (
@ -169,34 +187,59 @@ else
# End of configuration options # End of configuration options
# ---------------------------- # ----------------------------
buildDIR=$buildBASE/$mpiPACKAGE PKG_BUILD="$buildBASE/$PACKAGE"
cd "$PKG_SOURCE" || exit
cd $MPI_SOURCE_DIR || exit 1 make distclean 2>/dev/null || true
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
[ -e Makefile ] && make distclean 2>/dev/null
rm -rf $MPI_ARCH_PATH rm -rf "$PKG_PREFIX"
rm -rf $buildDIR rm -rf "$PKG_BUILD"
mkdir -p $buildDIR mkdir -p "$PKG_BUILD"
cd $buildDIR
set -x # The real prefix is /path/ThirdParty/platforms/arch/openmpi-x.y.z
$MPI_SOURCE_DIR/configure \ # but configure with prefix="/arch/openmpi-x.y.z"
--prefix=$MPI_ARCH_PATH \ # and install into "/path/ThirdParty/platforms"
--libdir=$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
# The final binaries are then independent of the build location and
# will always require OPAL_PREFIX to run
local_destdir="$(dirname $PKG_PREFIX)"
local_prefix="/$(basename $local_destdir)/$(basename $PKG_PREFIX)"
local_destdir="$(dirname $local_destdir)"
echo
echo "configured prefix: $local_prefix"
echo "install directory: $local_destdir"
echo
# Do not specify '--libdir' or relocating becomes difficult
cd "$PKG_BUILD" && set -x && \
"$PKG_SOURCE"/configure \
--prefix="$local_prefix" \
--disable-orterun-prefix-by-default \ --disable-orterun-prefix-by-default \
--enable-shared --disable-static \ --enable-shared --disable-static \
--enable-mpi-fortran=none \ --enable-mpi-fortran=none \
$configOpt \ $configOpt \
&& set +x \ && set +x \
&& make -j $WM_NCOMPPROCS \ && make -j $WM_NCOMPPROCS \
&& make install \ && make install DESTDIR="$local_destdir" \
&& echo "Built: $mpiPACKAGE" \ && echo "Built: $PACKAGE"
&& pkgconfigAdjust $MPI_ARCH_PATH
) || { ) || {
echo "Error building: $mpiPACKAGE" echo "Error building: $PACKAGE"
exit 1 exit 1
} }
# Unneeded generated files
for dir in share/doc share/info share/man
do
if [ -d "$PKG_PREFIX/$dir" ]
then
echo "Discard $dir files to save space: $PACKAGE"
rm -rf "$PKG_PREFIX/$dir"
fi
done
rmdir "$PKG_PREFIX"/share 2>/dev/null || true
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

288
makePETSC
View File

@ -3,12 +3,13 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makePETSC # makePETSC
@ -19,88 +20,98 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Dynamic library endings (default is .so) if : # Run from third-party directory
[ "$(uname -s)" = Darwin ] && SO=dylib || SO=so
# Short-circuit test for an installation
if [ "$1" = "-test" ]
then then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } cd "${0%/*}" || exit
dir="$2" # <- PETSC_ARCH_PATH wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
if [ -d "$dir/include" ] echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
then echo " Check your OpenFOAM environment and installation"
for lib in \ exit 1
$FOAM_EXT_LIBBIN/libpetsc.$SO \ }
$dir/lib/libpetsc.a \
$dir/lib/libpetsc.$SO \
$dir/lib$WM_COMPILER_LIB_ARCH/libpetsc.a \
$dir/lib$WM_COMPILER_LIB_ARCH/libpetsc.$SO \
;
do
if [ -r "$lib" ]
then
echo " petsc include: $dir/include"
echo " petsc library: ${lib%/*}"
exit 0
fi
done
fi
exit 2
fi fi
#------------------------------------------------------------------------------ . "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
# Run from third-party directory only
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
}
[ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Error (${0##*/}) : \$FOAM_EXT_LIBBIN not set"
echo " Check your OpenFOAM environment and installation"
exit 1
}
. etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
_foamConfig petsc _foamConfig petsc
petscPACKAGE=${petsc_version:-petsc-system} PETSC_PACKAGE="${petsc_version:-none}"
targetType=libso targetType=libso
unset HYPRE_PACKAGE
unset HYPRE_ARCH_PATH # Avoid inconsistency
if nonStandardPlatforms # Possibly unreliable inherited values
then
unset PETSC_ARCH_PATH
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions petsc; exit 0; }
exec 1>&2 printHelp() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [lib|libso] [PETSC-VERSION] Usage: ${0##*/} [OPTION] [lib|libso] [HYPRE-VERSION] [PETSC-VERSION] [-- configure-options]
options: options:
-gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX -force Force compilation, even if include/library already exists
-help -gcc Force use of gcc/g++
-inplace Build/install inplace (expert option)
-debug Build with debugging enabled
-hypre=URL Specify hypre download location
-no-hypre Disable automatic hypre download/detection
-list List available unpacked source versions
-help Display usage help
* build PETSC with * build PETSC with
${petscPACKAGE:-'unspecified petsc version'} ${PACKAGE:-[unspecified]}
USAGE USAGE
exit 1 showDownloadHint petsc
echo
echo "Many people who have downloaded PETSC have also downloaded HYPRE :"
showDownloadHint hypre
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset optDebug optForce optInplace optHypre
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; --) break;; # Extra configure options (leave on $@ for later detection)
-h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) optForce=true ;;
-inplace) optInplace=true ;;
-debug) optDebug=true ;;
lib|libso) lib|libso) targetType="$1" ;;
targetType="$1"
-hypre=*)
optHypre="${1#*=}" # URL for download
unset HYPRE_PACKAGE HYPRE_ARCH_PATH
;; ;;
petsc-[0-9]*) -no-hypre)
petscPACKAGE="${1%%/}" optHypre=false
unset PETSC_ARCH_PATH # Avoid inconsistency unset HYPRE_PACKAGE HYPRE_ARCH_PATH
;;
hypre-[0-9]* | hypre-git)
HYPRE_PACKAGE="${1%%/}"
unset optHypre
unset HYPRE_ARCH_PATH # Avoid inconsistency
;;
petsc/* | sources/petsc* |\
petsc-[0-9]* | petsc-git)
PETSC_PACKAGE="${1%%/}"
unset PETSC_ARCH_PATH # Avoid inconsistency
;; ;;
*) *)
die "unknown option/argument: '$1'" die "unknown option/argument: '$1'"
@ -109,47 +120,103 @@ do
shift shift
done done
[ -n "$petscPACKAGE" ] || die "The petsc-VERSION was not specified" if [ -z "$PETSC_PACKAGE" ]
# Nothing to build
if _foamIsNone $petscPACKAGE
then then
echo "Using petsc-none (skip ThirdParty build of PETSC)" die "The PETSC package/version not specified"
exit 0 elif _foamIsNone "$PETSC_PACKAGE" || _foamIsSystem "$PETSC_PACKAGE"
elif _foamIsSystem $petscPACKAGE
then then
echo "Using petsc-system" echo "Using none/system (skip ThirdParty build of PETSC)"
exit 0 exit 0
fi fi
#------------------------------------------------------------------------------
# Integrations
# Clunky
if [ -z "$optHypre" ] && [ -n "$HYPRE_PACKAGE" ] \
&& ! _foamIsNone "$HYPRE_PACKAGE"
then
echo "Using $HYPRE_PACKAGE"
: "${HYPRE_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$HYPRE_PACKAGE}"
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build PETSC # Build PETSC
# #
# PETSC_ARCH_PATH : installation directory # PETSC_ARCH_PATH : installation directory (as per config file)
# PETSC_SOURCE_DIR : location of the original sources #
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
PETSC_SOURCE_DIR=$sourceBASE/$petscPACKAGE PETSC_SOURCE="$(findSourceDir "$PETSC_PACKAGE")"
: ${PETSC_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$petscPACKAGE} PETSC_PACKAGE="$(basename "$PETSC_PACKAGE")"
PETSC_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PETSC_PACKAGE"
[ -d "$PETSC_SOURCE_DIR" ] || { # Override as per config file (if any)
echo "Missing sources: '$petscPACKAGE'" [ -n "$PETSC_ARCH_PATH" ] && PETSC_PREFIX="$PETSC_ARCH_PATH"
exit 1
[ -d "$PETSC_SOURCE" ] || {
echo "Missing sources: '$PETSC_PACKAGE'"
showDownloadHint petsc
exit 2
} }
echo "Starting build: $petscPACKAGE ($targetType)" # PETSC arch - same root as WM_OPTIONS (eg, DPInt32)
archOpt="$WM_SIZE_OPTIONS"
if [ -n "$optInplace" ]
then
# Inplace installation. No install stage required
unset PETSC_PREFIX
makeInstall() { true; }
else
# Regular installation location (PETSC_PREFIX)
makeInstall() {
make PETSC_DIR="$PETSC_SOURCE" PETSC_ARCH="$archOpt" install
pkgconfigAdjust "$PETSC_PREFIX"
}
fi
echo "Starting build: $PETSC_PACKAGE ($targetType)"
if [ "$WM_PRECISION_OPTION" = SP ]
then
optHypre=false # No single-precision hypre
echo "No single-precision hypre"
fi
if [ -d "$PETSC_SOURCE/$archOpt/externalpackages" ]
then
echo "Removing old $archOpt/externalpackages"
rm -rf "$PETSC_SOURCE/$archOpt/externalpackages"
fi
echo echo
( (
# PETSC arch - same root as WM_OPTIONS (eg, DPInt32) # Configuration options
archOpt="$WM_SIZE_OPTIONS"
# Configuration options: # Compiler or MPI (but not both)
configOpt="--with-cc=$(whichMpicc) --with-cxx=$(whichMpicxx)" # if [ -d "$MPI_ARCH_PATH" ]
# then
# configOpt="--with-mpi-dir=$MPI_ARCH_PATH"
# else
configOpt="--with-cc=$(whichMpicc) --with-cxx=$(whichMpicxx)"
# fi
if [ "$optDebug" = true ]
then
configOpt="$configOpt --with-debugging=1"
else
# A reasonable assumption for optimization
configOpt="$configOpt --with-debugging=0"
configOpt="$configOpt --COPTFLAGS=-O3 --CXXOPTFLAGS=-O3"
fi
if [ "$targetType" = libso ] if [ "$targetType" = libso ]
then then
configOpt="--with-shared-libraries" configOpt="$configOpt --with-shared-libraries"
fi fi
if [ "$WM_LABEL_SIZE" = 64 ] if [ "$WM_LABEL_SIZE" = 64 ]
@ -166,27 +233,66 @@ echo
configOpt="$configOpt --with-precision=double" configOpt="$configOpt --with-precision=double"
fi fi
cd $PETSC_SOURCE_DIR || exit 1 case "$optHypre" in
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo false)
configOpt="$configOpt --with-hypre=0"
;;
ftp:* | git:* | http:* | https:*)
configOpt="$configOpt --download-hypre=$optHypre"
;;
*)
# This is a really clunky way to use ThirdParty hypre
if [ -f "$HYPRE_ARCH_PATH/include/HYPRE.h" ]
then
echo "Has installed hypre: $HYPRE_PACKAGE"
configOpt="$configOpt --with-hypre-dir=$HYPRE_ARCH_PATH"
else
configOpt="$configOpt --download-hypre"
fi
;;
esac
rm -rf $PETSC_ARCH_PATH # Additional configure options
if [ "$1" = "--" ]
then
shift
configOpt="$configOpt $@"
fi
# We export compiler settings (above) but actually use the
# --with-cc and --with-cxx. So ignore these environment variables.
unset CC CXX
unset CFLAGS CXXFLAGS
cd "$PETSC_SOURCE" || exit
unset GIT_DIR # No special git-repo handling
if [ -n "$PETSC_PREFIX" ]
then
rm -rf "$PETSC_PREFIX"
fi
# No clean here, if we have multiple arch in the same directory
echo
set -x
./configure \ ./configure \
--prefix=$PETSC_ARCH_PATH \ ${PETSC_PREFIX:+--prefix="$PETSC_PREFIX"} \
--with-petsc-arch=$archOpt \ --PETSC_DIR="$PETSC_SOURCE" \
--with-petsc-arch="$archOpt" \
--with-clanguage=C \ --with-clanguage=C \
--with-scalapack=0 \ --with-fc=0 \
--with-superlu_dist=0 \ --with-x=0 \
--with-suitesparse=0 \
--download-f2cblaslapack=1 \
$configOpt \ $configOpt \
&& set +x \
&& echo "Configured: petsc" \ && echo "Configured: petsc" \
&& make PETSC_DIR=$PETSC_SOURCE_DIR PETSC_ARCH="$archOpt" all \ && make ${WM_NCOMPPROCS:+-j $WM_NCOMPPROCS} \
PETSC_DIR="$PETSC_SOURCE" PETSC_ARCH="$archOpt" all \
&& echo "Built: petsc" \ && echo "Built: petsc" \
&& make PETSC_DIR=$PETSC_SOURCE_DIR PETSC_ARCH="$archOpt" install && makeInstall \
&& echo "Installed: petsc" && echo "Installed: $PETSC_PACKAGE"
) || { ) || {
echo "Error building: petsc" echo "Error building: $PETSC_PACKAGE"
exit 1 exit 1
} }

View File

@ -3,12 +3,14 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeParaView # makeParaView
@ -24,19 +26,22 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only if : # Run from third-party directory
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { then
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " Check your OpenFOAM environment and installation" wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
exit 1 echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
} echo " Check your OpenFOAM environment and installation"
. etc/tools/ThirdPartyFunctions exit 1
. etc/tools/ParaViewFunctions }
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/CMakeFunctions
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ParaViewFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
unset ParaView_VERSION # Purge current values
# ParaView_VERSION from etc/config.sh file: # ParaView_VERSION from etc/config.sh file:
unset ParaView_VERSION # Purge current values
_foamConfig paraview _foamConfig paraview
# Avoid any potential conflicts (especially if building from git) # Avoid any potential conflicts (especially if building from git)
@ -61,16 +66,22 @@ setParaViewVersion ${ParaView_VERSION:-none}
# New rendering backend (starting with paraview 5.0). # New rendering backend (starting with paraview 5.0).
withGL2=auto # auto-config based on version withGL2=auto # auto-config based on version
# Hint for cmake findMPI
if [ -d "$MPI_ARCH_PATH" ]
then
export MPI_HOME="$MPI_ARCH_PATH"
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions paraview; exit 0; }
exec 1>&2 printHelp() {
: ${ParaView_VERSION:=none} # some dummy value for usage information : ${ParaView_VERSION:=none} # some dummy value for usage information
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [paraview-VERSION] [CMAKE-OPTION] Usage: ${0##*/} [OPTION] [paraview-VERSION] [CMAKE-OPTION]
options: options:
-gcc force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX -gcc Force use of gcc/g++
-cmake PATH with cmake from the given path
-rebuild for repeated builds (-make -install) *use with caution* -rebuild for repeated builds (-make -install) *use with caution*
-gl2 with new rendering backend (default: auto) -gl2 with new rendering backend (default: auto)
-mesa with mesa -mesa with mesa
@ -79,21 +90,24 @@ options:
-mesa-lib PATH path to mesa library (current: ${MESA_LIBRARY:-none}) -mesa-lib PATH path to mesa library (current: ${MESA_LIBRARY:-none})
-mpi with mpi -mpi with mpi
-mpi=N with max 'N' mpi processes. N=0 for no upper-limit. -mpi=N with max 'N' mpi processes. N=0 for no upper-limit.
-python with python -mpi-home PATH with mpi and hint for MPI_HOME
-python | -python2 | -python3
with python
-python-include DIR -python-include DIR
location of python headers (current: ${PYTHON_INCLUDE:-none}) location of python headers (current: ${PYTHON_INCLUDE:-none})
-python-lib PATH path to python library (current: ${PYTHON_LIBRARY:-none}) -python-lib PATH path to python library (current: ${PYTHON_LIBRARY:-none})
-cmake PATH with cmake from the path given -qmake PATH with QT version corresponding to the qmake in given path
-qmake PATH with the Qt version corresponding to the qmake path given
-qt with extra Qt gui support (if not already enabled) -qt with extra Qt gui support (if not already enabled)
-qt-VER with Qt version corresponding to -qt-<VER> with QT version corresponding to
\$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/qt-VER/bin/qmake \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/qt-VER/bin/qmake
-verbose verbose output in Makefiles -verbose verbose output in Makefiles
-version VER specify an alternative version (current: $ParaView_VERSION) -version VER specify an alternative version (current: $ParaView_VERSION)
-major VER specify an alternative major version for special builds -major VER specify an alternative major version for special builds
-buildType NAME specify the build type (default: Release) -buildType NAME specify the build type (default: Release)
-suffix NAME specify a suffix to distinguish the build -suffix NAME specify a suffix to distinguish the build
-help -DNAME=VALUE add cmake variable
-list List available unpacked source versions
-help Display usage help
The -no-FEATURE option can be used to forcibly disable these features: The -no-FEATURE option can be used to forcibly disable these features:
-no-gl2 | -no-mesa | -no-mpi | -no-python | -no-qt -no-gl2 | -no-mesa | -no-mpi | -no-python | -no-qt
@ -122,10 +136,11 @@ For example,
Or change the \$WM_PROJECT_DIR/etc/config.sh/paraview settings. Or change the \$WM_PROJECT_DIR/etc/config.sh/paraview settings.
USAGE USAGE
exit 1 showDownloadHint paraview
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler minimal # Minimal compiler info for CMake/configure
# Various building stages # Various building stages
unset runPATCH runCONFIG runMAKE runINSTALL unset runPATCH runCONFIG runMAKE runINSTALL
@ -136,13 +151,16 @@ while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;; -gcc) useGcc ;;
[0-9]* | paraview-[0-9]* | ParaView-[0-9]*) # paraview version # paraview version
setParaViewVersion "${1%%/}" paraview/* | vtk/* | sources/paraview* | sources/vtk* |\
[0-9]* | paraview-[0-9]* | ParaView-[0-9]* | ParaView-v[0-9]*)
setParaViewVersion "$(basename "$1")"
;; ;;
[A-Z]*=*) # cmake variables -D[A-Z]*=* | [A-Z]*=*) # cmake variables
addCMakeVariable "$1" addCMakeVariable "$1"
;; ;;
-patch) # stage 0: patch sources -patch) # stage 0: patch sources
@ -226,14 +244,27 @@ do
withMPI=true withMPI=true
MPI_MAX_PROCS="${1##*=}" MPI_MAX_PROCS="${1##*=}"
;; ;;
-mpi-home) # mpi with hint
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
withMPI=true
export MPI_HOME="${2%%/}"
case "${MPI_HOME:-none}" in (false|none) unset MPI_HOME;; esac
shift
;;
-no-mpi) -no-mpi)
withMPI=false withMPI=false
;; ;;
-python) -python)
withPYTHON=true withPYTHON=true
;; ;;
-python2)
withPYTHON=true; withPYTHON3=false
;;
-python3)
withPYTHON=true; withPYTHON3=true
;;
-no-python) -no-python)
withPYTHON=false withPYTHON=false; unset withPYTHON3
;; ;;
-python-include) -python-include)
[ "$#" -ge 2 ] || die "'$1' option requires an argument" [ "$#" -ge 2 ] || die "'$1' option requires an argument"
@ -263,7 +294,7 @@ do
-no-qt) -no-qt)
withQT=false withQT=false
;; ;;
-qt-[1-9]*) -qt-[0-9]*)
withQT=true withQT=true
QMAKE_PATH="$installBASE/${1##-}" QMAKE_PATH="$installBASE/${1##-}"
;; ;;
@ -317,6 +348,16 @@ then
fi fi
fi fi
# ParaView-5.7.0 default is python3
if [ "$withPYTHON" = true ] && [ -z "$withPYTHON3" ]
then
case "${ParaView_VERSION}" in
(5.[7-9]* | [6-9]* | [1-9][0-9].*)
withPYTHON3=true
;;
esac
fi
if [ "$runDEFAULT" = true ] if [ "$runDEFAULT" = true ]
then then
: ${runPATCH:=true} : ${runPATCH:=true}
@ -338,6 +379,7 @@ fi
# Set configure options # Set configure options
#~~~~~~~~~~~~~~~~~~~~~~ #~~~~~~~~~~~~~~~~~~~~~~
addGeneral # general settings (version-dependent)
addVerbosity # verbose makefiles addVerbosity # verbose makefiles
addMpiSupport # set MPI-specific options addMpiSupport # set MPI-specific options
addPythonSupport # set Python-specific options addPythonSupport # set Python-specific options
@ -365,6 +407,10 @@ Features selected
python ${withPYTHON:-false} python ${withPYTHON:-false}
qt ${withQT:-false} qt ${withQT:-false}
--------------------- ---------------------
Compiler
cxx ${CXX:-unknown}
flags ${CXXFLAGS:-none}
---------------------
Version information Version information
paraview ${ParaView_VERSION:-unknown} paraview ${ParaView_VERSION:-unknown}
major ${ParaView_MAJOR:-unknown} major ${ParaView_MAJOR:-unknown}

View File

@ -3,20 +3,25 @@
# - mpi (0 = no upper-limit on processes) # - mpi (0 = no upper-limit on processes)
# - mesa # - mesa
# - python (required for Catalyst) # - python (required for Catalyst)
# - has VTK_PYTHON_OPTIONAL_LINK=OFF to avoid
# undefined symbol: PyExc_ValueError
# #
# NOTE: must modify etc/config.*/paraview to use this particular version # NOTE: must modify etc/config.*/paraview to use this particular version
# and combination, or use chaining as per etc/config.*/example/paraview # and combination, or use chaining as per etc/config.*/example/paraview
# mesa=mesa-11.2.2 # mesa=mesa-11.2.2
# mesa=mesa-13.0.3 # mesa=mesa-13.0.3
mesa=mesa-17.1.1 # mesa=mesa-17.1.1
mesa=mesa-18.3.4
set -x set -x
./makeParaView \ ./makeParaView \
-mpi=0 \ -mpi \
-mesa-prefix $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mesa \ -mesa-prefix $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mesa \
-python \ -python \
-suffix mesa-mpi-py \ -suffix mesa-mpi-py \
-DPARAVIEW_ENABLE_FFMPEG=ON \
-DVTK_PYTHON_OPTIONAL_LINK=OFF \
"$@" "$@"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

122
makeQt
View File

@ -3,12 +3,14 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeQt # makeQt
@ -19,46 +21,63 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only if : # Run from third-party directory
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { then
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " Check your OpenFOAM environment and installation" wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
exit 1 echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
} echo " Check your OpenFOAM environment and installation"
. etc/tools/ThirdPartyFunctions exit 1
. etc/tools/QtFunctions }
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/QtFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions qt; exit 0; }
exec 1>&2 printHelp() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [qt-VERSION] [-- configure-options] Usage: ${0##*/} [OPTION] [qt-VERSION] [-- configure-options]
options: options:
-gcc Force gcc/g++ instead of using \$WM_CC, \$WM_CXX -force Force compilation, even if it already exists
-help -gcc Force use of gcc/g++
-list List available unpacked source versions
-help Display usage help
* build $qtTYPE, version ${qtVERSION:-undefined} * build $qtTYPE, version ${qtVERSION:-undefined}
USAGE USAGE
exit 1 showDownloadHint qt
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler true # Compiler info + flags for CMake/configure exportCompiler true # Compiler info + flags for CMake/configure
unset optForce
unset PACKAGE qtVERSION
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
--) break;; # Extra configure options (leave on $@ for later detection) --) break;; # Extra configure options (leave on $@ for later detection)
-h | -help) usage ;; -h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) optForce=true ;;
-qt-[1-9]* | [1-9]* | qt-*) qt/* | sources/qt*)
# -qt-VERSION, VERSION, qt-VERSION, qt-everywhere-opensource-src-VERSION
PACKAGE="${1%%/}";
qtVERSION="$(basename "$PACKAGE" | sed 's#^.*-##')"
;;
-qt-[0-9]* | [0-9]* | qt-*)
# -qt-VERSION, VERSION, qt-VERSION, qt-everywhere-opensource-src-VERSION # -qt-VERSION, VERSION, qt-VERSION, qt-everywhere-opensource-src-VERSION
qtVERSION="${1%%/}"; qtVERSION="${1%%/}";
qtVERSION="${qtVERSION##*-}" qtVERSION="${qtVERSION##*-}"
PACKAGE="$qtTYPE-$qtVERSION"
;; ;;
*) *)
@ -67,35 +86,41 @@ do
esac esac
shift shift
done done
qtPACKAGE=$qtTYPE-$qtVERSION
# Nothing to build if [ -z "$PACKAGE" ]
if _foamIsNone "$qtPACKAGE"
then then
echo "Using qt-none (skip ThirdParty build of QT)" die "The QT package/version not specified"
exit 0 elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
elif _foamIsSystem "$qtPACKAGE"
then then
echo "Using qt-system" echo "Using none/system (skip ThirdParty build of QT)"
exit 0 exit 0
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build QT # Build QT
#
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
QT_SOURCE_DIR=$sourceBASE/$qtPACKAGE PKG_SOURCE="$(findSourceDir "$PACKAGE" "$qtTYPE-$qtVERSION")"
QT_ARCH_PATH=$installBASE/qt-$qtVERSION PACKAGE="qt-$qtVERSION"
PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
echo echo
echo ======================================== echo ========================================
echo "Build Qt $qtPACKAGE" echo "Build Qt $PACKAGE"
echo echo
if [ -d "$QT_ARCH_PATH" -a -r "$QT_ARCH_PATH/bin/qmake" ]
if [ -z "$optForce" ] \
&& [ -d "$PKG_PREFIX" ] \
&& [ -r "$PKG_PREFIX"/bin/qmake ]
then then
echo "Already built: Qt-$qtVERSION" echo "Already built: $PACKAGE"
else else
echo "Starting build: Qt-$qtVERSION" echo "Starting build: $PACKAGE"
( (
# Configuration options: # Configuration options:
unset configOpt unset configOpt
@ -129,35 +154,34 @@ else
# End of configuration options # End of configuration options
# ---------------------------- # ----------------------------
buildDIR=$buildBASE/$qtPACKAGE PKG_BUILD="$buildBASE/$PACKAGE"
cd $QT_SOURCE_DIR || exit 1 cd "$PKG_SOURCE" || exit
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
[ -e Makefile ] && make distclean 2>/dev/null [ -e Makefile ] && make distclean 2>/dev/null
# Remove any existing build folder and recreate # Remove any existing build folder and recreate
rm -rf $QT_ARCH_DIR rm -rf "$PKG_PREFIX"
rm -rf $buildDIR 2>/dev/null rm -rf "$PKG_BUILD"
mkdir -p $buildDIR mkdir -p "$PKG_BUILD"
# Remove any remnants from a previous shadow build # Remove any remnants from a previous shadow build
rm -f "$QT_SOURCE_DIR/.qmake.cache" 2>/dev/null rm -f "$PKG_SOURCE"/.qmake.cache
rm -f "$QT_SOURCE_DIR/src/corelib/global/qconfig.h" 2>/dev/null rm -f "$PKG_SOURCE"/src/corelib/global/qconfig.h
rm -f "$QT_SOURCE_DIR/src/corelib/global/qconfig.cpp" 2>/dev/null rm -f "$PKG_SOURCE"/src/corelib/global/qconfig.cpp
cd $buildDIR || exit 1 cd "$PKG_BUILD" || exit
# Compile as opensource, accepting LGPL conditions (yes) # Compile as opensource, accepting LGPL conditions (yes)
echo yes | $QT_SOURCE_DIR/configure \ echo yes | "$PKG_SOURCE"/configure \
-prefix $QT_ARCH_PATH \ -prefix "$PKG_PREFIX" \
-opensource \ -opensource \
$configOpt \ $configOpt \
&& time make -j $WM_NCOMPPROCS \ && time make -j $WM_NCOMPPROCS \
&& make install \ && make install \
&& echo "Built: Qt-$qtVERSION" \ && echo "Built: $PACKAGE" \
&& finalizeQt && finalizeQt "$PKG_PREFIX"
) || { ) || {
echo "Error building: Qt-$qtVERSION" echo "Error building: $PACKAGE"
exit 1 exit 1
} }
fi fi

578
makeSCOTCH Executable file
View File

@ -0,0 +1,578 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2019-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# makeSCOTCH
#
# Description
# Build the SCOTCH and PTSCOTCH libraries, optionally build binaries
#
# ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------
if : # Run from third-party directory
then
cd "${0%/*}" || exit
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
}
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------
_foamConfig scotch # Get SCOTCH_ARCH_PATH, SCOTCH_VERSION
PACKAGE="${SCOTCH_VERSION:-system}"
unset withMPI
case "$WM_MPLIB" in (*MPI*) [ "$FOAM_MPI" = dummy ] || withMPI=true ;; esac
if nonStandardPlatforms # Possibly unreliable inherited values
then
unset SCOTCH_ARCH_PATH
fi
#------------------------------------------------------------------------------
printVersions() { listPackageVersions scotch; exit 0; }
printHelp() {
/bin/cat<<USAGE
Usage: ${0##*/} [OPTION] [libso] [scotch-VERSION]
options:
-force Force compilation, even if include/library already exists
Also force build attempt of pt-scotch (mingw)
-gcc Force use of gcc/g++
-int32 Use SCOTCH_Num 32
-int64 Use SCOTCH_Num 64
-bin Create scotch binaries as well
-no-bin Suppress creation of scotch binaries (default)
-no-mpi Suppress build of pt-scotch
-list List available unpacked source versions
-help Display usage help
* Build SCOTCH (default: -int${WM_LABEL_SIZE:-32}) with
${PACKAGE:-[unspecified]}
USAGE
showDownloadHint scotch
exit 0 # Clean exit
}
#------------------------------------------------------------------------------
unset optForce optNoExtlib
optBinaries=false
optLabelSize="${WM_LABEL_SIZE:-32}"
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;;
-force) optForce=true ;;
-int32 | -int64) optLabelSize="${1#-int}" ;;
-bin) optBinaries=true ;;
-no-bin) optBinaries=false ;;
-no-mpi) unset withMPI ;;
-no-extlib) optNoExtlib=true ;; # Hidden option
scotch/ | sources/scotch* |\
scotch-[0-9]* | scotch-v[0-9]* | scotch-git | scotch_* )
PACKAGE="${1%%/}"
unset SCOTCH_ARCH_PATH # Avoid inconsistency
;;
*)
die "unknown option/argument: '$1'"
;;
esac
shift
done
if [ -z "$PACKAGE" ]
then
die "The SCOTCH package/version not specified"
elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
then
echo "Using none/system (skip ThirdParty build of SCOTCH)"
exit 0
fi
if [ "$optNoExtlib" = true ]
then
unset FOAM_EXT_LIBBIN
else
requireExtLibBin
fi
#------------------------------------------------------------------------------
#
# Build SCOTCH
# SCOTCH_ARCH_PATH : installation directory (as per config file)
#
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
PKG_SOURCE="$(findSourceDir "$PACKAGE")"
PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
# Override as per config file (if any)
[ -n "$SCOTCH_ARCH_PATH" ] && PKG_PREFIX="$SCOTCH_ARCH_PATH"
[ -d "$PKG_SOURCE/src" ] || {
echo "Missing sources: '$PACKAGE'"
showDownloadHint scotch
exit 2
}
#------------------------------------------------------------------------------
# Select a Makefile.inc for the scotch build
# - could use more generalizing, but works fairly well
unset MakefileInc
for ending in \
"$(uname -s)-${WM_COMPILER}".shlib \
"$(uname -s)".shlib \
Linux.shlib \
;
do
# Fully resolve path
file="$WM_THIRD_PARTY_DIR/etc/makeFiles/scotch/Makefile.inc.$ending"
if [ -f "$file" ]
then
MakefileInc="$file"
break
fi
done
# - copy OpenFOAM-specific Makefile include files into the scotch dir.
# - place a full copy into an 'openfoam/' directory (for documentation)
# - make symlink from the openfoam/Makefile.inc.XXX -> src/Makefile.inc
createMakefileLinks()
{
# Sanity checks
if [ -z "$MakefileInc" ]
then
echo "Did not define a Makefile.inc for"
echo " $PACKAGE/src"
return 1
elif [ ! -f "$MakefileInc" ]
then
echo "No such file to include:"
echo " $MakefileInc"
return 1
fi
if [ ! -d "$PKG_SOURCE"/src ] || [ ! -w "$PKG_SOURCE"/src ]
then
echo "Directory missing or not writable:"
echo " $PKG_SOURCE/src"
return 1
fi
# Copy files and make links
mkdir -p "$PKG_SOURCE"/openfoam
cp -p "$(dirname "$MakefileInc")"/* "$PKG_SOURCE"/openfoam
rm -f "$PKG_SOURCE"/src/Makefile.inc
(
cd "$PKG_SOURCE/src" && \
ln -sf ../openfoam/"$(basename "$MakefileInc")" Makefile.inc
)
}
#------------------------------------------------------------------------------
#
# Manual installation of serial libraries
# from libdir to -> $FOAM_EXT_LIBBIN
#
install_serial()
{
local libdir_source="$1"
local libdir_target="$FOAM_EXT_LIBBIN"
local libname_suffix="-int$WM_LABEL_SIZE"
[ -n "$FOAM_EXT_LIBBIN" ] || unset libdir_target
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
echo
echo "Adjusting installation"
# Rename lib as xxx-intNN qualified library names (non-windows)
if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
then
(
cd "$libdir_source" || exit
echo "Tagging libraries with $libname_suffix"
for name in libscotch
do
if [ -f "$name$EXT_SO" ]
then
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
fi
done
)
fi
if [ -n "$libdir_target" ]
then
# Remove old libraries and links
for name in libscotch
do
rm -f "$libdir_target/$name$EXT_SO"
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
done
mkdir -p "$libdir_target"
echo "Relocating serial libraries"
# echo "Installing: $libdir_target/libscotch$libname_suffix"
mv -f "$libdir_source"/lib* "$libdir_target"
fi
rmdir "$libdir_source" 2>/dev/null # Failed rmdir is uncritical
return 0
}
#
# Manual installation of parallel libraries
# from libdir to -> $FOAM_EXT_LIBBIN/$FOAM_MPI
#
install_parallel()
{
local libdir_source="$1"
local libdir_target="$FOAM_EXT_LIBBIN/$FOAM_MPI"
local libname_suffix="-int$WM_LABEL_SIZE"
local link_serial=false
[ -n "$FOAM_EXT_LIBBIN" ] || unset libdir_target
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
echo
echo "Adjusting installation"
# Rename lib as xxx-intNN qualified library names (non-windows)
if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
then
(
cd "$libdir_source" || exit
echo "Tagging libraries with $libname_suffix"
# When linked, remove generated serial libraries
if [ "$link_serial" = true ]
then
rm -f libscotch*
fi
for name in libscotch libptscotch
do
if [ -f "$name$EXT_SO" ]
then
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
fi
done
)
fi
if [ -n "$libdir_target" ]
then
# Remove old libraries and links
for name in libscotch libptscotch
do
rm -f "$libdir_target/$name$EXT_SO"
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
done
mkdir -p "$libdir_target"
echo "Relocating parallel libraries"
# echo "Installing: $libdir_target/libptscotch$libname_suffix"
mv -f "$libdir_source"/lib* "$libdir_target"
fi
# Create symlinks to serial versions?
if [ -n "$link_serial" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
then
(
if [ -n "$libdir_target" ]
then
cd "$libdir_target" || exit
else
cd "$libdir_source" || exit
fi
for name in libscotch"$libname_suffix" libscotcherr*
do
if [ -f ../"$name$EXT_SO" ]
then
ln -sf ../"$name$EXT_SO" "$name$EXT_SO"
fi
done
for name in libscotch
do
if [ -f "$name$libname_suffix$EXT_SO" ]
then
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
fi
done
)
fi
rmdir "$libdir_source" 2>/dev/null # Failed rmdir is uncritical
return 0
}
echo
echo ========================================
echo "scotch decomposition ($PACKAGE)"
echo " Makefile.inc : ${customMakefileInc##*/}"
# (serial) scotch
bindir="$PKG_PREFIX"/bin
includedir="$PKG_PREFIX"/include
libdir="$FOAM_EXT_LIBBIN"
if [ -z "$FOAM_EXT_LIBBIN" ]
then
libdir="$PKG_PREFIX"/lib
fi
if [ "$optLabelSize" != "$WM_LABEL_SIZE" ]
then
echo "Using int-$optLabelSize instead of int-$WM_LABEL_SIZE"
fi
export WM_LABEL_SIZE="$optLabelSize"
# Test installation. May or may not have libscotcherrexit.so
if [ -z "$optForce" ] \
&& [ -f "$includedir"/scotch.h ] \
&& haveLibso "$libdir"/libscotch
then
echo " scotch include: $includedir"
echo " scotch library: $libdir"
elif [ -d "$PKG_SOURCE" ]
then
(
# Older versions ok, but scotch-6.0.5a cannot build in parallel.
# Force serial build
export WM_NCOMPPROCS=1
echo "*** building scotch in serial ***"
echo
cd "$PKG_SOURCE/src" || exit
applyPatch "$PACKAGE" .. # patch at parent-level
createMakefileLinks || exit
# Verify
[ -f Makefile.inc ] || {
echo " Error: scotch needs an appropriate Makefile.inc"
exit 1
}
# Fresh install
rm -rf "$PKG_PREFIX"
mkdir -p "$bindir" "$includedir" "$libdir"
# Temporary location for library install
libdir_tmp="$libdir"
if [ -n "$FOAM_EXT_LIBBIN" ]
then
libdir_tmp="$PKG_PREFIX"/lib-tmp
fi
export CCS="$(whichCC)" # CCS (serial compiler)
export CCP="$(whichMpicc)" # CCP (parallel compiler) default=mpicc
# Consistency for Intel-MPI and non-icc compilers
[ -n "$I_MPI_CC" ] || export I_MPI_CC="$(whichCC)"
# The make targets.
# - according to docs, cannot make binaries with suffix renaming
make_targets="libscotch"
if [ "$optBinaries" = true ]
then
make_targets="$make_targets scotch"
fi
make realclean 2>/dev/null # Extra safety
make -j $WM_NCOMPPROCS $make_targets \
&& make \
prefix="$PKG_PREFIX" \
bindir="$bindir" \
includedir="$includedir" \
libdir="$libdir_tmp" \
install
install_serial "$libdir_tmp"
sharedir="$PKG_PREFIX/share"
if [ "$optBinaries" = false ]
then
rm -rf "$sharedir/man" # No bins -> no manpages
fi
rmdir "$bindir" 2>/dev/null || true # Remove empty bin/
rmdir "${bindir%/*}" 2>/dev/null || true # ... and empty parent
rmdir "$sharedir" 2>/dev/null || true # Remove empty share/
make realclean 2>/dev/null || true # Failed cleanup is uncritical
) || warnBuildIssues SCOTCH
else
warnNotFound SCOTCH
fi
# Build ptscotch when MPI (ThirdParty or system) is available
if [ "${withMPI}" != true ]
then
# Report that the above tests failed and pass-through the failure
echo "Skipping pt-scotch (no mpi)"
exit 0
fi
# Known build issues for mingw (MS-MPI source code annotations)
case "$WM_COMPILER" in
(Mingw*)
if [ -z "$optForce" ]
then
echo "Skipping pt-scotch - known compilation issues with $WM_COMPILER"
exit 0
else
echo "Warning: pt-scotch - known compilation issues with $WM_COMPILER"
fi
;;
esac
# Build ptscotch if normal scotch was built (has include and library)
# (reuse prefix/include/lib dirs set above)
if [ -f "$includedir"/scotch.h ] \
&& haveLibso "$libdir"/libscotch
then
echo
echo ========================================
echo "pt-scotch decomposition ($PACKAGE with $FOAM_MPI)"
else
# Report that the above tests failed and pass-through the failure
echo "Skipping pt-scotch - no <scotch.h> found"
exit 2
fi
# (parallel) pt-scotch
bindir="$PKG_PREFIX/bin/$FOAM_MPI"
includedir="$PKG_PREFIX/include/$FOAM_MPI"
libdir="$FOAM_EXT_LIBBIN/$FOAM_MPI"
if [ -z "$FOAM_EXT_LIBBIN" ]
then
libdir="$PKG_PREFIX/lib/$FOAM_MPI"
fi
if [ -z "$optForce" ] \
&& [ -f "$includedir"/ptscotch.h ] \
&& haveLibso "$libdir"/libptscotch
then
echo " ptscotch include: $includedir"
echo " ptscotch library: $libdir"
else
(
# Older versions ok, but scotch-6.0.5a cannot build in parallel.
# Force serial build
export WM_NCOMPPROCS=1
echo "*** building pt-scotch in serial ***"
echo
cd "$PKG_SOURCE/src" || exit
createMakefileLinks || exit
# Verify
[ -f Makefile.inc ] || {
echo " Error: ptscotch needs an appropriate Makefile.inc"
exit 1
}
# Install into existing prefix
mkdir -p "$bindir" "$includedir" "$libdir"
# Temporary location for library install
libdir_tmp="$libdir"
if [ -n "$FOAM_EXT_LIBBIN" ]
then
libdir_tmp="$PKG_PREFIX"/lib-tmp
fi
export CCS="$(whichCC)" # CCS (serial compiler)
export CCP="$(whichMpicc)" # CCP (parallel compiler) default=mpicc
# Consistency for Intel-MPI and non-icc compilers
[ -n "$I_MPI_CC" ] || export I_MPI_CC="$(whichCC)"
# The make targets.
# - no simple means of handling mpi-specific binaries
# - according to docs, cannot make binaries with suffix renaming
make_targets="libptscotch"
if [ "$optBinaries" = true ]
then
make_targets="$make_targets ptscotch"
fi
# Remove any old symlinks etc
rm -rf "$includedir"/scotch*.h 2>/dev/null
rm -rf "$libdir"/libscotch*.so 2>/dev/null
make realclean 2>/dev/null # Extra safety
make -j $WM_NCOMPPROCS $make_targets \
&& make \
prefix="$PKG_PREFIX" \
bindir="$bindir" \
includedir="$includedir" \
libdir="$libdir_tmp" \
install
install_parallel "$libdir_tmp"
sharedir="$PKG_PREFIX/share"
if [ "$optBinaries" = false ]
then
rm -rf "$sharedir/man" # No bins -> no manpages
fi
rmdir "$bindir" 2>/dev/null || true # Remove empty bin/
rmdir "${bindir%/*}" 2>/dev/null || true # ... and empty parent
rmdir "$sharedir" 2>/dev/null || true # Remove empty share/
make realclean 2>/dev/null || true # Failed cleanup is uncritical
) || warnBuildIssues PTSCOTCH
fi
# Verify existence of ptscotch include
[ -f "$PKG_PREFIX/include/$FOAM_MPI/ptscotch.h" ] || {
echo
echo " WARNING: required include file 'ptscotch.h' not found!"
}
# Could remove $PKG_SOURCE/src/Makefile.inc, but leave for documentation
#------------------------------------------------------------------------------

233
makeUMPIRE Executable file
View File

@ -0,0 +1,233 @@
#!/bin/sh
#------------------------------------------------------------------------------
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2025 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# makeUMPIRE
#
# Description
# Build script for UMPIRE
#
# ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------
# Dynamic library ending (default is .so)
[ "$(uname -s)" = Darwin ] && EXT_SO=.dylib || EXT_SO=.so
# Short-circuit test for an installation
if [ "$1" = "-test" ]
then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH
[ -d "$dir/include/umpire" ] || exit 2
package="umpire"
libStatic="libumpire.a"
for lib in \
"$dir/lib/$libStatic" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libStatic" \
;
do
if [ -r "$lib" ]
then
echo " $package include: $dir/include"
echo " $package library: ${lib%/*}"
exit 0
fi
done
exit 2
fi
#------------------------------------------------------------------------------
if : # Run from third-party directory
then
cd "${0%/*}" || exit
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
}
fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/CMakeFunctions
#------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
_foamConfig umpire
PACKAGE="${umpire_version:-none}"
# Hint for cmake findMPI
if [ -d "$MPI_ARCH_PATH" ]
then
export MPI_HOME="$MPI_ARCH_PATH"
fi
#------------------------------------------------------------------------------
printVersions() { listPackageVersions umpire; exit 0; }
printHelp() {
cat<<USAGE
Usage: ${0##*/} [OPTION] [umpire-VERSION]
options:
-force Force compilation, even if include/library already exists
-gcc Force use of gcc/g++
-cmake PATH With cmake from the given path
-mpi-home PATH With hint for MPI_HOME
-DNAME=VALUE add cmake variable
-list List available unpacked source versions
-help Display usage help
* Build UMPIRE
${PACKAGE:-[unspecified]}
USAGE
showDownloadHint umpire
exit 0 # Clean exit
}
#------------------------------------------------------------------------------
exportCompiler minimal # Minimal compiler info for CMake/configure
unset optForce
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;;
-force) optForce=true ;;
-cmake)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
CMAKE_PATH="${2%%/}"
shift
;;
-mpi-home) # mpi with hint
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
export MPI_HOME="${2%%/}"
case "${MPI_HOME:-none}" in (false|none) unset MPI_HOME;; esac
shift
;;
umpire/* | sources/umpire* | umpire-[0-9]* | umpire-git*)
PACKAGE="${1%%/}"
;;
-D[A-Z]*=* | [A-Z]*=*) # cmake variables
addCMakeVariable "$1"
;;
*)
die "unknown option/argument: '$1'"
;;
esac
shift
done
if [ -z "$PACKAGE" ]
then
die "The UMPIRE package/version not specified"
elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
then
echo "Using none/system (skip ThirdParty build of UMPIRE)"
exit 0
fi
# Known build issues for mingw (various things)
case "$WM_COMPILER" in
(Mingw*)
if [ "$optForce" = true ]
then
echo "Warning: umpire - not tested with $WM_COMPILER"
else
echo "Skipping umpire - not tested with $WM_COMPILER"
exit 0
fi
;;
esac
#------------------------------------------------------------------------------
#
# Build UMPIRE
# *PACKAGE : name-version of the package
# *SOURCE : location of original sources
# *PREFIX : installation directory
PKG_SOURCE="$(findSourceDir "$PACKAGE")"
PACKAGE="$(basename "$PACKAGE")"
PKG_PREFIX="$installBASE/$PACKAGE"
export GIT_DIR="$PKG_SOURCE/.git"
echo
echo ========================================
echo "Build umpire library $PACKAGE"
echo
if [ -z "$optForce" ] \
&& [ -f "$PKG_PREFIX/include/umpire/Umpire.hpp" ] \
&& {
[ -r "$PKG_PREFIX/lib/libumpire.a" ] \
|| [ -r "$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH/libumpire.a" ]
}
then
echo " UMPIRE already built : $PKG_PREFIX"
else
# CMake options often lag the configure ones
echo "Starting build: $PACKAGE (using cmake)"
echo
(
PKG_BUILD="$buildBASE/$PACKAGE"
cd "$PKG_SOURCE" || exit
applyPatch "$PACKAGE" "$PKG_SOURCE"
# Remove any existing build folder and recreate
rm -rf "$PKG_PREFIX"
rm -rf "$PKG_BUILD"
mkdir -p "$PKG_BUILD"
# With MPI?
# -DENABLE_FIND_MPI=ON
cmake=$(findCMake)
# By default installs into lib64/,
# but libcamp installs into lib/ so use that here as well !
#
# Also note that the umpire currently (2025-04-03) doesn't properly
# handle a relative directory for CMAKE_INSTALL_LIBDIR
# (https://github.com/LLNL/Umpire/issues/952)
libdir="$PKG_PREFIX/lib"
cd "$PKG_BUILD" && set -x && \
${cmake:?} \
-DCMAKE_INSTALL_PREFIX="$PKG_PREFIX" \
-DCMAKE_INSTALL_LIBDIR="$libdir" \
-DCMAKE_BUILD_TYPE=Release \
-DCAMP_ENABLE_TESTS=OFF \
-DENABLE_ASTYLE=OFF \
-DENABLE_DOCS=OFF \
-DENABLE_DOXYGEN=OFF \
-DENABLE_EXAMPLES=OFF \
-DENABLE_FORTRAN=OFF \
-DENABLE_TESTS=OFF \
${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \
"$PKG_SOURCE" \
&& make -j $WM_NCOMPPROCS all \
&& make install \
&& echo "Built: $PACKAGE"
) || {
echo "Error building: $PACKAGE"
exit 1
}
fi
# -----------------------------------------------------------------------------

85
makeVTK
View File

@ -3,12 +3,13 @@
# ========= | # ========= |
# \\ / 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 | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2016-2023 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeVTK # makeVTK
@ -26,20 +27,22 @@
# ---------------------------------------------- # ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only if : # Run from third-party directory
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { then
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" cd "${0%/*}" || exit
echo " Check your OpenFOAM environment and installation" wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
exit 1 echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
} echo " Check your OpenFOAM environment and installation"
. etc/tools/ThirdPartyFunctions exit 1
. etc/tools/ParaViewFunctions }
. etc/tools/vtkFunctions fi
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/CMakeFunctions
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ParaViewFunctions
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/vtkFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Obtain version from OpenFOAM etc/config.sh file:
unset vtk_version mesa_version # Purge current values unset vtk_version mesa_version # Purge current values
# vtk version from OpenFOAM etc/config.sh file:
_foamConfig vtk _foamConfig vtk
VTK_VERSION="$vtk_version" VTK_VERSION="$vtk_version"
@ -51,19 +54,24 @@ case "$VTK_VERSION" in
esac esac
VTK_VERSION="${VTK_VERSION%%-*}" # Without suffix (eg, -mesa) VTK_VERSION="${VTK_VERSION%%-*}" # Without suffix (eg, -mesa)
# New rendering backend (starting with vtk 7?). # New rendering backend (starting with vtk 7?).
withGL2=auto # auto-config based on version withGL2=auto # auto-config based on version
# Hint for cmake findMPI
if [ -d "$MPI_ARCH_PATH" ]
then
export MPI_HOME="$MPI_ARCH_PATH"
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printVersions() { listPackageVersions vtk; exit 0; }
exec 1>&2 printHelp() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [vtk-VERSION] [CMAKE-OPTION] Usage: ${0##*/} [OPTION] [vtk-VERSION] [CMAKE-OPTION]
options: options:
-gcc force g++ instead of the value from \$WM_CXX -gcc Force use of gcc/g++
-cmake PATH with cmake from the given path
-rebuild for repeated builds (-make -install) *use with caution* -rebuild for repeated builds (-make -install) *use with caution*
-gl2 with new rendering backend (default: auto) -gl2 with new rendering backend (default: auto)
-mesa with mesa (if not already enabled) -mesa with mesa (if not already enabled)
@ -73,12 +81,14 @@ options:
-osmesa with off-screen mesa only -osmesa with off-screen mesa only
-mpi with mpi (VTK_Group_MPI=ON) -mpi with mpi (VTK_Group_MPI=ON)
-mpi=N with max 'N' mpi processes. N=0 for no upper-limit. -mpi=N with max 'N' mpi processes. N=0 for no upper-limit.
-cmake PATH with cmake from the path given -mpi-home PATH with mpi and hint for MPI_HOME
-verbose verbose output in Makefiles -verbose verbose output in Makefiles
-version VER specify an alternative version (current: $VTK_VERSION) -version VER specify an alternative version (current: $VTK_VERSION)
-buildType NAME specify the build type (default: Release) -buildType NAME specify the build type (default: Release)
-suffix NAME specify a suffix to distinguish the build -suffix NAME specify a suffix to distinguish the build
-help -DNAME=VALUE add cmake variable
-list List available unpacked source versions
-help Display usage help
The -no-FEATURE option can be used to forcibly disable these features: The -no-FEATURE option can be used to forcibly disable these features:
-no-gl2 | -no-mesa | -no-mpi -no-gl2 | -no-mesa | -no-mpi
@ -100,10 +110,11 @@ For finer control, the build stages can be selected or deselected individually:
-> \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/VTK-$VTK_VERSION$BUILD_SUFFIX -> \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/VTK-$VTK_VERSION$BUILD_SUFFIX
USAGE USAGE
exit 1 # showDownloadHint vtk
exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler minimal # Minimal compiler info for CMake/configure
# Various building stages # Various building stages
unset runPATCH runCONFIG runMAKE runINSTALL unset runPATCH runCONFIG runMAKE runINSTALL
@ -114,13 +125,16 @@ while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help*) printHelp;;
-list) printVersions;;
-gcc) useGcc ;; -gcc) useGcc ;;
[0-9]* | vtk-[0-9]* | VTK-[0-9]*) # VTK version # VTK version
setVtkVersion "${1%%/}" paraview/* | vtk/* | sources/paraview* | sources/vtk* |\
[0-9]* | vtk-[0-9]* | VTK-[0-9]*)
setVtkVersion "$(basename "$1")"
;; ;;
[A-Z]*=*) # cmake variables -D[A-Z]*=* | [A-Z]*=*) # cmake variables
addCMakeVariable "$1" addCMakeVariable "$1"
;; ;;
-patch) # stage 0: patch sources -patch) # stage 0: patch sources
@ -201,6 +215,13 @@ do
withMPI=true withMPI=true
MPI_MAX_PROCS="${1##*=}" MPI_MAX_PROCS="${1##*=}"
;; ;;
-mpi-home) # mpi with hint
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
withMPI=true
export MPI_HOME="${2%%/}"
case "${MPI_HOME:-none}" in (false|none) unset MPI_HOME;; esac
shift
;;
-no-mpi) -no-mpi)
withMPI=false withMPI=false
;; ;;
@ -293,6 +314,10 @@ Features selected
mesa ${withMESA:-false} mesa ${withMESA:-false}
mpi ${withMPI:-false} mpi ${withMPI:-false}
--------------------- ---------------------
Compiler
cxx ${CXX:-unknown}
cxxflags ${CXXFLAGS:-none}
---------------------
Version information Version information
vtk ${VTK_VERSION:-unknown} vtk ${VTK_VERSION:-unknown}
build ${BUILD_TYPE:-unknown} build ${BUILD_TYPE:-unknown}

View File

@ -2,10 +2,11 @@
# An example for building particular combinations of VTK with # An example for building particular combinations of VTK with
# - mesa (off-screen only) # - mesa (off-screen only)
vtk=VTK-9.0.0 vtk=VTK-8.2.0
# mesa=mesa-11.2.2 # mesa=mesa-11.2.2
# mesa=mesa-13.0.3 # mesa=mesa-13.0.3
mesa=mesa-17.1.1 # mesa=mesa-17.1.1
mesa=mesa-18.3.4
# Module_vtkAcceleratorsVTKm : Request building vtkAcceleratorsVTKm # Module_vtkAcceleratorsVTKm : Request building vtkAcceleratorsVTKm
# #
@ -13,11 +14,10 @@ mesa=mesa-17.1.1
set -x set -x
./makeVTK \ ./makeVTK \
-mpi \ -mpi \
-osmesa \ -osmesa \
-mesa-prefix $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mesa \ -mesa-prefix $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mesa \
$vtk "$@" \ $vtk "$@" \
Module_vtkAcceleratorsVTKm=ON Module_vtkAcceleratorsVTKm=ON
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -3,12 +3,13 @@
# ========= | # ========= |
# \\ / 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-2017 OpenCFD Ltd. # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# minCmake # minCmake
@ -20,18 +21,17 @@
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only # Run from third-party directory only
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { cd "${0%/*}" || exit
wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
echo " Check your OpenFOAM environment and installation" echo " Check your OpenFOAM environment and installation"
exit 1 exit 1
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printHelp() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [dir1 ... dirN] Usage: ${0##*/} [OPTION] [dir1 ... dirN]
options: options:
-help -help
@ -39,18 +39,17 @@ options:
* Without any arguments, select all first level directories. * Without any arguments, select all first level directories.
USAGE USAGE
exit 1 exit 0 # Clean exit
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
-h | -help) -h | -help*) printHelp;;
usage
;;
-*) -*)
usage "unknown option: '$1'" echo "$0: Error unknown option: '$1'" 1>&2
exit 1
;; ;;
*) *)
break break
@ -60,27 +59,55 @@ do
done done
# Nothing specified - use first level of unpacked directories # Nothing specified - use first level of unpacked directories
[ "$#" -gt 0 ] || set -- $(find -mindepth 1 -maxdepth 1 -type d) if [ "$#" -eq 0 ]
then
set -- \
$(
echo "searching..." 1>&2
find . -mindepth 2 -maxdepth 2 -name CMakeLists.txt
for dir in sources/*
do
[ -d "$dir" ] || continue
echo "search <$dir>" 1>&2
depth=1
# Is sources/pkg/pkg-version ?
if [ "$(echo "$dir" | sed -e 's#.*/[a-z][a-z]*##' | wc -w)" = 0 ]
then
depth=2
fi
find "$dir" -maxdepth "$depth" -name CMakeLists.txt
done
)
fi
echo "processing..." 1>&2
for dir for dir
do do
dir="${dir#./}" # Remove leading "./" dir="${dir#./}" # Remove leading "./"
dir="${dir%/}" # Remove trailing "/" dir="${dir%/}" # Remove trailing "/"
case "$dir" in
(*/CMakeLists.txt) file="$dir" ;;
(*) file="$dir/CMakeLists.txt" ;;
esac
dir="$(dirname "$file")"
dir="$(basename "$dir")"
min=$(sed -n \ min=$(sed -n \
-e 's/^.*cmake_minimum.*VERSION *\([0-9.][0-9.]*\).*/\1/p' \ -e 's/^.*cmake_minimum.*VERSION *\([0-9.][0-9.]*\).*/\1/p' \
"$dir/CMakeLists.txt" \ "$file" \
2>/dev/null | head -1) 2>/dev/null | head -1)
if [ -n "$min" ] if [ -n "$min" ]
then then
# Remove trailing ".0" from version # Remove trailing ".0" from version
echo "${min%.0}" "${dir#sources/}" echo "${min%.0}" "$dir"
fi fi
done \ done \
| sort -n -k 1 \ | sort -n -k 1 \
| xargs printf " %-10s %s\n" | xargs printf " %-10s %s\n"
# Use 4 leading spaces for easier pasting as Markdown # 4 leading spaces for easy pasting as Markdown
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------