mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-06-26 01:21:12 +08:00
Add Changelog and remove flag.
This commit is contained in:
parent
84f691e9d3
commit
85c3dc45ca
16
CHANGELOG.md
16
CHANGELOG.md
@ -3,6 +3,22 @@ Changelog
|
||||
|
||||
Development
|
||||
-----------
|
||||
|
||||
### Build
|
||||
- Feature: Support C++20 modules.
|
||||
This requires:
|
||||
- Using the Ninja or MSVC generator
|
||||
- A recent Clang/GCC/MSVC compiler.
|
||||
- Cmake 3.28 or higher.
|
||||
Usage:
|
||||
```cpp
|
||||
import ftxui;
|
||||
import ftxui.component;
|
||||
import ftxui.dom;
|
||||
import ftxui.screen;
|
||||
```
|
||||
Thanks @mikomikotaishi for PR #1015.
|
||||
|
||||
### Component
|
||||
- Bugfix: Fix a crash with ResizeableSplit. See #1023.
|
||||
- Clamp screen size to terminal size.
|
||||
|
@ -179,16 +179,4 @@ include(cmake/ftxui_package.cmake)
|
||||
|
||||
add_subdirectory(examples)
|
||||
add_subdirectory(doc)
|
||||
|
||||
option(FTXUI_BUILD_MODULES "Build C++ modules support" OFF)
|
||||
|
||||
if(FTXUI_BUILD_MODULES)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
|
||||
message(STATUS "Building C++ modules (CMake ${CMAKE_VERSION} supports modules)")
|
||||
add_subdirectory(modules/ftxui)
|
||||
else()
|
||||
message(STATUS "Skipping C++ modules (requires CMake 3.28+, found ${CMAKE_VERSION})")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "C++ modules support is disabled. Enable with -DFTXUI_BUILD_MODULES=ON")
|
||||
endif()
|
||||
add_subdirectory(modules/ftxui)
|
||||
|
@ -1,9 +1,30 @@
|
||||
#include "ftxui/component/component.hpp"
|
||||
#include "ftxui/component/screen_interactive.hpp"
|
||||
#include <memory> // for shared_ptr, allocator, __shared_ptr_access
|
||||
|
||||
#include "ftxui/component/component.hpp" // for Renderer, ResizableSplitBottom, ResizableSplitLeft, ResizableSplitRight, ResizableSplitTop
|
||||
#include "ftxui/component/component_base.hpp" // for ComponentBase
|
||||
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
||||
#include "ftxui/dom/elements.hpp" // for Element, operator|, text, center, border
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
auto screen = ScreenInteractive::Fullscreen();
|
||||
|
||||
int main(){
|
||||
auto screen = ftxui::ScreenInteractive::Fullscreen();
|
||||
auto testComponent = ftxui::Renderer([](){return ftxui::text("test Component");});
|
||||
screen.Loop(testComponent);
|
||||
return 0;
|
||||
std::string a = "aa";
|
||||
|
||||
auto component = Renderer([a] {
|
||||
|
||||
std::vector<Element> elements;
|
||||
|
||||
for (auto i = 0; i < 10; ++i) {
|
||||
elements.push_back(window(text(a), paragraph(a)));
|
||||
}
|
||||
|
||||
return vbox(elements);
|
||||
});
|
||||
|
||||
auto renderer =
|
||||
Renderer(component, [&] { return component->Render() | border; });
|
||||
|
||||
screen.Loop(renderer);
|
||||
}
|
||||
|
@ -1,21 +1,67 @@
|
||||
file(GLOB_RECURSE FTXUI_MODULES *.cppm)
|
||||
|
||||
add_library(ftxui_modules)
|
||||
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
|
||||
if(NOT COMMAND configure_cpp_module_target)
|
||||
function(configure_cpp_module_target target)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
|
||||
target_sources(${target} PUBLIC FILE_SET CXX_MODULES FILES ${FTXUI_MODULES})
|
||||
else()
|
||||
message(WARNING "C++ modules require CMake 3.28+. Using standard compilation.")
|
||||
target_sources(${target} PRIVATE ${FTXUI_MODULES})
|
||||
endif()
|
||||
endfunction()
|
||||
# CMake 3.28+ supports the new CMake C++ module system.
|
||||
if(CMAKE_VERSION VERSION_LESS 3.28)
|
||||
return()
|
||||
endif()
|
||||
|
||||
configure_cpp_module_target(ftxui_modules)
|
||||
# Not all compilers support the C++ module system yet.
|
||||
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU|MSVC")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# The list of generators which support scanning sources for C++ modules include:
|
||||
# - Ninja
|
||||
# - Ninja Multi-Config
|
||||
# - Visual Studio 17 2022
|
||||
if (NOT (CMAKE_GENERATOR MATCHES "Ninja") AND
|
||||
NOT (CMAKE_GENERATOR MATCHES "Visual Studio" AND
|
||||
CMAKE_GENERATOR_VERSION VERSION_GREATER_EQUAL 17))
|
||||
return()
|
||||
endif()
|
||||
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
add_library(ftxui_modules)
|
||||
|
||||
target_sources(ftxui_modules
|
||||
PUBLIC
|
||||
FILE_SET CXX_MODULES
|
||||
FILES
|
||||
component.cppm
|
||||
component/Animation.cppm
|
||||
component/CapturedMouse.cppm
|
||||
component/Component.cppm
|
||||
component/ComponentBase.cppm
|
||||
component/ComponentOptions.cppm
|
||||
component/Event.cppm
|
||||
component/Loop.cppm
|
||||
component/Mouse.cppm
|
||||
component/Receiver.cppm
|
||||
component/ScreenInteractive.cppm
|
||||
component/Task.cppm
|
||||
dom.cppm
|
||||
dom/Canvas.cppm
|
||||
dom/Deprecated.cppm
|
||||
dom/Direction.cppm
|
||||
dom/Elements.cppm
|
||||
dom/FlexboxConfig.cppm
|
||||
dom/LinearGradient.cppm
|
||||
dom/Node.cppm
|
||||
dom/Requirement.cppm
|
||||
dom/Selection.cppm
|
||||
dom/Table.cppm
|
||||
screen.cppm
|
||||
screen/Box.cppm
|
||||
screen/Color.cppm
|
||||
screen/ColorInfo.cppm
|
||||
screen/Deprecated.cppm
|
||||
screen/Image.cppm
|
||||
screen/Pixel.cppm
|
||||
screen/Screen.cppm
|
||||
screen/String.cppm
|
||||
screen/Terminal.cppm
|
||||
util.cppm
|
||||
util/AutoReset.cppm
|
||||
util/Ref.cppm
|
||||
)
|
||||
|
||||
target_link_libraries(ftxui_modules
|
||||
PUBLIC
|
||||
@ -24,17 +70,14 @@ target_link_libraries(ftxui_modules
|
||||
ftxui::component
|
||||
)
|
||||
|
||||
target_include_directories(ftxui_modules
|
||||
PRIVATE
|
||||
${ftxui_SOURCE_DIR}/include
|
||||
)
|
||||
target_compile_features(ftxui_modules PUBLIC cxx_std_20)
|
||||
|
||||
set_target_properties(ftxui_modules PROPERTIES
|
||||
CXX_STANDARD 23
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF
|
||||
CXX_MODULE_DYNDEP OFF
|
||||
)
|
||||
#set_target_properties(ftxui_modules PROPERTIES
|
||||
#CXX_STANDARD 23
|
||||
#CXX_STANDARD_REQUIRED ON
|
||||
#CXX_EXTENSIONS OFF
|
||||
#CXX_MODULE_DYNDEP OFF
|
||||
#)
|
||||
|
||||
add_library(ftxui::modules ALIAS ftxui_modules)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user