Problem
Currently, when specifying a dependency via git, mcpp strictly requires the cloned repository to contain an mcpp.toml at its root. If the upstream project does not use mcpp (which is common for third-party C/C++ libraries), the build fails immediately with:
git dependency 'xxx' (at '...') has no mcpp.toml
This is different from version-based dependencies, where mcpp can fall back to synthesizing a manifest from the index descriptor (mcpp = { ... } block in the .lua file). Git (and path) dependencies have no such fallback mechanism.
Use Case
I want to depend on a third-party library directly from its upstream Git repository (e.g., to track a specific commit or fork before it is published to the mcpp index). The library does not have mcpp.toml, but I know enough about its layout to describe it: source globs, include directories, target kind, etc.
Right now, the only workaround is to fork the repository and add an mcpp.toml manually, which adds maintenance burden and fragments upstream tracking.
Proposed Feature
Allow the consumer to provide an inline package description directly inside the dependency spec in their own mcpp.toml. When the fetched git repository lacks an mcpp.toml, mcpp should use this inline description as an overlay / synthesized manifest.
Example syntax:
[dependencies]
mylib = {
git = "https://github.com/user/mylib.git",
tag = "v1.0.0",
# Inline manifest keys used when upstream has no mcpp.toml
name = "mylib",
version = "1.0.0",
sources = ["src/**/*.cpp", "include/**/*.h"],
include_dirs = ["include"],
targets = { mylib = { kind = "lib" } }
}
Or alternatively, under a dedicated sub-table to avoid key conflicts:
[dependencies.mylib]
git = "https://github.com/user/mylib.git"
tag = "v1.0.0"
[dependencies.mylib.manifest]
name = "mylib"
version = "1.0.0"
sources = ["src/**/*.cpp"]
include_dirs = ["include"]
Benefits
- Lowers the barrier to adopting mcpp with existing third-party code.
- Avoids unnecessary forks just to add a 10-line
mcpp.toml.
- Keeps the dependency declaration self-contained in the consumer's manifest.
- Aligns with the existing descriptor-synthesis concept already used for index packages.
Additional Context
The relevant strict check lives in src/build/prepare.cppm around line 2967:
if (spec.isPath() || spec.isGit()) {
if (!std::filesystem::exists(dep_root / "mcpp.toml")) {
return std::unexpected(std::format(
"%s dependency '%s' (at '%s') has no mcpp.toml",
spec.isGit() ? "git" : "path", name, dep_root.string()));
}
For version dependencies, loadVersionDep already knows how to synthesize a manifest via synthesize_from_xpkg_lua when no mcpp.toml is present. A similar synthesis path could be added for git/path dependencies that carry an inline descriptor.
Problem
Currently, when specifying a dependency via
git, mcpp strictly requires the cloned repository to contain anmcpp.tomlat its root. If the upstream project does not use mcpp (which is common for third-party C/C++ libraries), the build fails immediately with:This is different from version-based dependencies, where mcpp can fall back to synthesizing a manifest from the index descriptor (
mcpp = { ... }block in the.luafile). Git (and path) dependencies have no such fallback mechanism.Use Case
I want to depend on a third-party library directly from its upstream Git repository (e.g., to track a specific commit or fork before it is published to the mcpp index). The library does not have
mcpp.toml, but I know enough about its layout to describe it: source globs, include directories, target kind, etc.Right now, the only workaround is to fork the repository and add an
mcpp.tomlmanually, which adds maintenance burden and fragments upstream tracking.Proposed Feature
Allow the consumer to provide an inline package description directly inside the dependency spec in their own
mcpp.toml. When the fetched git repository lacks anmcpp.toml, mcpp should use this inline description as an overlay / synthesized manifest.Example syntax:
Or alternatively, under a dedicated sub-table to avoid key conflicts:
Benefits
mcpp.toml.Additional Context
The relevant strict check lives in
src/build/prepare.cppmaround line 2967:For
versiondependencies,loadVersionDepalready knows how to synthesize a manifest viasynthesize_from_xpkg_luawhen nomcpp.tomlis present. A similar synthesis path could be added for git/path dependencies that carry an inline descriptor.