ENH: improve handling of ThirdParty packages

- generalize some of the library extensions (.so vs .dylib).
  Provide as wmake 'sysFunctions'

- added note about unsupported/incomplete system support

- centralize detection of ThirdParty packages into wmake/ subdirectory
  by providing a series of scripts in the spirit of GNU autoconfig.
  For example,

      have_boost, have_readline, have_scotch, ...

  Each of the `have_<package>` scripts will generally provide the
  following type of functions:

      have_<package>          # detection
      no_<package>            # reset
      echo_<package>          # echoing

  and the following type of variables:

      HAVE_<package>          # unset or 'true'
      <package>_ARCH_PATH     # root for <package>
      <package>_INC_DIR       # include directory for <package>
      <package>_LIB_DIR       # library directory for <package>

  This simplifies the calling scripts:

      if have_metis
      then
          wmake metisDecomp
      fi

  As well as reducing clutter in the corresponding Make/options:

      EXE_INC = \
          -I$(METIS_INC_DIR) \
          -I../decompositionMethods/lnInclude

      LIB_LIBS = \
          -L$(METIS_LIB_DIR) -lmetis

  Any additional modifications (platform-specific or for an external build
  system) can now be made centrally.
This commit is contained in:
Mark Olesen
2018-04-24 14:51:19 +02:00
parent 672f0574e2
commit b4d38ab468
82 changed files with 1796 additions and 608 deletions

View File

@ -1,17 +1,18 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments # (for error catching)
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
# Parse arguments for compilation (at least for error catching)
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
# Only build if libraries already exist
if [ -e $FOAM_LIBBIN/libccm.so ]
# Only build when the OpenFOAM libccm adaptor already exists
if [ -f $FOAM_LIBBIN/libccm$extLibso ]
then
echo "==> build optional ccm conversion components"
wmake $targetType ccmToFoam
wmake $targetType foamToCcm
else
echo "==> skip optional ccm conversion components (no libccm.so)"
echo "==> skip optional ccm conversion components (no libccm$extLibso)"
fi
#------------------------------------------------------------------------------

View File

@ -1,8 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments # (for error catching)
#------------------------------------------------------------------------------
# Parse arguments for compilation (at least for error catching)
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
wmake -all $targetType blockMesh
wmake -all $targetType extrude
wmake -all $targetType extrude2DMesh

View File

@ -1,9 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmake $targetType extrude2DMesh
wmake $targetType

View File

@ -1,16 +1,14 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
cd ${0%/*} || exit 1 # Run from this directory
export WM_CONTINUE_ON_ERROR=true # Optional unit
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments # (for error catching)
. $WM_PROJECT_DIR/wmake/scripts/have_cgal
# Optional unit: continue-on-error
# - may not have CGAL installed,
# - or the CGAL installation moved and gives CMake problems
export WM_CONTINUE_ON_ERROR=true
#------------------------------------------------------------------------------
# Optional
# - CGAL not installed, or installed but gives CMake problems
# Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
if [ -f "$CGAL_ARCH_PATH/include/CGAL/version.h" ] || \
[ "${CGAL_ARCH_PATH##*-}" = system -a -f /usr/include/CGAL/version.h ]
if have_cgal
then
wmake $targetType conformalVoronoiMesh
wmake $targetType conformalVoronoi2DMesh

View File

@ -1,8 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments # (for error catching)
# Parse arguments for compilation (at least for error catching)
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
if [ -d "${FASTDUALOCTREE_SRC_PATH}" ]
then

View File

@ -1,38 +1,27 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments # (for error catching)
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
. $WM_PROJECT_DIR/wmake/scripts/have_zoltan
# Parse arguments for compilation (at least for error catching)
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
unset COMP_FLAGS LINK_FLAGS
if [ -f "${FOAM_LIBBIN}/libSloanRenumber.so" ]
if [ -f $FOAM_LIBBIN/libSloanRenumber$extLibso ]
then
echo " found libSloanRenumber -- enabling sloan renumbering support."
export LINK_FLAGS="${LINK_FLAGS} -lSloanRenumber"
export LINK_FLAGS="$LINK_FLAGS -lSloanRenumber"
fi
if [ -f "${FOAM_LIBBIN}/libzoltanRenumber.so" ]
if [ -f $FOAM_LIBBIN/libzoltanRenumber$extLibso ]
then
if [ -z "$ZOLTAN_ARCH_PATH" ]
if have_zoltan
then
# Optional: get ZOLTAN_ARCH_PATH
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/zoltan)
then
. $settings
fi
echo " found libzoltanRenumber -- enabling zoltan renumbering support."
export COMP_FLAGS="$COMP_FLAGS -DHAVE_ZOLTAN"
export LINK_FLAGS="$LINK_FLAGS -lzoltanRenumber -L$ZOLTAN_LIB_DIR -lzoltan"
fi
for libdir in lib "lib${WM_COMPILER_LIB_ARCH}"
do
if [ -f "$ZOLTAN_ARCH_PATH/$libdir/libzoltan.a" ]
then
echo " found libzoltanRenumber -- enabling zoltan renumbering support."
export COMP_FLAGS="-DFOAM_USE_ZOLTAN"
export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L$ZOLTAN_ARCH_PATH/$libdir -lzoltan"
break
fi
done
fi
wmake $targetType

View File

@ -55,7 +55,7 @@ Description
#include "processorMeshes.H"
#include "hexRef8.H"
#ifdef FOAM_USE_ZOLTAN
#ifdef HAVE_ZOLTAN
#include "zoltanRenumber.H"
#endif
@ -633,7 +633,7 @@ int main(int argc, char *argv[])
// Force linker to include zoltan symbols. This section is only needed since
// Zoltan is a static library
#ifdef FOAM_USE_ZOLTAN
#ifdef HAVE_ZOLTAN
Info<< "renumberMesh built with zoltan support." << nl << endl;
(void)zoltanRenumber::typeName;
#endif

View File

@ -1,19 +1,17 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for compilation (at least for error catching)
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments # (for error catching)
. $WM_PROJECT_DIR/wmake/scripts/have_readline
#------------------------------------------------------------------------------
unset COMP_FLAGS LINK_FLAGS
#
# use readline if available
#
if [ -f /usr/include/readline/readline.h ]
# Use readline if available
if have_readline
then
echo " found <readline/readline.h> -- enabling readline support."
export COMP_FLAGS="-DHAS_READLINE"
export LINK_FLAGS="-lreadline"
echo " readline detected - enabling readline support."
export COMP_FLAGS="-DHAVE_LIBREADLINE -I$READLINE_INC_DIR"
export LINK_FLAGS="-L$READLINE_LIB_DIR -lreadline"
fi
wmake $targetType

View File

@ -55,10 +55,11 @@ Description
#include <stdio.h>
#ifdef HAS_READLINE
#ifdef HAVE_LIBREADLINE
#include <readline/readline.h>
#include <readline/history.h>
static const char* historyFile = ".setSet";
#endif
using namespace Foam;
@ -66,11 +67,6 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef HAS_READLINE
static const char* historyFile = ".setSet";
#endif
// Write set to VTK readable files
void writeVTK
(
@ -790,7 +786,7 @@ int main(int argc, char *argv[])
printAllSets(mesh, Info);
// Read history if interactive
#ifdef HAS_READLINE
#ifdef HAVE_LIBREADLINE
if (!batch && !read_history((runTime.path()/historyFile).c_str()))
{
Info<< "Successfully read history from " << historyFile << endl;
@ -872,7 +868,7 @@ int main(int argc, char *argv[])
}
else
{
#ifdef HAS_READLINE
#ifdef HAVE_LIBREADLINE
{
char* linePtr = readline("readline>");

View File

@ -1,9 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmake $targetType helpTypes
wmake $targetType

View File

@ -1,7 +1,7 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
export WM_CONTINUE_ON_ERROR=true # Optional unit
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments # Parse arguments
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
. $WM_PROJECT_DIR/wmake/scripts/cmakeFunctions # The CMake functions
# -----------------------------------------------------------------------------

View File

@ -1,9 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmake $targetType
#------------------------------------------------------------------------------

View File

@ -1,8 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/have_fftw
if [ -f "$FFTW_ARCH_PATH/include/fftw3.h" ] || \
[ "${FFTW_ARCH_PATH##*-}" = system -a -f "/usr/include/fftw3.h" ]
#------------------------------------------------------------------------------
if have_fftw
then
wmake
else

View File

@ -1,8 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/have_fftw
if [ -f "$FFTW_ARCH_PATH/include/fftw3.h" ] || \
[ "${FFTW_ARCH_PATH##*-}" = system -a -f "/usr/include/fftw3.h" ]
#------------------------------------------------------------------------------
if have_fftw
then
wmake
else

View File

@ -1,9 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmake $targetType tabulatedWallFunction
wmake $targetType

View File

@ -1,10 +1,11 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/have_cgal
#------------------------------------------------------------------------------
unset COMP_FLAGS LINK_FLAGS
if [ -f "$CGAL_ARCH_PATH/include/CGAL/version.h" ] || \
[ "${CGAL_ARCH_PATH##*-}" = system -a -f /usr/include/CGAL/version.h ]
if have_cgal
then
wmake PolyhedronReader
export COMP_FLAGS='-IPolyhedronReader'

View File

@ -1,7 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
(wmake libso extractionMethod && wmake)