Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 6 additions & 24 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Installation
- python should be installed
- gnuplot should be installed

**Note: The `build_things.sh` script assumes that TDEP was cloned and lives in a git repository. If you wish obtain TDEP in another you have to adjust the script.**
**Note: The `build_things.sh` script assumes that TDEP was cloned and lives in a git repository. If you wish obtain TDEP in another way you have to adjust the script.**

**If you have a package manager, `homebrew`, `apt-get`, `yay`, `pacman`, you name it, getting these dependencies should be straightforward.**

Expand Down Expand Up @@ -78,29 +78,6 @@ i.e., add the respective lines to your `.bashrc` and you are all set up!

**If problems occur, please look at the [Troubleshooting section below](#Troubleshooting). If you cannot fix the error, please reach out, e.g., via the [issue tracker](https://github.com/tdep-developers/tdep/issues).**

## Meson build system

Alternativaly to the `build_things.sh` script, there is also the possibility to use [Meson](https://mesonbuild.com/). It is a build automation tool, and it supports incremental builds. The dependencies should be installed in standard locations (e.g. `/usr/local/`) or specified in the `PKG_CONFIG_PATH`.

First setup the git version for the code:
```setup_git_version.sh```
Then you can run the configuration step:
```meson setup build```
And finally compile the code:
```
cd build
meson compile
meson install
```

If some dependencies are not found, please make sure that they are in your PKG_CONFIG_PATH. For example, put something of the form in your `.bashrc` / `.bash_profile` :
```export PKG_CONFIG_PATH="/path/to/your/netcdf/:${PKG_CONFIG_PATH}"```
Depending on the method used to install the required libraries, they may not be automatically put inside the search path (Homebrew is known to not always do it).
You can make sure that `pkg-config` is able to find the dependencies by running: `pkg-config --libs hdf5`
Meson will first try to find dependencies via `pkg-config`. If it does not find them, it will try to use CMake (if installed/loaded).

Once the configuration step is done, everything should go smoothly. The binaries will be in build/bin/executable_name.

## Check your installation

We advise to run the tests in [`./tests`](./tests) to check your installation.
Expand All @@ -122,6 +99,7 @@ where `FC` and `CC` should point to the same Fortran/C compilers you are using t
- [macOS](#macOS)
- [Supercomputers](#Supercomputers)
- [Platform-agnostic installation using Anaconda](#Anaconda)
- [Platform-agnostic installation using the Meson build system](#Meson-build-system)

## macOS

Expand All @@ -146,6 +124,10 @@ There are two template settings files you can look into:

One convenient, (mostly) platform-agnostic way to install TDEP is to use [Anaconda](https://anaconda.org/).

## Meson build system

To use the Meson build system instead of the `build_things.sh` script, see [INSTALL_Meson.md](INSTALL_Meson.md).

### Prepare environment


Expand Down
31 changes: 31 additions & 0 deletions INSTALL_Meson.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Installation with the Meson build system
===

Alternativaly to the `build_things.sh` script, there is also the possibility to use [Meson](https://mesonbuild.com/). It is a build automation tool, and it supports incremental builds (similarly to autotools and CMake). The dependencies should be installed in standard locations (e.g. `/usr/local/`) or specified in the `PKG_CONFIG_PATH`.

First setup the git version for the code:
```setup_git_version.sh```
Then you can run the configuration step:
```meson setup build```
And finally compile the code:
```
cd build
meson compile
meson install
```

If some dependencies are not found, please make sure that they are in your PKG_CONFIG_PATH. For example, put a line of the form in your `.bashrc` / `.bash_profile` :
```export PKG_CONFIG_PATH="/path/to/your/hdf5/:${PKG_CONFIG_PATH}"```
Depending on the method used to install the required libraries, they may not be automatically put inside the search path (Homebrew is known to not always do it). You may also have to set the environment variables `PKG_CONFIG_ALLOW_SYSTEM_LIBS` and `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS` to 1:
```
export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
```
You can make sure that `pkg-config` is able to find the dependencies and proper compilation/linking flags by running:
```
pkg-config --libs hdf5
pkg-config --cflags hdf5
```
Meson will first try to find dependencies via `pkg-config`. If it does not find them, it will try to use CMake (if installed/loaded).

Once the configuration step is done, everything should go smoothly. The binaries will be in bin/executable_name.
43 changes: 38 additions & 5 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,17 +1,50 @@
project('tdep', 'fortran', 'c', 'cpp')
project('tdep',
'fortran', 'c', 'cpp',
meson_version: '>=1.1',
default_options: ['buildtype=custom', 'debug=true', 'optimization=3'])
add_project_arguments('-cpp', language: 'fortran')
add_project_arguments('-ffree-line-length-none', language: 'fortran')
# add_project_arguments('-std=f2008', language: 'fortran')
add_project_arguments('-fallow-argument-mismatch', language: 'fortran')

# global dependencies:

# mpi
dep_mpi = dependency('mpi', language: 'fortran')
dep_blas = dependency('blas')
dep_lapack = dependency('lapack')

# linear algebra
dep_linalg_found = false
# 1) try accelerate framework for macos (if wanted)
# enabled via -Daccfrmwrk=true
if build_machine.system() == 'darwin' and get_option('accfrmwrk') == true
dep_linalg = dependency('appleframeworks', modules : 'accelerate', required: false)
dep_linalg_found = dep_linalg.found()
endif

# 2) try blas/openblas + lapack otherwise
if not dep_linalg_found
dep_blas = dependency('blas', required: false)
if not dep_blas.found()
message('Did not find the blas library. Trying with openblas')
dep_blas = dependency('openblas', required: true) # required as it is the last try
endif
dep_lapack = dependency('lapack', required: true)
dep_linalg = [dep_blas, dep_lapack]
endif
# # add some common path to pkg-config search path
# env = environ()
# env.prepend('PKG_CONFIG_PATH', '/usr/lib/x86_64-linux-gnu')

# message(get_option('linalg_flavor'))

# fft
dep_fftw = dependency('fftw3')

# hdf5
dep_hdf5 = dependency('hdf5', language: 'fortran', version: '>1.10.7')
dep_netcdf = dependency('netcdf', language: 'fortran')
dep_all = [dep_mpi, dep_blas, dep_lapack, dep_fftw, dep_hdf5, dep_netcdf]

# dep_all = [dep_mpi, dep_blas, dep_lapack, dep_fftw, dep_hdf5]
dep_all = [dep_mpi, dep_linalg, dep_fftw, dep_hdf5]

subdir('src/libolle')
subdir('src/libflap')
Expand Down
4 changes: 4 additions & 0 deletions meson.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# wether to use the apple accelerate framework on macos
option('accfrmwrk', type : 'boolean', value : false, description : 'Enables the use of Apple\'s accelerate framework for linear algebra, replacing blas/lapack.')
# option('linalg_flavor', type : 'combo', choices : ['auto', 'lapack', 'mkl'])
# option('fft_flavor', type : 'combo', choices : ['auto', 'fftw', 'mkl_dfti'])
9 changes: 4 additions & 5 deletions src/anharmonic_free_energy/meson.build
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
executable('anharmonic_free_energy',
exec_name='anharmonic_free_energy'
executable(exec_name,
'energy.f90',
'epot.f90',
'main.f90',
'options.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('anharmonic_free_energy', pointing_to: meson.project_build_root() / 'bin/anharmonic_free_energy', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
9 changes: 4 additions & 5 deletions src/atomic_distribution/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('atomic_distribution',
exec_name='atomic_distribution'
executable(exec_name,
'correlationfunction.f90',
'diffraction.f90',
'main.f90',
Expand All @@ -9,8 +10,6 @@ executable('atomic_distribution',
'vectordist.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('atomic_distribution', pointing_to: meson.project_build_root() / 'bin/atomic_distribution', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
9 changes: 4 additions & 5 deletions src/canonical_configuration/meson.build
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
executable('canonical_configuration',
exec_name='canonical_configuration'
executable(exec_name,
'main.f90',
'options.f90',
'semirandom.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('canonical_configuration', pointing_to: meson.project_build_root() / 'bin/canonical_configuration', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
9 changes: 4 additions & 5 deletions src/crystal_structure_info/meson.build
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
executable('crystal_structure_info',
exec_name='crystal_structure_info'
executable(exec_name,
'main.f90',
'options.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('crystal_structure_info', pointing_to: meson.project_build_root() / 'bin/crystal_structure_info', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
9 changes: 4 additions & 5 deletions src/dump_dynamical_matrices/meson.build
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
executable('dump_dynamical_matrices',
exec_name='dump_dynamical_matrices'
executable(exec_name,
'main.f90',
'options.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('dump_dynamical_matrices', pointing_to: meson.project_build_root() / 'bin/dump_dynamical_matrices', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
9 changes: 4 additions & 5 deletions src/extract_forceconstants/meson.build
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
executable('extract_forceconstants',
exec_name='extract_forceconstants'
executable(exec_name,
'main.f90',
'options.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('extract_forceconstants', pointing_to: meson.project_build_root() / 'bin/extract_forceconstants', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
9 changes: 4 additions & 5 deletions src/generate_structure/meson.build
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
executable('generate_structure',
exec_name='generate_structure'
executable(exec_name,
'autocell.f90',
'main.f90',
'options.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('generate_structure', pointing_to: meson.project_build_root() / 'bin/generate_structure', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
9 changes: 4 additions & 5 deletions src/lineshape/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('lineshape',
exec_name='lineshape'
executable(exec_name,
'dielscatter.f90',
'dielscatter_helper.f90',
# 'dielscatter_matrixelement.f90',
Expand All @@ -16,8 +17,6 @@ executable('lineshape',
'scatteringrates.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('lineshape', pointing_to: meson.project_build_root() / 'bin/lineshape', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
9 changes: 4 additions & 5 deletions src/pack_simulation/meson.build
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
executable('pack_simulation',
exec_name='pack_simulation'
executable(exec_name,
'main.f90',
'options.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('pack_simulation', pointing_to: meson.project_build_root() / 'bin/pack_simulation', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
9 changes: 4 additions & 5 deletions src/phasespace_surface/meson.build
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
executable('phasespace_surface',
exec_name='phasespace_surface'
executable(exec_name,
'main.f90',
'options.f90',
'type_phasespacesurface.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('phasespace_surface', pointing_to: meson.project_build_root() / 'bin/phasespace_surface', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
9 changes: 4 additions & 5 deletions src/phonon_dispersion_relations/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('phonon_dispersion_relations',
exec_name='phonon_dispersion_relations'
executable(exec_name,
'activity.f90',
'densityplots.f90',
'densityplots_stuntscattering.f90',
Expand All @@ -9,8 +10,6 @@ executable('phonon_dispersion_relations',
'velocitydos.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('phonon_dispersion_relations', pointing_to: meson.project_build_root() / 'bin/phonon_dispersion_relations', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
9 changes: 4 additions & 5 deletions src/refine_structure/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('refine_structure',
exec_name='refine_structure'
executable(exec_name,
'lo_spacegroup_applyoperation.f90',
'lo_spacegroup_charactertable.f90',
'lo_spacegroup.f90',
Expand All @@ -9,8 +10,6 @@ executable('refine_structure',
'refine.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('refine_structure', pointing_to: meson.project_build_root() / 'bin/refine_structure', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name/ exec_name, install_dir: meson.project_source_root() / 'bin')
9 changes: 4 additions & 5 deletions src/samples_from_md/meson.build
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
executable('samples_from_md',
exec_name='samples_from_md'
executable(exec_name,
'main.f90',
'options.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('samples_from_md', pointing_to: meson.project_build_root() / 'bin/samples_from_md', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
9 changes: 4 additions & 5 deletions src/thermal_conductivity/meson.build
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
executable('thermal_conductivity',
exec_name='thermal_conductivity'
executable(exec_name,
'cumulative_kappa.f90',
'kappa.f90',
'main.f90',
'options.f90',
'scattering.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('thermal_conductivity', pointing_to: meson.project_build_root() / 'bin/thermal_conductivity', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
9 changes: 4 additions & 5 deletions src/thermal_conductivity_2023/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
executable('thermal_conductivity_2023',
exec_name='thermal_conductivity_2023'
executable(exec_name,
'main.f90',
'mfp.f90',
'options.f90',
Expand All @@ -7,8 +8,6 @@ executable('thermal_conductivity_2023',
'scatteringstrengths.f90',
link_with: [libolle, libflap],
include_directories: ['../libolle', '../libflap'],
dependencies: dep_all,
install: true,
install_dir: meson.project_build_root() / 'bin')
dependencies: dep_all)

install_symlink('thermal_conductivity_2023', pointing_to: meson.project_build_root() / 'bin/thermal_conductivity_2023', install_dir: meson.project_source_root() / 'bin')
install_symlink(exec_name, pointing_to: meson.project_build_root() / 'src' / exec_name / exec_name, install_dir: meson.project_source_root() / 'bin')
Loading