|
|
This page explains how to build the examples. You must have checked that [git](Git), [a C++ compiler](MinGW) and [cmake](CMake) are correctly installed on your system.
|
|
This page explains how to build the examples on your personal laptop or on the CECI supercomputers (nic5).
|
|
|
|
|
|
|
|
As prerequisite, you must have verified that [git](Git), [a C++ compiler](MinGW) and [CMake](CMake) are correctly installed on your system. Using [VS Code](Visual-Studio-Code) is recommended by not mandatory.
|
|
|
|
|
|
|
|
## Windows
|
|
## Windows
|
|
|
* Clone the repository somewhere on your PC using "git bash"
|
|
* Clone the repository somewhere on your PC:
|
|
|
```
|
|
```
|
|
|
git clone git@gitlab.uliege.be:R.Boman/math0471.git
|
|
git clone git@gitlab.uliege.be:R.Boman/math0471.git
|
|
|
```
|
|
```
|
|
|
* Open VS Code and load the `math0471` folder.
|
|
* Open VS Code and load the `math0471` folder.
|
|
|
* In the terminal of VS Code, go to the `lib` folder and install gmsh-sdk and Eigen using the scripts `get_gmsh.cmd` and `get_eigen.cmd`(only once per working copy of the repository)
|
|
* In the terminal of VS Code, go to the `lib` folder and install gmsh-sdk and Eigen using the scripts `get_gmsh.cmd` and `get_eigen.cmd` (this should be done only once per working copy of the repository):
|
|
|
```
|
|
```
|
|
|
cd lib
|
|
cd lib
|
|
|
get_gmsh.cmd
|
|
get_gmsh.cmd
|
| ... | @@ -14,90 +16,87 @@ get_eigen.cmd |
... | @@ -14,90 +16,87 @@ get_eigen.cmd |
|
|
cd ..
|
|
cd ..
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
* Add MinGW, gmsh-sdk and eigen to your environment by running this script (it should be done each time you re-open VS Code or a new terminal):
|
|
* Add MinGW, gmsh-sdk and Eigen to your environment by running this script (it should be done each time you re-open VS Code or a new terminal):
|
|
|
```
|
|
```
|
|
|
envs\windows.cmd
|
|
envs\windows.cmd
|
|
|
```
|
|
```
|
|
|
* Then, in the same terminal, go to an example folder:
|
|
* Then, in the same terminal, go to the example folder:
|
|
|
```
|
|
```
|
|
|
cd examples\gmsh_api
|
|
cd examples\gmsh_api
|
|
|
```
|
|
```
|
|
|
* Create a build folder in `examples\gmsh_api`:
|
|
* Create a `build` folder in `examples\gmsh_api`:
|
|
|
```
|
|
```
|
|
|
mkdir build
|
|
mkdir build
|
|
|
```
|
|
```
|
|
|
* Go into this folder
|
|
* Go into this folder:
|
|
|
```
|
|
```
|
|
|
cd build
|
|
cd build
|
|
|
```
|
|
```
|
|
|
* Run cmake
|
|
* Run CMake (if an error occurs at this stage, it usually means that you forgot to run `envs\windows.cmd` or you installed the programs at locations on your hard drive other than those recommended in this wiki):
|
|
|
```
|
|
```
|
|
|
cmake ..
|
|
cmake ..
|
|
|
```
|
|
```
|
|
|
* start the compilation (with 4 parallel processes)
|
|
* Start the compilation (with 4 parallel processes):
|
|
|
```
|
|
```
|
|
|
make -j 4
|
|
make -j 4
|
|
|
```
|
|
```
|
|
|
* run a program:
|
|
* Run a program:
|
|
|
```
|
|
```
|
|
|
code1_loadgeo.exe ..\rectangle.geo
|
|
code1_loadgeo.exe ..\rectangle.geo
|
|
|
```
|
|
```
|
|
|
If a window does not show up, it means that you forgot to run `envs\windows.cmd`.
|
|
|
|
|
|
|
|
|
|
## CECI clusters / linux
|
|
## CECI clusters / Linux / macOS
|
|
|
|
|
|
|
|
* clone the repository
|
|
* Clone the repository:
|
|
|
```
|
|
```
|
|
|
git clone git@gitlab.uliege.be:R.Boman/math0471.git
|
|
git clone git@gitlab.uliege.be:R.Boman/math0471.git
|
|
|
```
|
|
```
|
|
|
* go into the project folder
|
|
* Go into the project folder:
|
|
|
```
|
|
```
|
|
|
cd math0471
|
|
cd math0471
|
|
|
```
|
|
```
|
|
|
* install gmsh-sdk and Eigen using the script `get_gmsh.sh` and `get_eigen.sh` in the `lib` folder
|
|
* Install gmsh-sdk and Eigen using the script `get_gmsh.sh` and `get_eigen.sh` in the `lib` folder:
|
|
|
```
|
|
```
|
|
|
cd lib
|
|
cd lib
|
|
|
./get_gmsh.sh
|
|
./get_gmsh.sh
|
|
|
./get_eigen.sh
|
|
./get_eigen.sh
|
|
|
cd ..
|
|
cd ..
|
|
|
```
|
|
```
|
|
|
* set the environment variables for cmake
|
|
* Set the environment variables for cmake:
|
|
|
```
|
|
```
|
|
|
source ./envs/linux-macos.sh
|
|
source ./envs/linux-macos.sh
|
|
|
```
|
|
```
|
|
|
* go to the `examples/gmsh_api` folder:
|
|
* Go to the `examples/gmsh_api` folder:
|
|
|
```
|
|
```
|
|
|
cd examples/gmsh_api
|
|
cd examples/gmsh_api
|
|
|
```
|
|
```
|
|
|
* create a build folder and go into it
|
|
* Create a `build` folder and go into it:
|
|
|
```
|
|
```
|
|
|
mkdir build
|
|
mkdir build
|
|
|
cd build
|
|
cd build
|
|
|
```
|
|
```
|
|
|
* run cmake
|
|
* Run CMake (if an error occurs at this stage, it usually means that you forgot to "source" `envs/linux-macos.sh`):
|
|
|
```
|
|
```
|
|
|
cmake ..
|
|
cmake ..
|
|
|
```
|
|
```
|
|
|
* build the project (with 4 parallel processes)
|
|
* Build the project (with 4 parallel processes):
|
|
|
```
|
|
```
|
|
|
make -j 4
|
|
make -j 4
|
|
|
```
|
|
```
|
|
|
* run a program
|
|
* Run a program:
|
|
|
```
|
|
```
|
|
|
./code1_loadgeo ../rectangle.geo
|
|
./code1_loadgeo ../rectangle.geo
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
# Note about the environment scripts
|
|
# Note about the environment scripts
|
|
|
|
|
|
|
|
The scripts in the `math0471/envs/` folder add several folders to 3 environment variables so that the system and cmake find the compiler and the libraries correctly:
|
|
The scripts in the `math0471/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`),
|
|
* `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),
|
|
* `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`.
|
|
* `INCLUDE`: points to the path of the folder containing the `gmsh.h` header and the `Eigen` folder.
|
|
|
|
|
|
|
|
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.
|
|
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").
|
|
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`). |
|
On Linux/macOS, you can add/modify environment variables by editing `~/.bashrc` (just copy & paste the contents of `envs/linux-macos.sh`). |
|
|
|
|
|
|
|
|
|
|