Repository navigation
Compilation
This page describes how to compile Fast-FEM on Linux and Windows, lists required dependencies, and provides step-by-step commands. The repository's CI (.github/workflows/build.yml) follows the same steps — these instructions are a human-friendly expansion.
Quick summary: the project uses CMake and FetchContent to fetch ImGui, ImGui-SFML, SFML and Eigen. You still need basic system development packages (X11, OpenGL, audio, fonts, etc.) and a working C++ toolchain.
Supported platforms: Linux (Ubuntu/Debian), Windows (Visual Studio + vcpkg or MSYS2).
Prerequisites (tools):
- CMake: modern CMake (>= 3.16 recommended). See: https://cmake.org
- A C++17 compiler: GCC/Clang on Linux, MSVC (Visual Studio 2019/2022) or MinGW/MSYS2 on Windows.
- Git: to clone the repository and allow CMake FetchContent to fetch subprojects.
Primary upstream libraries used by the project (links):
- SFML: https://github.com/SFML/SFML
- ImGui: https://github.com/ocornut/imgui
- ImGui-SFML: https://github.com/eliasdaler/imgui-sfml (also mirrored/available from SFML organization)
- Eigen: https://gitlab.com/libeigen/eigen
- vcpkg (Windows package manager): https://github.com/microsoft/vcpkg
Linux (Ubuntu / Debian) — recommended steps
- Install system dependencies (example for Ubuntu/Debian):
sudo apt-get update
sudo apt-get install -y build-essential cmake git \
libx11-dev libxrandr-dev libxcursor-dev libxi-dev libxext-dev \
libgl1-mesa-dev libudev-dev libopenal-dev libasound2-dev pkg-config \
libogg-dev libvorbis-dev libflac-dev libfreetype6-devNotes:
- These packages provide headers and libraries required when building SFML and the GUI (X11, OpenGL, audio backends, fonts and codecs).
- The project uses CMake FetchContent to pull SFML, ImGui, ImGui-SFML, and Eigen automatically. The system packages above satisfy build-time native dependencies.
- Configure and build (out-of-source build):
# from repository root
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release -- -j$(nproc)- Running the binary and resources:
- After build, the produced executable is
build/main(orbuild/<config>/maindepending on platform). The CMakeLists copiesresourcesto the executable folder during POST_BUILD; checkbuild/resourcesorbuild/<config>/resources. - For details on running the application, see Running.
- Debug build:
cmake -S . -B build/debug -DCMAKE_BUILD_TYPE=Debug
cmake --build build/debug --config Debug -- -j$(nproc)- Packaging (example):
mkdir -p dist && cp build/main dist/ && cp -r build/resources dist/
tar -czf fastfem-linux.tar.gz -C dist .Windows (recommended: Visual Studio + vcpkg)
Option A — Visual Studio + vcpkg (recommended for reproducible builds):
-
Install Visual Studio 2019/2022 with "Desktop development with C++" workload.
-
Install and bootstrap
vcpkg:
# run in PowerShell or cmd
git clone https://github.com/microsoft/vcpkg.git C:\\vcpkg
C:\\vcpkg\\bootstrap-vcpkg.bat
# install commonly required runtime libs
C:\\vcpkg\\vcpkg.exe install sfml:x64-windows libogg:x64-windows libvorbis:x64-windows libflac:x64-windows freetype:x64-windows- Configure CMake to use vcpkg toolchain and build:
cmake -S . -B build -A x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build --config ReleaseNotes:
- If you installed additional packages via vcpkg (e.g., SFML, freetype), CMake should find these automatically when using the vcpkg toolchain file.
- The GitHub Actions workflow included in this repo also uses vcpkg for Windows in a similar way.
- For instructions on running the built executable, refer to Running.
Option B — MSYS2 (MinGW) (alternative):
- Install MSYS2: https://www.msys2.org and use the
mingw64environment. - Install toolchain and SFML within MSYS2:
# in MSYS2 MinGW64 shell
pacman -Syu
pacman -S --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-sfml mingw-w64-x86_64-cmake git- Configure and build using the MinGW generator:
cmake -S . -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release -- -j8- See Running for details on executing the application after build.
CI / Reproducible build notes
- The repository contains
.github/workflows/build.ymlwhich demonstrates how to configure and build on Linux and Windows with actions. It installs system packages on Ubuntu, uses vcpkg on Windows, runs CMake configure and build steps, and packages artifacts. - If you want a local environment that mirrors GitHub Actions, follow the Linux/Apt or Windows/vcpkg steps above.
Troubleshooting
- Missing headers like
X11/Xlib.horGL/gl.h— install the X11/OpenGL development packages listed in the Linux prerequisites. - Linker errors for audio or codecs — ensure
libopenal-dev,libogg-dev,libvorbis-dev, andlibflac-devare installed on Linux, or install corresponding vcpkg packages on Windows. - CMake cannot find SFML or ImGui — confirm network access for FetchContent or install SFML via your package manager/vcpkg and point CMake to the toolchain file.
- If using vcpkg on Windows, remember to use the
-A x64generator (or matching triplet) and the-DCMAKE_TOOLCHAIN_FILEargument.
Quick reference commands
- Configure Release (Linux):
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release -- -j8- Configure Debug (Linux):
cmake -S . -B build/debug -DCMAKE_BUILD_TYPE=Debug
cmake --build build/debug --config Debug -- -j8- Windows + vcpkg example:
# bootstrap vcpkg once
git clone https://github.com/microsoft/vcpkg.git C:\\vcpkg
C:\\vcpkg\\bootstrap-vcpkg.bat
# install packages
C:\\vcpkg\\vcpkg.exe install sfml:x64-windows libogg:x64-windows libvorbis:x64-windows libflac:x64-windows freetype:x64-windows
# configure + build
cmake -S . -B build -A x64 -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release- For instructions on running the application after compilation, see Running.