After downloading and uncompressing you must have the `lmgc90_user_xxx` directory somewhere. Inside, you should have the following
subdirectories:
**src* : the sources of LMGC90 software
**examples* : the user examples working with the sources
**manuals* : a list of manuals/documentation for the software in pdf format
**docs* : the html documentation generated from the sources
**build* : (empty) where to build the LMGC90 libraries
If an error arises during the compilation step please first check if there is not a solution
in the [FAQ](Faq#compile_error)
You must run a set of commands from the terminal to build LMGC90 software for your system.
## Unix like system (linux, MacOS, WSL) ##
Run the following commands:
```shell
cd build
cmake ..
make
```
#### Python selection ####
It is really important that the compilation process get access to the python version
that the user want to use with lmgc90. As such, it possible to specify the absolute path
to the python executable. For an example, to use python3 on ubuntu 18,
one must run the next line by replacing `[absolute path to python]` by `/usr/bin/python3` (
whereas a macos user will use `/opt/local/bin/python`).
```shell
cd build
cmake .. -DPython_EXECUTABLE=[absolute path to python]
make
```
Or if the user prefers to use *virtual environment* (with or without a manager like [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/#) or [miniconda](https://virtualenvwrapper.readthedocs.io/en/latest/#), then there is two changes:
1. the path to the environment must be provided to cmake
2. lmgc90 must be installed in the environment.
For example when using *virtualenvwrapper* and with an environment called *lmgc90* the compilation steps becomes:
```shell
workon lmgc90
cd build
cmake .. -DVENV_PATH=$VIRTUAL_ENV
make
make install
```
#### Optional compilation ####
Instead of simply running `cmake`, you can run `ccmake` or `cmake-gui` to help you changing some
configuration parameters. For examples to be able to write HDF5 file (assuming you installed the dependancies),
you have to compile with:
```shell
cmake .-DWITH_HDF5=True
make
```
If you want to re-build the documentation run:
```shell
make docs
```
It will build the sphinx documentation in `build/docs` directory,
but the one provided should be up-to-date
#### Installation ####
If a *virtual environment* is used, then the `make install` command has already taken car of this step. It is directly possible to check on the [first steps](./first step) section.
In any other case, our policy is to not mess with default system paths. So our recommendation is
to use an environment variable to add to python the path to our build directory.
In general adding the following lines to your *.bashrc* (Linux) or *.zshrc* (MacOS) file
does the trick. Of course you have to replace *mysourcepath* by the path to your own `lmgc90_user_xxx` directory (something like `/users/name/LMGC90/lmgc90_user_xxx/`
and replacing `xxx` by the version you downloaded).
After downloading and uncompressing you must have the `lmgc90_user_xxx` directory somewhere. Inside, you should have the following
subdirectories:
**src* : the sources of LMGC90 software
**examples* : the user examples working with the sources
**manuals* : a list of manuals/documentation for the software in pdf format
**docs* : the html documentation generated from the sources
**build* : (empty) where to build the LMGC90 libraries
If an error arises during the compilation step please first check if there is not a solution
in the [FAQ](Faq#compile_error)
You must run a set of commands from the terminal to build LMGC90 software for your system.
## Unix like system (linux, MacOS, WSL) ##
Run the following commands:
```shell
cd build
cmake ..
make
```
_In case of error during the `make` step on macOS, check [this part of the FAQ](faq#an-error-arise-when-building-on-mac-os)_
#### Python selection ####
It is really important that the compilation process get access to the python version
that the user want to use with lmgc90. As such, it possible to specify the absolute path
to the python executable. For an example, to use python3 on ubuntu 18,
one must run the next line by replacing `[absolute path to python]` by `/usr/bin/python3` (
whereas a macos user will use `/opt/local/bin/python`).
```shell
cd build
cmake .. -DPython_EXECUTABLE=[absolute path to python]
make
```
Or if the user prefers to use *virtual environment* (with or without a manager like [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/#) or [miniconda](https://virtualenvwrapper.readthedocs.io/en/latest/#), then there is two changes:
1. the path to the environment must be provided to cmake
2. lmgc90 must be installed in the environment.
For example when using *virtualenvwrapper* and with an environment called *lmgc90* the compilation steps becomes:
```shell
workon lmgc90
cd build
cmake .. -DVENV_PATH=$VIRTUAL_ENV
make
make install
```
#### Optional compilation ####
Instead of simply running `cmake`, you can run `ccmake` or `cmake-gui` to help you changing some
configuration parameters. For examples to be able to write HDF5 file (assuming you installed the dependancies),
you have to compile with:
```shell
cmake .-DWITH_HDF5=True
make
```
If you want to re-build the documentation run:
```shell
make docs
```
It will build the sphinx documentation in `build/docs` directory,
but the one provided should be up-to-date
#### Installation ####
If a *virtual environment* is used, then the `make install` command has already taken car of this step. It is directly possible to check on the [first steps](./first step) section.
In any other case, our policy is to not mess with default system paths. So our recommendation is
to use an environment variable to add to python the path to our build directory.
In general adding the following lines to your *.bashrc* (Linux) or *.zshrc* (MacOS) file
does the trick. Of course you have to replace *mysourcepath* by the path to your own `lmgc90_user_xxx` directory (something like `/users/name/LMGC90/lmgc90_user_xxx/`
and replacing `xxx` by the version you downloaded).