-
Notifications
You must be signed in to change notification settings - Fork 78
HOWTO interface a new dependency library
COOLFluiD already depends on a few packages, whose main ones are reviewed here. If you need to interface a new package, there are a few necessary steps that you have to follow, requiring the following modifications:
-
prepare.pl
: you need to define a set of new variables to be configured in thecoolfluid.conf
; - root
CMakeLists.txt
: the new variables have to be mapped to cmake environmental variables; - module (kernel or plugin)
CMakeLists.txt
: binding to library and include paths must be created; -
coolfluid.conf
: you have to set the new variables to the corresponding values.
There are plenty of examples one can look at, but for illustrative purposes we will analyze in details what each step required for interfacing the Mutation++ library. The following offers a quite representative and sufficiently complex scenario.
We add the new package to the list of dependency libraries:
my @libraries = (..., "mutationpp", ...)
.
This will create the environmental variable MUTATIONPP_HOME
.
We create some new variables (e.g. flags, library and include paths) and set default values inside my %default_options = (...)
:
-
'with_mutationpp' => 0,
: this flag controls whether the library is activated; -
'mutationpp_dir' => "",
: this string gives the root path of the library; -
'mutationpp_librarydir' => "/usr/lib64",
: this string gives the library path; -
'mutationpp_includedir' => "/usr/include",
: this tring gives the include path.
We map library and include paths to environmental variables (MUTATIONPP_LIBRARYDIR
, MUTATIONPP_INCLUDEDIR
) by declaring them as:
my @dep_variables = ( ..., "mutationpp_librarydir", "mutationpp_includedir")
.
We directly map the activation flag to an environmental variable to be used later:
setup_option('with_mutationpp', 'CF_ENABLE_MUTATIONPP');
We introduce some conditional behavior depending on the library activation flag:
IF ( CF_ENABLE_MUTATIONPP )
FIND_PACKAGE(Mutationpp)
ADD_DEFINITIONS ( -DCF_HAVE_MUTATIONPP )
ENDIF()
In particular, we define an environmental variable CF_HAVE_MUTATIONPP
that will be visible inside other cmake files and, if needed, inside the C++ code itself.
A cmake/FindMutationpp.cmake
needs to be implemented: this wil set the environmental variables MUTATIONPP_INCLUDE_DIR
, MUTATIONPP_LIBRARY
and CF_HAVE_MUTATIONPP
, starting from the user-defined MUTATIONPP_HOME
, MUTATIONPP_LIBRARYDIR
and MUTATIONPP_INCLUDEDIR
.
Inside plugins/MutationppI/CMakeLists.txt
we update the include and library paths:
LIST ( APPEND MutationppI_includedirs ${MUTATIONPP_INCLUDE_DIR} )
LIST ( APPEND MutationppI_libs ${MUTATIONPP_LIBRARY} )
We set the values of all new variables, previously defined within the prepare.pl
:
with_mutationpp = 1
mutationpp_dir = /Users/lani/mutation++
mutationpp_includedir = /Users/lani/mutation++/install/include/mutation++
mutationpp_librarydir = /Users/lani/mutation++/install/lib
NOTE: once you have done all steps 1-4, in order to update your configuration to take into account the changes, you need to:
- update your library path:
export LD_LIBRARY_PATH=/Users/lani/mutation++/install/lib:$LD_LIBRARY_PATH
; - completely remove your existing build directory (e.g.
optim
); - reconfigure again with
./prepare.pl --build=optim
(or similar); - compile with
make
inside theoptim
(or whatever other build directory you have).
The COOLFluiD team is involved and open to new collaborations in Horizon2020, ESA and other research projects dealing with complex multi-disciplinary problems and computational challenges.
Training sessions and consulting services can also be provided on demand.
For any request or suggestions please contact andrea.lani@gmail.com
Parallel mesh decomposition
High-performance computing (strong scaling on NASA Pleiades for 1/2 billion-cells 3D grid)
Chemically reacting flows and plasma
Complex all-speed flow simulations