Skip to content

Conversation

@munechika-koyo
Copy link

@munechika-koyo munechika-koyo commented Dec 5, 2025

Summary

This pull request introduces Meson as an alternative build system for IMAS-Core, complementing the existing CMake build system. This addition provides developers with a modern, fast, and user-friendly build option while maintaining full backward compatibility with the current CMake workflow.

Motivation

  • Build System Diversity: Offers developers choice between CMake and Meson based on their preferences and requirements
  • Modern Build Experience: Meson provides faster configuration, better dependency management, and more intuitive syntax
  • Cross-Platform Support: Enhanced support for various platforms with Meson's robust cross-compilation features
  • Future-Proofing: Prepares the project for potential future migration while maintaining current stability

Key Features

🔧 Complete Build System Implementation

  • Core Library: Full support for building al-core with all backends (HDF5, UDA, MDSplus)
  • Python Bindings: Native Meson integration with Cython for imas-core Python package
  • Testing: Integration with test executables and test runners
  • Configuration Options: Comprehensive build options matching CMake functionality

📦 Backend Support

  • HDF5 Backend (enabled by default)
  • UDA Backend (configurable)
  • 🔄 MDSplus Backend (planned for future implementation)
  • 🔄 MDSplus Models (planned for future implementation)

🐍 Python Integration

  • Version detection via setuptools-scm
  • Cython binding compilation with proper dependency management

Files Added/Modified

New Meson Files

  • meson.build - Main build configuration
  • meson_options.txt - Build options and feature toggles
  • src/meson.build - Core library build configuration
  • include/meson.build - Public Header installation configuration
  • python/meson.build - Python bindings build configuration

Build Options

# Configure with Meson (examples)
meson setup builddir
meson setup builddir -Dal_backend_hdf5=true -Dal_backend_uda=false
meson setup builddir -Dpython_bindings=true
meson setup builddir -Dal_dummy_exe=true

# Build
meson compile -C builddir

# Test
meson test -C builddir -Dal_dummy_exe=true

Compatibility

  • No Migration Required: CMake remains the primary build system
  • Parallel Support: Both build systems can coexist without conflicts
  • Feature Parity: All CMake options have equivalent Meson counterparts
  • Same Dependencies: Uses identical external dependencies (HDF5, UDA, MDSplus, etc.)

Testing

  • Builds on macOS
  • Builds on Linux
  • Builds on Windows
  • All backends compile correctly (except for MDSplus)
  • Python bindings generate properly
  • Test dummy executable build and run
  • Test al-core executables build and run
  • Test Python bindings imas-core

Development Environment

We used pixi to manage the development environment for testing the Meson build system.
The pixi.toml file has been updated to include Meson and Ninja as build tools, ensuring a consistent and reproducible environment for developers.
Here is the configuration I used:

pixi.toml
[workspace]
authors = ["munechika-koyo <[email protected]>"]
channels = ["https://prefix.dev/conda-forge"]
name = "imas-core"
platforms = ["osx-arm64", "osx-64", "linux-64", "win-64"]

[tasks]
configure = "meson setup builddir"
build = "meson compile -C builddir"
test = "meson test -C builddir -Dal_dummy_exe=true"

[dependencies]
# Compiler
cxx-compiler = ">=1.11.0,<2"

# Build tools
meson = ">=1.9.1,<2"
ninja = ">=1.13.2,<2"
pkg-config = ">=0.29.2,<0.30"
setuptools-scm = ">=9.2.2,<10"

# Link Libraries
libboost-devel = ">=1.88.0,<2"
hdf5 = ">=1.14.6,<2"
uda-cpp = ">=2.9.3,<3"

# Link and Tools for the python wrapper
python = ">=3.14.1,<3.15"
numpy = ">=2.3.5,<3"
cython = ">=3.2.2,<4"

[target.win-64.dependencies]
# Build tools
cmake = ">=4.2.1,<5"

# Link Libraries
dlfcn-win32 = ">=1.4.2,<2"
pthreads-win32 = ">=2.9.1,<3"

meson command can be used through pixi run meson ....


Note: This is a non-breaking change that purely adds functionality. All existing CMake-based workflows continue to work unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant