build(meson): updated build system. Note that this build system should be able to bring in MFEM and all needed deps automatically (tested on ubuntu, fedora, and macos)

This commit is contained in:
2026-11-09 13:50:06 -05:00
parent 811bbd9694
commit 829e53d56e
6 changed files with 3155 additions and 182 deletions

View File

@@ -1,11 +1,11 @@
project(
'meson-mfem-template',
'serif',
['c', 'cpp'],
version: '0.1.0',
meson_version: '>=1.9.1',
default_options: [
'c_std=c11',
'cpp_std=c++23',
'cpp_std=c++26',
'warning_level=2',
],
)
@@ -35,13 +35,42 @@ endif
subdir('build-check')
subdir('build-config')
subdir('include/meson_mfem_template')
# Stellar mesh construction uses the bundled STROID with the same MFEM and C++ ABI.
stroid_project = subproject('stroid', default_options: [
'build_tests=false',
'build_tools=false',
'build_python=false',
'pkg_config=false',
])
stroid_dep = stroid_project.get_variable('stroid_dep')
subdir('src')
# Register the original library first: RayFEM's archive reader depends on SERiF.
# Only downstream consumers receive RayFEM, keeping the library graph acyclic.
meson.override_dependency('serif', declare_dependency(
dependencies: serif_dep,
variables: {'libdir': fs.parent(serif_lib.full_path())},
))
rayfem_project = subproject('rayfem', default_options: [
'mfem_provider=external',
'serif=enabled',
'build_viewer=enabled',
'build_examples=disabled',
'build_tests=disabled',
])
rayfem_dep = rayfem_project.get_variable('rayfem_dep')
serif_dep = declare_dependency(dependencies: [serif_dep, rayfem_dep])
subdir('tests')
summary(
{
'MFEM provider': mfem_provider,
'build type': get_option('buildtype'),
'optimization': get_option('optimization'),
'debug symbols': get_option('debug'),
'bundled MFEM debug checks': mfem_provider == 'system' ? 'external' : mfem_debug_checks.to_string(),
'dependency profile': get_option('feature_profile'),
'allow preinstalled': get_option('allow_preinstalled'),
'parallel MPI/Hypre': mfem_has_mpi,
@@ -55,9 +84,10 @@ summary(
'libCEED': mfem_features.get('ceed'),
'FMS': mfem_features.get('fms'),
'Algoim': mfem_features.get('algoim'),
'SparseDirect backend': serif_sparse_direct_backend,
'Python bindings': get_option('build_python'),
'tests': get_option('build_tests'),
},
section: 'meson-mfem-template ' + meson.project_version(),
section: 'serif ' + meson.project_version(),
bool_yn: true,
)