Initialize

This commit is contained in:
2025-10-17 22:34:40 -05:00
commit 75d706eadd
605 changed files with 131346 additions and 0 deletions

19
ftxui/tools/format.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
cd "$(dirname "$0")"
cd ..
# Add the license file.
files=$(find ./src ./include ./examples -name "*.hpp" -o -name "*.cpp")
for file in $files
do
if ! grep -q Copyright $file
then
cat ./tools/license_headers.cpp $file > $file.new && mv $file.new $file
fi
done
# Use clang-format.
for file in $files
do
clang-format -i $file
done

View File

@@ -0,0 +1,29 @@
#!/bin/bash
# Generate ./examples_modules from ./examples to using C++20 modules instead of
# #includes for ftxui.
# This is useful for testing ftxui with modules. This ensures we don't forget
# to update the FTXUI modules when adding new features to FTXUI.
echo "Generating ./examples_modules"
rm -rf ./examples_modules
cp -r ./examples ./examples_modules
for file in ./examples_modules/**/*.cpp; do
echo "Generating $file"
sed -i '/#include "ftxui/d' "$file"
sed -i '/#include <ftxui/d' "$file"
sed -i '1i\import ftxui.component;' "$file"
sed -i '2i\import ftxui.dom;' "$file"
sed -i '3i\import ftxui.screen;' "$file"
sed -i '4i\import ftxui.util;' "$file"
sed -i '5i\\' "$file"
done
# Modify the CMakeLists.txt file to link against ftxui-modules
sed -i 's/${DIRECTORY_LIB}/ftxui-modules/g' ./examples_modules/CMakeLists.txt
sed -i 's/ftxui_example_/ftxui_modules_example_/g' ./examples_modules/CMakeLists.txt

13
ftxui/tools/iwyu.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
cd "$(dirname "$0")"
cd ..
mapping_dir=$(pwd)
mkdir -p iwyu
cd iwyu
rm * -rf
echo $CMAKE_CXX_INCLUDE_WHAT_YOU_USE
cmake .. -DFTXUI_BUILD_TESTS=ON -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-Xiwyu;--cxx17ns;-Xiwyu;--mapping_file=${mapping_dir}/iwyu.imp;-Xiwyu;--verbose=3"
make -j 2>out
fix_include --comments < out
../tools/format.sh

View File

@@ -0,0 +1,4 @@
// Copyright 2025 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

18
ftxui/tools/test_bazel.sh Executable file
View File

@@ -0,0 +1,18 @@
# This script tests the project with different versions of Bazel and compilers
# locally. This avoids waiting on the CI to run the tests.
for ver in \
"6.0.0" \
"7.0.0" \
"8.0.0"
do
for cc in \
"gcc" \
"clang"
do
echo "=== Testing with Bazel ${ver} with ${cc} ==="
USE_BAZEL_VERSION=${ver} CC=${cc} bazel clean --expunge
USE_BAZEL_VERSION=${ver} CC=${cc} bazel build //...
USE_BAZEL_VERSION=${ver} CC=${cc} bazel test //...
done
done