Skip to content
Snippets Groups Projects
Commit 803c2625 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

CONFIG: improve consistency between cmake and wmake approaches (issue #5)

- the build is now much more strongly oriented on cmake.

  The wmake wrapper only adds some minor versioning on the build
  and uses a standard CMAKE_INSTALL_PREFIX to define its installation
  location.

  These changes can make it easier for some packagers (eg, spack)
  to manage.
parent 64955ba0
Branches
Tags
No related merge requests found
......@@ -47,39 +47,60 @@ Ensure that the OpenFOAM environment is active and that ParaView or Catalyst
can be found (Eg, the `ParaView_DIR` environment is properly set).
### With the OpenFOAM `wmake`
### To install in the normal OpenFOAM directories (using `wmake`)
Simply use the supplied `Allwmake` script:
````
./Allwmake
````
This will install into `$FOAM_LIBBIN`
This will install the library under
`$WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib`,
which corresponds to the `$FOAM_LIBBIN` location.
### With `cmake` directly
### To install in arbitrary locations (using `cmake`)
Without parameters, it installs to `$FOAM_LIBBIN` as the default output
location for the library.
Without parameters, it installs to `/usr/local` as the default location.
This can be changed as required with the cmake `CMAKE_INSTALL_PREFIX`
parameter.
````
mkdir build; cd build
cmake ../src/catalyst
cmake -DCMAKE_INSTALL_PREFIX=/install/path ../src/catalyst
````
which is identical to
The installation using the `./Allwmake` script can be replicated with
either of these commands:
````
mkdir build; cd build
cmake -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=default ../src/catalyst
cmake -DCMAKE_INSTALL_PREFIX=$WM_PROJECT_DIR/platforms/$WM_OPTIONS ../src/catalyst
make install
````
To specifying an alternative library location, change the cmake parameter:
or
````
mkdir build; cd build
cmake -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/output/path/lib ../src/catalyst
cmake -DCMAKE_INSTALL_PREFIX=${FOAM_LIBBIN%/*} ../src/catalyst
make install
````
The cmake configuration possibilities are functional, but still very
**rudimentary** at the moment.
### Where to start
Look at the tutorials cases to get an idea of how different things
might be done. Know what types of inputs your particular Catalyst
function object is producing. The `writeAll.py` script included as
part of the normal OpenFOAM distribution provides a good starting point
for examing your output, but also for generating initial data sets for
your pipelines. Use the script generation capabilities within ParaView
to generate your pipelines. Save a backup of your pipelines as `pvsm`
state files so that you can go back and tweak your pipelines without
manually editing the python scripts and introducing possible errors.
Be aware that there may be some combinations of pipelines or
annotations that misbehave. If you encounter such a problem, try
backing out various pieces to isolate the cause. If it does appear to be
a reproducible error, test it on a tutorial example too.
## Authors
......
......@@ -3,12 +3,14 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/cmakeFunctions # The cmake functions
# CMake into objectsDir with external dependency
# - This function override can be removed with OpenFOAM-1806
cmakeVersioned()
# - Can this function can be removed with OpenFOAM-1812 ?
unset -f cmakeVersionedInstall 2>/dev/null
cmakeVersionedInstall()
{
local depend="$1"
local sourceDir="$2"
local objectsDir
shift 2
# Where generated files are stored
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
......@@ -18,7 +20,7 @@ cmakeVersioned()
rm -rf "$objectsDir" > /dev/null 2>&1
mkdir -p $objectsDir \
&& (cd $objectsDir && _cmake $sourceDir && make) \
&& (cd $objectsDir && _cmake "$@" $sourceDir && make install) \
&& echo "$depend" >| "${sentinel:-/dev/null}"
}
......@@ -28,6 +30,16 @@ echo "======================================================================"
echo "${PWD##*/} : $PWD"
echo
# For FOAM_LIBBIN
cmakeOpts="-DCMAKE_INSTALL_PREFIX=$WM_PROJECT_DIR/platforms/$WM_OPTIONS"
# or
# cmakeOpts="-DCMAKE_INSTALL_PREFIX=${FOAM_LIBBIN%/*}"
# For FOAM_USER_LIBBIN
# cmakeOpts="-DCMAKE_INSTALL_PREFIX=${FOAM_USER_LIBBIN%/*}"
unset depend
if [ -d "$ParaView_DIR" ]
then
......@@ -40,7 +52,7 @@ then
then
if command -v cmake > /dev/null 2>&1
then
cmakeVersioned "$depend" $PWD || {
cmakeVersionedInstall "$depend" $PWD "$cmakeOpts" || {
echo
echo " WARNING: incomplete build of ParaView Catalyst"
echo
......
......@@ -26,16 +26,6 @@ else()
endif()
#------------------------------------------------------------------------------
# Installation locations (not much)
# - default install into FOAM_LIBBIN
if ((NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) OR
("${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" STREQUAL "default"))
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $ENV{FOAM_LIBBIN})
endif()
#-----------------------------------------------------------------------------
# All messages
......@@ -45,8 +35,7 @@ message("Using ParaView = $ENV{ParaView_DIR}")
if (NOT PARAVIEW_USE_MPI)
message(WARNING "==== Recommended to build using ParaView Catalyst with MPI ====")
endif()
message("install libdir = ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
message("install installdir = ${CMAKE_INSTALL_PREFIX}")
message("install prefix = ${CMAKE_INSTALL_PREFIX}")
message("================")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment