Prerequisites for Windows
You need to have Visual Studio 2015 or higher installed. We recommend Visual Studio 2015 (tested on our Dashboard).
Visit Visual Studio downloads page.
CMake: Makefile generator
You need to have CMake 3.1 or higher installed. The easiest way to do this is to get the installer from the CMake download page.
Finally, SOFA requires some specific dependencies:
Qt (>= 5.5.0)
We recommend to install Qt from the unified installer.
Boost (>= 1.54.0)
Find the last official Boost installer for every Visual Studio version here. Beware of the correspondance between Visual Studio and MSVC versions (VS-2015 == MSVC-14.0, VS-2017 == MSVC-14.1).
Get Python 2.7.x (32 or 64 bit) on python.org download page.
- External libraries: libPNG, Zlib, Glew and Glut
- VS2015 users: download the Windows dependency pack for VS2015.
- VS2017 users: download the Windows dependency pack for VS2017.
You will unzip them in your sources folder (e.g. sofa/src/) after cloning SOFA (see below).
To complete the dependencies integration, you can add Boost and Qt to your PATH.
Building on Windows
Setting up your source and build directories
To set up clean repositories, we propose to arrange the SOFA directories as follows:
First, download the sources from Git repository:
Get the current stable version on the v17.06 branch:
git clone -b v17.06 https://github.com/sofa-framework/sofa.git sofa/src/
Or get the development unstable version on the master branch:
git clone -b master https://github.com/sofa-framework/sofa.git sofa/src/
Next, unzip in your sources folder (sofa/src/) the SOFA dependencies for Windows you downloaded before.
Finally, you should have something like this:
Generate a Makefile with CMake
If you didn’t do it yet, create a build/ folder respecting directories arrangement.
Open CMake-GUI and set source folder with Browse Source and build folder with Browse Build.
Next, run Configure. A popup window will ask you to specify the generator for the project. Using the drop down menu, select your preferred version of Visual Studio. If you have Visual Studio 2013 and a 64-bit system select "Visual Studio 12 2013 Win64". Keep "Use default native compilers" selected, and press "Finish".
You need to run Configure twice, since SOFA requires two passes to manage the module dependencies. You can then customize your version of SOFA, activate or deactivate plugins and functionalities.
Qt detection errors
To solve Qt detection errors, click on Add Entry and add
CMAKE_PREFIX_PATH with path
C:/Qt/X.X/msvcXXXX matching your Qt MSVC folder.
Boost detection errors
To solve Boost detection errors, click on Add Entry and add
BOOST_ROOT with path
C:/boost/boost_1_XX_X matching your Boost lib folder.
A further dev warning may appear:
CMake Warning (dev) at YOUR_QT_MSVC_PATH/lib/cmake/Qt5Core/Qt5CoreMacros.cmake:224 (configure_file): configure_file called with unknown argument(s): COPY_ONLY Call Stack (most recent call first): applications/projects/Modeler/exec/CMakeLists.txt:14 (qt5_add_resources)
This is just a typo with Qt5CoreMacros.cmake file. It uses COPY_ONLY instead of COPYONLY. Simply edit your Qt5CoreMacros.cmake, replace COPY_ONLY with COPYONLY and Configure again.
When you are ready, press Generate. This will create your Visual Studio solution or your makefiles if you chose another generator.
If you are using Visual Studio, building SOFA is just like any other project building. Simply open the generated Sofa.sln and build the solution.
Time for a coffee !
Last modified: 28 August 2017