summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2025-08-25 00:23:44 -0400
committerpommicket <pommicket@gmail.com>2025-08-25 00:23:44 -0400
commit22930a350cfefb1eff33d7d2207e387bf16021a2 (patch)
treea3dbc544d8f3cdaaad8934f0e9215bcd3dffa5fe
parent16dcf619a2e632c2f8e427cc93e505ed2fdc56c4 (diff)
Various fixes for windows build
-rw-r--r--mingw-build.sh31
-rw-r--r--quacker/macondobackend.cpp32
-rw-r--r--quacker/macondobackend.h2
3 files changed, 42 insertions, 23 deletions
diff --git a/mingw-build.sh b/mingw-build.sh
new file mode 100644
index 0000000..685fac6
--- /dev/null
+++ b/mingw-build.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# Build Quackle and copy required DLLs, data files
+# Intended for MinGW UCRT shell
+if [ "$1" = '' ]; then
+ MODE=RelWithDebInfo
+else
+ MODE=$1
+fi
+[ "$MACONDO" = '' ] && MACONDO="$(pwd)/macondo"
+pacman --needed -S mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-qt5-base mingw-w64-ucrt-x86_64-gcc
+mkdir -p quacker/build
+cd quacker/build
+cmake -DCMAKE_BUILD_TYPE=$MODE ..
+ninja
+mkdir -p $MODE
+cp Quackle.exe $MODE/
+for file in Qt5Core.dll Qt5Gui.dll Qt5Widgets.dll libbrotlicommon.dll libbrotlidec.dll libbz2-1.dll libdouble-conversion.dll \
+ libfreetype-6.dll libgcc_s_seh-1.dll libglib-2.0-0.dll libgraphite2.dll libharfbuzz-0.dll libiconv-2.dll \
+ libicudt77.dll libicuin77.dll libicuuc77.dll libintl-8.dll libmd4c.dll libpcre2-16-0.dll libpcre2-8-0.dll \
+ libpng16-16.dll libstdc++-6.dll libwinpthread-1.dll libzstd.dll zlib1.dll; do
+ cp /ucrt64/bin/$file $MODE/
+done
+rm -rf $MODE/data
+cp -r ../../data $MODE/
+rm -rf $MODE/macondo
+cp -r "$MACONDO" $MODE/
+for folder in styles imageformats platforms; do
+ rm -rf $MODE/$folder
+ cp -r /ucrt64/share/qt5/plugins/$folder $MODE/
+done
diff --git a/quacker/macondobackend.cpp b/quacker/macondobackend.cpp
index faa4ca8..ef1b6dd 100644
--- a/quacker/macondobackend.cpp
+++ b/quacker/macondobackend.cpp
@@ -108,35 +108,33 @@ MacondoBackend::MacondoBackend(Quackle::Game *game, const MacondoInitOptions &op
m_updateTimer->start();
}
-bool MacondoBackend::startProcess() {
+bool MacondoBackend::startProcess(Command command) {
if (m_process) return true;
+ m_command = command;
m_process = new QProcess(this);
QStringList args;
- m_process->start(m_execPath.c_str(), args);
connect(m_process, SIGNAL(started()), this, SLOT(processStarted()));
connect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus)));
+ m_process->start(m_execPath.c_str(), args, QIODevice::Unbuffered | QIODevice::Text | QIODevice::ReadWrite);
return true;
}
bool MacondoBackend::simulate(const MacondoSimulateOptions &options, const Quackle::MoveList &moves) {
- if (!startProcess())
- return false;
m_movesToLoad = moves;
- m_command = Command::Simulate;
+ if (!startProcess(Command::Simulate))
+ return false;
return true;
}
void MacondoBackend::solveEndgame(const MacondoEndgameOptions &options) {
m_endgameOptions = options;
- startProcess();
- m_command = Command::SolveEndgame;
+ startProcess(Command::SolveEndgame);
}
void MacondoBackend::solvePreEndgame(const MacondoPreEndgameOptions &options) {
m_preEndgamePlaysToAnalyze = 0;
m_preEndgameOptions = options;
- startProcess();
- m_command = Command::SolvePreEndgame;
+ startProcess(Command::SolvePreEndgame);
}
static bool parseInt(const std::string &s, int &value, size_t *len) {
@@ -426,25 +424,15 @@ const char *MacondoBackend::updateDots(bool anythingNew) {
void MacondoBackend::send(const QByteArray &data) {
if (data.isEmpty()) return;
emit newLogOutput(data);
- if (isWindows()) {
- QByteArray copy;
- copy.replace("\n", "\r\n");
- m_process->write(copy);
- } else {
- m_process->write(data);
- }
+ m_process->write(data);
}
QByteArray MacondoBackend::receiveStdout() {
- QByteArray data = m_process->readAllStandardOutput();
- data.replace("\r\n", "\n");
- return data;
+ return m_process->readAllStandardOutput();
}
QByteArray MacondoBackend::receiveStderr() {
- QByteArray data = m_process->readAllStandardError();
- data.replace("\r\n", "\n");
- return data;
+ return m_process->readAllStandardError();
}
void MacondoBackend::timer() {
diff --git a/quacker/macondobackend.h b/quacker/macondobackend.h
index 93032b7..0b9694a 100644
--- a/quacker/macondobackend.h
+++ b/quacker/macondobackend.h
@@ -71,7 +71,7 @@ private:
SolvePreEndgame,
SolveEndgame,
};
- bool startProcess();
+ bool startProcess(Command command);
void loadGCG();
void killProcess();
void removeTempGCG();