update instructions authored by Boman Romain's avatar Boman Romain
# How to compile the examples? # How to compile the examples?
## PC/windows/codeblocks ## PC/windows/mingw
* Clone the repository
* Go to the [gmsh web page](http://gmsh.info/) and download the latest version of gmsh-SDK: Windows-32bits (Code::Blocks provides a 32bits compiler) * 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)
* Unzip it somewhere e.g. `C:\local\gmsh-4.1.4-Windows32-sdk` * Unzip it in the `gmsh-api` folder
* Optional: you can create a soft link to shorten this path with the commands Open a terminal with `cmd.exe`, then: * Rename `gmsh-4.5.2-Windows64-sdk` into `gmsh-sdk`
* Double click on `envs\win-mingw64.cmd`
* Create a build folder:
``` ```
c: mkdir build
cd local
mklink /J gmsh-sdk32 gmsh-4.1.4-Windows32-sdk
``` ```
* It is also very convenient to move the gmsh dll from the `lib` folder to the `bin` folder: * Go into this folder
``` ```
move gmsh-sdk32\lib\gmsh-4.1.dll gmsh-sdk32\bin cd build
``` ```
* Overwrite `gmsh.h` with `gmsh.h_cwrap`: * Run cmake
``` ```
copy /Y gmsh-sdk32\include\gmsh.h_cwrap gmsh-sdk32\include\gmsh.h cmake -G "MinGW Makefiles" ..
``` ```
* Add the following environment variables to your windows session: * start the compilation
``` ```
set GMSHSDK=C:\local\gmsh-sdk32 mingw32-make -j 4
set PATH=%GMSHSDK%\bin;%PATH%
set INCLUDE=%GMSHSDK%\include;%INCLUDE%
set LIB=%GMSHSDK%\lib;%LIB%
set PYTHONPATH=%GMSHSDK%\lib;%PYTHONPATH%
``` ```
In other words, you should add the `bin` folder of `gmsh-sdk32` to your `PATH` so that you can type `gmsh` in any terminal. The `bin` folder also contains the gmsh dynamic library, that must be found when `gmsh` (or your future solver) is run. The `INCLUDE` and `LIB` variables allows `CMake` to find the header `gmsh.h` and the library `gmsh.lib` respectively. Eventually, you may want to add the `lib` folder to your `PYTHONPATH` so that the command `import gmsh` works in python (it could be useful if you want to run python examples) * run each program
* Download the latest version of CMake from the [CMake website](https://cmake.org/download/) and install it (add `cmake` to your `PATH` when asked, so that you can type `cmake` from a terminal)
* Download [Code::Blocks](http://www.codeblocks.org/downloads). Choose the version with the mingw compiler included. Install it with the default options.
* Add the MinGW compiler to your `PATH`
* Clone this repository
* ...
## PC/Linux/gcc
gmsh SDK requires `libgfortran.so.3` to be installed on the system. On Ubuntu, you can install gfortran with the following line (admin rights required)
``` ```
sudo apt-get install libgfortran3 myedges.exe
``` ```
## PC/Linux/gcc
If you want to build the examples on NIC4, you must load a gcc module. I recommend the following one which is compatible with many other libraries of the system. If you want to build the examples on NIC4, you must load a gcc module. I recommend the following one which is compatible with many other libraries of the system.
``` ```
module load gcc/4.9.2 module load gcc
``` ```
The following variables should also be defined so that CMake finds the correct gcc. Put these lines in your `~/.bashrc` file: The following variables should also be defined so that CMake finds the correct gcc. Put these lines in your `~/.bashrc` file:
``` ```
...@@ -51,8 +39,3 @@ export CC=gcc ...@@ -51,8 +39,3 @@ export CC=gcc
export CXX=g++ export CXX=g++
export FC=gfortran export FC=gfortran
``` ```
## macOS/clang