mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-11-15 11:38:56 +08:00
Use module partitions instead of full modules (#1146)
Follow-up to #1015. This pull request replaces the full modules that represent headers, with partitions, to emphasise the belonging of the header to the module. This should hopefully provide a speedup to compilation, and confuse users less by aggregating the usable modules into a smaller set.
This commit is contained in:
@@ -4,15 +4,15 @@
|
||||
> [!WARNING]
|
||||
> This feature is still in development, and the API may change in future releases.
|
||||
> Your contribution is needed to help us improve the compatibility and usability
|
||||
> of C++20 modules in FTXUI. If you encounter any issues or have suggestions,
|
||||
> of C++ modules in FTXUI. If you encounter any issues or have suggestions,
|
||||
> please open an issue.
|
||||
|
||||
FTXUI experimentally supports
|
||||
[C++20 modules](https://en.cppreference.com/w/cpp/language/modules) to reduce
|
||||
compilation times and improve code organization. Each header has a
|
||||
corresponding module.
|
||||
compilation times and improve code organization. Each part of the library has a
|
||||
corresponding module, split into partitions per each header.
|
||||
|
||||
Use the FTXUI_BUILD_MODULES option to build the FTXUI project itself to provide C++ 20 modules,
|
||||
Use the FTXUI_BUILD_MODULES option to build the FTXUI project itself to provide C++20 modules,
|
||||
for example with CMake and Ninja:
|
||||
|
||||
```sh
|
||||
@@ -25,7 +25,7 @@ ninja
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> To use modules, you need a C++20 compatible compiler, CMake version 3.20 or
|
||||
> To use modules, you need a C++≥20 compatible compiler, CMake version 3.20 or
|
||||
> higher, and use a compatible generator like Ninja. Note that Makefile
|
||||
> generators **do not support modules**.
|
||||
|
||||
@@ -34,9 +34,12 @@ Then, in your own code you can consume the modules and code as normal:
|
||||
```cpp
|
||||
import ftxui;
|
||||
|
||||
using ftxui::Button;
|
||||
using ftxui::ScreenInteractive;
|
||||
|
||||
int main() {
|
||||
auto screen = ftxui::ScreenInteractive::TerminalOutput();
|
||||
auto button = ftxui::Button("Click me", screen.QuitClosure());
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
auto button = Button("Click me", screen.QuitClosure());
|
||||
screen.Loop(button);
|
||||
return 0;
|
||||
}
|
||||
@@ -70,38 +73,6 @@ are available:
|
||||
|
||||
- `ftxui`
|
||||
- `ftxui.component`
|
||||
- `ftxui.component.Animation`
|
||||
- `ftxui.component.CapturedMouse`
|
||||
- `ftxui.component.Component`
|
||||
- `ftxui.component.ComponentBase`
|
||||
- `ftxui.component.ComponentOptions`
|
||||
- `ftxui.component.Event`
|
||||
- `ftxui.component.Loop`
|
||||
- `ftxui.component.Mouse`
|
||||
- `ftxui.component.Receiver`
|
||||
- `ftxui.component.ScreenInteractive`
|
||||
- `ftxui.component.Task`
|
||||
- `ftxui.dom`
|
||||
- `ftxui.dom.Canvas`
|
||||
- `ftxui.dom.Deprecated`
|
||||
- `ftxui.dom.Direction`
|
||||
- `ftxui.dom.Elements`
|
||||
- `ftxui.dom.FlexboxConfig`
|
||||
- `ftxui.dom.LinearGradient`
|
||||
- `ftxui.dom.Node`
|
||||
- `ftxui.dom.Requirement`
|
||||
- `ftxui.dom.Selection`
|
||||
- `ftxui.dom.Table`
|
||||
- `ftxui.screen`
|
||||
- `ftxui.screen.Box`
|
||||
- `ftxui.screen.Color`
|
||||
- `ftxui.screen.ColorInfo`
|
||||
- `ftxui.screen.Deprecated`
|
||||
- `ftxui.screen.Image`
|
||||
- `ftxui.screen.Pixel`
|
||||
- `ftxui.screen.Screen`
|
||||
- `ftxui.screen.String`
|
||||
- `ftxui.screen.Terminal`
|
||||
- `ftxui.util`
|
||||
- `ftxui.util.AutoReset`
|
||||
- `ftxui.util.Ref`
|
||||
- `ftxui.dom`
|
||||
- `ftxui.screen`
|
||||
- `ftxui.util`
|
||||
|
||||
Reference in New Issue
Block a user