Skip to content

configure build

Mirror Bot edited this page Aug 31, 2026 · 3 revisions

title: Configure and Build for Linux and macOS

Install Dependencies

It is recommended to build on Linux, or, if on Windows, use the Windows Subsystem for Linux (WSL) described on this page. In case you want to build on windows see the Windows build instructions.

Before you can build, you need to install all needed programs and packages.

  • Follow the instruction in this link Build Dependencies for CFS for your operation system.
  • Additional we recommend to install the CMake gui. E.g. for Ubuntu its installed with this terminal command apt install cmake-curses-gui.

Be aware that for some commands must be executed as root (superuser/admin). To execute commands as root simply add sudo for the command, e.g.:

sudo apt install cmake-curses-gui

If you want to run the ctest-suite you need Python with some packages preinstalled. You can install it with

apt-get install python3 python3-dev python3-numpy python3-scipy python3-matplotlib python3-h5py python3-vtk

The vtk module depends on your distribution version. For Ubuntu 24.04 use python3-vtk9.

To build the documentation, LaTeX and Doxygen are required, install them with

apt-get install texlive-full doxygen

Follow the standard instructions on how to install Intel's oneAPI. Install at least the following packages intel-oneapi-mkl and intel-oneapi-mkl-core-devel

Configure

First create a build directory <build>, e.g. at ~/code/cfs_release

mkdir <build>

Then go there and run the CMake gui to interactively configure

cd <build>
cmake <source>
ccmake .

Press c (2 times) then you can generate with g.

If you want to have a debug-build, you have to switch DEBUG=ON in ccmake and if you want to test your Python installation switch BUILD_TESTING=ON.

Build

Now you can build with

make cfsdeps
make -j

This builds the cfsdeps serial (implicit -j 1) and then the remaining code parallel with all available threads. You can limit the number of threads to an arbitrary number via -j <N>.

Note: For multiple builds it is faster to set an external directory for the cfsdeps, the configuration can be found here.

Build on macOS

openCFS builds nicely on macOS - both Intel and Apple Silicon.

You need brew installed and from brew at least

  • cmake
  • gfortran (from gcc)
  • libomp (Apple's clang has no own OpenMP)

Note that there are brew installations for x86 in /usr/local and arm64 in /opt/homebrew, check also /opt/homebrew/opt/libomp

Special handling for Apple Silicon arm64 architecture

Make sure to have the proper gfortran and cmake

FC=/opt/homebrew/bin/gfortran /opt/homebrew/bin/cmake

This is a cmake call for arm64 with OpenMP hints: FC=/opt/homebrew/bin/gfortran-12 cmake .. -DUSE_BLAS_LAPACK=ACCELERATE -DCMAKE_OSX_ARCHITECTURES=arm64 -DCFS_ARCH=ARM64 -DOpenMP_CXX_FLAG="-Xclang -fopenmp" -DOpenMP_CXX_INCLUDE_DIR=/opt/homebrew/opt/libomp/include -DOpenMP_CXX_LIB_NAMES=libomp -DOpenMP_C_FLAG="-Xclang -fopenmp" -DOpenMP_C_INCLUDE_DIR=/opt/homebrew/opt/libomp/include -DOpenMP_C_LIB_NAMES=libomp -DOpenMP_libomp_LIBRARY=/opt/homebrew/opt/libomp/lib/libomp.dylib

Clone this wiki locally