-
-
Notifications
You must be signed in to change notification settings - Fork 404
Remove submodule fallback support from Meson build #2084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Copilot
wants to merge
7
commits into
main
Choose a base branch
from
copilot/configure-meson-build-system
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+616
−2
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8f274f0
Initial plan
Copilot 086aeed
Add initial Meson build configuration for C++ library
Copilot 30bc375
Fix Meson config and build most of C++ library
Copilot 21b25ac
Add Meson build documentation and ext symlinks
Copilot f363fa1
Refactor to use glob patterns and avoid listing individual files
Copilot 03f5694
Add Meson CI job to test build system
Copilot ba525e3
Remove submodule fallback support, require system packages only
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| # Meson Build System for Cantera | ||
|
|
||
| This directory contains the Meson build configuration for Cantera's C++ library. | ||
|
|
||
| ## Status | ||
|
|
||
| The Meson build system builds the complete C++ library using system-installed dependencies only. | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Meson >= 1.0.0 | ||
| - Ninja build system | ||
| - C++20 compatible compiler (GCC, Clang, or MSVC) | ||
| - System dependencies (all required): | ||
| - Eigen3 >= 3.4 | ||
| - Boost >= 1.83 | ||
| - fmt >= 9.1.0 | ||
| - yaml-cpp >= 0.6 | ||
| - SUNDIALS >= 6.0 (cvodes, idas, nvecserial) | ||
| - Optional: HDF5, BLAS/LAPACK, HighFive | ||
|
|
||
| ### Building | ||
|
|
||
| 1. Configure the build: | ||
| ```bash | ||
| meson setup builddir | ||
| ``` | ||
|
|
||
| 2. Compile: | ||
| ```bash | ||
| meson compile -C builddir | ||
| ``` | ||
|
|
||
| 3. Install (optional): | ||
| ```bash | ||
| meson install -C builddir | ||
| ``` | ||
|
|
||
| ## Dependencies | ||
|
|
||
| All dependencies must be installed as system packages. The Meson build does not support fallback to bundled libraries in ext/ submodules. | ||
|
|
||
| ### Required System Packages | ||
|
|
||
| - **Boost** (>= 1.83): Header-only library | ||
| - **Eigen3** (>= 3.4): Header-only library for linear algebra | ||
| - **fmt** (>= 9.1.0): Formatting library | ||
| - **yaml-cpp** (>= 0.6): YAML parser/emitter | ||
| - **SUNDIALS** (>= 6.0): ODE/DAE solvers (cvodes, idas, nvecserial components required) | ||
|
|
||
| ### Optional System Packages | ||
|
|
||
| - **HDF5**: For HDF5 data file support | ||
| - **BLAS/LAPACK**: For optimized linear algebra (falls back to Eigen if not available) | ||
| - **HighFive**: C++ wrapper for HDF5 (required if HDF5 support is desired) | ||
|
|
||
| ## Configuration Options | ||
|
|
||
| - `cantera_datadir`: Directory for Cantera data files (default: `prefix/share/cantera/data`) | ||
|
|
||
| Example: | ||
| ```bash | ||
| meson setup builddir -Dcantera_datadir=/opt/cantera/data | ||
| ``` | ||
|
|
||
| ## Build Features | ||
|
|
||
| ### Automatic Source Discovery | ||
|
|
||
| The Meson build automatically discovers source files using glob patterns, similar to how SCons uses `multi_glob()`: | ||
|
|
||
| ```meson | ||
| # Automatically find all .cpp files in each module directory | ||
| base_files = run_command(find, 'base', '-name', '*.cpp', ...) | ||
| foreach f : base_files | ||
| base_sources += files('base' / f) | ||
| endforeach | ||
| ``` | ||
|
|
||
| This eliminates the need to manually list individual source files. | ||
|
|
||
| ### Installation | ||
|
|
||
| On Ubuntu/Debian: | ||
| ```bash | ||
| sudo apt install meson ninja-build libboost-dev libeigen3-dev \ | ||
| libfmt-dev libyaml-cpp-dev libsundials-dev | ||
| ``` | ||
|
|
||
| On macOS with Homebrew: | ||
| ```bash | ||
| brew install meson ninja boost eigen fmt yaml-cpp sundials | ||
| ``` | ||
|
|
||
| On Fedora/RHEL: | ||
| ```bash | ||
| sudo dnf install meson ninja-build boost-devel eigen3-devel \ | ||
| fmt-devel yaml-cpp-devel sundials-devel | ||
| ``` | ||
|
|
||
| ## Known Limitations | ||
|
|
||
| 1. **No Python bindings**: Only C++ library is currently supported | ||
| 2. **No Fortran interface**: F90 interface not yet implemented | ||
| 3. **Limited testing**: Build system needs more testing across platforms | ||
| 4. **System packages required**: No support for bundled ext/ submodules | ||
|
|
||
| ## Comparison with SCons | ||
|
|
||
| The Meson build aims to eventually replace the SCons build system with these benefits: | ||
| - Faster build times with better parallelization | ||
| - Better IDE integration | ||
| - Standard pkg-config support | ||
| - Simpler dependency management (system packages only) | ||
| - Cross-compilation support | ||
| - **Automatic source discovery** like SCons `multi_glob()` | ||
|
|
||
| ## Contributing | ||
|
|
||
| Contributions are welcome to: | ||
| - Add Python bindings support | ||
| - Add testing infrastructure | ||
| - Port more configuration options from SCons | ||
| - Test on more platforms | ||
|
|
||
| ## Files | ||
|
|
||
| - `meson.build`: Root build configuration | ||
| - `meson_options.txt`: Build options | ||
| - `src/meson.build`: C++ source compilation with automatic file discovery | ||
| - `include/cantera/base/config.h.meson.in`: Configuration header template |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #ifndef CT_CONFIG_H | ||
| #define CT_CONFIG_H | ||
|
|
||
| //---------------------------- Version Flags ------------------// | ||
| // Cantera version -> this will be a double-quoted string value | ||
| @CANTERA_VERSION@ | ||
|
|
||
| // Just the major + minor version (that is, 2.2 instead of 2.2.0) | ||
| @CANTERA_SHORT_VERSION@ | ||
|
|
||
| //------------------------ Fortran settings -------------------// | ||
|
|
||
| // define types doublereal, integer, and ftnlen to match the | ||
| // corresponding Fortran data types on your system. The defaults | ||
| // are OK for most systems | ||
|
|
||
| typedef double doublereal; // Fortran double precision | ||
| typedef int integer; // Fortran integer | ||
| typedef int ftnlen; // Fortran hidden string length type | ||
|
|
||
| // Fortran compilers pass character strings in argument lists by | ||
| // adding a hidden argument with the length of the string. Some | ||
| // compilers add the hidden length argument immediately after the | ||
| // CHARACTER variable being passed, while others put all of the hidden | ||
| // length arguments at the end of the argument list. Define this if | ||
| // the lengths are at the end of the argument list. This is usually the | ||
| // case for most unix Fortran compilers, but is (by default) false for | ||
| // Visual Fortran under Windows. | ||
| #define STRING_LEN_AT_END | ||
|
|
||
| // Define this if Fortran adds a trailing underscore to names in object files. | ||
| // For linux and most unix systems, this is the case. | ||
| @FTN_TRAILING_UNDERSCORE@ | ||
|
|
||
| //-------- LAPACK / BLAS --------- | ||
|
|
||
| @LAPACK_FTN_STRING_LEN_AT_END@ | ||
| @LAPACK_FTN_TRAILING_UNDERSCORE@ | ||
| @CT_USE_LAPACK@ | ||
|
|
||
| @CT_USE_SYSTEM_EIGEN@ | ||
| @CT_USE_SYSTEM_EIGEN_PREFIXED@ | ||
| @CT_USE_SYSTEM_FMT@ | ||
| @CT_USE_SYSTEM_YAMLCPP@ | ||
|
|
||
| //-------------- Optional Cantera Capabilities ---------------------- | ||
|
|
||
| // Enable Sundials to use an external BLAS/LAPACK library if it was | ||
| // built to use this option | ||
| @CT_SUNDIALS_USE_LAPACK@ | ||
|
|
||
| // Enable export/import of HDF data via C++ HighFive | ||
| @CT_USE_HDF5@ | ||
| @CT_USE_SYSTEM_HIGHFIVE@ | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../ext/eigen/Eigen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../ext/fmt/include/fmt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../ext/yaml-cpp/include/yaml-cpp |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / zizmor
unpinned action reference