SOFA policy is to support only the latest Windows version.
Common prerequisites
Two wolutions exist for building SOFA on your own windows environement. Both require to first install a C++17 compatible compiler. Here are the step to install MSVC.
Compiler
SOFA requires a C++17 compatible compiler.
On Windows, we officially support Microsoft Visual Studio >= 2017 (version 15.7).
If you want to use Visual Studio IDE, install the complete Visual Studio solution.
If you want to use another IDE (like QtCreator), install the Build Tools only.
| Visual Studio 2017 | Visual Studio 2019 | Visual Studio 2022 | |
|---|---|---|---|
| Build Tools only | download | download | download |
| IDE + Build Tools | download | download | download |
In the installer, you must enable:
- In the main panel: the C++ development toolkit, called "C++ Build Tools" or "Desktop C++".
- In the side panel: the C++ ATL and C++ MFC components.

Installation with Pixi
You can download and build SOFA in only three steps without any more environment installation.
Prerequisites
- Install build tools for windows (see previous section)
- Install Git
- Install Pixi
Installation steps
- Clone SOFA :
git clone https://github.com/sofa-framework/sofa:inbox_tray: - Trigger the build : run
pixi run -e supported-plugins buildin the sofa source folder :desktop_computer: - Launch SOFA : run
pixi run -e supported-plugins runSofa:rocket:
Troubleshoots
These are some of the possible issue face using pixi for compiling SOFA. Launching pixi run -e supported-plugins runSofa will first gonfigure the cmake project, then build and install it. We know that issues can arise at the configure and build step.
- Configure step: During the configure step some plugins are fetched using git. Some plugins (such as Regression) clone migh fail due to long reference names and paths. To fix that:
1. Activate pixi shell pixi shell -e supported-plugins-dev
2. Run the git command to enable long paths git config --global core.longpaths true
3. Exit the shell exit and re run pixi run -e supported-plugins runSofa
- Compile step: This long path issue might also break the compilation. If strange errors stating that the artifact produced by compiler cannot be found then certainly this is your issue. To fix this there are multiple solutions
1. Enable long path on windows/ In an administrato powershell : New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force, then reboot. But this might not be enough.
2. Clone sofa in the root of your volume e.g. under C:\sofa reducing all of the path handeled by the compiler.
3. If this is still not enough, pixi allow to define the environement path outside of your source dir. By modifying or creating sofa\.pixi\config.toml and adding this line detached-environments = "C:\\pe". It will create the environement at the root of your volume, reducing even more the paths used by the compiler.
Manual installation (for developpers)
This installation method is advised for developers. It is STRONGLY advised to read through this entire doc page before getting started.
Build tools
CMake: Makefile generator
SOFA requires at least CMake 3.22.1. Install CMake with the latest official installer. IMPORTANT: check the option "Add CMake to the system PATH for all users" during the install process.
[optional] Ninja: build system
We strongly advise you to use Ninja if you chose to install the Build Tools only (no IDE). Ninja is an alternative to NMake. It has a better handling of incremental builds. You can download the latest release from their GitHub repository. IMPORTANT: do not forget to add ninja to your system PATH.Dependencies
Core (required)
SOFA requires some libraries:- Boost (>= 1.65.1)
Download and install the latest version compatible with your Visual Studio from https://sourceforge.net/projects/boost/files/boost-binaries/.- For Visual Studio 2022: choose boost_X_X_X-msvc-14.3-64.exe
- For Visual Studio 2019: choose boost_X_X_X-msvc-14.2-64.exe
- For Visual Studio 2017: choose boost_X_X_X-msvc-14.1-64.exe
- Python (= 3.12.x)
Download and install the latest Python 3.12 (amd64). Python 3.12 now favor the use of venv. We highly recommend it too. To bootstrap it typeC:\path\to\python3.12 -m venv sofa-venvin the folder you want to keep this venv. We recommend creating it either in your home directory, in the folder containing both your sources and the build directory. Once created, you can activate it by callingC:\path\to\sofa-venv\bin\Scripts\activate.bat. Now you can install all dependency through the following commands. Then, install the Python dependencies. Run the following commands in cmd by replacingpath\to\Python312\by the path to you venv bin directory. Now, each time you want to build or use SOFA, you first need to call `C:\path\to\sofa-venv\bin\Scripts\activate.bat` to activate this virtual environment and get access to the dependencies. - Additional libraries: libPNG, libJPEG, libTIFF, Glew, Zlib, TinyXML2 It will be fetch automatically from https://github.com/sofa-framework/WinDepPack.git directly by SOFA CMake generation. For advanced dev, you can provide you own by modfying the CMake variables WINDEPPACK_GIT_REPOSITORY and WINDEPPACK_GIT_TAG.
- Eigen (>= 3.2.10)
Download and extract the latest Eigen sources.
[optional] PATH modification
You can add Boost to your PATH to ease their detection by CMake.Boost: add
your/Boost/path and your/Boost/path/libXX-msvc-XX
Build SOFA
Setup your source and build directories
To set up clean repositories, we recommend to arrange the SOFA directories as follows: First, checkout the sources from Git repository: Get the current stable version on the v26.06 branch: OR get the development unstable version on the master branch:Generate a VS project (.sln) or a Makefile with CMake
- Create build directories respecting the arrangement above.
- In Windows Start menu, search for
Native Tools Command Promptand run the one corresponding to your Windows architecture (x64 for 64-bit, x86 for 32-bit).

