After downloading and uncompressing you must have the `lmgc90_user_xxx` directory somewhere. Inside, you should have the following
After downloading and uncompressing you must have the `lmgc90_user_xxx` directory somewhere. Inside, you should have the following
subdirectories:
subdirectories:
**src* : the sources of LMGC90 software
**src* : the sources of LMGC90 software
**examples* : the user examples working with the sources
**examples* : the user examples working with the sources
**manuals* : a list of manuals/documentation for the software in pdf format
**manuals* : a list of manuals/documentation for the software in pdf format
**docs* : the html documentation generated from the sources
**docs* : the html documentation generated from the sources
**build* : (empty) where to build the LMGC90 libraries
**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
If an error arises during the compilation step please first check if there is not a solution
in the [FAQ](Faq#compile_error)
in the [FAQ](Faq#compile_error)
You must run a set of commands from the terminal to build LMGC90 software for your system.
You must run a set of commands from the terminal to build LMGC90 software for your system.
## Unix like system (linux, MacOS, WSL) ##
## Unix like system (linux, MacOS, WSL) ##
Run the following commands:
Run the following commands:
```shell
```shell
cd build
cd build
cmake ..
cmake ..
make
make
```
```
#### Python selection ####
_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)_
It is really important that the compilation process get access to the python version
#### Python selection ####
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,
It is really important that the compilation process get access to the python version
one must run the next line by replacing `[absolute path to python]` by `/usr/bin/python3` (
that the user want to use with lmgc90. As such, it possible to specify the absolute path
whereas a macos user will use `/opt/local/bin/python`).
to the python executable. For an example, to use python3 on ubuntu 18,
```shell
one must run the next line by replacing `[absolute path to python]` by `/usr/bin/python3` (
cd build
whereas a macos user will use `/opt/local/bin/python`).
cmake .. -DPython_EXECUTABLE=[absolute path to python]
```shell
make
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.
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
For example when using *virtualenvwrapper* and with an environment called *lmgc90* the compilation steps becomes:
2. lmgc90 must be installed in the environment.
```shell
workon lmgc90
For example when using *virtualenvwrapper* and with an environment called *lmgc90* the compilation steps becomes:
cd build
```shell
cmake .. -DVENV_PATH=$VIRTUAL_ENV
workon lmgc90
make
cd build
make install
cmake .. -DVENV_PATH=$VIRTUAL_ENV
```
make
make install
#### Optional compilation ####
```
#### 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:
Instead of simply running `cmake`, you can run `ccmake` or `cmake-gui` to help you changing some
```shell
configuration parameters. For examples to be able to write HDF5 file (assuming you installed the dependancies),
cmake .-DWITH_HDF5=True
you have to compile with:
make
```shell
```
cmake .-DWITH_HDF5=True
make
If you want to re-build the documentation run:
```
```shell
make docs
If you want to re-build the documentation run:
```
```shell
It will build the sphinx documentation in `build/docs` directory,
make docs
but the one provided should be up-to-date
```
It will build the sphinx documentation in `build/docs` directory,
#### Installation ####
but the one provided should be up-to-date
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.
#### Installation ####
In any other case, our policy is to not mess with default system paths. So our recommendation is
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.
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
In any other case, our policy is to not mess with default system paths. So our recommendation is
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/`
to use an environment variable to add to python the path to our build directory.
and replacing `xxx` by the version you downloaded).
In general adding the following lines to your *.bashrc* (Linux) or *.zshrc* (MacOS) file
```shell
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/`
if[-z${PYTHONPATH}];then
and replacing `xxx` by the version you downloaded).