Skip to content

Commit 217d184

Browse files
authored
Merge pull request #203 from bakpaul/25_07_update_build_instruction_for_new_release
Update installation and build instruction for new release
2 parents 983704b + e9af62f commit 217d184

3 files changed

Lines changed: 46 additions & 29 deletions

File tree

10_Getting_Started/20_Build/10_Linux.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,16 @@ SOFA requires some libraries:
9494
sudo apt install libboost-all-dev
9595
```
9696
97-
- **Python 3.10** + pip + numpy + scipy
97+
- **Python 3.12** + pip + numpy + scipy
9898
```
99-
sudo apt install python3.10-dev pybind11-dev
99+
sudo apt install python3.12-dev python3.12-venv
100100
```
101-
101+
Python 3.12 now favor the use of venv. We highly recommend it too. To bootstrap it type `python3.12 -m venv sofa-venv` in 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 calling `source /path/to/sofa-venv/bin/activate`. Now you can install all dependency through the following commands:
102102
```
103-
sudo apt-get install python3.10-distutils \
104-
&& curl -L https://bootstrap.pypa.io/pip/get-pip.py --output /tmp/get-pip3.py \
105-
&& python3.10 /tmp/get-pip3.py \
106-
&& python3.10 -m pip install --upgrade pip \
107-
&& python3.10 -m pip install numpy scipy pybind11==2.9.1
103+
python3.12 -m pip install --upgrade pip \
104+
&& python3.12 -m pip install numpy scipy pybind11==2.12.0
108105
```
106+
Now, each time you want to build or use SOFA, you first need to call `source /path/to/sofa-venv/bin/activate` to activate this virtual environment and get access to the dependencies.
109107
110108
- **Additional libraries**: libPNG, libJPEG, libTIFF, Glew, Zlib
111109
```
@@ -207,6 +205,8 @@ git clone -b master https://github.com/sofa-framework/sofa.git sofa/src
207205

208206
## Generate a Makefile with CMake
209207

208+
0. Activate your venv `source /path/to/sofa-venv/bin/activate` and tell CMake to look there to find pybind11 `export CMAKE_PREFIX_PATH=/path/to/sofa-venv/lib/python3.12/site-packages`
209+
210210
1. Create build directories respecting the arrangement above.
211211

212212
2. Run CMake-GUI and set source folder and build folder.
@@ -256,7 +256,8 @@ Time for a coffee!
256256
To solve Qt detection errors, click on **Add Entry** and add
257257
`CMAKE_PREFIX_PATH` with path `/home/YOUR_USERNAME/Qt/QT_VERSION/COMPILER` matching your
258258
Qt installation.
259-
Example: `CMAKE_PREFIX_PATH=/home/bob/Qt/5.15/gcc_64`
259+
Example: `CMAKE_PREFIX_PATH=/home/bob/Qt/5.15/gcc_64`.
260+
Note that this is a list, in which you can provide multiple paths by separating them with a semicolon ';'.
260261

261262
Then, **Configure** again.
262263

10_Getting_Started/20_Build/20_MacOS.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,19 @@ SOFA requires some libraries:
8484
brew install boost
8585
```
8686

87-
- **Python 3.10** + pip + numpy + scipy
88-
```bash
89-
brew install python@3.10
87+
- **Python 3.12** + pip + numpy + scipy
88+
```
89+
brew install python@3.12
9090
brew link --force python@3.10
91-
python3 -m pip install --upgrade pip
92-
python3 -m pip install numpy scipy
93-
brew install pybind11
9491
```
92+
Python 3.12 now favor the use of venv. We highly recommend it too. To bootstrap it type `python3.12 -m venv sofa-venv` in 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 calling `source /path/to/sofa-venv/bin/activate`. Now you can install all dependency through the following commands:
93+
```
94+
python3.12 -m pip install --upgrade pip \
95+
&& python3.12 -m pip install numpy scipy pybind11==2.12.0
96+
```
97+
Now, each time you want to build or use SOFA, you first need to call `source /path/to/sofa-venv/bin/activate` to activate this virtual environment and get access to the dependencies.
98+
99+
95100

