diff --git a/cmake/StandardProjectSettings.cmake b/cmake/StandardProjectSettings.cmake index 59c36aa..e92434f 100644 --- a/cmake/StandardProjectSettings.cmake +++ b/cmake/StandardProjectSettings.cmake @@ -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() diff --git a/meson.build b/meson.build index 961066a..b354613 100644 --- a/meson.build +++ b/meson.build @@ -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', diff --git a/src/main.cpp b/src/main.cpp index 1978114..c1ded10 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,6 +4,15 @@ #include #include +#include +#include +#include +#include +#include +#include + +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); } diff --git a/subprojects/fmt.wrap b/subprojects/fmt.wrap index 9a1b8d4..e00b034 100644 --- a/subprojects/fmt.wrap +++ b/subprojects/fmt.wrap @@ -1,6 +1,6 @@ [wrap-git] url = https://github.com/fmtlib/fmt.git -revision = 491ba2dda5a04c2438abb6bd90219de773793ec0 +revision = c472a2781852778cc3f06521a3384a2c5c5822d5 patch_directory = fmt diff --git a/subprojects/packagefiles/fmt/meson.build b/subprojects/packagefiles/fmt/meson.build index fe20724..fcba42c 100644 --- a/subprojects/packagefiles/fmt/meson.build +++ b/subprojects/packagefiles/fmt/meson.build @@ -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 = [ ] diff --git a/subprojects/packagefiles/ftxui/meson.build b/subprojects/packagefiles/ftxui/meson.build index 838aaad..c524727 100644 --- a/subprojects/packagefiles/ftxui/meson.build +++ b/subprojects/packagefiles/ftxui/meson.build @@ -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(