Skip to content

Commit dd44f8e

Browse files
committed
feat(ftxui): compile 7.0.3's own module units — import ftxui; works
Upstream's new C++20 module units (src/ftxui/*.cppm) join the sources, so 7.0.3 consumers can `import ftxui;` — they are global-fragment includes + `using` re-exports, every declaration stays attached to the global module, and `#include`/`import` mix freely against the same compiled objects. On 6.1.9 the .cppm globs are zero-hit warnings (redis-plus-plus union precedent). A new CompatModule smoke test imports ftxui and renders. Verified locally (mcpp 2026.8.29.1): `mcpp test -p core` passes on 7.0.3 (both #include and `import ftxui;` smoke tests) and on 6.1.9 (loop.cpp kept, zero-hit .cppm globs are warnings); `mcpp xpkg parse` green.
1 parent 3e785ee commit dd44f8e

2 files changed

Lines changed: 33 additions & 3 deletions

File tree

‎pkgs/c/compat.ftxui.lua‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
-- component,util}), so the 6.1.9 globs apply verbatim, and the public header
1111
-- API this index's smoke test uses (hbox/text/separator, `Dimension::Fit`,
1212
-- `Screen::Create(Dimensions, Dimensions)`, `Render`) is source-compatible
13-
-- with 6.1.9. Upstream added C++20 module units (src/ftxui/*.cppm,
14-
-- FTXUI_BUILD_MODULES, off by default); the `*.cpp` globs never match them,
15-
-- and the plain .cpp sources still compile header-only style.
13+
-- with 6.1.9. Upstream added C++20 module units (src/ftxui/*.cppm) and this
14+
-- descriptor compiles them, so 7.0.3 consumers can `import ftxui;` — the
15+
-- units are global-fragment includes + `using` re-exports, every declaration
16+
-- stays attached to the global module, and `#include`/`import` can be mixed
17+
-- in one consumer against the same compiled objects.
1618
--
1719
-- ONE version skew the globs cannot express (no per-version build blocks,
1820
-- mcpp-community/mcpp#290): FTXUI 7 moved Loop's method definitions from
@@ -96,6 +98,15 @@ package = {
9698
"*/src/ftxui/**/*.cpp",
9799
"!*/src/ftxui/**/*_test.cpp", -- gtest files (30+ in 6.1.9, 47 in 7.0.3)
98100
"!*/src/ftxui/**/*_fuzzer.cpp", -- fuzz targets (16 in 6.1.9, 6 in 7.0.3)
101+
-- 7.0.3's own module units: global-fragment includes + `using`
102+
-- re-exports, so `import ftxui;` works and still links against
103+
-- the compiled .cpp objects. 6.1.9 has no .cppm — these globs
104+
-- are zero-hit warnings there, same as the redis-plus-plus union.
105+
"*/src/ftxui/screen.cppm",
106+
"*/src/ftxui/dom.cppm",
107+
"*/src/ftxui/component.cppm",
108+
"*/src/ftxui/util.cppm",
109+
"*/src/ftxui/ftxui.cppm",
99110
},
100111
targets = { ["ftxui"] = { kind = "lib" } },
101112
deps = { },
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// FTXUI 7 module smoke: compat.ftxui 7.0.3 compiles upstream's own .cppm
2+
// units, so consumers can `import ftxui;` instead of (or mixed with)
3+
// #include — the re-export style keeps every declaration in the global
4+
// module, so both spellings link against the same objects.
5+
import ftxui;
6+
7+
#include <string>
8+
9+
#include <gtest/gtest.h>
10+
11+
TEST(CompatModule, FtxuiImport) {
12+
using namespace ftxui;
13+
Element document = hbox({text("module"), separator(), text("ftxui")});
14+
Screen screen = Screen::Create(Dimension::Fit(document), Dimension::Fit(document));
15+
Render(screen, document);
16+
const std::string rendered = screen.ToString();
17+
EXPECT_TRUE(rendered.find("module") != std::string::npos &&
18+
rendered.find("ftxui") != std::string::npos);
19+
}

0 commit comments

Comments
 (0)