main
Brett 2024-05-17 18:01:17 -04:00
parent 47fa891c8d
commit 75a16ff187
3 changed files with 57 additions and 6 deletions

View File

@ -2,5 +2,6 @@
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/lib/blt" vcs="Git" />
</component> </component>
</project> </project>

View File

@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.28) cmake_minimum_required(VERSION 3.28)
project(floc VERSION 0.0.2) project(floc VERSION 0.0.3)
include(FetchContent)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
@ -7,14 +9,29 @@ option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
add_subdirectory(lib/blt)
include_directories(include/) include_directories(include/)
file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
add_executable(floc ${PROJECT_BUILD_FILES}) add_executable(floc ${PROJECT_BUILD_FILES})
add_subdirectory(lib/blt)
FetchContent_Declare(ftxui
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
GIT_TAG v5.0.0
)
FetchContent_GetProperties(ftxui)
if(NOT ftxui_POPULATED)
FetchContent_Populate(ftxui)
add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
target_link_libraries(floc ${BLT_TARGET}) target_link_libraries(floc ${BLT_TARGET})
target_link_libraries(floc
PRIVATE ftxui::screen
PRIVATE ftxui::dom
PRIVATE ftxui::component
)
target_compile_options(floc PRIVATE -Wall -Werror -Wpedantic -Wno-comment) target_compile_options(floc PRIVATE -Wall -Werror -Wpedantic -Wno-comment)
target_link_options(floc PRIVATE -Wall -Werror -Wpedantic -Wno-comment) target_link_options(floc PRIVATE -Wall -Werror -Wpedantic -Wno-comment)

View File

@ -1,7 +1,40 @@
#include <iostream> #include <iostream>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
#include "ftxui/screen/string.hpp"
int main() int main()
{ {
std::cout << "Hello, World!" << std::endl; using namespace ftxui;
return 0;
auto summary = [&] {
auto content = vbox({
hbox({text(L"- done: "), text(L"3") | bold}) | color(Color::Green),
hbox({text(L"- active: "), text(L"2") | bold}) | color(Color::RedLight),
hbox({text(L"- queue: "), text(L"9") | bold}) | color(Color::Red),
});
return window(text(L" Summary "), content);
};
auto document = //
vbox({
hbox({
summary(),
summary(),
summary() | flex,
}),
summary(),
summary(),
});
// Limit the size of the document to 80 char.
document = document | size(WIDTH, LESS_THAN, 80);
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
Render(screen, document);
std::cout << screen.ToString() << '\0' << std::endl;
return EXIT_SUCCESS;
} }