Create and build a simulation function
From OpenFLUID
The creation and build of a simulation function can be reached in 3 steps
- Creation of the source code and build system configuration
- Initialization of the build system
- Build and installation of the simulation function
These instructions apply to the version 1.5.x and higher of OpenFLUID
Information about building a simulation function could be found in the OpenFLUID Trainings documents (in french).
Pre-requisites
In order to create and build a simulation function, the development environment must be installed and fully functional. See Setting up the development environment for instructions.
Creation of the source code and build system configuration
A minimal simulation function package consists in:
- The function source code
- The build system configuration files
In order to create these files, we recommend to use the Eclipse environment with the OpenFLUID plugin for Eclipse. The source file can also be obtained through the newfunc buddy.
Initialization of the build system
Once the simulation function created (including source code and build configuration files), the build system must be initialized.
On Linux/Unix systems:
1. Open a terminal
2. Create a build directory next to the simulation function (e.g. /path/to/function/_build)
mkdir /path/to/function/_build
3. Go to this build directory
cd /path/to/function/_build
4. Run the cmake command to initialize the build system
cmake ..
On Windows systems:
1. Open a command prompt (cmd.exe)
2. Create a build directory next to the simulation function (e.g. /path/to/function/_build)
mkdir /path/to/function/_build
3. Go to this build directory
cd /path/to/function/_build
4. Run the cmake command to initialize the build system, with the option enabling the use of the MinGW environment
cmake .. -G "MinGW Makefiles"
The cmake command must be run each time the
Build and installation of the simulation function
On Linux/Unix systems:
1. Open a terminal
2. Go to the build directory
cd /path/to/function/_build
3. Run the make command to build and install the simulation function
make install
On Windows systems:
1. Open a command prompt (cmd.exe)
2. Go to the build directory
cd /path/to/function/_build
3. Run the MinGW make command to build and install the simulation function
mingw32-make install
The build and installation command should be run each time the simulation function has been modified.
