xT: clean up Windows and Mac deployment
All checks were successful
Alpine 3.22 Success
Arch Linux AUR Success
OpenBSD 7.8 Success

This commit is contained in:
2025-12-26 21:05:31 +01:00
parent 77aaf87860
commit 2728f9d1eb

View File

@@ -1,4 +1,5 @@
# As per Qt 6.8 documentation, at least 3.16 is necessary
# CMake 3.21 has RUNTIME_DEPENDENCY_SET.
cmake_minimum_required (VERSION 3.21.1)
file (READ ../xK-version project_version)
@@ -68,8 +69,9 @@ else ()
set (resource_file "${PROJECT_BINARY_DIR}/xT.rc")
list (APPEND project_sources "${resource_file}")
# Qt specifically looks up IDI_ICON1 and nothing else.
add_custom_command (OUTPUT "${resource_file}"
COMMAND ${CMAKE_COMMAND} -E echo "1 ICON \"xT.ico\""
COMMAND ${CMAKE_COMMAND} -E echo "IDI_ICON1 ICON \"xT.ico\""
> ${resource_file} VERBATIM)
set_property (SOURCE "${resource_file}"
APPEND PROPERTY OBJECT_DEPENDS ${icon_ico})
@@ -110,13 +112,24 @@ if (ANDROID)
install (TARGETS xT DESTINATION .)
elseif (APPLE OR WIN32)
install (TARGETS xT
RUNTIME_DEPENDENCY_SET dependencies_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.
if (WIN32)
install (RUNTIME_DEPENDENCY_SET dependencies_xT DIRECTORIES $ENV{PATH}
PRE_EXCLUDE_REGEXES "api-ms-win-.*"
POST_EXCLUDE_REGEXES ".*[/\\]system32[/\\].*")
endif ()
qt_generate_deploy_app_script (TARGET xT OUTPUT_SCRIPT deploy_xT)
install (SCRIPT "${deploy_xT}")
# At least with Homebrew Qt, you will get QTBUG-127075,
# which can be circumvented by running macdeployqt twice.
if (APPLE)
install (SCRIPT "${deploy_xT}")
endif ()
else ()
install (TARGETS xT DESTINATION ${CMAKE_INSTALL_BINDIR})
install (FILES ../LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
@@ -129,26 +142,6 @@ 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>")