|
1 | 1 | -- Form B inline descriptor for Eigen — a C++ template library for linear |
2 | | --- algebra (matrices, vectors, numerical solvers, related algorithms). Eigen |
3 | | --- is HEADER-ONLY: there is nothing to compile, so the package just exposes |
4 | | --- the source tree's root on the include path (`#include <Eigen/Dense>` etc.) |
5 | | --- and carries a tiny anchor translation unit so mcpp still has a buildable |
6 | | --- `lib` target (same shape as compat.opengl / compat.khrplatform). |
| 2 | +-- algebra (matrices, vectors, numerical solvers, related algorithms). The |
| 3 | +-- Eigen *core* is HEADER-ONLY: there is nothing to compile for normal use, so |
| 4 | +-- the package exposes the source tree's root on the include path |
| 5 | +-- (`#include <Eigen/Dense>` etc.) and carries a tiny anchor translation unit |
| 6 | +-- so mcpp always has a buildable `lib` target (same shape as compat.opengl / |
| 7 | +-- compat.khrplatform). The optional `blas` feature additionally compiles |
| 8 | +-- Eigen's reference BLAS into that lib (see below). |
7 | 9 | -- |
8 | 10 | -- `include_dirs = {"*"}` points at the tarball root (`eigen-<ver>/`), which is |
9 | 11 | -- exactly the directory upstream tells you to put on the include path. That |
10 | 12 | -- makes BOTH the stable modules under `Eigen/` and the experimental modules |
11 | 13 | -- under `unsupported/Eigen/` (Tensor, AutoDiff, Splines, MatrixFunctions, …) |
12 | | --- resolvable — see the note on features below for why `unsupported` is not a |
13 | | --- separate opt-in here. |
| 14 | +-- resolvable out of the box. |
14 | 15 | -- |
15 | | --- On the `feature` mechanism (asked for, deliberately omitted — analysis): |
16 | | --- mcpp's package-descriptor `features` table gates **sources only** (a |
17 | | --- feature contributes extra source globs that are excluded by default and |
18 | | --- compiled in when the feature is requested — see compat.cjson's `utils` |
19 | | --- and compat.gtest's `main`). Eigen has no such optional *source*: it is |
20 | | --- header-only. Its natural opt-in axis would be the `unsupported/` modules, |
21 | | --- but those are headers that live BESIDE `Eigen/` under the same tarball |
22 | | --- root, so any include path that exposes the stable core (`*`) inevitably |
23 | | --- exposes `unsupported/` too — there is no source to gate and no way to |
24 | | --- hide the headers behind a feature with the current (sources-only) gate. |
25 | | --- Other Eigen knobs (EIGEN_MPL2_ONLY, EIGEN_USE_BLAS/LAPACKE, …) are |
26 | | --- compile *defines*, which the feature table also cannot carry on mcpp |
27 | | --- 0.0.68. So a feature here would be cosmetic/misleading; we expose the |
28 | | --- full header set instead and document it. If mcpp later lets a feature |
29 | | --- contribute defines/cflags, an `mpl2only` (-> -DEIGEN_MPL2_ONLY) feature |
30 | | --- would be the clean fit. |
| 16 | +-- Feature: `blas` — Eigen's reference BLAS implementation. |
| 17 | +-- Eigen ships a full BLAS library under `blas/` (the `eigen_blas` target in |
| 18 | +-- upstream CMake). Despite the historical name, it builds from pure C++ |
| 19 | +-- (`blas/*.cpp`) + f2c-translated C (`blas/f2c/*.c`) — NO Fortran compiler |
| 20 | +-- is needed (the only `.f` files live under `blas/testing/`, the test |
| 21 | +-- suite, and are not part of the library). So it fits mcpp's sources-only |
| 22 | +-- feature gate cleanly, exactly like compat.cjson's `utils`: excluded by |
| 23 | +-- default, and compiled into the `eigen` lib when the dependency requests |
| 24 | +-- `features = ["blas"]`. The result exposes the standard BLAS symbols |
| 25 | +-- (sgemm_/dgemm_/ddot_/… , Fortran ABI) for code that wants to link a BLAS. |
| 26 | +-- Common.h pulls Eigen via a path RELATIVE to blas/ (`../Eigen/Core`), so |
| 27 | +-- the sources must compile in place — they do, since `*/blas/*.cpp` keeps |
| 28 | +-- them under the unpacked tree. Verified locally on mcpp 0.0.68. |
| 29 | +-- |
| 30 | +-- What is NOT a feature here (and why): |
| 31 | +-- * `unsupported/` modules are header-only and live BESIDE `Eigen/` under |
| 32 | +-- the same tarball root, so the core include path (`*`) already exposes |
| 33 | +-- them; a sources-only gate cannot hide headers, so there is nothing to |
| 34 | +-- gate — they are simply available. |
| 35 | +-- * Eigen's compile-define knobs (EIGEN_MPL2_ONLY, EIGEN_USE_BLAS/LAPACKE, |
| 36 | +-- …) are preprocessor defines; the feature table carries only `sources` |
| 37 | +-- on mcpp 0.0.68, so they cannot be feature-gated yet. If mcpp later lets |
| 38 | +-- a feature contribute defines/cflags, `mpl2only` (-> -DEIGEN_MPL2_ONLY) |
| 39 | +-- would be the clean fit. |
31 | 40 | -- |
32 | 41 | -- All `mcpp` paths are GLOBS relative to the verdir; the leading `*` absorbs |
33 | 42 | -- the GitLab archive's `eigen-<tag>/` wrap layer. |
@@ -83,6 +92,19 @@ package = { |
83 | 92 | }, |
84 | 93 | sources = { "mcpp_generated/eigen_anchor.c" }, |
85 | 94 | targets = { ["eigen"] = { kind = "lib" } }, |
| 95 | + -- Optional: compile Eigen's reference BLAS (`eigen_blas`) into the lib. |
| 96 | + -- C++ + f2c-C only, no Fortran. Off by default; pulled in with |
| 97 | + -- `features = ["blas"]`. blas/ has exactly the 5 library .cpp and |
| 98 | + -- blas/f2c/ exactly the 18 library .c (the upstream eigen_blas source |
| 99 | + -- set); the `*.cpp`/`*.c` globs match them and nothing else. |
| 100 | + features = { |
| 101 | + ["blas"] = { |
| 102 | + sources = { |
| 103 | + "*/blas/*.cpp", |
| 104 | + "*/blas/f2c/*.c", |
| 105 | + }, |
| 106 | + }, |
| 107 | + }, |
86 | 108 | deps = { }, |
87 | 109 | }, |
88 | 110 | } |
0 commit comments