From f71c8b9ca8dbdbb88a0770b016d6e8cd18a9653d Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Tue, 1 Feb 2022 20:42:49 -0500 Subject: [PATCH 01/56] Switch default macOS font, try to fix blur --- CMakeLists.txt | 6 ++++++ assets/resources/macos/Info.plist | 10 ++++++++++ scripts/linux/package.sh | 1 + src/main.cpp | 1 + src/utils.hpp | 2 +- 5 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 assets/resources/macos/Info.plist diff --git a/CMakeLists.txt b/CMakeLists.txt index b61b4e9f..f4b6dc77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,12 @@ endif() target_link_libraries(nvui PRIVATE ${Boost_LIBRARIES} ) +if(APPLE) + set_target_properties(nvui PROPERTIES + MACOSX_BUNDLE TRUE + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/assets/resources/macos/Info.plist + ) +endif() include(CheckIPOSupported) check_ipo_supported(RESULT LTOAvailable) if(LTOAvailable) diff --git a/assets/resources/macos/Info.plist b/assets/resources/macos/Info.plist new file mode 100644 index 00000000..cb16414d --- /dev/null +++ b/assets/resources/macos/Info.plist @@ -0,0 +1,10 @@ + + + + + NSPrincipalClass + NSApplication + NSHighResolutionCapable + + + diff --git a/scripts/linux/package.sh b/scripts/linux/package.sh index 189e86b4..f938aa6b 100644 --- a/scripts/linux/package.sh +++ b/scripts/linux/package.sh @@ -3,6 +3,7 @@ cd build mkdir packaged mkdir packaged/bin cp nvui packaged/bin +cp Info.plist packaged/bin cp -r ../assets packaged rm -rf packaged/assets/display cp -r ../vim packaged diff --git a/src/main.cpp b/src/main.cpp index 0dd6213f..448e0888 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -127,6 +127,7 @@ bool is_executable(std::string_view path) int main(int argc, char** argv) { QCoreApplication::setApplicationName("nvui"); + QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); const auto args = get_args(argc, argv); #ifdef Q_OS_LINUX // See issue #21 diff --git a/src/utils.hpp b/src/utils.hpp index 31c31c6c..2d561605 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -133,7 +133,7 @@ msgpack::object_handle pack(const T& obj) inline QString default_font_family() { #if defined(Q_OS_MAC) - return "Courier New"; + return "Menlo"; #elif defined(Q_OS_WIN) return "Consolas"; #else From a4460e2b484516f3f54dec5bdf965c8cbe190982 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Fri, 4 Feb 2022 20:34:16 -0500 Subject: [PATCH 02/56] Fix? build for mac, don't package assets Assets are bundled through QRC, no need for assets folder anymore. --- .github/workflows/build.yml | 13 +++++++++++-- scripts/linux/package.sh | 3 --- scripts/windows/package.ps1 | 2 -- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc6b4d43..db4c35f7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -160,13 +160,22 @@ jobs: if: matrix.test run: ./build/nvui_test - - name: Package (Ubuntu & Mac) - if: matrix.upload + - name: Package (Ubuntu) + if: matrix.upload && startsWith(matrix.os, 'ubuntu') run: | ls build chmod +x ./scripts/linux/package.sh ./scripts/linux/package.sh + - name: Package (macOS) + if: matrix.upload && startsWith(matrix.os, 'macos') + run: | + cd build + mkdir packaged + mkdir packaged/bin + cp nvui.app packaged/bin + cp -r ../vim packaged + - name: Ubuntu - Upload artifact uses: actions/upload-artifact@v2 if: matrix.upload && startsWith(matrix.os, 'ubuntu') diff --git a/scripts/linux/package.sh b/scripts/linux/package.sh index f938aa6b..d424c941 100644 --- a/scripts/linux/package.sh +++ b/scripts/linux/package.sh @@ -3,7 +3,4 @@ cd build mkdir packaged mkdir packaged/bin cp nvui packaged/bin -cp Info.plist packaged/bin -cp -r ../assets packaged -rm -rf packaged/assets/display cp -r ../vim packaged diff --git a/scripts/windows/package.ps1 b/scripts/windows/package.ps1 index 46f7b37b..7e548855 100644 --- a/scripts/windows/package.ps1 +++ b/scripts/windows/package.ps1 @@ -6,9 +6,7 @@ mkdir bin cd .. (gci -Path ./* -Include nvui.exe, *.dll, *.conf).fullname | foreach {Copy-Item -Force -Path $_ -Destination nvui/bin} Copy-Item -Force -Recurse -Path plugins -Destination nvui/bin -Copy-Item -Force -Recurse -Path ../assets -Destination nvui Copy-Item -Force -Recurse -Path ../vim -Destination nvui -Remove-Item -Force -Recurse -Path nvui/assets/display Compress-Archive -Force -Path nvui -DestinationPath nvui.zip Move-Item -Force -Path nvui.zip -Destination ../ cd .. From b231cbeb15c94a5a69c274e25a691c2033696a1e Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Sat, 5 Feb 2022 12:11:07 -0500 Subject: [PATCH 03/56] Add -r flag to copy .app --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db4c35f7..77aed0db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -173,7 +173,7 @@ jobs: cd build mkdir packaged mkdir packaged/bin - cp nvui.app packaged/bin + cp -r nvui.app packaged/bin cp -r ../vim packaged - name: Ubuntu - Upload artifact From 3e116f1f615013a4742782d15bc3f791d778fb0a Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Fri, 11 Feb 2022 20:21:17 -0500 Subject: [PATCH 04/56] Add Qt::AA_EnableHighDpiScaling flag --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.cpp b/src/main.cpp index 448e0888..1c908e55 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -128,6 +128,7 @@ int main(int argc, char** argv) { QCoreApplication::setApplicationName("nvui"); QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); const auto args = get_args(argc, argv); #ifdef Q_OS_LINUX // See issue #21 From 9b0bec4805bd91375811789d6059b93df12f9ebd Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Sat, 12 Feb 2022 14:31:20 -0500 Subject: [PATCH 05/56] Fix dpi scaling blurriness on Qt (not Windows yet) --- src/main.cpp | 1 - src/platform/windows/d2deditor.cpp | 12 +++-- src/platform/windows/d2deditor.hpp | 1 + src/popupmenu.cpp | 9 +++- src/qeditor.cpp | 19 ++++++-- src/qeditor.hpp | 1 + src/qpaintgrid.cpp | 73 +++++++++++++++++++----------- src/qpaintgrid.hpp | 6 +-- 8 files changed, 81 insertions(+), 41 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 1c908e55..62953b34 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -127,7 +127,6 @@ bool is_executable(std::string_view path) int main(int argc, char** argv) { QCoreApplication::setApplicationName("nvui"); - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); const auto args = get_args(argc, argv); #ifdef Q_OS_LINUX diff --git a/src/platform/windows/d2deditor.cpp b/src/platform/windows/d2deditor.cpp index 22337f47..9dcfde29 100644 --- a/src/platform/windows/d2deditor.cpp +++ b/src/platform/windows/d2deditor.cpp @@ -39,7 +39,8 @@ D2DEditor::D2DEditor( ) : QWidget(parent), QtEditorUIBase(*this, cols, rows, std::move(capabilities), - std::move(nvim_path), std::move(nvim_args)) + std::move(nvim_path), std::move(nvim_args)), + dpr(devicePixelRatioF()) { setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_InputMethodEnabled); @@ -80,6 +81,11 @@ D2DEditor::~D2DEditor() = default; void D2DEditor::resizeEvent(QResizeEvent* event) { Base::handle_nvim_resize(event); + if (dpr != devicePixelRatioF()) + { + dpr = devicePixelRatioF(); + update_font_metrics(); + } hwnd_target->Resize(D2D1::SizeU(width(), height())); QWidget::resizeEvent(event); } @@ -132,13 +138,14 @@ void D2DEditor::mouseMoveEvent(QMouseEvent* event) D2DEditor::OffscreenRenderingPair D2DEditor::create_render_target(u32 width, u32 height) { - auto size = D2D1::SizeU(width, height); + auto size = D2D1::SizeU(width * devicePixelRatioF(), height * devicePixelRatioF()); ComPtr target; ComPtr bitmap; device->CreateDeviceContext( D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS, &target ); + target->SetDpi(default_dpi, default_dpi); target->CreateBitmap( size, nullptr, 0, D2D1::BitmapProperties1( @@ -153,7 +160,6 @@ D2DEditor::create_render_target(u32 width, u32 height) target->SetTarget(bitmap.Get()); target->SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE); target->SetAntialiasMode(D2D1_ANTIALIAS_MODE_ALIASED); - target->SetDpi(default_dpi, default_dpi); return {target, bitmap}; } diff --git a/src/platform/windows/d2deditor.hpp b/src/platform/windows/d2deditor.hpp index 95b52587..ab0299d2 100644 --- a/src/platform/windows/d2deditor.hpp +++ b/src/platform/windows/d2deditor.hpp @@ -85,6 +85,7 @@ class D2DEditor : public QWidget, public QtEditorUIBase ComPtr device = nullptr; float current_point_size = 12.0f; bool vsync = true; + double dpr; }; #endif // NVUI_D2DEDITOR_HPP diff --git a/src/popupmenu.cpp b/src/popupmenu.cpp index 901b1829..995a05da 100644 --- a/src/popupmenu.cpp +++ b/src/popupmenu.cpp @@ -358,8 +358,12 @@ void PopupMenuQ::paintEvent(QPaintEvent*) QPainter p(this); int pad = border_width; QRect r(pad, pad, width() - 2 * pad, height() - 2 * pad); + auto dpr = devicePixelRatioF(); + QRect pixmap_rect = QRect( + r.x() * dpr, r.y() * dpr, r.width() * dpr, r.height() * dpr + ); p.fillRect(rect(), border_color.qcolor()); - p.drawPixmap(r, pixmap, r); + p.drawPixmap(r, pixmap, pixmap_rect); } void PopupMenuQ::update_dimensions() @@ -403,7 +407,8 @@ void PopupMenuQ::update_dimensions() auto new_pixmap_size = pixmap.size().expandedTo({width, height}); if (new_pixmap_size != pixmap.size()) { - pixmap = QPixmap(width, height); + pixmap = QPixmap(width * devicePixelRatioF(), height * devicePixelRatioF()); + pixmap.setDevicePixelRatio(devicePixelRatioF()); } resize(width, height); if (pmenu) pixmap.fill(hl_state->colors_for(*pmenu).bg.qcolor()); diff --git a/src/qeditor.cpp b/src/qeditor.cpp index 0de15ce9..dff28e71 100644 --- a/src/qeditor.cpp +++ b/src/qeditor.cpp @@ -19,7 +19,7 @@ static void set_relative_font_size( const double tolerance, const std::size_t max_iterations ) -{ +{ constexpr auto width = [](const QFontMetricsF& m) { return m.horizontalAdvance('a'); }; @@ -53,7 +53,8 @@ QEditor::QEditor( ) : QWidget(parent), QtEditorUIBase(*this, cols, rows, std::move(capabilities), - std::move(nvim_path), std::move(nvim_args)) + std::move(nvim_path), std::move(nvim_args)), + device_pixelratio(devicePixelRatioF()) { first_font.setFamily(default_font_family()); first_font.setPointSizeF(11.25); @@ -87,6 +88,11 @@ std::unique_ptr QEditor::cmdline_new() void QEditor::resizeEvent(QResizeEvent* ev) { Base::handle_nvim_resize(ev); + if (device_pixelratio != devicePixelRatioF()) + { + device_pixelratio = devicePixelRatioF(); + update_font_metrics(); + } update(); } @@ -192,7 +198,7 @@ void QEditor::set_fonts(std::span fontdescs) void QEditor::update_font_metrics() { first_font.setLetterSpacing(QFont::AbsoluteSpacing, charspace); - QFontMetricsF metrics {first_font}; + QFontMetricsF metrics {first_font, this}; float combined_height = std::max(metrics.height(), metrics.lineSpacing()); double font_height = combined_height + linespacing(); constexpr QChar any_char = 'W'; @@ -231,8 +237,11 @@ void QEditor::paintEvent(QPaintEvent*) auto* grid = static_cast(grid_base.get()); if (!grid->hidden) { - QSize size = grid->buffer().size(); - auto r = QRectF(grid->pos(), size).intersected(grid_clip_rect); + auto bf_dpr = grid->buffer().devicePixelRatioF(); + QSize sz = grid->buffer().size(); + sz.rwidth() /= bf_dpr; + sz.rheight() /= bf_dpr; + auto r = QRectF(grid->pos(), sz).intersected(grid_clip_rect); p.setClipRect(r); grid->process_events(); grid->render(p); diff --git a/src/qeditor.hpp b/src/qeditor.hpp index 5161e660..54bb7129 100644 --- a/src/qeditor.hpp +++ b/src/qeditor.hpp @@ -55,6 +55,7 @@ class QEditor : public QWidget, public QtEditorUIBase void update_font_metrics(); QFont first_font; std::vector fonts; + double device_pixelratio; }; #endif // NVUI_QEDITOR_HPP diff --git a/src/qpaintgrid.cpp b/src/qpaintgrid.cpp index 47be3477..9ae7c2e1 100644 --- a/src/qpaintgrid.cpp +++ b/src/qpaintgrid.cpp @@ -73,7 +73,11 @@ static void set_pen_width(QPainter& painter, double w) void QPaintGrid::update_pixmap_size() { auto&& [font_width, font_height] = editor_area->font_dimensions(); - pixmap = QPixmap(cols * font_width, rows * font_height); + pixmap = QPixmap( + cols * font_width * editor_area->devicePixelRatioF(), + rows * font_height * editor_area->devicePixelRatioF() + ); + pixmap.setDevicePixelRatio(editor_area->devicePixelRatioF()); send_redraw(); } @@ -307,13 +311,16 @@ void QPaintGrid::process_events() break; case PaintKind::Scroll: { + auto dpr = editor_area->devicePixelRatioF(); auto [font_width, font_height] = editor_area->font_dimensions(); const auto& [rect, dx, dy] = evt.scroll_info(); + // I love how the rectangle coordinates aren't automatically scaled + // by the pixmap's device pixel ratio QRect r( - rect.x() * font_width, - rect.y() * font_height, - rect.width() * font_width, - rect.height() * font_height + rect.x() * font_width * dpr, + rect.y() * font_height * dpr, + rect.width() * font_width * dpr, + rect.height() * font_height * dpr ); // This would probably be faster using QPixmap::scroll // but it doesn't want to work @@ -331,14 +338,20 @@ void QPaintGrid::process_events() void QPaintGrid::render(QPainter& p) { - auto&& [font_width, font_height] = editor_area->font_dimensions(); - QRectF rect(top_left.x(), top_left.y(), pixmap.width(), pixmap.height()); - auto snapshot_height = pixmap.height(); + auto [font_width, font_height] = editor_area->font_dimensions(); + // p (the editor painter) scales ITS OWN coordinates (the QPoint/QPointF) + // that's the first parameter in every call) by the device pixel ratio + // However, the coordinates of the grid pixmap are not scaled by the DPR. + // So we have to take this into account when interacting with the painter. + auto pixmap_height = pixmap.height() / editor_area->devicePixelRatioF(); + auto pixmap_width = pixmap.width() / editor_area->devicePixelRatioF(); + QRectF rect {top_left, QSize(pixmap_width, pixmap_height)}; if (!editor_area->animations_enabled() || !is_scrolling) { p.drawPixmap(pos(), pixmap); return; } + QPointF topleft_text = QPointF(top_left.x() / font_width, top_left.y() / font_height); p.fillRect(rect, editor_area->hlstate().default_bg().qcolor()); float cur_scroll_y = current_scroll_y * font_height; float cur_snapshot_top = viewport.topline * font_height; @@ -347,32 +360,38 @@ void QPaintGrid::render(QPainter& p) for(auto it = snapshots.rbegin(); it != snapshots.rend(); ++it) { const auto& snapshot = *it; - QRectF r; - float snapshot_top = snapshot.vp.topline * font_height; - float offset = snapshot_top - cur_scroll_y; - auto pixmap_top = top_left.y() + offset; - QPointF pt; + float offset = snapshot.vp.topline - current_scroll_y; + QRectF px_rect; + QPointF px_pt; + float top_row = topleft_text.y() + offset; if (snapshot.vp.topline < min_topline) { - auto height = (min_topline - snapshot.vp.topline) * font_height; - height = std::min(height, float(snapshot_height)); + float height = (min_topline - snapshot.vp.topline); + height = std::min(height, float(rows)); min_topline = snapshot.vp.topline; - r = QRect(0, 0, pixmap.width(), height); - pt = {top_left.x(), pixmap_top}; + px_rect = QRectF(0, 0, cols, height); + px_pt = QPointF(topleft_text.x(), top_row); } else if (snapshot.vp.botline > max_botline) { - auto height = (snapshot.vp.botline - max_botline) * font_height; - height = std::min(height, float(snapshot_height)); + float height = (snapshot.vp.botline - max_botline); + height = std::min(height, float(rows)); max_botline = snapshot.vp.botline; - r = QRect(0, snapshot_height - height, pixmap.width(), height); - pt = {top_left.x(), pixmap_top + pixmap.height() - height}; - } - QRectF draw_rect = {top_left, r.size()}; - if (!r.isNull() && rect.contains(draw_rect)) - { - p.drawPixmap(pt, snapshot.image, r); + px_rect = QRectF(0, (rows - height), cols, height); + px_pt = QPointF(topleft_text.x(), top_row + (rows - height)); } + else continue; + double dpr = editor_area->devicePixelRatioF(); + p.drawPixmap( + QPointF {px_pt.x() * font_width, px_pt.y() * font_height}, + snapshot.image, + QRectF { + px_rect.x() * font_width * dpr, + px_rect.y() * font_height * dpr, + px_rect.width() * font_width * dpr, + px_rect.height() * font_height * dpr + } + ); } float offset = cur_snapshot_top - cur_scroll_y; QPointF pt = {top_left.x(), top_left.y() + offset}; @@ -417,7 +436,7 @@ void QPaintGrid::update_position(double new_x, double new_y) top_left = {new_x * font_width, new_y * font_height}; } -void QPaintGrid::initialize_cache() +void QPaintGrid::init_connections() { QObject::connect(editor_area, &QEditor::font_changed, this, [&] { text_cache.clear(); diff --git a/src/qpaintgrid.hpp b/src/qpaintgrid.hpp index 89fe99a7..17e199f1 100644 --- a/src/qpaintgrid.hpp +++ b/src/qpaintgrid.hpp @@ -36,7 +36,7 @@ class QPaintGrid : public GridBase { update_pixmap_size(); update_position(x, y); - initialize_cache(); + init_connections(); initialize_scroll_animation(); initialize_move_animation(); } @@ -85,8 +85,8 @@ class QPaintGrid : public GridBase ); /// Update the pixmap size void update_pixmap_size(); - /// Initialize the cache - void initialize_cache(); + /// Create necessary connections between editor and grid + void init_connections(); /// Initialize scroll animation timer void initialize_scroll_animation(); /// Initialize move animation timer From 4e5971b1d5796cd85021d7ce1ed92b0b2a33f38f Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Sun, 13 Feb 2022 12:33:32 -0500 Subject: [PATCH 06/56] Scale for DPI on D2D (Windows) When the DPI changes the font size changes but the rest of the app pretends like the DPI hasn't changed. --- src/cmdline.cpp | 10 +++++----- src/main.cpp | 2 ++ src/platform/windows/d2deditor.cpp | 24 +++++++++++++++--------- src/platform/windows/d2deditor.hpp | 5 ++++- src/qpaintgrid.cpp | 3 ++- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/cmdline.cpp b/src/cmdline.cpp index ffc0d794..d75f606f 100644 --- a/src/cmdline.cpp +++ b/src/cmdline.cpp @@ -313,9 +313,9 @@ static std::tuple draw_pos( int CmdlineQ::fitting_height() const { + QFontMetricsF fm {cmd_font, this}; int maxwidth = width() - (border_width + padding) * 2; auto contentstring = get_content_string(); - QFontMetricsF fm {cmd_font}; auto maxheight = fm.height() * contentstring.size(); QRectF constraint(0, 0, maxwidth, maxheight); float pad = border_width + padding; @@ -341,7 +341,7 @@ void CmdlineQ::draw_cursor(QPainter& p, const Cursor& cursor) QString contentstring = get_content_string(); int upto = contentstring.size() - cur_content_length + cursor_pos; float pad = border_width + padding; - QFontMetricsF fm {cmd_font}; + const auto fm = p.fontMetrics(); float left = pad; float top = pad; const auto adv_x = [&](float adv) { @@ -352,7 +352,7 @@ void CmdlineQ::draw_cursor(QPainter& p, const Cursor& cursor) if (contentstring[i] == '\n') { left = pad; top += fm.height(); } else { - adv_x(fm.horizontalAdvance(contentstring[i])); + adv_x(p.fontMetrics().horizontalAdvance(contentstring[i])); } } auto [rect, id, drawtext, opacity] = cursor.rect( @@ -366,10 +366,10 @@ void CmdlineQ::draw_cursor(QPainter& p, const Cursor& cursor) void CmdlineQ::paintEvent(QPaintEvent*) { - QFontMetricsF fm {cmd_font}; - int offset = fm.ascent(); QPainter p(this); p.setFont(cmd_font); + const auto fm = p.fontMetrics(); + int offset = fm.ascent(); auto contentstring = get_content_string(); QColor bg = inner_bg.value_or(hl_state.default_bg()).qcolor(); QColor fg = inner_fg.value_or(hl_state.default_fg()).qcolor(); diff --git a/src/main.cpp b/src/main.cpp index 62953b34..81751048 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -127,7 +127,9 @@ bool is_executable(std::string_view path) int main(int argc, char** argv) { QCoreApplication::setApplicationName("nvui"); +#ifdef USE_QPAINTER QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif const auto args = get_args(argc, argv); #ifdef Q_OS_LINUX // See issue #21 diff --git a/src/platform/windows/d2deditor.cpp b/src/platform/windows/d2deditor.cpp index 9dcfde29..a253443a 100644 --- a/src/platform/windows/d2deditor.cpp +++ b/src/platform/windows/d2deditor.cpp @@ -40,7 +40,7 @@ D2DEditor::D2DEditor( : QWidget(parent), QtEditorUIBase(*this, cols, rows, std::move(capabilities), std::move(nvim_path), std::move(nvim_args)), - dpr(devicePixelRatioF()) + win_dpi(GetDpiForWindow((HWND) winId())) { setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_InputMethodEnabled); @@ -81,10 +81,11 @@ D2DEditor::~D2DEditor() = default; void D2DEditor::resizeEvent(QResizeEvent* event) { Base::handle_nvim_resize(event); - if (dpr != devicePixelRatioF()) + auto maybe_new_dpi = GetDpiForWindow((HWND) winId()); + if (maybe_new_dpi != win_dpi) { - dpr = devicePixelRatioF(); - update_font_metrics(); + win_dpi = maybe_new_dpi; + set_fonts(guifonts); } hwnd_target->Resize(D2D1::SizeU(width(), height())); QWidget::resizeEvent(event); @@ -138,7 +139,7 @@ void D2DEditor::mouseMoveEvent(QMouseEvent* event) D2DEditor::OffscreenRenderingPair D2DEditor::create_render_target(u32 width, u32 height) { - auto size = D2D1::SizeU(width * devicePixelRatioF(), height * devicePixelRatioF()); + auto size = D2D1::SizeU(width, height); ComPtr target; ComPtr bitmap; device->CreateDeviceContext( @@ -296,7 +297,7 @@ void D2DEditor::set_fonts(std::span fontlist) continue; } dw_formats.emplace_back( - dwrite_factory(), wcname, current_point_size, default_dpi, + dwrite_factory(), wcname, current_point_size * scale_factor(), default_dpi, default_font_weight(), default_font_style() ); dw_fonts.emplace_back(std::move(font)); @@ -307,14 +308,19 @@ void D2DEditor::set_fonts(std::span fontlist) static const auto default_font_name = default_font_family().toStdWString(); dw_fonts.push_back(font_from_name(default_font_name, font_collection.Get())); dw_formats.emplace_back( - dwrite_factory(), default_font_name, current_point_size, default_dpi, - default_font_weight(), default_font_style() + dwrite_factory(), default_font_name, current_point_size * scale_factor(), + default_dpi, default_font_weight(), default_font_style() ); } update_font_metrics(); emit layouts_invalidated(); } +float D2DEditor::scale_factor() const +{ + return win_dpi / default_dpi; +} + void D2DEditor::linespace_changed(float) { update_font_metrics(); @@ -341,7 +347,7 @@ void D2DEditor::update_font_metrics() format->GetFontFamilyName(name.data(), (UINT32) name.size()); QFont f; f.setFamily(QString::fromWCharArray(name.c_str())); - f.setPointSizeF(current_point_size); + f.setPointSizeF(current_point_size * scale_factor()); f.setLetterSpacing(QFont::AbsoluteSpacing, charspace); popup->font_changed(f, font_dimensions()); } diff --git a/src/platform/windows/d2deditor.hpp b/src/platform/windows/d2deditor.hpp index ab0299d2..af0d0055 100644 --- a/src/platform/windows/d2deditor.hpp +++ b/src/platform/windows/d2deditor.hpp @@ -74,6 +74,9 @@ class D2DEditor : public QWidget, public QtEditorUIBase void create_grid(u32 x, u32 y, u32 w, u32 h, u64 id) override; void set_fonts(std::span fonts) override; u32 calc_fallback_index(u32 ucs); + // The scale factor for the current monitor, based on dpi divided + // by the default dpi (96). + float scale_factor() const; private: std::unordered_map fallback_indices {}; std::vector> dw_fonts; @@ -85,7 +88,7 @@ class D2DEditor : public QWidget, public QtEditorUIBase ComPtr device = nullptr; float current_point_size = 12.0f; bool vsync = true; - double dpr; + u32 win_dpi; }; #endif // NVUI_D2DEDITOR_HPP diff --git a/src/qpaintgrid.cpp b/src/qpaintgrid.cpp index 9ae7c2e1..8a4a0933 100644 --- a/src/qpaintgrid.cpp +++ b/src/qpaintgrid.cpp @@ -77,6 +77,7 @@ void QPaintGrid::update_pixmap_size() cols * font_width * editor_area->devicePixelRatioF(), rows * font_height * editor_area->devicePixelRatioF() ); + pixmap.fill(editor_area->default_bg().qcolor()); pixmap.setDevicePixelRatio(editor_area->devicePixelRatioF()); send_redraw(); } @@ -196,7 +197,7 @@ void QPaintGrid::draw_text_and_bg( QRectF rect = {start, end}; painter.setClipRect(rect); painter.fillRect(rect, bg.qcolor()); - rect.setWidth(rect.width() * 3.); + rect.setWidth(rect.width() + 1.0); draw_text( painter, text, fg, sp, rect, attr.font_opts, font, font_width, font_height ); From baa2043da91fe54c72348677d6b1fa14d6c2505b Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Fri, 25 Feb 2022 13:29:27 -0500 Subject: [PATCH 07/56] Set environment on macOS If nvui is opened anywhere except the terminal on macOS the environment variables are empty. Setting them manually solves it --- src/main.cpp | 8 ++++++ src/platform/macos/macos_utils.hpp | 39 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/platform/macos/macos_utils.hpp diff --git a/src/main.cpp b/src/main.cpp index 81751048..d6563316 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,6 +19,11 @@ #include #include #include +#include + +#ifdef Q_OS_MAC +#include "platform/macos/macos_utils.hpp" +#endif // Q_OS_MAC using std::string; using std::vector; @@ -129,6 +134,9 @@ int main(int argc, char** argv) QCoreApplication::setApplicationName("nvui"); #ifdef USE_QPAINTER QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif +#ifdef Q_OS_MAC + macos_utils::set_env_vars() #endif const auto args = get_args(argc, argv); #ifdef Q_OS_LINUX diff --git a/src/platform/macos/macos_utils.hpp b/src/platform/macos/macos_utils.hpp new file mode 100644 index 00000000..c490ec6c --- /dev/null +++ b/src/platform/macos/macos_utils.hpp @@ -0,0 +1,39 @@ +#ifndef NVUI_PLATFORM_MACOS_UTILS_HPP +#define NVUI_PLATFORM_MACOS_UTILS_HPP + +#include + +namespace macos_utils +{ + +inline void set_env_vars() +{ + QProcess env_printer; + auto shell = qgetenv("SHELL"); + if (shell.isEmpty()) shell = "/bin/bash"; + // Ported from Goneovim's editor.go at + // https://github.com/akiyosi/goneovim/blob/981f41440935542ed35b3ef93cfdcd17744a4e1a/editor/editor.go#L548 + // When nvui is compiled into a .app file and run, there are differences + // between the environment when it is run by clicking vs. running from command line. + // When run by clicking the PATH doesn't contain the Neovim executable path + // even if it was set by the user. + // Thus we have to print out the path in an external process and set it ourselves. + env_printer.start(shell, {"-lc", "env", "-i"}); + if (!env_printer.waitForFinished(5000)) + { + return; + } + auto out = env_printer.readAllStandardOutput().split('\n'); + for(const auto& line : out) + { + // The name of the environment variable, and then its value. + // Separated by an '=' sign. + auto s = line.split('='); + if (s.size() < 2) continue; + qputenv(s[0], s[1]); + } +} + +} // namespace macos_utils + +#endif // NVUI_PLATFORM_MACOS_UTILS_HPP From 766dacd1de25f4ebf7b28d2d427a98160f4784a6 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Fri, 25 Feb 2022 13:38:18 -0500 Subject: [PATCH 08/56] Add semicolon --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index d6563316..08ce133d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -136,7 +136,7 @@ int main(int argc, char** argv) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif #ifdef Q_OS_MAC - macos_utils::set_env_vars() + macos_utils::set_env_vars(); #endif const auto args = get_args(argc, argv); #ifdef Q_OS_LINUX From 090bf5b4b95e06f8643b0dfd62d90a6a5fb3483f Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Tue, 26 Apr 2022 20:17:12 -0400 Subject: [PATCH 09/56] Re-trigger builds From be22b1fd796b00f7b473afb252db1c6896504d1e Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 15 Jun 2022 16:45:57 -0400 Subject: [PATCH 10/56] Update vcpkg to latest --- CMakeLists.txt | 2 +- vcpkg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 85171486..234e31b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,7 @@ if (WIN32) ) list(APPEND SOURCES ${WINONLYSOURCES}) endif() -find_package(Boost COMPONENTS filesystem thread REQUIRED) +find_package(Boost COMPONENTS filesystem REQUIRED) if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Release") add_executable(nvui WIN32 "assets/icons/desktop/neovim_icon.rc" "src/main.cpp" ${SOURCES}) else() diff --git a/vcpkg b/vcpkg index 03ca9b59..3d054a17 160000 --- a/vcpkg +++ b/vcpkg @@ -1 +1 @@ -Subproject commit 03ca9b59af1506a86840e3a3a01a092f3333a29b +Subproject commit 3d054a171071ebfb5a615406367fb09a6fadae58 From 91dd1afcd16c6be3d608c00489a9a6eee2e93f79 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Sun, 13 Nov 2022 13:28:02 -0500 Subject: [PATCH 11/56] Update vcpkg, attempt to fix building on Windows --- CMakeLists.txt | 3 +-- test/test_default_colors.cpp | 2 +- test/test_hl_attr_from_object.cpp | 2 +- test/test_main.cpp | 2 +- test/test_nvim_eval.cpp | 2 +- test/test_nvim_set_var.cpp | 2 +- test/test_object.cpp | 2 +- test/test_object_deserialization_msgpack.cpp | 2 +- vcpkg | 2 +- 9 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 234e31b7..42a3b910 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,7 +147,7 @@ if(BUILD_TESTS) list(APPEND TEST_SOURCES ${WINONLYTESTSOURCES}) endif() add_executable(nvui_test ${SOURCES} ${TEST_SOURCES}) - target_link_libraries(nvui_test PRIVATE Catch2::Catch2) + target_link_libraries(nvui_test PRIVATE Catch2::Catch2 Catch2::Catch2WithMain) target_link_libraries(nvui_test PRIVATE Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Svg) target_link_libraries(nvui_test PRIVATE fmt::fmt) if (WIN32) @@ -166,7 +166,6 @@ if(BUILD_TESTS) target_include_directories(nvui_test PRIVATE ${Boost_INCLUDE_DIR}) endif() target_link_libraries(nvui_test PRIVATE - Boost::thread Boost::filesystem ) include(CTest) diff --git a/test/test_default_colors.cpp b/test/test_default_colors.cpp index ebd8a67b..86718035 100644 --- a/test/test_default_colors.cpp +++ b/test/test_default_colors.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "hlstate.hpp" #include "object.hpp" diff --git a/test/test_hl_attr_from_object.cpp b/test/test_hl_attr_from_object.cpp index 58a90c2d..a01795b0 100644 --- a/test/test_hl_attr_from_object.cpp +++ b/test/test_hl_attr_from_object.cpp @@ -1,6 +1,6 @@ #include "object.hpp" #include "hlstate.hpp" -#include +#include #include #include #include diff --git a/test/test_main.cpp b/test/test_main.cpp index 4ed06df1..2c344d5b 100644 --- a/test/test_main.cpp +++ b/test/test_main.cpp @@ -1,2 +1,2 @@ #define CATCH_CONFIG_MAIN -#include +#include diff --git a/test/test_nvim_eval.cpp b/test/test_nvim_eval.cpp index a6300d40..66db7bac 100644 --- a/test/test_nvim_eval.cpp +++ b/test/test_nvim_eval.cpp @@ -1,6 +1,6 @@ #include "nvim.hpp" #include "utils.hpp" -#include +#include #include #include #include diff --git a/test/test_nvim_set_var.cpp b/test/test_nvim_set_var.cpp index 47d7a87b..7c951ee0 100644 --- a/test/test_nvim_set_var.cpp +++ b/test/test_nvim_set_var.cpp @@ -1,6 +1,6 @@ #include "nvim.hpp" #include "utils.hpp" -#include +#include #include #include #include diff --git a/test/test_object.cpp b/test/test_object.cpp index bacf2591..8a1e8cf3 100644 --- a/test/test_object.cpp +++ b/test/test_object.cpp @@ -1,6 +1,6 @@ #include #include "object.hpp" -#include +#include #include #include diff --git a/test/test_object_deserialization_msgpack.cpp b/test/test_object_deserialization_msgpack.cpp index 1c9f4d6c..80766af1 100644 --- a/test/test_object_deserialization_msgpack.cpp +++ b/test/test_object_deserialization_msgpack.cpp @@ -1,4 +1,4 @@ -#include +#include #include "object.hpp" #include #include diff --git a/vcpkg b/vcpkg index 3d054a17..6f7ffeb1 160000 --- a/vcpkg +++ b/vcpkg @@ -1 +1 @@ -Subproject commit 3d054a171071ebfb5a615406367fb09a6fadae58 +Subproject commit 6f7ffeb18f99796233b958aaaf14ec7bd4fb64b2 From 07586699578d0fc6f9e497e089383074aeb07b8f Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Mon, 14 Nov 2022 20:36:25 -0500 Subject: [PATCH 12/56] Try removing vcpkg.json and manually installing vcpkg packages --- CMakeLists.txt | 5 ++++- scripts/linux/build-debug.sh | 2 ++ scripts/linux/build-release.sh | 2 ++ scripts/windows/build-debug.ps1 | 2 ++ scripts/windows/build-release.ps1 | 2 ++ vcpkg.json | 19 ------------------- 6 files changed, 12 insertions(+), 20 deletions(-) delete mode 100644 vcpkg.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 42a3b910..9c325b6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,7 +147,10 @@ if(BUILD_TESTS) list(APPEND TEST_SOURCES ${WINONLYTESTSOURCES}) endif() add_executable(nvui_test ${SOURCES} ${TEST_SOURCES}) - target_link_libraries(nvui_test PRIVATE Catch2::Catch2 Catch2::Catch2WithMain) + target_link_libraries(nvui_test PRIVATE Catch2::Catch2) + if(WIN32) + target_link_libraries(nvui_test PRIVATE Catch2::Catch2WithMain) + endif() target_link_libraries(nvui_test PRIVATE Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Svg) target_link_libraries(nvui_test PRIVATE fmt::fmt) if (WIN32) diff --git a/scripts/linux/build-debug.sh b/scripts/linux/build-debug.sh index e34daa09..5f2a1b90 100644 --- a/scripts/linux/build-debug.sh +++ b/scripts/linux/build-debug.sh @@ -1,4 +1,6 @@ #!/bin/bash +./vcpkg/bootstrap-vcpkg.sh -disableMetrics +./vcpkg/vcpkg install fmt msgpack boost-process boost-container qt5-base qt5-svg catch2 cmake -B build . \ -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake \ -DCMAKE_BUILD_TYPE=Debug diff --git a/scripts/linux/build-release.sh b/scripts/linux/build-release.sh index a17eac0c..50a9d2aa 100644 --- a/scripts/linux/build-release.sh +++ b/scripts/linux/build-release.sh @@ -1,4 +1,6 @@ #!/bin/bash +./vcpkg/booststrap-vcpkg.sh -disableMetrics +./vcpkg/vcpkg install fmt msgpack boost-process boost-container qt5-base qt5-svg cmake -B build . \ -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake \ -DCMAKE_BUILD_TYPE=Release diff --git a/scripts/windows/build-debug.ps1 b/scripts/windows/build-debug.ps1 index 70668604..77d46ad5 100644 --- a/scripts/windows/build-debug.ps1 +++ b/scripts/windows/build-debug.ps1 @@ -5,5 +5,7 @@ param( ) $generator = '"{0}"' -f $gen $cmd = Write-Output "cmake . -B build -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator -DBUILD_TESTS=ON" +.\vcpkg\bootstrap-vcpkg.bat -disableMetrics +.\vcpkg\vcpkg install fmt msgpack boost-process boost-container qt5-base qt5-svg catch2 cmd /C $cmd cmake --build build --config Debug diff --git a/scripts/windows/build-release.ps1 b/scripts/windows/build-release.ps1 index c7686879..c2413137 100644 --- a/scripts/windows/build-release.ps1 +++ b/scripts/windows/build-release.ps1 @@ -5,5 +5,7 @@ param( ) $generator = '"{0}"' -f $gen $cmd = Write-Output "cmake . -B build -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator" +.\vcpkg\bootstrap-vcpkg.bat -disableMetrics +.\vcpkg\vcpkg install fmt msgpack qt5-base qt5-svg boost-process boost-container cmd /C $cmd cmake --build build --config Release diff --git a/vcpkg.json b/vcpkg.json deleted file mode 100644 index f22d4471..00000000 --- a/vcpkg.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", - "name": "nvui", - "version-string": "0.1.4", - "dependencies": [ - "fmt", - "msgpack", - "qt5-base", - "qt5-svg", - "boost-process", - "boost-container" - ], - "features": { - "tests": { - "description": "Build tests", - "dependencies": [ "catch2" ] - } - } -} From 764f9b71b4a87112d99fb3813434623f37b8fb17 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 16 Nov 2022 20:34:28 -0500 Subject: [PATCH 13/56] Hopefully fix actions --- .github/workflows/build.yml | 34 +++++++++++++++++++++++++++++++ CMakeLists.txt | 5 ++++- scripts/windows/build-debug.ps1 | 2 -- scripts/windows/build-release.ps1 | 2 -- scripts/windows/package.ps1 | 1 - 5 files changed, 38 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77aed0db..cf8ff218 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -148,6 +148,8 @@ jobs: - name: Build nvui and nvui_test using vcpkg if: matrix.use_vcpkg run: | + ./vcpkg/bootstrap-vcpkg.sh -disableMetrics + ./vcpkg/vcpkg install fmt qt5-base qt5-svg boost-container boost-process msgpack cmake -B build . -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} ${{ matrix.cmakeflags }} cmake --build build --config ${{ matrix.buildtype }} @@ -243,6 +245,18 @@ jobs: run: choco install -y neovim - name: Add Neovim to PATH run: echo "C:\tools\neovim\Neovim\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + # Step was taken from Neovim-Qt's github actions workflow file + # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml + - name: Install Qt5 + env: + QT_DIR: ${{ github.workspace\5.15.2\msvc2019_64}} + run: | + python -m pip install aqtinstall + python -m aqt install-qt -O ./Qt 5.15.2 windows desktop win64_msvc2019_64 + Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" + Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" + Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" + - name: Add Qt to path - name: Restore deps from cache if they exist uses: actions/cache@v2 with: @@ -251,6 +265,10 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} restore-keys: | ${{ runner.os }}-build-debug-${{ hashFiles('vcpkg.json') }} + - name: Install vcpkg dependencies + run: | + .\vcpkg\bootstrap-vcpkg.bat -disableMetrics + .\vcpkg\vcpkg install fmt msgpack boost-process boost-container catch2 - name: Build nvui and nvui_test run: .\scripts\windows\build-debug.ps1 - name: Run tests @@ -280,6 +298,22 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} restore-keys: | ${{ runner.os }}-build-release-${{ hashFiles('vcpkg.json') }} + # Step was taken from Neovim-Qt's github actions workflow file + # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml + - name: Install Qt5 + env: + QT_DIR: ${{ github.workspace\5.15.2\msvc2019_64}} + run: | + python -m pip install aqtinstall + python -m aqt install-qt -O ./Qt 5.15.2 windows desktop win64_msvc2019_64 + Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" + Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" + Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" + - name: Install vcpkg dependencies and build + - run: | + .\vcpkg\bootstrap-vcpkg.bat -disableMetrics + vcpkg install fmt msgpack boost-process boost-container + .\scripts\windows\build-release.ps1 - name: Package into a zip run: .\scripts\windows\package.ps1 - name: Upload artifact diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c325b6c..23581ee2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ option(BUILD_TESTS "Build tests" OFF) if (BUILD_TESTS) list(APPEND VCPKG_MANIFEST_FEATURES "tests") endif() - +set(THREADS_PREFER_PTHREAD_FLAG ON) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") @@ -41,6 +41,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) find_package(msgpack CONFIG REQUIRED) find_package(Qt5 5.15.2 REQUIRED COMPONENTS Core Gui Svg Widgets) find_package(fmt CONFIG REQUIRED) +find_package(Threads REQUIRED) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) @@ -105,6 +106,7 @@ else() endif() target_link_libraries(nvui PRIVATE Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Svg) target_link_libraries(nvui PRIVATE fmt::fmt) +target_link_libraries(nvui PRIVATE Threads::Threads) target_include_directories(nvui PRIVATE "${PROJECT_SOURCE_DIR}/src" ) @@ -153,6 +155,7 @@ if(BUILD_TESTS) endif() target_link_libraries(nvui_test PRIVATE Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Svg) target_link_libraries(nvui_test PRIVATE fmt::fmt) + target_link_libraries(nvui_test PRIVATE Threads::Threads) if (WIN32) target_link_libraries(nvui_test PUBLIC d2d1 diff --git a/scripts/windows/build-debug.ps1 b/scripts/windows/build-debug.ps1 index 77d46ad5..70668604 100644 --- a/scripts/windows/build-debug.ps1 +++ b/scripts/windows/build-debug.ps1 @@ -5,7 +5,5 @@ param( ) $generator = '"{0}"' -f $gen $cmd = Write-Output "cmake . -B build -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator -DBUILD_TESTS=ON" -.\vcpkg\bootstrap-vcpkg.bat -disableMetrics -.\vcpkg\vcpkg install fmt msgpack boost-process boost-container qt5-base qt5-svg catch2 cmd /C $cmd cmake --build build --config Debug diff --git a/scripts/windows/build-release.ps1 b/scripts/windows/build-release.ps1 index c2413137..c7686879 100644 --- a/scripts/windows/build-release.ps1 +++ b/scripts/windows/build-release.ps1 @@ -5,7 +5,5 @@ param( ) $generator = '"{0}"' -f $gen $cmd = Write-Output "cmake . -B build -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator" -.\vcpkg\bootstrap-vcpkg.bat -disableMetrics -.\vcpkg\vcpkg install fmt msgpack qt5-base qt5-svg boost-process boost-container cmd /C $cmd cmake --build build --config Release diff --git a/scripts/windows/package.ps1 b/scripts/windows/package.ps1 index 7e548855..8e6fc7b6 100644 --- a/scripts/windows/package.ps1 +++ b/scripts/windows/package.ps1 @@ -1,4 +1,3 @@ -./scripts/windows/build-release.ps1 cd build mkdir nvui cd nvui From fa4056008e41c968f3eff8a3da93f221ef675e94 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 16 Nov 2022 20:41:46 -0500 Subject: [PATCH 14/56] Remove empty step --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cf8ff218..1031ea35 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -256,7 +256,6 @@ jobs: Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" - - name: Add Qt to path - name: Restore deps from cache if they exist uses: actions/cache@v2 with: From f2300e831d93413bc710c45b9ea6731ce8841747 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 16 Nov 2022 20:44:31 -0500 Subject: [PATCH 15/56] Remove - in front of run command, fix some formatting --- .github/workflows/build.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1031ea35..26ebea36 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -238,13 +238,17 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' + - uses: ilammy/msvc-dev-cmd@v1 with: sdk: 10.0.19041.0 + - name: Install Neovim Stable run: choco install -y neovim + - name: Add Neovim to PATH run: echo "C:\tools\neovim\Neovim\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + # Step was taken from Neovim-Qt's github actions workflow file # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml - name: Install Qt5 @@ -256,6 +260,7 @@ jobs: Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" + - name: Restore deps from cache if they exist uses: actions/cache@v2 with: @@ -264,12 +269,15 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} restore-keys: | ${{ runner.os }}-build-debug-${{ hashFiles('vcpkg.json') }} + - name: Install vcpkg dependencies run: | .\vcpkg\bootstrap-vcpkg.bat -disableMetrics .\vcpkg\vcpkg install fmt msgpack boost-process boost-container catch2 + - name: Build nvui and nvui_test run: .\scripts\windows\build-debug.ps1 + - name: Run tests run: | cd build @@ -297,6 +305,7 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} restore-keys: | ${{ runner.os }}-build-release-${{ hashFiles('vcpkg.json') }} + # Step was taken from Neovim-Qt's github actions workflow file # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml - name: Install Qt5 @@ -308,13 +317,16 @@ jobs: Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" + - name: Install vcpkg dependencies and build - - run: | + run: | .\vcpkg\bootstrap-vcpkg.bat -disableMetrics vcpkg install fmt msgpack boost-process boost-container .\scripts\windows\build-release.ps1 + - name: Package into a zip run: .\scripts\windows\package.ps1 + - name: Upload artifact uses: actions/upload-artifact@v2 with: From 6cb57b47358639c75fa87f40736f7a13f7d7260b Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 16 Nov 2022 20:45:47 -0500 Subject: [PATCH 16/56] Fix Qt5_Dir setting --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 26ebea36..1dfb77b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -253,7 +253,7 @@ jobs: # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml - name: Install Qt5 env: - QT_DIR: ${{ github.workspace\5.15.2\msvc2019_64}} + QT_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64}} run: | python -m pip install aqtinstall python -m aqt install-qt -O ./Qt 5.15.2 windows desktop win64_msvc2019_64 @@ -310,7 +310,7 @@ jobs: # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml - name: Install Qt5 env: - QT_DIR: ${{ github.workspace\5.15.2\msvc2019_64}} + QT_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64}} run: | python -m pip install aqtinstall python -m aqt install-qt -O ./Qt 5.15.2 windows desktop win64_msvc2019_64 From 44ebc178b66899f38585ab2d544aa7ca4bf4f981 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Tue, 17 Jan 2023 18:08:56 -0500 Subject: [PATCH 17/56] Fix? install-qt command on Windows --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1dfb77b0..ac141791 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -256,7 +256,7 @@ jobs: QT_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64}} run: | python -m pip install aqtinstall - python -m aqt install-qt -O ./Qt 5.15.2 windows desktop win64_msvc2019_64 + python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" @@ -313,7 +313,7 @@ jobs: QT_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64}} run: | python -m pip install aqtinstall - python -m aqt install-qt -O ./Qt 5.15.2 windows desktop win64_msvc2019_64 + python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" From 2258cb139a0121e701f4acc4d8df02da65143f15 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Tue, 17 Jan 2023 18:35:25 -0500 Subject: [PATCH 18/56] Revert "Update vcpkg to latest" This reverts commit be22b1fd796b00f7b473afb252db1c6896504d1e. --- .github/workflows/build.yml | 45 -------------------- CMakeLists.txt | 11 ++--- scripts/linux/build-debug.sh | 2 - scripts/linux/build-release.sh | 2 - scripts/windows/package.ps1 | 1 + test/test_default_colors.cpp | 2 +- test/test_hl_attr_from_object.cpp | 2 +- test/test_main.cpp | 2 +- test/test_nvim_eval.cpp | 2 +- test/test_nvim_set_var.cpp | 2 +- test/test_object.cpp | 2 +- test/test_object_deserialization_msgpack.cpp | 2 +- vcpkg | 2 +- vcpkg.json | 19 +++++++++ 14 files changed, 31 insertions(+), 65 deletions(-) create mode 100644 vcpkg.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac141791..77aed0db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -148,8 +148,6 @@ jobs: - name: Build nvui and nvui_test using vcpkg if: matrix.use_vcpkg run: | - ./vcpkg/bootstrap-vcpkg.sh -disableMetrics - ./vcpkg/vcpkg install fmt qt5-base qt5-svg boost-container boost-process msgpack cmake -B build . -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} ${{ matrix.cmakeflags }} cmake --build build --config ${{ matrix.buildtype }} @@ -238,29 +236,13 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' - - uses: ilammy/msvc-dev-cmd@v1 with: sdk: 10.0.19041.0 - - name: Install Neovim Stable run: choco install -y neovim - - name: Add Neovim to PATH run: echo "C:\tools\neovim\Neovim\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - # Step was taken from Neovim-Qt's github actions workflow file - # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml - - name: Install Qt5 - env: - QT_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64}} - run: | - python -m pip install aqtinstall - python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 - Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" - Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" - Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" - - name: Restore deps from cache if they exist uses: actions/cache@v2 with: @@ -269,15 +251,8 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} restore-keys: | ${{ runner.os }}-build-debug-${{ hashFiles('vcpkg.json') }} - - - name: Install vcpkg dependencies - run: | - .\vcpkg\bootstrap-vcpkg.bat -disableMetrics - .\vcpkg\vcpkg install fmt msgpack boost-process boost-container catch2 - - name: Build nvui and nvui_test run: .\scripts\windows\build-debug.ps1 - - name: Run tests run: | cd build @@ -305,28 +280,8 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} restore-keys: | ${{ runner.os }}-build-release-${{ hashFiles('vcpkg.json') }} - - # Step was taken from Neovim-Qt's github actions workflow file - # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml - - name: Install Qt5 - env: - QT_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64}} - run: | - python -m pip install aqtinstall - python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 - Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" - Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" - Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" - - - name: Install vcpkg dependencies and build - run: | - .\vcpkg\bootstrap-vcpkg.bat -disableMetrics - vcpkg install fmt msgpack boost-process boost-container - .\scripts\windows\build-release.ps1 - - name: Package into a zip run: .\scripts\windows\package.ps1 - - name: Upload artifact uses: actions/upload-artifact@v2 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 23581ee2..85171486 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ option(BUILD_TESTS "Build tests" OFF) if (BUILD_TESTS) list(APPEND VCPKG_MANIFEST_FEATURES "tests") endif() -set(THREADS_PREFER_PTHREAD_FLAG ON) + if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") @@ -41,7 +41,6 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) find_package(msgpack CONFIG REQUIRED) find_package(Qt5 5.15.2 REQUIRED COMPONENTS Core Gui Svg Widgets) find_package(fmt CONFIG REQUIRED) -find_package(Threads REQUIRED) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) @@ -98,7 +97,7 @@ if (WIN32) ) list(APPEND SOURCES ${WINONLYSOURCES}) endif() -find_package(Boost COMPONENTS filesystem REQUIRED) +find_package(Boost COMPONENTS filesystem thread REQUIRED) if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Release") add_executable(nvui WIN32 "assets/icons/desktop/neovim_icon.rc" "src/main.cpp" ${SOURCES}) else() @@ -106,7 +105,6 @@ else() endif() target_link_libraries(nvui PRIVATE Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Svg) target_link_libraries(nvui PRIVATE fmt::fmt) -target_link_libraries(nvui PRIVATE Threads::Threads) target_include_directories(nvui PRIVATE "${PROJECT_SOURCE_DIR}/src" ) @@ -150,12 +148,8 @@ if(BUILD_TESTS) endif() add_executable(nvui_test ${SOURCES} ${TEST_SOURCES}) target_link_libraries(nvui_test PRIVATE Catch2::Catch2) - if(WIN32) - target_link_libraries(nvui_test PRIVATE Catch2::Catch2WithMain) - endif() target_link_libraries(nvui_test PRIVATE Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Svg) target_link_libraries(nvui_test PRIVATE fmt::fmt) - target_link_libraries(nvui_test PRIVATE Threads::Threads) if (WIN32) target_link_libraries(nvui_test PUBLIC d2d1 @@ -172,6 +166,7 @@ if(BUILD_TESTS) target_include_directories(nvui_test PRIVATE ${Boost_INCLUDE_DIR}) endif() target_link_libraries(nvui_test PRIVATE + Boost::thread Boost::filesystem ) include(CTest) diff --git a/scripts/linux/build-debug.sh b/scripts/linux/build-debug.sh index 5f2a1b90..e34daa09 100644 --- a/scripts/linux/build-debug.sh +++ b/scripts/linux/build-debug.sh @@ -1,6 +1,4 @@ #!/bin/bash -./vcpkg/bootstrap-vcpkg.sh -disableMetrics -./vcpkg/vcpkg install fmt msgpack boost-process boost-container qt5-base qt5-svg catch2 cmake -B build . \ -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake \ -DCMAKE_BUILD_TYPE=Debug diff --git a/scripts/linux/build-release.sh b/scripts/linux/build-release.sh index 50a9d2aa..a17eac0c 100644 --- a/scripts/linux/build-release.sh +++ b/scripts/linux/build-release.sh @@ -1,6 +1,4 @@ #!/bin/bash -./vcpkg/booststrap-vcpkg.sh -disableMetrics -./vcpkg/vcpkg install fmt msgpack boost-process boost-container qt5-base qt5-svg cmake -B build . \ -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake \ -DCMAKE_BUILD_TYPE=Release diff --git a/scripts/windows/package.ps1 b/scripts/windows/package.ps1 index 8e6fc7b6..7e548855 100644 --- a/scripts/windows/package.ps1 +++ b/scripts/windows/package.ps1 @@ -1,3 +1,4 @@ +./scripts/windows/build-release.ps1 cd build mkdir nvui cd nvui diff --git a/test/test_default_colors.cpp b/test/test_default_colors.cpp index 86718035..ebd8a67b 100644 --- a/test/test_default_colors.cpp +++ b/test/test_default_colors.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "hlstate.hpp" #include "object.hpp" diff --git a/test/test_hl_attr_from_object.cpp b/test/test_hl_attr_from_object.cpp index a01795b0..58a90c2d 100644 --- a/test/test_hl_attr_from_object.cpp +++ b/test/test_hl_attr_from_object.cpp @@ -1,6 +1,6 @@ #include "object.hpp" #include "hlstate.hpp" -#include +#include #include #include #include diff --git a/test/test_main.cpp b/test/test_main.cpp index 2c344d5b..4ed06df1 100644 --- a/test/test_main.cpp +++ b/test/test_main.cpp @@ -1,2 +1,2 @@ #define CATCH_CONFIG_MAIN -#include +#include diff --git a/test/test_nvim_eval.cpp b/test/test_nvim_eval.cpp index 66db7bac..a6300d40 100644 --- a/test/test_nvim_eval.cpp +++ b/test/test_nvim_eval.cpp @@ -1,6 +1,6 @@ #include "nvim.hpp" #include "utils.hpp" -#include +#include #include #include #include diff --git a/test/test_nvim_set_var.cpp b/test/test_nvim_set_var.cpp index 7c951ee0..47d7a87b 100644 --- a/test/test_nvim_set_var.cpp +++ b/test/test_nvim_set_var.cpp @@ -1,6 +1,6 @@ #include "nvim.hpp" #include "utils.hpp" -#include +#include #include #include #include diff --git a/test/test_object.cpp b/test/test_object.cpp index 8a1e8cf3..bacf2591 100644 --- a/test/test_object.cpp +++ b/test/test_object.cpp @@ -1,6 +1,6 @@ #include #include "object.hpp" -#include +#include #include #include diff --git a/test/test_object_deserialization_msgpack.cpp b/test/test_object_deserialization_msgpack.cpp index 80766af1..1c9f4d6c 100644 --- a/test/test_object_deserialization_msgpack.cpp +++ b/test/test_object_deserialization_msgpack.cpp @@ -1,4 +1,4 @@ -#include +#include #include "object.hpp" #include #include diff --git a/vcpkg b/vcpkg index 6f7ffeb1..03ca9b59 160000 --- a/vcpkg +++ b/vcpkg @@ -1 +1 @@ -Subproject commit 6f7ffeb18f99796233b958aaaf14ec7bd4fb64b2 +Subproject commit 03ca9b59af1506a86840e3a3a01a092f3333a29b diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 00000000..f22d4471 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", + "name": "nvui", + "version-string": "0.1.4", + "dependencies": [ + "fmt", + "msgpack", + "qt5-base", + "qt5-svg", + "boost-process", + "boost-container" + ], + "features": { + "tests": { + "description": "Build tests", + "dependencies": [ "catch2" ] + } + } +} From 8fa4f7dfeaccf0b7350f8d9b24e1f9e656608267 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Tue, 17 Jan 2023 19:36:07 -0500 Subject: [PATCH 19/56] Install Qt5 manually on Windows --- .github/workflows/build.yml | 27 +++++++++++++++++++++++++++ .gitignore | 1 + vcpkg.json | 10 ++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77aed0db..5e236b5c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -243,6 +243,7 @@ jobs: run: choco install -y neovim - name: Add Neovim to PATH run: echo "C:\tools\neovim\Neovim\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Restore deps from cache if they exist uses: actions/cache@v2 with: @@ -251,6 +252,19 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} restore-keys: | ${{ runner.os }}-build-debug-${{ hashFiles('vcpkg.json') }} + + # Step was taken from Neovim-Qt's github actions workflow file + # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml + - name: Install Qt5 + env: + QT_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64}} + run: | + python -m pip install aqtinstall + python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 + Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" + Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" + Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" + - name: Build nvui and nvui_test run: .\scripts\windows\build-debug.ps1 - name: Run tests @@ -280,6 +294,19 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} restore-keys: | ${{ runner.os }}-build-release-${{ hashFiles('vcpkg.json') }} + + # Step was taken from Neovim-Qt's github actions workflow file + # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml + - name: Install Qt5 + env: + QT_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64}} + run: | + python -m pip install aqtinstall + python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 + Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" + Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" + Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" + - name: Package into a zip run: .\scripts\windows\package.ps1 - name: Upload artifact diff --git a/.gitignore b/.gitignore index e087b38a..2db02f9f 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ CMakeLists.txt.user .ccls-cache/ CMakeSettings.json .ignore +vcpkg_installed/ diff --git a/vcpkg.json b/vcpkg.json index f22d4471..84997857 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -5,8 +5,14 @@ "dependencies": [ "fmt", "msgpack", - "qt5-base", - "qt5-svg", + { + "name": "qt5-base", + "platform": "!windows" + }, + { + "name": "qt5-svg", + "platform": "!windows" + }, "boost-process", "boost-container" ], From 689b4bd485a10301f18d146a22bcd352eb73ef8b Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Tue, 17 Jan 2023 19:46:37 -0500 Subject: [PATCH 20/56] Update package list before installing (attempting to fix python not found error) --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5e236b5c..a9b449d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,6 +76,8 @@ jobs: - name: Ubuntu - Install vcpkg dependencies if: startsWith(matrix.os, 'ubuntu') && matrix.use_vcpkg run: > + sudo apt-get update + sudo apt-get update sudo apt-get install gperf autoconf build-essential libtool libgl1-mesa-dev libxi-dev libx11-dev libxext-dev libxkbcommon-x11-dev libglu1-mesa-dev libx11-xcb-dev From eb67fd0bf5007ee2f35fe353afd41dc5867ff415 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 18 Jan 2023 15:27:18 -0500 Subject: [PATCH 21/56] Update vcpkg but keep boost versions the same --- .github/workflows/build.yml | 8 ++++---- test/test_default_colors.cpp | 2 +- test/test_hl_attr_from_object.cpp | 2 +- test/test_main.cpp | 2 +- test/test_nvim_eval.cpp | 2 +- test/test_nvim_set_var.cpp | 2 +- test/test_object.cpp | 2 +- test/test_object_deserialization_msgpack.cpp | 2 +- vcpkg | 2 +- vcpkg.json | 11 +++++++++++ 10 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a9b449d8..2d8b915b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,9 +76,7 @@ jobs: - name: Ubuntu - Install vcpkg dependencies if: startsWith(matrix.os, 'ubuntu') && matrix.use_vcpkg run: > - sudo apt-get update - sudo apt-get update - sudo apt-get install gperf autoconf build-essential libtool + sudo apt-get update && sudo apt-get update && sudo apt-get install gperf autoconf build-essential libtool libgl1-mesa-dev libxi-dev libx11-dev libxext-dev libxkbcommon-x11-dev libglu1-mesa-dev libx11-xcb-dev '^libxcb.*-dev' libxrender-dev ninja-build curl @@ -268,7 +266,9 @@ jobs: Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" - name: Build nvui and nvui_test - run: .\scripts\windows\build-debug.ps1 + run: | + .\vcpkg\vcpkg install + .\scripts\windows\build-debug.ps1 - name: Run tests run: | cd build diff --git a/test/test_default_colors.cpp b/test/test_default_colors.cpp index ebd8a67b..86718035 100644 --- a/test/test_default_colors.cpp +++ b/test/test_default_colors.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "hlstate.hpp" #include "object.hpp" diff --git a/test/test_hl_attr_from_object.cpp b/test/test_hl_attr_from_object.cpp index 58a90c2d..a01795b0 100644 --- a/test/test_hl_attr_from_object.cpp +++ b/test/test_hl_attr_from_object.cpp @@ -1,6 +1,6 @@ #include "object.hpp" #include "hlstate.hpp" -#include +#include #include #include #include diff --git a/test/test_main.cpp b/test/test_main.cpp index 4ed06df1..2c344d5b 100644 --- a/test/test_main.cpp +++ b/test/test_main.cpp @@ -1,2 +1,2 @@ #define CATCH_CONFIG_MAIN -#include +#include diff --git a/test/test_nvim_eval.cpp b/test/test_nvim_eval.cpp index a6300d40..66db7bac 100644 --- a/test/test_nvim_eval.cpp +++ b/test/test_nvim_eval.cpp @@ -1,6 +1,6 @@ #include "nvim.hpp" #include "utils.hpp" -#include +#include #include #include #include diff --git a/test/test_nvim_set_var.cpp b/test/test_nvim_set_var.cpp index 47d7a87b..7c951ee0 100644 --- a/test/test_nvim_set_var.cpp +++ b/test/test_nvim_set_var.cpp @@ -1,6 +1,6 @@ #include "nvim.hpp" #include "utils.hpp" -#include +#include #include #include #include diff --git a/test/test_object.cpp b/test/test_object.cpp index bacf2591..8a1e8cf3 100644 --- a/test/test_object.cpp +++ b/test/test_object.cpp @@ -1,6 +1,6 @@ #include #include "object.hpp" -#include +#include #include #include diff --git a/test/test_object_deserialization_msgpack.cpp b/test/test_object_deserialization_msgpack.cpp index 1c9f4d6c..80766af1 100644 --- a/test/test_object_deserialization_msgpack.cpp +++ b/test/test_object_deserialization_msgpack.cpp @@ -1,4 +1,4 @@ -#include +#include #include "object.hpp" #include #include diff --git a/vcpkg b/vcpkg index 03ca9b59..5908d702 160000 --- a/vcpkg +++ b/vcpkg @@ -1 +1 @@ -Subproject commit 03ca9b59af1506a86840e3a3a01a092f3333a29b +Subproject commit 5908d702d61cea1429b223a0b7a10ab86bad4c78 diff --git a/vcpkg.json b/vcpkg.json index 84997857..c23cdcd3 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -2,6 +2,7 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", "name": "nvui", "version-string": "0.1.4", + "builtin-baseline": "03ca9b59af1506a86840e3a3a01a092f3333a29b", "dependencies": [ "fmt", "msgpack", @@ -16,6 +17,16 @@ "boost-process", "boost-container" ], + "overrides": [ + { + "name": "boost-process", + "version": "1.77.0" + }, + { + "name": "boost-container", + "version": "1.77.0" + } + ], "features": { "tests": { "description": "Build tests", From 048cff252c6918a4a3c45c2f75d712b14740238e Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 18 Jan 2023 15:40:56 -0500 Subject: [PATCH 22/56] Update vcpkg baseline commit --- vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index c23cdcd3..7b851456 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", "name": "nvui", "version-string": "0.1.4", - "builtin-baseline": "03ca9b59af1506a86840e3a3a01a092f3333a29b", + "builtin-baseline": "5908d702d61cea1429b223a0b7a10ab86bad4c78", "dependencies": [ "fmt", "msgpack", From 6e05c9d00fef53cc4f83ed2f20a4e5379b68bb65 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 18 Jan 2023 17:15:02 -0500 Subject: [PATCH 23/56] Once again, try to update vcpkg to latest --- .github/workflows/build.yml | 2 +- vcpkg | 2 +- vcpkg.json | 21 ++------------------- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2d8b915b..cd843da8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -106,7 +106,7 @@ jobs: run: | git clone https://github.com/catchorg/Catch2.git cd Catch2 - git checkout v2.x + git checkout devel cmake -B build -H. -DBUILD_TESTING=OFF cd build sudo make install diff --git a/vcpkg b/vcpkg index 5908d702..89e38172 160000 --- a/vcpkg +++ b/vcpkg @@ -1 +1 @@ -Subproject commit 5908d702d61cea1429b223a0b7a10ab86bad4c78 +Subproject commit 89e38172980b10200c2170a1914300643b352b85 diff --git a/vcpkg.json b/vcpkg.json index 7b851456..f22d4471 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -2,31 +2,14 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", "name": "nvui", "version-string": "0.1.4", - "builtin-baseline": "5908d702d61cea1429b223a0b7a10ab86bad4c78", "dependencies": [ "fmt", "msgpack", - { - "name": "qt5-base", - "platform": "!windows" - }, - { - "name": "qt5-svg", - "platform": "!windows" - }, + "qt5-base", + "qt5-svg", "boost-process", "boost-container" ], - "overrides": [ - { - "name": "boost-process", - "version": "1.77.0" - }, - { - "name": "boost-container", - "version": "1.77.0" - } - ], "features": { "tests": { "description": "Build tests", From ad9549a5bf7bb1a008fcb8cbfda4384197c08779 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 18 Jan 2023 18:25:08 -0500 Subject: [PATCH 24/56] Attempting to fix builds --- .github/workflows/build.yml | 7 ++++--- CMakeLists.txt | 5 ++--- test/test_default_colors.cpp | 2 +- test/test_hl_attr_from_object.cpp | 2 +- test/test_main.cpp | 9 +++++++-- test/test_nvim_eval.cpp | 2 +- test/test_nvim_set_var.cpp | 2 +- test/test_object.cpp | 2 +- test/test_object_deserialization_msgpack.cpp | 2 +- 9 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cd843da8..6c3fbfb9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,16 +76,16 @@ jobs: - name: Ubuntu - Install vcpkg dependencies if: startsWith(matrix.os, 'ubuntu') && matrix.use_vcpkg run: > - sudo apt-get update && sudo apt-get update && sudo apt-get install gperf autoconf build-essential libtool + sudo apt-get install gperf autoconf build-essential libtool libgl1-mesa-dev libxi-dev libx11-dev libxext-dev libxkbcommon-x11-dev libglu1-mesa-dev libx11-xcb-dev '^libxcb.*-dev' libxrender-dev ninja-build curl - zip unzip tar autopoint python + zip unzip tar autopoint python2 - name: Mac - Install vcpkg dependencies if: startsWith(matrix.os, 'macos') && matrix.use_vcpkg run: | - brew install automake + brew install automake autoconf-archive libtool - name: Restore vcpkg packages if: matrix.use_vcpkg @@ -267,6 +267,7 @@ jobs: - name: Build nvui and nvui_test run: | + .\vcpkg\bootstrap-vcpkg.bat -disableMetrics .\vcpkg\vcpkg install .\scripts\windows\build-debug.ps1 - name: Run tests diff --git a/CMakeLists.txt b/CMakeLists.txt index 85171486..f14d137a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,7 @@ if (WIN32) ) list(APPEND SOURCES ${WINONLYSOURCES}) endif() -find_package(Boost COMPONENTS filesystem thread REQUIRED) +find_package(Boost COMPONENTS filesystem REQUIRED) if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Release") add_executable(nvui WIN32 "assets/icons/desktop/neovim_icon.rc" "src/main.cpp" ${SOURCES}) else() @@ -166,8 +166,7 @@ if(BUILD_TESTS) target_include_directories(nvui_test PRIVATE ${Boost_INCLUDE_DIR}) endif() target_link_libraries(nvui_test PRIVATE - Boost::thread - Boost::filesystem + ${Boost_LIBRARIES} ) include(CTest) include(Catch) diff --git a/test/test_default_colors.cpp b/test/test_default_colors.cpp index 86718035..35b822f2 100644 --- a/test/test_default_colors.cpp +++ b/test/test_default_colors.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "hlstate.hpp" #include "object.hpp" diff --git a/test/test_hl_attr_from_object.cpp b/test/test_hl_attr_from_object.cpp index a01795b0..8bc1af22 100644 --- a/test/test_hl_attr_from_object.cpp +++ b/test/test_hl_attr_from_object.cpp @@ -1,6 +1,6 @@ #include "object.hpp" #include "hlstate.hpp" -#include +#include #include #include #include diff --git a/test/test_main.cpp b/test/test_main.cpp index 2c344d5b..927523ec 100644 --- a/test/test_main.cpp +++ b/test/test_main.cpp @@ -1,2 +1,7 @@ -#define CATCH_CONFIG_MAIN -#include +#include + +int main(int argc, char** argv) +{ + int result = Catch::Session().run(argc, argv); + return result; +} diff --git a/test/test_nvim_eval.cpp b/test/test_nvim_eval.cpp index 66db7bac..5a4eee46 100644 --- a/test/test_nvim_eval.cpp +++ b/test/test_nvim_eval.cpp @@ -1,6 +1,6 @@ #include "nvim.hpp" #include "utils.hpp" -#include +#include #include #include #include diff --git a/test/test_nvim_set_var.cpp b/test/test_nvim_set_var.cpp index 7c951ee0..fb5d8e67 100644 --- a/test/test_nvim_set_var.cpp +++ b/test/test_nvim_set_var.cpp @@ -1,6 +1,6 @@ #include "nvim.hpp" #include "utils.hpp" -#include +#include #include #include #include diff --git a/test/test_object.cpp b/test/test_object.cpp index 8a1e8cf3..07472486 100644 --- a/test/test_object.cpp +++ b/test/test_object.cpp @@ -1,6 +1,6 @@ #include #include "object.hpp" -#include +#include #include #include diff --git a/test/test_object_deserialization_msgpack.cpp b/test/test_object_deserialization_msgpack.cpp index 80766af1..d3fe2f71 100644 --- a/test/test_object_deserialization_msgpack.cpp +++ b/test/test_object_deserialization_msgpack.cpp @@ -1,4 +1,4 @@ -#include +#include #include "object.hpp" #include #include From f234c55993ebe8de34fd15baa6b8d925e61dd435 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 18 Jan 2023 19:43:13 -0500 Subject: [PATCH 25/56] Hopefully fix builds for macos debug & ubuntu --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c3fbfb9..35669efa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,7 +80,7 @@ jobs: libgl1-mesa-dev libxi-dev libx11-dev libxext-dev libxkbcommon-x11-dev libglu1-mesa-dev libx11-xcb-dev '^libxcb.*-dev' libxrender-dev ninja-build curl - zip unzip tar autopoint python2 + zip unzip tar autopoint python2 autoconf-archive - name: Mac - Install vcpkg dependencies if: startsWith(matrix.os, 'macos') && matrix.use_vcpkg @@ -101,13 +101,13 @@ jobs: sudo apt-get install libmsgpack-dev libfmt-dev libboost-all-dev mesa-common-dev libglu1-mesa-dev - - name: Ubuntu - Install Catch2 - if: ${{ startsWith(matrix.os, 'ubuntu') && !matrix.use_vcpkg }} + - name: Ubuntu & MacOS Debug - Build & install Catch2 from source + if: ${{ !matrix.use_vcpkg }} run: | git clone https://github.com/catchorg/Catch2.git cd Catch2 git checkout devel - cmake -B build -H. -DBUILD_TESTING=OFF + cmake -B build -H. -DBUILD_TESTING=OFF -DCMAKE_CXX_STANDARD=17 cd build sudo make install From e0f4f4e0c1ba489b4c971cc99ec17405425b623b Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 18 Jan 2023 20:04:03 -0500 Subject: [PATCH 26/56] Remove vcpkg.json --- .github/workflows/build.yml | 12 ++++++++++-- vcpkg.json | 19 ------------------- 2 files changed, 10 insertions(+), 21 deletions(-) delete mode 100644 vcpkg.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35669efa..403062b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -145,6 +145,10 @@ jobs: /bin/bash -c "sudo xcode-select -s /Applications/Xcode_12.app/Contents/Developer" brew install make + - name: Install Vcpkg packages + if: matrix.use_vcpkg + run: ./vcpkg/vcpkg install fmt msgpack qt5-base qt5-svg boost-process boost-container + - name: Build nvui and nvui_test using vcpkg if: matrix.use_vcpkg run: | @@ -265,10 +269,11 @@ jobs: Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" + - name: Install Vcpkg Packages (not Qt5) + run: .\vcpkg\vcpkg install fmt msgpack boost-process boost-container + - name: Build nvui and nvui_test run: | - .\vcpkg\bootstrap-vcpkg.bat -disableMetrics - .\vcpkg\vcpkg install .\scripts\windows\build-debug.ps1 - name: Run tests run: | @@ -310,6 +315,9 @@ jobs: Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" + - name: Install Vcpkg Packages (not Qt5) + run: .\vcpkg\vcpkg install fmt msgpack boost-process boost-container + - name: Package into a zip run: .\scripts\windows\package.ps1 - name: Upload artifact diff --git a/vcpkg.json b/vcpkg.json deleted file mode 100644 index f22d4471..00000000 --- a/vcpkg.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", - "name": "nvui", - "version-string": "0.1.4", - "dependencies": [ - "fmt", - "msgpack", - "qt5-base", - "qt5-svg", - "boost-process", - "boost-container" - ], - "features": { - "tests": { - "description": "Build tests", - "dependencies": [ "catch2" ] - } - } -} From 746e35081cf9993f046bb02947cd4d263c24dc9f Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 18 Jan 2023 20:15:44 -0500 Subject: [PATCH 27/56] Bootstrap vcpkg before install.. --- .github/workflows/build.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 403062b0..4e56f3cb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -130,7 +130,7 @@ jobs: - name: Mac - Install dependencies if: ${{ startsWith(matrix.os, 'macos') && !matrix.use_vcpkg }} run: | - brew install fmt boost qt@5 msgpack-cxx catch2 + brew install fmt boost qt@5 msgpack-cxx sudo ln -s /usr/local/Cellar/qt@5/5.15.2/plugins /usr/local/plugins - name: Mac - Set environment variables @@ -147,7 +147,9 @@ jobs: - name: Install Vcpkg packages if: matrix.use_vcpkg - run: ./vcpkg/vcpkg install fmt msgpack qt5-base qt5-svg boost-process boost-container + run: | + ./vcpkg/bootstrap-vcpkg.sh -disableMetrics + ./vcpkg/vcpkg install fmt msgpack qt5-base qt5-svg boost-process boost-container - name: Build nvui and nvui_test using vcpkg if: matrix.use_vcpkg @@ -270,7 +272,9 @@ jobs: Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" - name: Install Vcpkg Packages (not Qt5) - run: .\vcpkg\vcpkg install fmt msgpack boost-process boost-container + run: | + .\vcpkg\bootstrap-vcpkg.bat -disableMetrics + .\vcpkg\vcpkg install fmt msgpack boost-process boost-container - name: Build nvui and nvui_test run: | @@ -316,7 +320,9 @@ jobs: Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" - name: Install Vcpkg Packages (not Qt5) - run: .\vcpkg\vcpkg install fmt msgpack boost-process boost-container + run: | + .\vcpkg\bootstrap-vcpkg.bat -disableMetrics + .\vcpkg\vcpkg install fmt msgpack boost-process boost-container - name: Package into a zip run: .\scripts\windows\package.ps1 From 1624240bf143d4379d9fecdd74cfa366ad97a946 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 18 Jan 2023 20:49:45 -0500 Subject: [PATCH 28/56] Get rid of caching for now --- .github/workflows/build.yml | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e56f3cb..078efc9f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,14 +87,6 @@ jobs: run: | brew install automake autoconf-archive libtool - - name: Restore vcpkg packages - if: matrix.use_vcpkg - uses: actions/cache@v2 - with: - path: | - build/vcpkg_installed - key: ${{ matrix.os }}-${{ hashFiles('vcpkg.json') }}-${{ env.CC }}-${{ env.CXX }} - - name: Ubuntu - Install dependencies from system package manager if: ${{ startsWith(matrix.os, 'ubuntu') && !matrix.use_vcpkg }} run: > @@ -250,15 +242,6 @@ jobs: - name: Add Neovim to PATH run: echo "C:\tools\neovim\Neovim\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - name: Restore deps from cache if they exist - uses: actions/cache@v2 - with: - path: | - build/vcpkg_installed - key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} - restore-keys: | - ${{ runner.os }}-build-debug-${{ hashFiles('vcpkg.json') }} - # Step was taken from Neovim-Qt's github actions workflow file # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml - name: Install Qt5 @@ -298,14 +281,6 @@ jobs: - uses: ilammy/msvc-dev-cmd@v1 with: sdk: 10.0.19041.0 - - name: Restore deps from cache if they exist - uses: actions/cache@v2 - with: - path: | - build/vcpkg_installed - key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} - restore-keys: | - ${{ runner.os }}-build-release-${{ hashFiles('vcpkg.json') }} # Step was taken from Neovim-Qt's github actions workflow file # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml From d1af8ca83a418aed96743b5c97c6392f05e47278 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 18 Jan 2023 21:41:46 -0500 Subject: [PATCH 29/56] Revert "Remove vcpkg.json" This reverts commit e0f4f4e0c1ba489b4c971cc99ec17405425b623b. --- .github/workflows/build.yml | 45 +++++++++++++++++++++++-------------- vcpkg.json | 19 ++++++++++++++++ 2 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 vcpkg.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 078efc9f..35669efa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,6 +87,14 @@ jobs: run: | brew install automake autoconf-archive libtool + - name: Restore vcpkg packages + if: matrix.use_vcpkg + uses: actions/cache@v2 + with: + path: | + build/vcpkg_installed + key: ${{ matrix.os }}-${{ hashFiles('vcpkg.json') }}-${{ env.CC }}-${{ env.CXX }} + - name: Ubuntu - Install dependencies from system package manager if: ${{ startsWith(matrix.os, 'ubuntu') && !matrix.use_vcpkg }} run: > @@ -122,7 +130,7 @@ jobs: - name: Mac - Install dependencies if: ${{ startsWith(matrix.os, 'macos') && !matrix.use_vcpkg }} run: | - brew install fmt boost qt@5 msgpack-cxx + brew install fmt boost qt@5 msgpack-cxx catch2 sudo ln -s /usr/local/Cellar/qt@5/5.15.2/plugins /usr/local/plugins - name: Mac - Set environment variables @@ -137,12 +145,6 @@ jobs: /bin/bash -c "sudo xcode-select -s /Applications/Xcode_12.app/Contents/Developer" brew install make - - name: Install Vcpkg packages - if: matrix.use_vcpkg - run: | - ./vcpkg/bootstrap-vcpkg.sh -disableMetrics - ./vcpkg/vcpkg install fmt msgpack qt5-base qt5-svg boost-process boost-container - - name: Build nvui and nvui_test using vcpkg if: matrix.use_vcpkg run: | @@ -242,6 +244,15 @@ jobs: - name: Add Neovim to PATH run: echo "C:\tools\neovim\Neovim\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Restore deps from cache if they exist + uses: actions/cache@v2 + with: + path: | + build/vcpkg_installed + key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} + restore-keys: | + ${{ runner.os }}-build-debug-${{ hashFiles('vcpkg.json') }} + # Step was taken from Neovim-Qt's github actions workflow file # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml - name: Install Qt5 @@ -254,13 +265,10 @@ jobs: Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" - - name: Install Vcpkg Packages (not Qt5) - run: | - .\vcpkg\bootstrap-vcpkg.bat -disableMetrics - .\vcpkg\vcpkg install fmt msgpack boost-process boost-container - - name: Build nvui and nvui_test run: | + .\vcpkg\bootstrap-vcpkg.bat -disableMetrics + .\vcpkg\vcpkg install .\scripts\windows\build-debug.ps1 - name: Run tests run: | @@ -281,6 +289,14 @@ jobs: - uses: ilammy/msvc-dev-cmd@v1 with: sdk: 10.0.19041.0 + - name: Restore deps from cache if they exist + uses: actions/cache@v2 + with: + path: | + build/vcpkg_installed + key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} + restore-keys: | + ${{ runner.os }}-build-release-${{ hashFiles('vcpkg.json') }} # Step was taken from Neovim-Qt's github actions workflow file # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml @@ -294,11 +310,6 @@ jobs: Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" - - name: Install Vcpkg Packages (not Qt5) - run: | - .\vcpkg\bootstrap-vcpkg.bat -disableMetrics - .\vcpkg\vcpkg install fmt msgpack boost-process boost-container - - name: Package into a zip run: .\scripts\windows\package.ps1 - name: Upload artifact diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 00000000..f22d4471 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", + "name": "nvui", + "version-string": "0.1.4", + "dependencies": [ + "fmt", + "msgpack", + "qt5-base", + "qt5-svg", + "boost-process", + "boost-container" + ], + "features": { + "tests": { + "description": "Build tests", + "dependencies": [ "catch2" ] + } + } +} From 674f721fb319466c258052a0686d60b9110dc094 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 18 Jan 2023 22:04:44 -0500 Subject: [PATCH 30/56] Don't install qt5 from vcpkg on windows --- .github/workflows/build.yml | 46 ++++++++++++++++++------------------- vcpkg.json | 10 ++++++-- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35669efa..0275c60c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,13 +87,13 @@ jobs: run: | brew install automake autoconf-archive libtool - - name: Restore vcpkg packages - if: matrix.use_vcpkg - uses: actions/cache@v2 - with: - path: | - build/vcpkg_installed - key: ${{ matrix.os }}-${{ hashFiles('vcpkg.json') }}-${{ env.CC }}-${{ env.CXX }} + #- name: Restore vcpkg packages + #if: matrix.use_vcpkg + #uses: actions/cache@v2 + #with: + #path: | + #build/vcpkg_installed + #key: ${{ matrix.os }}-${{ hashFiles('vcpkg.json') }}-${{ env.CC }}-${{ env.CXX }} - name: Ubuntu - Install dependencies from system package manager if: ${{ startsWith(matrix.os, 'ubuntu') && !matrix.use_vcpkg }} @@ -244,14 +244,14 @@ jobs: - name: Add Neovim to PATH run: echo "C:\tools\neovim\Neovim\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - name: Restore deps from cache if they exist - uses: actions/cache@v2 - with: - path: | - build/vcpkg_installed - key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} - restore-keys: | - ${{ runner.os }}-build-debug-${{ hashFiles('vcpkg.json') }} + #- name: Restore deps from cache if they exist + #uses: actions/cache@v2 + #with: + #path: | + #build/vcpkg_installed + #key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} + #restore-keys: | + #${{ runner.os }}-build-debug-${{ hashFiles('vcpkg.json') }} # Step was taken from Neovim-Qt's github actions workflow file # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml @@ -289,14 +289,14 @@ jobs: - uses: ilammy/msvc-dev-cmd@v1 with: sdk: 10.0.19041.0 - - name: Restore deps from cache if they exist - uses: actions/cache@v2 - with: - path: | - build/vcpkg_installed - key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} - restore-keys: | - ${{ runner.os }}-build-release-${{ hashFiles('vcpkg.json') }} + #- name: Restore deps from cache if they exist + #uses: actions/cache@v2 + #with: + #path: | + #build/vcpkg_installed + #key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} + #restore-keys: | + #${{ runner.os }}-build-release-${{ hashFiles('vcpkg.json') }} # Step was taken from Neovim-Qt's github actions workflow file # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml diff --git a/vcpkg.json b/vcpkg.json index f22d4471..84997857 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -5,8 +5,14 @@ "dependencies": [ "fmt", "msgpack", - "qt5-base", - "qt5-svg", + { + "name": "qt5-base", + "platform": "!windows" + }, + { + "name": "qt5-svg", + "platform": "!windows" + }, "boost-process", "boost-container" ], From e50a7c4e2d4bed46ec6ea9b539ba14d70fc06033 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 18 Jan 2023 22:10:35 -0500 Subject: [PATCH 31/56] Remove catch2 from brew install on Mac --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0275c60c..7c206927 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -130,7 +130,7 @@ jobs: - name: Mac - Install dependencies if: ${{ startsWith(matrix.os, 'macos') && !matrix.use_vcpkg }} run: | - brew install fmt boost qt@5 msgpack-cxx catch2 + brew install fmt boost qt@5 msgpack-cxx sudo ln -s /usr/local/Cellar/qt@5/5.15.2/plugins /usr/local/plugins - name: Mac - Set environment variables From 5f5eeec96bfa800ebdfba96daa9089cbffc8212b Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 18 Jan 2023 22:47:47 -0500 Subject: [PATCH 32/56] Add more to CMAKE_PREFIX_PATH on Windows --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c206927..1362b750 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -261,7 +261,7 @@ jobs: run: | python -m pip install aqtinstall python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 - Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" + Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake;$env:QT_DIR\lib\cmake\Qt5" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" @@ -306,7 +306,7 @@ jobs: run: | python -m pip install aqtinstall python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 - Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" + Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake;$env:QT_DIR\lib\cmake\Qt5" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" From 7838373d82e838e933d41a3cb61bdadb937fde83 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Wed, 18 Jan 2023 23:26:25 -0500 Subject: [PATCH 33/56] Remove bad brackets --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1362b750..8d7917b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -257,7 +257,7 @@ jobs: # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml - name: Install Qt5 env: - QT_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64}} + QT_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64 run: | python -m pip install aqtinstall python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 @@ -302,7 +302,7 @@ jobs: # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml - name: Install Qt5 env: - QT_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64}} + QT_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64 run: | python -m pip install aqtinstall python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 From 511d839dd44c2bdb34c1d46673b3a1781f40dba8 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Thu, 19 Jan 2023 00:57:24 -0500 Subject: [PATCH 34/56] Try another way of adding to env/path --- .github/workflows/build.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d7917b9..e85b05df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -261,12 +261,14 @@ jobs: run: | python -m pip install aqtinstall python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 - Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake;$env:QT_DIR\lib\cmake\Qt5" - Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" - Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" + "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake;$env:QT_DIR\lib\cmake\Qt5" >> $env:GITHUB_ENV + "${{ env.qt_dir }}" >> $env:GITHUB_PATH + "${{ env.qt_dir }}" >> $env:GITHUB_PATH + shell: pwsh - name: Build nvui and nvui_test run: | + echo $env:GITHUB_ENV .\vcpkg\bootstrap-vcpkg.bat -disableMetrics .\vcpkg\vcpkg install .\scripts\windows\build-debug.ps1 @@ -306,12 +308,15 @@ jobs: run: | python -m pip install aqtinstall python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 - Add-Content -Path $env:GITHUB_ENV -Value "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake;$env:QT_DIR\lib\cmake\Qt5" - Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}" - Add-Content -Path $env:GITHUB_PATH -Value "${{ env.qt_dir }}\bin" + "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake;$env:QT_DIR\lib\cmake\Qt5" >> $env:GITHUB_ENV + "${{ env.qt_dir }}" >> $env:GITHUB_PATH + "${{ env.qt_dir }}" >> $env:GITHUB_PATH + shell: pwsh - name: Package into a zip - run: .\scripts\windows\package.ps1 + run: | + echo $env:GITHUB_ENV + .\scripts\windows\package.ps1 - name: Upload artifact uses: actions/upload-artifact@v2 with: From aa9073159b87b5db692d0a4bf38ea8289642b7ec Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Thu, 19 Jan 2023 01:24:57 -0500 Subject: [PATCH 35/56] Use CMAKE_PREFIX_PATH env var in cmake command --- scripts/windows/build-debug.ps1 | 2 +- scripts/windows/build-release.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/windows/build-debug.ps1 b/scripts/windows/build-debug.ps1 index 70668604..5f656e51 100644 --- a/scripts/windows/build-debug.ps1 +++ b/scripts/windows/build-debug.ps1 @@ -4,6 +4,6 @@ param( [string]$gen = "Ninja" ) $generator = '"{0}"' -f $gen -$cmd = Write-Output "cmake . -B build -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator -DBUILD_TESTS=ON" +$cmd = Write-Output "cmake . -B build -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator -DBUILD_TESTS=ON -DCMAKE_PREFIX_PATH=""$env:CMAKE_PREFIX_PATH""" cmd /C $cmd cmake --build build --config Debug diff --git a/scripts/windows/build-release.ps1 b/scripts/windows/build-release.ps1 index c7686879..cd7cf645 100644 --- a/scripts/windows/build-release.ps1 +++ b/scripts/windows/build-release.ps1 @@ -4,6 +4,6 @@ param( [string]$gen = "Ninja" ) $generator = '"{0}"' -f $gen -$cmd = Write-Output "cmake . -B build -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator" +$cmd = Write-Output "cmake . -B build -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator -DCMAKE_PREFIX_PATH=""$env:CMAKE_PREFIX_PATH""" cmd /C $cmd cmake --build build --config Release From c9b1e9ff97537af2eb09964dd8b9a0a3de4e48b6 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Thu, 19 Jan 2023 02:03:46 -0500 Subject: [PATCH 36/56] Remove part of CMAKE_PREFIX_PATH --- .github/workflows/build.yml | 4 ++-- scripts/windows/build-debug.ps1 | 2 +- scripts/windows/build-release.ps1 | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e85b05df..353491bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -261,7 +261,7 @@ jobs: run: | python -m pip install aqtinstall python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 - "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake;$env:QT_DIR\lib\cmake\Qt5" >> $env:GITHUB_ENV + "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" >> $env:GITHUB_ENV "${{ env.qt_dir }}" >> $env:GITHUB_PATH "${{ env.qt_dir }}" >> $env:GITHUB_PATH shell: pwsh @@ -308,7 +308,7 @@ jobs: run: | python -m pip install aqtinstall python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 - "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake;$env:QT_DIR\lib\cmake\Qt5" >> $env:GITHUB_ENV + "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" >> $env:GITHUB_ENV "${{ env.qt_dir }}" >> $env:GITHUB_PATH "${{ env.qt_dir }}" >> $env:GITHUB_PATH shell: pwsh diff --git a/scripts/windows/build-debug.ps1 b/scripts/windows/build-debug.ps1 index 5f656e51..537aeecd 100644 --- a/scripts/windows/build-debug.ps1 +++ b/scripts/windows/build-debug.ps1 @@ -4,6 +4,6 @@ param( [string]$gen = "Ninja" ) $generator = '"{0}"' -f $gen -$cmd = Write-Output "cmake . -B build -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator -DBUILD_TESTS=ON -DCMAKE_PREFIX_PATH=""$env:CMAKE_PREFIX_PATH""" +$cmd = Write-Output "cmake . -B build -DCMAKE_PREFIX_PATH=""$env:CMAKE_PREFIX_PATH"" -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator -DBUILD_TESTS=ON" cmd /C $cmd cmake --build build --config Debug diff --git a/scripts/windows/build-release.ps1 b/scripts/windows/build-release.ps1 index cd7cf645..348c9918 100644 --- a/scripts/windows/build-release.ps1 +++ b/scripts/windows/build-release.ps1 @@ -4,6 +4,6 @@ param( [string]$gen = "Ninja" ) $generator = '"{0}"' -f $gen -$cmd = Write-Output "cmake . -B build -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator -DCMAKE_PREFIX_PATH=""$env:CMAKE_PREFIX_PATH""" +$cmd = Write-Output "cmake . -B build -DCMAKE_PREFIX_PATH=""$env:CMAKE_PREFIX_PATH"" -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator" cmd /C $cmd cmake --build build --config Release From 54b1acd2a4b5684a9081f002dfca9a25edf81f95 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Thu, 19 Jan 2023 02:22:00 -0500 Subject: [PATCH 37/56] Add CMAKE_PREFIX_PATH as env var instead of GITHUB_ENV --- .github/workflows/build.yml | 8 ++++++++ scripts/windows/package.ps1 | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 353491bb..7d50f01f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -267,7 +267,10 @@ jobs: shell: pwsh - name: Build nvui and nvui_test + env: + CMAKE_PREFIX_PATH: ${{ env.CMAKE_PREFIX_PATH }} run: | + echo $env echo $env:GITHUB_ENV .\vcpkg\bootstrap-vcpkg.bat -disableMetrics .\vcpkg\vcpkg install @@ -314,9 +317,14 @@ jobs: shell: pwsh - name: Package into a zip + env: + CMAKE_PREFIX_PATH: ${{ env.CMAKE_PREFIX_PATH }} run: | + echo $env echo $env:GITHUB_ENV + .\scripts\windows\build-release.ps1 .\scripts\windows\package.ps1 + - name: Upload artifact uses: actions/upload-artifact@v2 with: diff --git a/scripts/windows/package.ps1 b/scripts/windows/package.ps1 index 7e548855..8e6fc7b6 100644 --- a/scripts/windows/package.ps1 +++ b/scripts/windows/package.ps1 @@ -1,4 +1,3 @@ -./scripts/windows/build-release.ps1 cd build mkdir nvui cd nvui From e048dc536a4fd599e23f473e93307427440da082 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Thu, 19 Jan 2023 02:52:27 -0500 Subject: [PATCH 38/56] More dependencies for Ubuntu, try to use Qt5_Dir on Windows --- .github/workflows/build.yml | 6 ++++-- scripts/windows/build-debug.ps1 | 2 +- scripts/windows/build-release.ps1 | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7d50f01f..6a8b0d95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,6 +81,8 @@ jobs: libxkbcommon-x11-dev libglu1-mesa-dev libx11-xcb-dev '^libxcb.*-dev' libxrender-dev ninja-build curl zip unzip tar autopoint python2 autoconf-archive + libfreetype6-dev libfontconfig1-dev libxfixes-dev + libxkbcommon-dev libwayland-dev nodejs - name: Mac - Install vcpkg dependencies if: startsWith(matrix.os, 'macos') && matrix.use_vcpkg @@ -261,7 +263,7 @@ jobs: run: | python -m pip install aqtinstall python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 - "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" >> $env:GITHUB_ENV + "Qt5_DIR=$env:QT_DIR\lib\cmake\Qt5" >> $env:GITHUB_ENV "${{ env.qt_dir }}" >> $env:GITHUB_PATH "${{ env.qt_dir }}" >> $env:GITHUB_PATH shell: pwsh @@ -311,7 +313,7 @@ jobs: run: | python -m pip install aqtinstall python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 - "CMAKE_PREFIX_PATH=$env:QT_DIR;$env:QT_DIR\lib\cmake" >> $env:GITHUB_ENV + "Qt5_DIR=$env:QT_DIR\lib\cmake\Qt5" >> $env:GITHUB_ENV "${{ env.qt_dir }}" >> $env:GITHUB_PATH "${{ env.qt_dir }}" >> $env:GITHUB_PATH shell: pwsh diff --git a/scripts/windows/build-debug.ps1 b/scripts/windows/build-debug.ps1 index 537aeecd..f4a66a57 100644 --- a/scripts/windows/build-debug.ps1 +++ b/scripts/windows/build-debug.ps1 @@ -4,6 +4,6 @@ param( [string]$gen = "Ninja" ) $generator = '"{0}"' -f $gen -$cmd = Write-Output "cmake . -B build -DCMAKE_PREFIX_PATH=""$env:CMAKE_PREFIX_PATH"" -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator -DBUILD_TESTS=ON" +$cmd = Write-Output "cmake . -B build -DQt5_DIR=$env:Qt5_DIR -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator -DBUILD_TESTS=ON" cmd /C $cmd cmake --build build --config Debug diff --git a/scripts/windows/build-release.ps1 b/scripts/windows/build-release.ps1 index 348c9918..4c376081 100644 --- a/scripts/windows/build-release.ps1 +++ b/scripts/windows/build-release.ps1 @@ -4,6 +4,6 @@ param( [string]$gen = "Ninja" ) $generator = '"{0}"' -f $gen -$cmd = Write-Output "cmake . -B build -DCMAKE_PREFIX_PATH=""$env:CMAKE_PREFIX_PATH"" -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator" +$cmd = Write-Output "cmake . -B build -DQt5_DIR=$env:Qt5_DIR -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=$cc -DCMAKE_CXX_COMPILER=$cxx -G $generator" cmd /C $cmd cmake --build build --config Release From 74ea0481319e53213a3fbfe9365e4f6ade36bace Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Thu, 19 Jan 2023 17:17:51 -0500 Subject: [PATCH 39/56] Hardcode Qt5_DIR (hopefully this works --- .github/workflows/build.yml | 89 +++++++++++++++---------------------- 1 file changed, 37 insertions(+), 52 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a8b0d95..2a9130f7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -227,10 +227,19 @@ jobs: tag: ${{ github.ref }} overwrite: false body: "Automated release by Github Actions." - windows-debug: - runs-on: windows-latest + windows: strategy: fail-fast: false + matrix: + include: + - os: windows-latest + debug: true + upload: false + + - os: windows-latest + debug: false + upload: true + runs-on: ${{ matrix.os }} timeout-minutes: 500 env: buildDir: '${{ github.workspace }}/build' @@ -241,11 +250,14 @@ jobs: - uses: ilammy/msvc-dev-cmd@v1 with: sdk: 10.0.19041.0 + - name: Install Neovim Stable + if: matrix.debug run: choco install -y neovim + - name: Add Neovim to PATH + if: matrix.debug run: echo "C:\tools\neovim\Neovim\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - #- name: Restore deps from cache if they exist #uses: actions/cache@v2 #with: @@ -253,7 +265,7 @@ jobs: #build/vcpkg_installed #key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} #restore-keys: | - #${{ runner.os }}-build-debug-${{ hashFiles('vcpkg.json') }} + #${{ runner.os }}-build-release-${{ hashFiles('vcpkg.json') }} # Step was taken from Neovim-Qt's github actions workflow file # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml @@ -266,78 +278,51 @@ jobs: "Qt5_DIR=$env:QT_DIR\lib\cmake\Qt5" >> $env:GITHUB_ENV "${{ env.qt_dir }}" >> $env:GITHUB_PATH "${{ env.qt_dir }}" >> $env:GITHUB_PATH - shell: pwsh - - name: Build nvui and nvui_test + - name: Package into a zip (Release) + if: ${{ !matrix.debug }} env: CMAKE_PREFIX_PATH: ${{ env.CMAKE_PREFIX_PATH }} + Qt5_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64\lib\cmake\Qt5 + run: | + echo $env + echo $env:GITHUB_ENV + .\scripts\windows\build-release.ps1 + .\scripts\windows\package.ps1 + + - name: Build nvui and nvui_test (Debug) + if: matrix.debug + env: + CMAKE_PREFIX_PATH: ${{ env.CMAKE_PREFIX_PATH }} + Qt5_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64\lib\cmake\Qt5 run: | echo $env echo $env:GITHUB_ENV .\vcpkg\bootstrap-vcpkg.bat -disableMetrics .\vcpkg\vcpkg install .\scripts\windows\build-debug.ps1 + - name: Run tests + if: matrix.debug run: | cd build .\nvui_test shell: cmd - windows-release: - runs-on: windows-latest - strategy: - fail-fast: false - timeout-minutes: 500 - env: - buildDir: '${{ github.workspace }}/build' - steps: - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - uses: ilammy/msvc-dev-cmd@v1 - with: - sdk: 10.0.19041.0 - #- name: Restore deps from cache if they exist - #uses: actions/cache@v2 - #with: - #path: | - #build/vcpkg_installed - #key: ${{ runner.os }}-${{ hashFiles('vcpkg.json') }} - #restore-keys: | - #${{ runner.os }}-build-release-${{ hashFiles('vcpkg.json') }} - - # Step was taken from Neovim-Qt's github actions workflow file - # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml - - name: Install Qt5 - env: - QT_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64 - run: | - python -m pip install aqtinstall - python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 - "Qt5_DIR=$env:QT_DIR\lib\cmake\Qt5" >> $env:GITHUB_ENV - "${{ env.qt_dir }}" >> $env:GITHUB_PATH - "${{ env.qt_dir }}" >> $env:GITHUB_PATH - shell: pwsh - - - name: Package into a zip - env: - CMAKE_PREFIX_PATH: ${{ env.CMAKE_PREFIX_PATH }} - run: | - echo $env - echo $env:GITHUB_ENV - .\scripts\windows\build-release.ps1 - .\scripts\windows\package.ps1 - name: Upload artifact + if: matrix.upload uses: actions/upload-artifact@v2 with: name: nvui-win64 if-no-files-found: ignore path: build/nvui + - name: Rename nvui.zip to nvui-win64.zip for release upload - if: startsWith(github.ref, 'refs/tags/') + if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.upload }} run: ren nvui.zip nvui-win64.zip + - name: Upload Release asset - if: startsWith(github.ref, 'refs/tags/') + if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.upload }} uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} From f6735419ed4f90ee2b64730c0278e97ee78b471a Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Thu, 19 Jan 2023 17:42:30 -0500 Subject: [PATCH 40/56] Bring windows debug & release builds more together --- .github/workflows/build.yml | 53 +++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2a9130f7..dbd573d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,8 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-latest + - name: Ubuntu Debug + os: ubuntu-latest buildtype: 'Debug' cc: clang-12 cxx: clang++-12 @@ -15,7 +16,8 @@ jobs: upload: false cmakeflags: '-DBUILD_TESTS=ON' - - os: ubuntu-latest + - name: Ubuntu Release + os: ubuntu-latest buildtype: 'Release' cc: clang-12 cxx: clang++-12 @@ -24,7 +26,8 @@ jobs: use_vcpkg: true cmakeflags: '' - - os: macos-10.15 + - name: Macos Debug + os: macos-10.15 buildtype: 'Debug' cc: clang cxx: clang++ @@ -32,7 +35,8 @@ jobs: upload: false cmakeflags: '-DBUILD_TESTS=ON' - - os: macos-10.15 + - name: Macos Release + os: macos-10.15 buildtype: 'Release' cc: clang cxx: clang++ @@ -232,13 +236,25 @@ jobs: fail-fast: false matrix: include: - - os: windows-latest + - name: Windows Release + os: windows-latest + buildtype: 'Release' debug: true upload: false + cmakeflags: '' + c: clang + cpp: clang++ + gen: Ninja - - os: windows-latest + - name: Windows Debug + os: windows-latest + buildtype: 'Debug' debug: false upload: true + cmakeflags: '-DBUILD_TESTS=ON' + c: clang + cpp: clang++ + gen: Ninja runs-on: ${{ matrix.os }} timeout-minutes: 500 env: @@ -279,28 +295,15 @@ jobs: "${{ env.qt_dir }}" >> $env:GITHUB_PATH "${{ env.qt_dir }}" >> $env:GITHUB_PATH - - name: Package into a zip (Release) + - name: Build nvui (& nvui_test in Debug mode) if: ${{ !matrix.debug }} env: CMAKE_PREFIX_PATH: ${{ env.CMAKE_PREFIX_PATH }} Qt5_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64\lib\cmake\Qt5 run: | - echo $env - echo $env:GITHUB_ENV - .\scripts\windows\build-release.ps1 - .\scripts\windows\package.ps1 - - - name: Build nvui and nvui_test (Debug) - if: matrix.debug - env: - CMAKE_PREFIX_PATH: ${{ env.CMAKE_PREFIX_PATH }} - Qt5_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64\lib\cmake\Qt5 - run: | - echo $env - echo $env:GITHUB_ENV - .\vcpkg\bootstrap-vcpkg.bat -disableMetrics - .\vcpkg\vcpkg install - .\scripts\windows\build-debug.ps1 + cmake -B build . -DQt5_DIR=${{ env.Qt5_DIR }} -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} ${{ matrix.cmakeflags }} -DCMAKE_C_COMPILER=${{ matrix.c }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp }} -G ${{ matrix.gen }} + cmake --build build --config ${{ matrix.buildtype }} + shell: cmd - name: Run tests if: matrix.debug @@ -309,6 +312,10 @@ jobs: .\nvui_test shell: cmd + - name: Package nvui (Release) + if: ${{ !matrix.debug }} + run: .\scripts\windows\package.ps1 + - name: Upload artifact if: matrix.upload uses: actions/upload-artifact@v2 From b889e03fc5960f612cb2e1dacfb3f7ecad6f582b Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Thu, 19 Jan 2023 17:54:55 -0500 Subject: [PATCH 41/56] Fix switching up of Debug & Release for windows actions --- .github/workflows/build.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dbd573d0..b817a7db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -239,8 +239,8 @@ jobs: - name: Windows Release os: windows-latest buildtype: 'Release' - debug: true - upload: false + debug: false + upload: true cmakeflags: '' c: clang cpp: clang++ @@ -249,8 +249,8 @@ jobs: - name: Windows Debug os: windows-latest buildtype: 'Debug' - debug: false - upload: true + debug: true + upload: false cmakeflags: '-DBUILD_TESTS=ON' c: clang cpp: clang++ @@ -296,10 +296,9 @@ jobs: "${{ env.qt_dir }}" >> $env:GITHUB_PATH - name: Build nvui (& nvui_test in Debug mode) - if: ${{ !matrix.debug }} env: CMAKE_PREFIX_PATH: ${{ env.CMAKE_PREFIX_PATH }} - Qt5_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64\lib\cmake\Qt5 + Qt5_DIR: '.\5.15.2\msvc2019_64\lib\cmake\Qt5' run: | cmake -B build . -DQt5_DIR=${{ env.Qt5_DIR }} -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} ${{ matrix.cmakeflags }} -DCMAKE_C_COMPILER=${{ matrix.c }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp }} -G ${{ matrix.gen }} cmake --build build --config ${{ matrix.buildtype }} From ce2a433c0494d3f347a0bf52cf954c35f2635a30 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Thu, 19 Jan 2023 18:06:43 -0500 Subject: [PATCH 42/56] Fix Qt5 directory (?) --- .github/workflows/build.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b817a7db..d53ef578 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -287,7 +287,7 @@ jobs: # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml - name: Install Qt5 env: - QT_DIR: ${{ github.workspace }}\5.15.2\msvc2019_64 + QT_DIR: ${{ github.workspace }}\Qt\5.15.2\msvc2019_64 run: | python -m pip install aqtinstall python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 @@ -296,9 +296,6 @@ jobs: "${{ env.qt_dir }}" >> $env:GITHUB_PATH - name: Build nvui (& nvui_test in Debug mode) - env: - CMAKE_PREFIX_PATH: ${{ env.CMAKE_PREFIX_PATH }} - Qt5_DIR: '.\5.15.2\msvc2019_64\lib\cmake\Qt5' run: | cmake -B build . -DQt5_DIR=${{ env.Qt5_DIR }} -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} ${{ matrix.cmakeflags }} -DCMAKE_C_COMPILER=${{ matrix.c }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp }} -G ${{ matrix.gen }} cmake --build build --config ${{ matrix.buildtype }} From 6f2e2cabee322b98f5fab5e572e6b8509e281419 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Thu, 19 Jan 2023 18:42:49 -0500 Subject: [PATCH 43/56] Back to installing qt5-base through vcpkg on Windows --- .github/workflows/build.yml | 18 +++++++++--------- vcpkg.json | 6 ++---- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d53ef578..756c0ab7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -285,15 +285,15 @@ jobs: # Step was taken from Neovim-Qt's github actions workflow file # at https://github.com/equalsraf/neovim-qt/blob/master/.github/workflows/build-test.yml - - name: Install Qt5 - env: - QT_DIR: ${{ github.workspace }}\Qt\5.15.2\msvc2019_64 - run: | - python -m pip install aqtinstall - python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 - "Qt5_DIR=$env:QT_DIR\lib\cmake\Qt5" >> $env:GITHUB_ENV - "${{ env.qt_dir }}" >> $env:GITHUB_PATH - "${{ env.qt_dir }}" >> $env:GITHUB_PATH + #- name: Install Qt5 + #env: + #QT_DIR: ${{ github.workspace }}\Qt\5.15.2\msvc2019_64 + #run: | + #python -m pip install aqtinstall + #python -m aqt install-qt -O ./Qt windows desktop 5.15.2 win64_msvc2019_64 + #"Qt5_DIR=$env:QT_DIR\lib\cmake\Qt5" >> $env:GITHUB_ENV + #"${{ env.qt_dir }}" >> $env:GITHUB_PATH + #"${{ env.qt_dir }}" >> $env:GITHUB_PATH - name: Build nvui (& nvui_test in Debug mode) run: | diff --git a/vcpkg.json b/vcpkg.json index 84997857..d58e5125 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -6,12 +6,10 @@ "fmt", "msgpack", { - "name": "qt5-base", - "platform": "!windows" + "name": "qt5-base" }, { - "name": "qt5-svg", - "platform": "!windows" + "name": "qt5-svg" }, "boost-process", "boost-container" From dd2ea8c0a4173488943cd91aea1343cb0d8daeb7 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Thu, 19 Jan 2023 22:48:20 -0500 Subject: [PATCH 44/56] Try using C drive on Windows for more space --- .github/workflows/build.yml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 756c0ab7..e154a271 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -257,12 +257,15 @@ jobs: gen: Ninja runs-on: ${{ matrix.os }} timeout-minutes: 500 - env: - buildDir: '${{ github.workspace }}/build' steps: - uses: actions/checkout@v2 with: submodules: 'recursive' + - name: Move repo to C drive (apparently, has more space?) + run: | + cd .. + Move-Item -Path .\nvui -Destination C:\nvui + - uses: ilammy/msvc-dev-cmd@v1 with: sdk: 10.0.19041.0 @@ -273,7 +276,8 @@ jobs: - name: Add Neovim to PATH if: matrix.debug - run: echo "C:\tools\neovim\Neovim\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + run: | + "C:\tools\neovim\Neovim\bin" >> $env:GITHUB_PATH #- name: Restore deps from cache if they exist #uses: actions/cache@v2 #with: @@ -297,20 +301,24 @@ jobs: - name: Build nvui (& nvui_test in Debug mode) run: | - cmake -B build . -DQt5_DIR=${{ env.Qt5_DIR }} -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} ${{ matrix.cmakeflags }} -DCMAKE_C_COMPILER=${{ matrix.c }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp }} -G ${{ matrix.gen }} + cd C:\nvui + cmake -B build . -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} ${{ matrix.cmakeflags }} -DCMAKE_C_COMPILER=${{ matrix.c }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp }} -G ${{ matrix.gen }} cmake --build build --config ${{ matrix.buildtype }} shell: cmd - name: Run tests if: matrix.debug run: | + cd C:\nvui cd build .\nvui_test shell: cmd - name: Package nvui (Release) if: ${{ !matrix.debug }} - run: .\scripts\windows\package.ps1 + run: | + cd C:\nvui + .\scripts\windows\package.ps1 - name: Upload artifact if: matrix.upload @@ -318,18 +326,20 @@ jobs: with: name: nvui-win64 if-no-files-found: ignore - path: build/nvui + path: C:/nvui/build/nvui - name: Rename nvui.zip to nvui-win64.zip for release upload if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.upload }} - run: ren nvui.zip nvui-win64.zip + run: | + cd C:\nvui + ren nvui.zip nvui-win64.zip - name: Upload Release asset if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.upload }} uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: nvui-win64.zip + file: C:\nvui\nvui-win64.zip tag: ${{ github.ref }} overwrite: false body: "Automated release by Github Actions." From 6a9fa2a734019c5edd4bd54f01a01fbd4b0ca195 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Fri, 20 Jan 2023 00:43:34 -0500 Subject: [PATCH 45/56] Clone repo to C and use working-directory property --- .github/workflows/build.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e154a271..0c60b9ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -258,15 +258,14 @@ jobs: runs-on: ${{ matrix.os }} timeout-minutes: 500 steps: - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - name: Move repo to C drive (apparently, has more space?) + - name: Clone repo to C drive run: | - cd .. - Move-Item -Path .\nvui -Destination C:\nvui + git clone --recurse-submodules ${{ github.repositoryUrl }} C:\nvui + cd C:\nvui + git checkout ${{ github.sha }} - uses: ilammy/msvc-dev-cmd@v1 + working-directory: C:/nvui with: sdk: 10.0.19041.0 @@ -300,46 +299,48 @@ jobs: #"${{ env.qt_dir }}" >> $env:GITHUB_PATH - name: Build nvui (& nvui_test in Debug mode) + working-directory: C:/nvui run: | - cd C:\nvui cmake -B build . -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} ${{ matrix.cmakeflags }} -DCMAKE_C_COMPILER=${{ matrix.c }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp }} -G ${{ matrix.gen }} cmake --build build --config ${{ matrix.buildtype }} shell: cmd - name: Run tests + working-directory: C:/nvui if: matrix.debug run: | - cd C:\nvui cd build .\nvui_test shell: cmd - name: Package nvui (Release) + working-directory: C:/nvui if: ${{ !matrix.debug }} run: | - cd C:\nvui .\scripts\windows\package.ps1 - name: Upload artifact + working-directory: C:/nvui if: matrix.upload uses: actions/upload-artifact@v2 with: name: nvui-win64 if-no-files-found: ignore - path: C:/nvui/build/nvui + path: build/nvui - name: Rename nvui.zip to nvui-win64.zip for release upload + working-directory: C:/nvui if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.upload }} run: | - cd C:\nvui ren nvui.zip nvui-win64.zip - name: Upload Release asset + working-directory: C:/nvui if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.upload }} uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: C:\nvui\nvui-win64.zip + file: nvui-win64.zip tag: ${{ github.ref }} overwrite: false body: "Automated release by Github Actions." From dc886f3527c0f35a7a7246b0451e0aae98df90bc Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Fri, 20 Jan 2023 00:53:47 -0500 Subject: [PATCH 46/56] Remove working-directory for uses steps --- .github/workflows/build.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c60b9ee..83364739 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -265,7 +265,6 @@ jobs: git checkout ${{ github.sha }} - uses: ilammy/msvc-dev-cmd@v1 - working-directory: C:/nvui with: sdk: 10.0.19041.0 @@ -320,7 +319,6 @@ jobs: .\scripts\windows\package.ps1 - name: Upload artifact - working-directory: C:/nvui if: matrix.upload uses: actions/upload-artifact@v2 with: @@ -335,12 +333,11 @@ jobs: ren nvui.zip nvui-win64.zip - name: Upload Release asset - working-directory: C:/nvui if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.upload }} uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: nvui-win64.zip + file: C:\nvui\nvui-win64.zip tag: ${{ github.ref }} overwrite: false body: "Automated release by Github Actions." From 38ce1cca702219a6aa185cc777eb0fe5a9f36052 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Fri, 20 Jan 2023 00:57:23 -0500 Subject: [PATCH 47/56] Use https github repository url --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 83364739..fda315ff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -260,7 +260,7 @@ jobs: steps: - name: Clone repo to C drive run: | - git clone --recurse-submodules ${{ github.repositoryUrl }} C:\nvui + git clone --recurse-submodules https://github.com/rohit-px2/nvui.git C:\nvui cd C:\nvui git checkout ${{ github.sha }} From 55ec9e980a7df30bd8ff324c8f6e7d4d5eda84aa Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Fri, 20 Jan 2023 01:14:51 -0500 Subject: [PATCH 48/56] Bootstrap vcpkg before running cmake --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fda315ff..da41d71a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -300,6 +300,7 @@ jobs: - name: Build nvui (& nvui_test in Debug mode) working-directory: C:/nvui run: | + .\vcpkg\bootstrap-vcpkg.bat -disableMetrics cmake -B build . -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} ${{ matrix.cmakeflags }} -DCMAKE_C_COMPILER=${{ matrix.c }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp }} -G ${{ matrix.gen }} cmake --build build --config ${{ matrix.buildtype }} shell: cmd From 46e66bc6a8c526a7206606b74f1ece1af7e1a3c2 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Fri, 20 Jan 2023 01:58:11 -0500 Subject: [PATCH 49/56] Update vcpkg submodule after checkout --- .github/workflows/build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da41d71a..20badeaa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -263,6 +263,8 @@ jobs: git clone --recurse-submodules https://github.com/rohit-px2/nvui.git C:\nvui cd C:\nvui git checkout ${{ github.sha }} + git submodule init + git submodule update - uses: ilammy/msvc-dev-cmd@v1 with: @@ -297,10 +299,13 @@ jobs: #"${{ env.qt_dir }}" >> $env:GITHUB_PATH #"${{ env.qt_dir }}" >> $env:GITHUB_PATH + - name: Bootstrap vcpkg before build + working-directory: C:/nvui + run: .\vcpkg\bootstrap-vcpkg.bat -disableMetrics + - name: Build nvui (& nvui_test in Debug mode) working-directory: C:/nvui run: | - .\vcpkg\bootstrap-vcpkg.bat -disableMetrics cmake -B build . -DCMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} ${{ matrix.cmakeflags }} -DCMAKE_C_COMPILER=${{ matrix.c }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp }} -G ${{ matrix.gen }} cmake --build build --config ${{ matrix.buildtype }} shell: cmd From 1ad92867ead00a0db0d88afc882e905351b49ad0 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Fri, 20 Jan 2023 03:44:51 -0500 Subject: [PATCH 50/56] Fix PR build and Ubuntu (?) --- .github/workflows/build.yml | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 20badeaa..21c0ce5d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,13 +80,21 @@ jobs: - name: Ubuntu - Install vcpkg dependencies if: startsWith(matrix.os, 'ubuntu') && matrix.use_vcpkg run: > - sudo apt-get install gperf autoconf build-essential libtool - libgl1-mesa-dev libxi-dev libx11-dev libxext-dev - libxkbcommon-x11-dev libglu1-mesa-dev libx11-xcb-dev - '^libxcb.*-dev' libxrender-dev ninja-build curl - zip unzip tar autopoint python2 autoconf-archive - libfreetype6-dev libfontconfig1-dev libxfixes-dev - libxkbcommon-dev libwayland-dev nodejs + sudo apt-get install git curl zip unzip tar at libxt-dev gperf libxaw7-dev cifs-utils + build-essential g++ gfortran libx11-dev libxkbcommon-x11-dev libxi-dev + libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxinerama-dev libxxf86vm-dev + libxcursor-dev yasm libnuma1 libnuma-dev libtool-bin + flex bison libbison-dev autoconf libudev-dev libncurses5-dev libtool libxrandr-dev + xutils-dev dh-autoreconf autoconf-archive libgles2-mesa-dev ruby-full + libxext-dev libxfixes-dev libxrender-dev + libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-util0-devpkg-config meson nasm cmake ninja-build + libxkbcommon-dev libxcb-keysyms1-dev + libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev + libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev + libxcb-render-util0-dev libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev + libxcb-cursor-dev libkrb5-dev libxcb-res0-dev libxcb-keysyms1-dev libxcb-xkb-dev libxcb-record0-dev + python3-setuptools python3-mako python3-pip python3-venv nodejs libwayland-dev python2 python-is-python3 + guile-2.2-dev libxdamage-dev libdbus-1-dev libxtst-dev haskell-stack python-yaml libkrb5-3 zlib1g libicu66 - name: Mac - Install vcpkg dependencies if: startsWith(matrix.os, 'macos') && matrix.use_vcpkg @@ -258,11 +266,20 @@ jobs: runs-on: ${{ matrix.os }} timeout-minutes: 500 steps: + - name: Set last commit hash as environment variable (push) + if: ${{ github.event_name == 'push' }} + run: | + "COMMIT_SHA=${{ github.sha }}" >> $env:GITHUB_ENV + - name: Set last commit hash as environment variable (pull request) + if: ${{ github.event_name == 'pull_request' }} + run: | + "COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> $env:GITHUB_ENV + - name: Clone repo to C drive run: | git clone --recurse-submodules https://github.com/rohit-px2/nvui.git C:\nvui cd C:\nvui - git checkout ${{ github.sha }} + git checkout $env:COMMIT_SHA git submodule init git submodule update From 425f00aa99815f58e6374ff070b60e664b486b61 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Fri, 20 Jan 2023 11:09:47 -0500 Subject: [PATCH 51/56] Remove missing packages, use old way to add to PATH --- .github/workflows/build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 21c0ce5d..e2b71b46 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,14 +87,15 @@ jobs: flex bison libbison-dev autoconf libudev-dev libncurses5-dev libtool libxrandr-dev xutils-dev dh-autoreconf autoconf-archive libgles2-mesa-dev ruby-full libxext-dev libxfixes-dev libxrender-dev - libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-util0-devpkg-config meson nasm cmake ninja-build + libxcb1-dev libx11-xcb-dev libxcb-glx0-dev meson nasm cmake ninja-build libxkbcommon-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev libxcb-cursor-dev libkrb5-dev libxcb-res0-dev libxcb-keysyms1-dev libxcb-xkb-dev libxcb-record0-dev python3-setuptools python3-mako python3-pip python3-venv nodejs libwayland-dev python2 python-is-python3 - guile-2.2-dev libxdamage-dev libdbus-1-dev libxtst-dev haskell-stack python-yaml libkrb5-3 zlib1g libicu66 + guile-2.2-dev libxdamage-dev libdbus-1-dev libxtst-dev haskell-stack libkrb5-3 zlib1g + # libicu66 python-yaml libxcb-util0-devpkg-config - name: Mac - Install vcpkg dependencies if: startsWith(matrix.os, 'macos') && matrix.use_vcpkg @@ -294,7 +295,7 @@ jobs: - name: Add Neovim to PATH if: matrix.debug run: | - "C:\tools\neovim\Neovim\bin" >> $env:GITHUB_PATH + echo "C:\tools\neovim\Neovim\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append #- name: Restore deps from cache if they exist #uses: actions/cache@v2 #with: From f757f8ff0ebd882e568131b3de3b3bca68561215 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Fri, 20 Jan 2023 14:48:19 -0500 Subject: [PATCH 52/56] Add back some packages (had a typo) --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e2b71b46..6411d0ff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -95,7 +95,8 @@ jobs: libxcb-cursor-dev libkrb5-dev libxcb-res0-dev libxcb-keysyms1-dev libxcb-xkb-dev libxcb-record0-dev python3-setuptools python3-mako python3-pip python3-venv nodejs libwayland-dev python2 python-is-python3 guile-2.2-dev libxdamage-dev libdbus-1-dev libxtst-dev haskell-stack libkrb5-3 zlib1g - # libicu66 python-yaml libxcb-util0-devpkg-config + libxcb-util0-dev pkg-config + # libicu66 python-yaml - name: Mac - Install vcpkg dependencies if: startsWith(matrix.os, 'macos') && matrix.use_vcpkg From ffaa540683b85a2d876153884e5c0ae5e0ba44de Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Sat, 21 Jan 2023 01:53:05 -0500 Subject: [PATCH 53/56] Use specific versions for unix OSes --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6411d0ff..ba03c9a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: matrix: include: - name: Ubuntu Debug - os: ubuntu-latest + os: ubuntu-20.04 buildtype: 'Debug' cc: clang-12 cxx: clang++-12 @@ -17,7 +17,7 @@ jobs: cmakeflags: '-DBUILD_TESTS=ON' - name: Ubuntu Release - os: ubuntu-latest + os: ubuntu-20.04 buildtype: 'Release' cc: clang-12 cxx: clang++-12 @@ -27,7 +27,7 @@ jobs: cmakeflags: '' - name: Macos Debug - os: macos-10.15 + os: macos-11 buildtype: 'Debug' cc: clang cxx: clang++ @@ -36,7 +36,7 @@ jobs: cmakeflags: '-DBUILD_TESTS=ON' - name: Macos Release - os: macos-10.15 + os: macos-11 buildtype: 'Release' cc: clang cxx: clang++ @@ -296,7 +296,7 @@ jobs: - name: Add Neovim to PATH if: matrix.debug run: | - echo "C:\tools\neovim\Neovim\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "C:\tools\neovim\nvim-win64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append #- name: Restore deps from cache if they exist #uses: actions/cache@v2 #with: From b2e6696e416787b78447fc628a0d012bdff2c634 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Sat, 21 Jan 2023 02:13:11 -0500 Subject: [PATCH 54/56] Nevermind use macos 10.15 for now --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba03c9a5..73d7c79c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,7 @@ jobs: cmakeflags: '' - name: Macos Debug - os: macos-11 + os: macos-10.15 buildtype: 'Debug' cc: clang cxx: clang++ @@ -36,7 +36,7 @@ jobs: cmakeflags: '-DBUILD_TESTS=ON' - name: Macos Release - os: macos-11 + os: macos-10.15 buildtype: 'Release' cc: clang cxx: clang++ From 01cb5fc10406529fee221d78a27634f6498f006a Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Tue, 31 Jan 2023 20:19:02 -0500 Subject: [PATCH 55/56] Install libicu66 --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73d7c79c..cfcd8712 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -95,8 +95,8 @@ jobs: libxcb-cursor-dev libkrb5-dev libxcb-res0-dev libxcb-keysyms1-dev libxcb-xkb-dev libxcb-record0-dev python3-setuptools python3-mako python3-pip python3-venv nodejs libwayland-dev python2 python-is-python3 guile-2.2-dev libxdamage-dev libdbus-1-dev libxtst-dev haskell-stack libkrb5-3 zlib1g - libxcb-util0-dev pkg-config - # libicu66 python-yaml + libxcb-util0-dev pkg-config libicu66 + # python-yaml - name: Mac - Install vcpkg dependencies if: startsWith(matrix.os, 'macos') && matrix.use_vcpkg From 1599b3109a9268263a162d7faa2ac52f0ee46fc8 Mon Sep 17 00:00:00 2001 From: Rohit Pradhan Date: Tue, 31 Jan 2023 20:28:46 -0500 Subject: [PATCH 56/56] Require boost thread component --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f14d137a..58c5b78d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,7 @@ if (WIN32) ) list(APPEND SOURCES ${WINONLYSOURCES}) endif() -find_package(Boost COMPONENTS filesystem REQUIRED) +find_package(Boost COMPONENTS filesystem thread REQUIRED) if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Release") add_executable(nvui WIN32 "assets/icons/desktop/neovim_icon.rc" "src/main.cpp" ${SOURCES}) else()