- Call
to activate the virtual environment.C:\path\to\sofa-venv\bin\Scripts\activate.bat - In the command prompt, type
cmake-guiand press Enter.
If you get the error'cmake-gui' is not recognized as an internal or external command, it means that your system PATH does not correctly include the path to cmake-gui. In this case, you need to provide the full path to your cmake-gui. - In CMake-GUI, set source folder and build folder.
- Run Configure.
- A pop-up will ask you to specify the generator for the project.
- If you want to use Visual Studio IDE, select
Visual Studio 15 2017 Win64orVisual Studio 16 2019 Win64(or without theWin64if you are on Windows 32-bit). - If you want to use another IDE like QtCreator, select
CodeBlocks - Ninja(recommended, needs Ninja) orCodeBlocks - NMake.
Use default native compilersand pressFinish. - If you want to use Visual Studio IDE, select
- Fix eventual dependency errors by following CMake messages (see Troubleshoot section below). You may ignore warnings.
- e.g. define the
Eigen3_DIRwith the path where you installed Eigen - Add the path to your venv site-packages to CMake by setting a path variable called
CMAKE_PREFIX_PATH=C:\path\to\sofa-venv\Lib\site-packages
- e.g. define the
- (optional) Customize SOFA via CMake variables
- choose the build type by setting
CMAKE_BUILD_TYPEtoReleaseorRelWithDebInfo(recommended) orDebug - activate or deactivate plugins: see
PLUGIN_XXXvariables - activate or deactivate features: see
SOFA_XXXvariables
NOTE: here is an exhaustive list of plugins that can be activated for an in-tree compilation. - choose the build type by setting
- When you are ready, run Generate. In the build directory, this will create a Visual Studio project (
.sln) or a Makefile depending on the generator you chose at step 4.
Compile
To build SOFA in Visual Studio, simply open the generated Sofa.sln. Finally, build the solution using the Visual Studio interface as shown in the image below:
If you chose another generator you will have to run the generator from the build directory.
Example with Ninja:
- In Windows Start menu, search for
Native Tools Command Promptand run the one corresponding to your Windows architecture (x64 for 64-bit, x86 for 32-bit). - Go to the build directory with
cd - Run
ninja
Setup script
To simplify the configuration of our continuous integration machines, we created a complete set of setup scripts.These scripts install a lot of software directly in
C:\ without any preliminary check.
It is meant to be used on a fresh Windows. We use it on disposable virtual machines only.Setup script: I am aware of the disclaimer above. WARNING: USE AT YOUR OWN RISKS The two scripts
setup-windows_1.bat and setup-windows_2.bat install the minimum set of requirements.
Compilation tutorial
See our page presenting video tutorial for compilation on Windows.Run SOFA
with the SOFA GUI
To run SOFA, locate and execute the application called runSofa. For more detailed information on how to use the application, you can refer to the page dedicated to runsofa. This documentation will provide you with further guidance on using SOFA effectively.
within a Python environment
To use SOFA within a Python3 environment, the section "using Python3" details how to set up your environment on various operating systems.