Skip to content

Commit

Permalink
WIP: Meson builds
Browse files Browse the repository at this point in the history
  • Loading branch information
pastewka committed Jun 20, 2023
1 parent b3a35ee commit de8b41e
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 34 deletions.
15 changes: 13 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ atomistica_target = 'standalone'

#add_global_arguments('-ffree-form', language: 'fortran')

# Store global configuration to dictionary
#
# Configure atomistica and compiler
#
atomistica_date = run_command(python, '-c', '"import versioneer; print(versioneer.get_versions()[\'date\'])"').stdout().strip()
if git.found()
atomistica_url = run_command(git, 'config', '--get', 'remote.origin.url').stdout().strip()
Expand All @@ -33,6 +35,11 @@ if fortran_compiler.get_id() == 'gcc'
add_project_arguments('-DNO_BIND_C_OPTIONAL', language: 'fortran') # Only gfortran
# Disable some warnings
add_project_arguments('-Wno-unused-dummy-argument', language: 'fortran')
add_project_arguments('-Wno-character-truncation', language: 'fortran')
add_project_arguments('-Wno-conversion', language: 'fortran')
add_project_arguments('-Wno-tabs', language: 'fortran')
add_project_arguments('-Wno-unused-function', language: 'fortran')
add_project_arguments('-Wno-unused-variable', language: 'fortran')
endif

atomistica_configuration = configuration_data({
Expand All @@ -45,6 +52,11 @@ atomistica_configuration = configuration_data({
'compilerversion': fortran_compiler.version()
})


#
# Find dependencies
#

fftw3 = dependency('fftw3', required: false)
if fftw3.found()
atomistica_with_fftw3 = true
Expand All @@ -65,7 +77,6 @@ else
message('Atomistica netCDF: no')
endif


atomistica_dependencies = [fftw3, netcdf]

subdir('src')
19 changes: 9 additions & 10 deletions src/potentials/bop/brenner/meson.build
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
pair_sources = [
'born_mayer.f90',
'double_harmonic.f90',
'harmonic.f90',
'lj_cut.f90',
'r6.f90',
brenner_sources = [
'brenner.f90',
'brenner_scr.f90'
]

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

potentials_pair = static_library(
'pair',
pair_sources,
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
4 changes: 3 additions & 1 deletion src/potentials/bop/juslin/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ juslin_sources = [
'juslin_scr.f90'
]

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

potentials_juslin = static_library(
'juslin',
Expand All @@ -13,3 +13,5 @@ potentials_juslin = static_library(
dependencies: atomistica_dependencies,
install: true # needed, otherwise it is not copied to wheel
)

all_potentials_sources += juslin_sources
6 changes: 4 additions & 2 deletions src/potentials/bop/kumagai/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ kumagai_sources = [
'kumagai_scr.f90'
]

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

potentials_kumagai = static_library(
'kumagai',
juslin_sources,
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
2 changes: 1 addition & 1 deletion src/potentials/bop/rebo2/bop_kernel_rebo2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2336,7 +2336,7 @@ recursive subroutine BOP_KERNEL( &
this%sfacbo(i1:i2) = this%sfacbo(i1:i2) + dffac
endif

#endif SCREENING
#endif ! SCREENING

endif jl2_within_cutoff

Expand Down
7 changes: 5 additions & 2 deletions src/potentials/bop/rebo2/meson.build
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
rebo2_sources = [
'rebo2_default_tables.f90',
'rebo2.f90',
'rebo2_scr.f90'
]

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

potentials_rebo2 = static_library(
'rebo2',
juslin_sources,
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
6 changes: 4 additions & 2 deletions src/potentials/bop/tersoff/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ tersoff_sources = [
'tersoff_scr.f90'
]

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

potentials_tersoff = static_library(
'tersoff',
juslin_sources,
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
4 changes: 3 additions & 1 deletion src/potentials/coulomb/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ incdirs = include_directories('../..', '../../support')

potentials_coulomb = static_library(
'coulomb',
pair_sources,
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
2 changes: 2 additions & 0 deletions src/potentials/eam/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ potentials_eam = static_library(
dependencies: atomistica_dependencies,
install: true # needed, otherwise it is not copied to wheel
)

potentials_sources += eam_sources
15 changes: 14 additions & 1 deletion src/potentials/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
all_potentials_sources = []

potentials_sources = []
subdir('bop')
subdir('coulomb')
subdir('dispersion')
subdir('eam')
subdir('pair')
subdir('pair')


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

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

23 changes: 11 additions & 12 deletions tools/listclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
# and scan metadata.
#

from __future__ import print_function

import getopt
import io
import os
Expand Down Expand Up @@ -147,17 +145,18 @@ def write_interface_info(metadata, interface, finterface_list, exclude_list,
['exclude=', 'has_finterface='])

if len(args) < 5:
raise RuntimeError('Syntax: listclasses.py <path> <interface> '
raise RuntimeError('Syntax: listclasses.py <interface> '
'<definition-file> <makefile> <config-file> '
'<source-file-1> <source-file-2> ... '
'[-I<include directory>] '
'[--exclude=<exclude list>] '
'[--has_finterface=<interface list>]')

path = args[0]
interface = args[1]
deffn = args[2]
mkfn = args[3]
cfgfn = args[4]
#interface = args[0]
#deffn = args[1]
#mkfn = args[2]
#cfgfn = args[3]
path = args[0:]

exclude_list = []
finterface_list = []
Expand All @@ -178,7 +177,7 @@ def write_interface_info(metadata, interface, finterface_list, exclude_list,
print('Scanning metadata of all source files...')
metadata = scanallmeta(path)

print("Dumping information for classes that implement '{0}' interface..." \
.format(interface))
write_interface_info(metadata, interface, finterface_list, exclude_list,
include_list, deffn, mkfn, cfgfn)
#print("Dumping information for classes that implement '{0}' interface..." \
# .format(interface))
#write_interface_info(metadata, interface, finterface_list, exclude_list,
# include_list, deffn, mkfn, cfgfn)

0 comments on commit de8b41e

Please sign in to comment.