Skip to content

Commit

Permalink
WIP: Switching build system to Meson
Browse files Browse the repository at this point in the history
  • Loading branch information
pastewka committed Apr 29, 2024
1 parent de8b41e commit 54d1279
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 131 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"mesonbuild.configureOnOpen": true,
"C_Cpp.default.compileCommands": "builddir/vscode_compile_commands.json",
"cmake.configureOnOpen": false
"cmake.configureOnOpen": false,
"C_Cpp.default.configurationProvider": "mesonbuild.mesonbuild"
}
20 changes: 7 additions & 13 deletions src/potentials/bop/brenner/meson.build
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
old_path = path
path = join_paths(path, 'brenner')

brenner_sources = [
'brenner.f90',
'brenner_scr.f90'
join_paths(path, 'brenner.f90'),
join_paths(path, 'brenner_scr.f90')
]

incdirs = include_directories('../../..', '../../../support')

potentials_brenner = static_library(
'brenner',
brenner_sources,
include_directories: incdirs,
link_with: [atomistica_supplib, atomistica_corelib],
dependencies: atomistica_dependencies,
install: true # needed, otherwise it is not copied to wheel
)
all_potentials_sources += brenner_sources

all_potentials_sources += brenner_sources
path = old_path
18 changes: 5 additions & 13 deletions src/potentials/bop/juslin/meson.build
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
old_path = path
path = join_paths(path, 'juslin')

juslin_sources = [
'juslin.f90',
'juslin_scr.f90'
join_paths(path, 'juslin.f90'),
join_paths(path, 'juslin_scr.f90')
]

incdirs = include_directories('../../..', '../../../support')

potentials_juslin = static_library(
'juslin',
juslin_sources,
include_directories: incdirs,
link_with: [atomistica_supplib, atomistica_corelib],
dependencies: atomistica_dependencies,
install: true # needed, otherwise it is not copied to wheel
)

all_potentials_sources += juslin_sources
18 changes: 5 additions & 13 deletions src/potentials/bop/kumagai/meson.build
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
old_path = path
path = join_paths(path, 'kumagai')

kumagai_sources = [
'kumagai.f90',
'kumagai_scr.f90'
join_paths(path, 'kumagai.f90'),
join_paths(path, 'kumagai_scr.f90')
]

incdirs = include_directories('../../..', '../../../support')

potentials_kumagai = static_library(
'kumagai',
kumagai_sources,
include_directories: incdirs,
link_with: [atomistica_supplib, atomistica_corelib],
dependencies: atomistica_dependencies,
install: true # needed, otherwise it is not copied to wheel
)

all_potentials_sources += kumagai_sources
7 changes: 6 additions & 1 deletion src/potentials/bop/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
old_path = path
path = join_paths(path, 'bop')

subdir('brenner')
subdir('juslin')
subdir('kumagai')
subdir('rebo2')
subdir('tersoff')
subdir('tersoff')

path = old_path
20 changes: 6 additions & 14 deletions src/potentials/bop/rebo2/meson.build
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
old_path = path
path = join_paths(path, 'rebo2')

rebo2_sources = [
'rebo2_default_tables.f90',
'rebo2.f90',
'rebo2_scr.f90'
join_paths(path, 'rebo2_default_tables.f90'),
join_paths(path, 'rebo2.f90'),
join_paths(path, 'rebo2_scr.f90')
]

incdirs = include_directories('../../..', '../../../support')

potentials_rebo2 = static_library(
'rebo2',
rebo2_sources,
include_directories: incdirs,
link_with: [atomistica_supplib, atomistica_corelib],
dependencies: atomistica_dependencies,
install: true # needed, otherwise it is not copied to wheel
)

all_potentials_sources += rebo2_sources
18 changes: 5 additions & 13 deletions src/potentials/bop/tersoff/meson.build
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
old_path = path
path = join_paths(path, 'tersoff')

tersoff_sources = [
'tersoff.f90',
'tersoff_scr.f90'
join_paths(path, 'tersoff.f90'),
join_paths(path, 'tersoff_scr.f90')
]

incdirs = include_directories('../../..', '../../../support')

potentials_tersoff = static_library(
'tersoff',
tersoff_sources,
include_directories: incdirs,
link_with: [atomistica_supplib, atomistica_corelib],
dependencies: atomistica_dependencies,
install: true # needed, otherwise it is not copied to wheel
)

all_potentials_sources += tersoff_sources
34 changes: 13 additions & 21 deletions src/potentials/coulomb/meson.build
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
old_path = path
path = join_paths(path, 'coulomb')

