From 8ddabbf609dd2d9877b05412de4add0565ae6467 Mon Sep 17 00:00:00 2001 From: Dadoum Date: Wed, 25 Oct 2023 01:21:43 +0200 Subject: [PATCH] Attempt to fix Windows build --- .github/workflows/build-qt.yml | 10 ++++++---- dub.json | 4 ++-- qt/frontend.d | 19 ++++--------------- source/main.d | 2 +- windows/common/logging.d | 1 - 5 files changed, 13 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build-qt.yml b/.github/workflows/build-qt.yml index c50d7c3..fa877f2 100644 --- a/.github/workflows/build-qt.yml +++ b/.github/workflows/build-qt.yml @@ -281,6 +281,7 @@ jobs: - name: Set-up Qt for cross-compilation run: cp -r $Qt5_DIR/lib/* $HOME/ldc2-1.33.0-windows-x64/lib + ln ldc2-1.33.0-windows-x64/lib/msvcrt.lib ldc2-1.33.0-windows-x64/lib/MSVCRT.lib - name: Write version file run: echo 'module version_string; enum versionStr = "Sideloader automated build, branch ${{ github.ref_name }}, commit ${{ github.sha }}";' > source/version_string.d @@ -290,12 +291,13 @@ jobs: - name: Rename run: | - mv "${{github.workspace}}/bin/sideloader.exe" "${{github.workspace}}/bin/sideloader-windows-x86_64.exe" - mv "${{github.workspace}}/bin/sideloader.pdb" "${{github.workspace}}/bin/sideloader-windows-x86_64.pdb" + mkdir "${{github.workspace}}/bin/platforms" + cp $Qt5_DIR/plugins/platforms/qwindows.dll "${{github.workspace}}/bin/platforms" + cp $Qt5_DIR/bin/Qt5Core.dll $Qt5_DIR/bin/Qt5Gui.dll $Qt5_DIR/bin/Qt5Widgets.dll "${{github.workspace}}/bin" + zip -r sideloader-windows.zip bin/* - uses: actions/upload-artifact@v3 with: name: sideloader-windows-x86_64 path: | - ${{github.workspace}}/bin/sideloader-windows-x86_64.exe - ${{github.workspace}}/bin/sideloader-windows-x86_64.pdb + ${{github.workspace}}/sideloader-windows.zip diff --git a/dub.json b/dub.json index b34db52..789de94 100644 --- a/dub.json +++ b/dub.json @@ -90,8 +90,8 @@ ], "libs-windows": [ - "ucrtbase", - "msvcrt120", + "vcruntime140", + "Qt5Bootstrap", "Qt5Core", "Qt5Gui", "Qt5Widgets" diff --git a/qt/frontend.d b/qt/frontend.d index dbffd1e..49ca129 100644 --- a/qt/frontend.d +++ b/qt/frontend.d @@ -52,21 +52,10 @@ shared class QtFrontend: Frontend { version (Windows) { configureSegfaultHandler(); } - try { - scope qtApp = new QApplication(Runtime.cArgs.argc, Runtime.cArgs.argv); - // version (OSX) { - // QDir plugInDir = QCoreApplication.applicationDirPath(); - // plugInDir.cdUp(); - // plugInDir.cd(QString("plugins")); - // QCoreApplication.setLibraryPaths(QStringList(plugInDir.absolutePath())); - // } - auto w = new MainWindow(); - w.show(); - return qtApp.exec(); - } catch (Exception ex) { - getLogger().errorF!"Unhandled exception: %s"(ex); - throw ex; - } + scope qtApp = new QApplication(Runtime.cArgs.argc, Runtime.cArgs.argv); + auto w = new MainWindow(); + w.show(); + return qtApp.exec(); } } diff --git a/source/main.d b/source/main.d index 7e0f06e..bda3dc4 100644 --- a/source/main.d +++ b/source/main.d @@ -47,8 +47,8 @@ int main(string[] args) { signal(SIGSEGV, cast(Parameters!signal[1]) &SIGSEGV_trace); - frontend = native_frontend.makeFrontend(); log.info(versionStr); + frontend = native_frontend.makeFrontend(); log.infoF!"Configuration path: %s"(frontend.configurationPath()); if (!file.exists(frontend.configurationPath)) { file.mkdirRecurse(frontend.configurationPath); diff --git a/windows/common/logging.d b/windows/common/logging.d index 7b95ace..5c9eafc 100644 --- a/windows/common/logging.d +++ b/windows/common/logging.d @@ -17,7 +17,6 @@ class OutputDebugStringLogHandler : LogHandler { // if (msg.level.value >= Levels.ERROR.value) { // OutputDebugStringA(logStr.toStringz()); // } else { - writeln(logStr); OutputDebugStringA(logStr.toStringz()); // } }