👷 add simple menu

fix deps detection
This commit is contained in:
Vladislav Nepogodin 2021-11-28 20:22:19 +04:00
parent ae8737ccdb
commit f7da6dd6e2
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
6 changed files with 81 additions and 6 deletions

View File

@ -40,3 +40,7 @@ else()
message(STATUS "No colored compiler diagnostic set for '${CMAKE_CXX_COMPILER_ID}' compiler.")
endif()
# Enables STL container checker if not building a release.
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-D_GLIBCXX_ASSERTIONS)
endif()

View File

@ -8,11 +8,23 @@ project('cachyos-installer', 'cpp',
'werror=true',
'b_ndebug=if-release'])
is_debug_build = get_option('buildtype').startswith('debug')
cc = meson.get_compiler('cpp')
if cc.get_id() == 'clang'
specific_cc_flags = [
'-nostdlib++',
'-nodefaultlibs',
]
specific_link_flags = [
'-fuse-ld=lld',
]
add_global_arguments(cc.get_supported_arguments(specific_cc_flags), language : 'cpp')
add_global_link_arguments(cc.get_supported_link_arguments(specific_link_flags), language : 'cpp')
endif
# Common dependencies
fmt = dependency('fmt', version : ['>=8.0.0'], fallback : ['fmt', 'fmt_dep'])
ftxui = dependency('ftxui', version : ['>=0.11.1'], modules : ['ftxui::screen', 'ftxui::dom', 'ftxui::component'], fallback : ['ftxui', 'ftxui_dep'])
ftxui = dependency('ftxui', modules : ['ftxui::screen', 'ftxui::dom', 'ftxui::component'], fallback : ['ftxui', 'ftxui_dep'])
nlohmann_json = dependency('nlohmann_json', version : ['>=3.10.4'], fallback : ['nlohmann_json', 'nlohmann_json_dep'])
src_files = files(
@ -48,7 +60,11 @@ if cc.get_id() == 'gcc'
]
endif
if get_option('buildtype') != 'debug'
if is_debug_build
possible_cc_flags += [
'-D_GLIBCXX_ASSERTIONS',
]
else
if cc.get_id() == 'gcc'
possible_cc_flags += [
'-flto',

View File

@ -4,6 +4,15 @@
#include <regex>
#include <thread>
#include <ftxui/component/captured_mouse.hpp>
#include <ftxui/component/component.hpp>
#include <ftxui/component/component_options.hpp>
#include <ftxui/component/screen_interactive.hpp>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
using namespace ftxui;
static constexpr int32_t SLEEP_TIMEOUT = 15;
void show_iwctl() {
@ -52,4 +61,44 @@ int main() {
}
}
}
auto screen = ScreenInteractive::Fullscreen();
auto button_ok = Button("Ok", screen.ExitLoopClosure());
auto button_quit = Button("Quit", screen.ExitLoopClosure());
auto component = Container::Horizontal({
button_ok,
button_quit,
});
auto dialog = vbox({
text("TODO!!"),
separator(),
hbox({
button_ok->Render(),
button_quit->Render(),
}),
});
// -------- Center Menu --------------
/* clang-format off */
auto center_dialog = hbox({
filler(),
border(dialog),
filler(),
}) | vcenter;
/* clang-format on */
auto renderer = Renderer(component, [&] {
return vbox({
text("New CLI Installer") | bold,
filler(),
// -------- Center Menu --------------
center_dialog | hcenter,
filler(),
});
});
screen.Loop(renderer);
}

View File

@ -1,6 +1,6 @@
[wrap-git]
url = https://github.com/fmtlib/fmt.git
revision = 491ba2dda5a04c2438abb6bd90219de773793ec0
revision = c472a2781852778cc3f06521a3384a2c5c5822d5
patch_directory = fmt

View File

@ -1,7 +1,10 @@
project('fmt', 'cpp',
version : '8.0.1',
license : 'BSD',
default_options : ['cpp_std=c++14']
default_options : [
'cpp_std=c++14',
'default_library=static',
]
)
fmt_private_cpp_args = [ ]

View File

@ -65,7 +65,8 @@ ftxui_dom_lib = static_library('ftxui_dom',
'src/ftxui/dom/util.cpp',
'src/ftxui/dom/vbox.cpp'
],
include_directories : [ftxui_inc, ftxui_priv_inc]
include_directories : [ftxui_inc, ftxui_priv_inc],
link_with : [ftxui_screen_lib]
)
ftxui_component_lib = static_library('ftxui_component',
@ -97,7 +98,9 @@ ftxui_component_lib = static_library('ftxui_component',
'src/ftxui/component/terminal_input_parser.hpp',
'src/ftxui/component/toggle.cpp'
],
include_directories : [ftxui_inc, ftxui_priv_inc]
include_directories : [ftxui_inc, ftxui_priv_inc],
link_with : [ftxui_dom_lib],
dependencies : [thread_dep]
)
ftxui_dep = declare_dependency(