coulomb_sources = [
'coulomb_short_gamma.f90',
'cutoff_coulomb.f90',
'damp_short_gamma.f90',
'direct_coulomb.f90',
'gaussian_charges.f90',
'pme_kernel.f90',
'pme.f90',
'slater_charges.f90'
join_paths(path, 'coulomb_short_gamma.f90'),
join_paths(path, 'cutoff_coulomb.f90'),
join_paths(path, 'damp_short_gamma.f90'),
join_paths(path, 'direct_coulomb.f90'),
join_paths(path, 'gaussian_charges.f90'),
join_paths(path, 'pme_kernel.f90'),
join_paths(path, 'pme.f90'),
join_paths(path, 'slater_charges.f90')
]

if not atomistica_with_fftw3
coulomb_sources += [
'fft3-public.f',
'fft_wrap.f',
join_paths(path, 'fft3-public.f'),
join_paths(path, 'fft_wrap.f')
]
endif

incdirs = include_directories('../..', '../../support')

potentials_coulomb = static_library(
'coulomb',
coulomb_sources,
include_directories: incdirs,
link_with: [atomistica_supplib, atomistica_corelib],
dependencies: atomistica_dependencies,
install: true # needed, otherwise it is not copied to wheel
)

all_potentials_sources += coulomb_sources
16 changes: 5 additions & 11 deletions src/potentials/dispersion/meson.build
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
old_path = path
path = join_paths(path, 'dispersion')

dispersion_sources = [
'dispdftd3.f90'
join_paths(path, 'dispdftd3.f90'),
]

incdirs = include_directories('../..', '../../support')

potentials_dispersion = static_library(
'dispersion',
dispersion_sources,
include_directories: incdirs,
link_with: [atomistica_supplib, atomistica_corelib],
dependencies: atomistica_dependencies,
install: true # needed, otherwise it is not copied to wheel
)
all_potentials_sources += dispersion_sources
22 changes: 7 additions & 15 deletions src/potentials/eam/meson.build
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
eam_sources = [
'tabulated_eam.f90',
'tabulated_alloy_eam.f90'
]

incdirs = include_directories('../..', '../../support')
old_path = path
path = join_paths(path, 'eam')

potentials_eam = static_library(
'eam',
eam_sources,
include_directories: incdirs,
link_with: [atomistica_supplib, atomistica_corelib],
dependencies: atomistica_dependencies,
install: true # needed, otherwise it is not copied to wheel
)
juslin_sources = [
join_paths(path, 'tabulated_eam.f90'),
join_paths(path, 'tabulated_alloy_eam.f90')
]

potentials_sources += eam_sources
all_potentials_sources += juslin_sources
4 changes: 2 additions & 2 deletions src/potentials/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
all_potentials_sources = []

potentials_sources = []
path = ''
subdir('bop')
subdir('coulomb')
subdir('dispersion')
Expand All @@ -10,7 +10,7 @@ subdir('pair')

message('=== LISTCLASSES ===')

r = run_command(python, '../../tools/listclasses.py', all_potentials_sources, check: truew)
r = run_command(python, '../../tools/discover_classes.py', all_potentials_sources, check: true)
message(r.stdout())
message(r.stderr())

26 changes: 12 additions & 14 deletions src/potentials/pair/meson.build
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
old_path = path
path = join_paths(path, 'pair')

pair_sources = [
'born_mayer.f90',
'double_harmonic.f90',
'harmonic.f90',
'lj_cut.f90',
'r6.f90',
join_paths(path, 'born_mayer.f90'),
join_paths(path, 'double_harmonic.f90'),
join_paths(path, 'harmonic.f90'),
join_paths(path, 'lj_cut.f90'),
join_paths(path, 'r6.f90')
]

incdirs = include_directories('../..', '../../support')
juslin_sources = [
join_paths(path, 'dispdftd3.f90'),
]

potentials_pair = static_library(
'pair',
pair_sources,
include_directories: incdirs,
link_with: [atomistica_supplib, atomistica_corelib],
dependencies: atomistica_dependencies,
install: true # needed, otherwise it is not copied to wheel
)
all_potentials_sources += pair_sources
14 changes: 14 additions & 0 deletions tools/discover_classes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! /usr/bin/env python

#
# Parse all .f90 files in a certain directory (and subdirectories thereof)
# and scan metadata.
#

import sys

from meta import scanmeta

if __name__ == '__main__':
for fn in sys.argv[1:]:
metadata = scanmeta(fn)

0 comments on commit 54d1279

Please sign in to comment.