96101
- **Additional libraries**: libPNG, libJPEG, libTIFF, Glew
97102
```bash
@@ -173,6 +178,8 @@ git clone -b master https://github.com/sofa-framework/sofa.git sofa/src
173178
174179
## Generate a Makefile with CMake
175180
181+
0. Activate your venv `source /path/to/sofa-venv/bin/activate` and tell CMake to look there to find pybind11 `export CMAKE_PREFIX_PATH=/path/to/sofa-venv/lib/python3.12/site-packages`
182+
176183
1. Create build directories respecting the arrangement above.
177184
178185
2. Run CMake.app and set source folder and build folder.
@@ -214,7 +221,9 @@ To solve Qt detection errors, click on **Add Entry** and add
214221
`CMAKE_PREFIX_PATH` with path `/home/YOUR_USERNAME/Qt/QT_VERSION/COMPILER` matching your
215222
Qt architecture.
216223
Example: `CMAKE_PREFIX_PATH=/home/bob/Qt/5.7/gcc_64`
217-
**Configure** again.
224+
Note that this is a list, in which you can provide multiple paths by separating them with a semicolon ';'.
225+
226+
Then, **Configure** again.
218227
219228
A further dev warning may appear:
220229

10_Getting_Started/20_Build/30_Windows.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ SOFA requires some libraries:
5656
- **For Visual Studio 2019**: choose boost_X_X_X-msvc-14.2-64.exe
5757
- **For Visual Studio 2017**: choose boost_X_X_X-msvc-14.1-64.exe
5858

59-
- **Python** (= 3.10.x)
60-
Download and install the latest [**Python 3.10 (amd64)**](https://www.python.org/ftp/python/3.10.10/python-3.10.10-amd64.exe).
61-
Then install the python dependencies. Run the following commands in cmd by replacing `path\to\Python310\ ` by the path where python was installed on your OS.
59+
- **Python** (= 3.12.x)
60+
Download and install the latest [**Python 3.12 (amd64)**](https://www.python.org/ftp/python/3.12.10/python-3.12.10-amd64.exe).
61+
Python 3.12 now favor the use of venv. We highly recommend it too. To bootstrap it type `C:\path\to\python3.12 -m venv sofa-venv` in 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 calling `C:\path\to\sofa-venv\bin\Scripts\activate.bat`. Now you can install all dependency through the following commands.
62+
Then, install the Python dependencies. Run the following commands in cmd by replacing `path\to\Python312\` by the path to you venv bin directory.
6263
```
63-
path\to\Python310\python.exe -m pip install --upgrade pip
64-
path\to\Python310\python.exe -m pip install numpy scipy pybind11==2.9.1
64+
path\to\Python312\python.exe -m pip install --upgrade pip
65+
path\to\Python312\python.exe -m pip install numpy scipy pybind11==2.12.0
6566
```
67+
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.
6668
6769
- **Additional libraries**: libPNG, libJPEG, libTIFF, Glew, Zlib, TinyXML2
6870
Download the [Windows dependency pack](https://www.sofa-framework.org/download/WinDepPack/VS-2017/latest).
@@ -130,32 +132,35 @@ git clone -b master https://github.com/sofa-framework/sofa.git sofa/src
130132
2. In Windows Start menu, search for `Native Tools Command Prompt` and run the one corresponding to your Windows architecture (x64 for 64-bit, x86 for 32-bit).
131133
![](https://www.sofa-framework.org/wp-content/uploads/2020/04/SearchCommandPrompt2.png)
132134

133-
3. In the command prompt, type `cmake-gui` and press Enter.
135+
3. Call ``C:\path\to\sofa-venv\bin\Scripts\activate.bat`` to activate the virtual environment.
136+
137+
4. In the command prompt, type `cmake-gui` and press Enter.
134138
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.
135139

136-
4. In CMake-GUI, set source folder and build folder.
140+
5. In CMake-GUI, set source folder and build folder.
137141

138-
5. Run **Configure**.
142+
6. Run **Configure**.
139143

140-
6. A popup will ask you to specify the generator for the project.
144+
7. A pop-up will ask you to specify the generator for the project.
141145

142146
- If you want use **Visual Studio IDE**, select "Visual Studio 15 2017 Win64" or "Visual Studio 16 2019 Win64" (or without the "Win64" if you are on Windows 32-bit).
143147
- If you want to use **another IDE like QtCreator**, select "CodeBlocks - Ninja" (recommended, needs [Ninja](#optional-ninja-build-system)) or "CodeBlocks - NMake".
144148
Keep "Use default native compilers" and press "Finish".
145149

146-
7. Fix eventual dependency errors by following CMake messages (see Troubleshoot section below). Do not worry about warnings.
150+
8. Fix eventual dependency errors by following CMake messages (see Troubleshoot section below). You may ignore warnings.
147151

148152
- e.g. define the `Eigen3_DIR` with the path where you installed Eigen
153+
- 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`
149154

150-
8. (optional) Customize SOFA via CMake variables
155+
9. (optional) Customize SOFA via CMake variables
151156

152157
- choose the build type by setting CMAKE_BUILD_TYPE to "Release" or "RelWithDebInfo" (recommended) or "Debug"
153158
- activate or deactivate plugins: see PLUGIN_XXX variables
154159
- activate or deactivate features: see SOFA_XXX variables
155160
Do not forget to **Configure** again to check if your changes are valid.
156161
**_NOTE_**: here is an [exhaustive list of plugins](../activate-plugins/) that can be activated for an in-tree compilation.
157162

158-
9. 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.
163+
10. 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.
159164

160165

161166
## Compile
@@ -181,7 +186,9 @@ Time for a coffee!
181186
To solve Qt detection errors, click on **Add Entry** and add
182187
`CMAKE_PREFIX_PATH` with path to your Qt directory (navigate until msvcXXXX_XX directory).
183188
Example: `CMAKE_PREFIX_PATH=C:/dev/Qt/5.11.3/msvc2017_64`
184-
**Configure** again.
189+
Note that this is a list, in which you can provide multiple paths by separating them with a semicolon ';'.
190+
191+
Then, **Configure** again.
185192

186193
A further dev warning may appear:
187194

0 commit comments

Comments
 (0)