## 复现步骤 1. 创建如下项目: `src/main.cpp`: ```cpp #ifdef TEST_USE_MODULES import std; import lib; #else #include <print> #endif int main(int argc, char* argv[]) { std::println("Hello from hello!"); printHello(); return 0; } ``` `src/lib.cppm`: ```cpp #ifndef TEST_USE_MODULES module; #include <print> #endif export module lib; #ifdef TEST_USE_MODULES import std; #endif export void printHello() { std::println("Hello world in lib.cppm!"); } ``` `mcpp.toml`: ```toml [package] name = "hello" version = "0.1.0" description = "A modular C++23 package" license = "Apache-2.0" [build] defines = ["TEST_USE_MODULES"] [scan_overrides."src/lib.cppm"] provides = ["lib"] imports = ["std"] [scan_overrides."src/main.cpp"] imports = ["std", "lib"] ``` 2. 运行 `mcpp build`。 ## 实际行为 构建失败,报错: ``` error: module-graph divergence in obj/lib.m.o: planned : provides [lib] imports [std] compiler: provides [lib] imports [<none>] The compiler's P1689 scan disagrees with the planner's assumption ... error: module-graph divergence in obj/main.o: planned : provides [<none>] imports [lib, std] compiler: provides [<none>] imports [<none>] ``` ## 期望行为 `[build].defines` 应该被脱糖为 `-D<x>` 并传递给 P1689 模块扫描和普通编译命令,使条件 `import` 被正确识别,构建成功。 ## 环境 - mcpp 版本:`2026.7.27.1` - OS:Windows(根因跨平台) - 工具链:llvm@20.1.7
Activity
fix: fold [build].defines into cflags/cxxflags before P1689 scan
fix: [build].defines is a BuildInputs member, and [build] stops swall…