-
-
Notifications
You must be signed in to change notification settings - Fork 426
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
Closed
Closed
Changes from 6 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,128 @@ | ||
| # Meson Build System for Cantera | ||
|
|
||
| This directory contains the initial Meson build configuration for Cantera's C++ library. | ||
|
|
||
| ## Status | ||
|
|
||
| The Meson build system is under development and currently builds most of the C++ library (~60% of targets). The build is blocked by the SUNDIALS dependency which needs to be added as a subproject or installed system-wide. | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Meson >= 1.0.0 | ||
| - Ninja build system | ||
| - C++20 compatible compiler (GCC, Clang, or MSVC) | ||
| - System dependencies: | ||
| - Eigen3 >= 3.4 (or will use ext/eigen submodule) | ||
| - Boost >= 1.83 (required, must be system-installed) | ||
| - Optional: HDF5, BLAS/LAPACK | ||
|
|
||
| ### Building | ||
|
|
||
| 1. Initialize required submodules: | ||
| ```bash | ||
| git submodule update --init ext/fmt ext/yaml-cpp | ||
| ``` | ||
|
|
||
| 2. Create a compatibility symlink for fmt (required for older fmt references): | ||
| ```bash | ||
| cd ext/fmt/include/fmt && ln -s ranges.h join.h | ||
| ``` | ||
|
|
||
| 3. Configure the build: | ||
| ```bash | ||
| meson setup builddir | ||
| ``` | ||
|
|
||
| 4. Compile: | ||
| ```bash | ||
| meson compile -C builddir | ||
| ``` | ||
|
|
||
| 5. Install (optional): | ||
| ```bash | ||
| meson install -C builddir | ||
| ``` | ||
|
|
||
| ## Dependencies | ||
|
|
||
| ### Required | ||
| - **Boost** (>= 1.83): Header-only, must be system-installed | ||
| - **Eigen3** (>= 3.4): Uses system if available, otherwise ext/eigen submodule | ||
| - **fmt** (>= 9.1.0): Uses system if available, otherwise ext/fmt (header-only mode) | ||
| - **yaml-cpp** (>= 0.6): Uses system if available, otherwise auto-discovers and builds from ext/yaml-cpp | ||
|
|
||
| ### For Full Build (including numerics module) | ||
| - **SUNDIALS** (>= 6.0): Required for ODE/DAE integration. Currently requires system installation (e.g., `libsundials-dev` on Ubuntu). Without SUNDIALS, builds ~60% of C++ library (all modules except numerics). | ||
|
|
||
| ### Optional | ||
| - **HDF5**: For HDF5 data file support | ||
| - **BLAS/LAPACK**: For optimized linear algebra (falls back to Eigen) | ||
| - **HighFive**: C++ wrapper for HDF5 | ||
|
|
||
| ## 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. | ||
|
|
||
| ### Dependency Management | ||
|
|
||
| Dependencies are tried in order: | ||
| 1. **System packages** (via pkg-config/CMake) | ||
| 2. **Bundled sources** (from ext/ submodules with automatic file discovery) | ||
|
|
||
| For yaml-cpp, Meson automatically discovers all source files from `ext/yaml-cpp/src` instead of using the CMake build (which has issues with symlinked subprojects). | ||
|
|
||
| ## Known Limitations | ||
|
|
||
| 1. **SUNDIALS not yet supported**: The SUNDIALS dependency needs to be implemented as a Meson subproject or made available system-wide | ||
| 2. **No Python bindings**: Only C++ library is currently supported | ||
| 3. **No Fortran interface**: F90 interface not yet implemented | ||
| 4. **Limited testing**: Build system needs more testing across platforms | ||
|
|
||
| ## 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 | ||
| - Cross-compilation support | ||
| - **Automatic source discovery** like SCons `multi_glob()` | ||
|
|
||
| ## Contributing | ||
|
|
||
| This is initial work to replace the SCons build system. Contributions are welcome to: | ||
| - Add SUNDIALS subproject support | ||
| - Improve dependency detection | ||
| - Add testing infrastructure | ||
| - Port more configuration options from SCons | ||
|
|
||
| ## 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 | ||
| - `include/cantera/ext/`: Symlinks to submodule headers (fmt, yaml-cpp, 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,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