aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-12-18 15:37:27 +0100
committerPřemysl Eric Janouch <p@janouch.name>2024-12-19 03:08:13 +0100
commit6ac2ac55116af9d2d37186468eb9df981b159f92 (patch)
treea16b154ca43a0a79ff378d742814751ca305557b
parentf6483489c2a4861bc6dd6c5521fb8a153eddbcb1 (diff)
downloadxK-6ac2ac55116af9d2d37186468eb9df981b159f92.tar.gz
xK-6ac2ac55116af9d2d37186468eb9df981b159f92.tar.xz
xK-6ac2ac55116af9d2d37186468eb9df981b159f92.zip
xT: improve MSYS2 build
The static Qt 6 package is unusable.
-rw-r--r--xT/CMakeLists.txt26
-rw-r--r--xT/xT.cpp1
2 files changed, 25 insertions, 2 deletions
diff --git a/xT/CMakeLists.txt b/xT/CMakeLists.txt
index 56ab835..8f27be3 100644
--- a/xT/CMakeLists.txt
+++ b/xT/CMakeLists.txt
@@ -109,8 +109,10 @@ include (GNUInstallDirs)
if (ANDROID)
install (TARGETS xT DESTINATION .)
elseif (APPLE OR WIN32)
- # TODO(p): Consider whether or not to use MSYS2.
- install (TARGETS xT DESTINATION .)
+ install (TARGETS xT
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
# XXX: QTBUG-127075, which can be circumvented by manually running
# macdeployqt on xT.app before the install.
qt_generate_deploy_app_script (TARGET xT OUTPUT_SCRIPT deploy_xT)
@@ -127,6 +129,26 @@ else ()
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
endif ()
+# Within MSYS2, windeployqt doesn't copy the compiler runtime,
+# which is always linked dynamically by the Qt binaries.
+# TODO(p): Consider whether or not to use MSYS2 to cross-compile, and how.
+if (WIN32)
+ install (CODE [=[
+ set (bindir "${CMAKE_INSTALL_PREFIX}/bin")
+ execute_process (COMMAND cygpath -m /
+ OUTPUT_VARIABLE cygroot OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (cygroot)
+ execute_process (COMMAND ldd "${bindir}/xT.exe"
+ OUTPUT_VARIABLE ldd_output OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string (REGEX MATCHALL " /mingw64/bin/[^ ]+ " libs "${ldd_output}")
+ foreach (lib ${libs})
+ string (STRIP "${lib}" lib)
+ file (COPY "${cygroot}${lib}" DESTINATION "${bindir}")
+ endforeach()
+ endif ()
+ ]=])
+endif ()
+
# CPack
set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch")
set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>")
diff --git a/xT/xT.cpp b/xT/xT.cpp
index 0f6de57..f84c87c 100644
--- a/xT/xT.cpp
+++ b/xT/xT.cpp
@@ -1421,6 +1421,7 @@ static void
build_main_window()
{
g.wMain = new QMainWindow;
+ refresh_icon();
auto central = new QWidget(g.wMain);
auto vbox = new QVBoxLayout(central);