Update Build authored by Boman Romain's avatar Boman Romain
...@@ -5,11 +5,16 @@ This page explains how to build the code. You must have checked that [git](Git), ...@@ -5,11 +5,16 @@ This page explains how to build the code. You must have checked that [git](Git),
``` ```
git clone git@gitlab.uliege.be:R.Boman/gmsh-api.git git clone git@gitlab.uliege.be:R.Boman/gmsh-api.git
``` ```
* Go to the [gmsh web page](http://gmsh.info/) and download the latest version of [Software Development Kit (SDK) for Windows 64-bit](http://gmsh.info/bin/Windows/gmsh-4.5.2-Windows64-sdk.zip) * Open VS Code and load the `gmsh-api` folder.
* Unzip it in the `gmsh-api` folder * In the terminal of VS Code, install gmsh-sdk using the script `get_gmsh.cmd` (only once per working copy of the repository)
* Rename `gmsh-4.5.2-Windows64-sdk` into `gmsh-sdk` ```
* Double click on `envs\win-mingw64.cmd` get_gmsh.cmd
* Create a build folder: ```
* Add MinGW and gmsh-sdk to your environment by running this script (it should be done each time you re-open VS Code or a new terminal):
```
envs\win-mingw64.cmd
```
* Then, in the same terminal, create a build folder:
``` ```
mkdir build mkdir build
``` ```
...@@ -19,11 +24,11 @@ cd build ...@@ -19,11 +24,11 @@ cd build
``` ```
* Run cmake * Run cmake
``` ```
cmake -G "MinGW Makefiles" .. cmake ..
``` ```
* start the compilation (with 4 cores) * start the compilation (with 4 cores)
``` ```
mingw32-make -j 4 make -j 4
``` ```
* run a program * run a program
``` ```
...@@ -67,3 +72,18 @@ make -j 4 ...@@ -67,3 +72,18 @@ make -j 4
gmsh -2 ../sandbox/mymesh.geo gmsh -2 ../sandbox/mymesh.geo
./bin/myedges.exe ../sandbox/mymesh.msh ./bin/myedges.exe ../sandbox/mymesh.msh
``` ```
# Note about the environment scripts
The scripts in the `gmsh-api/envs/` folder add several folders to 3 environment variables so that the system and cmake find the compiler and the libraries correctly:
* `PATH`: this variable should contain the location of the folder of your `g++` compiler, of `gmsh.exe` and its shared library (`gmsh.dll/so/dylib`),
* `LIB`: points to the path of the folder containing `gmsh.lib` (windows) or `gmsh.so` (linux) or `gmsh.dylib` (macOS),
* `INCLUDE`: points to the path of the folder containing the header `gmsh.h`.
Instead of using these scripts which should be loaded each time you start a new terminal, these 3 variables can be defined in your global user environment once and for all.
This is done by going to "Settings" on Windows, and typing "env" in the search bar. Then choose the appropriate menu ("modify environment variables").
On Linux/macOS, you can add/modify environment variables by editing `~/.bashrc` (just copy & paste the contents of `envs/linux-macOS.sh`).