hack: resolve dependencies for imageformats on mingw

Signed-off-by: DioEgizio <83089242+DioEgizio@users.noreply.github.com>
This commit is contained in:
DioEgizio
2026-01-09 20:45:39 +01:00
parent 2e8256e322
commit a98ec194be

View File

@@ -1612,6 +1612,49 @@ if(WIN32 OR (UNIX AND APPLE))
SCRIPT ${QT_DEPLOY_SCRIPT}
COMPONENT bundle
)
# FIXME: remove this crap once we stop using msys2
if(MINGW)
# i've not found a solution better than injecting the config vars like this...
# with install(CODE" for everything everything just breaks
install(CODE "
set(QT_PLUGINS_DIR \"${QT_PLUGINS_DIR}\")
set(QT_LIBS_DIR \"${QT_LIBS_DIR}\")
set(QT_LIBEXECS_DIR \"${QT_LIBEXECS_DIR}\")
set(CMAKE_SYSTEM_LIBRARY_PATH \"${CMAKE_SYSTEM_LIBRARY_PATH}\")
set(CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\")
"
COMPONENT bundle)
install(CODE [[
file(GLOB QT_IMAGEFORMAT_DLLS "${QT_PLUGINS_DIR}/imageformats/*.dll")
set(CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL objdump)
file(GET_RUNTIME_DEPENDENCIES
RESOLVED_DEPENDENCIES_VAR imageformatdeps
LIBRARIES ${QT_IMAGEFORMAT_DLLS}
DIRECTORIES
${CMAKE_SYSTEM_LIBRARY_PATH}
${QT_PLUGINS_DIR}
${QT_LIBS_DIR}
${QT_LIBEXECS_DIR}
PRE_EXCLUDE_REGEXES
"^(api-ms-win|ext-ms)-.*\\.dll$"
# FIXME: Why aren't these caught by the below regex???
"^azure.*\\.dll$"
"^vcruntime.*\\.dll$"
POST_EXCLUDE_REGEXES
"system32"
)
foreach(_lib ${imageformatdeps})
file(INSTALL
DESTINATION ${CMAKE_INSTALL_PREFIX}
TYPE SHARED_LIBRARY
FOLLOW_SYMLINK_CHAIN
FILES ${_lib}
)
endforeach()
]]
COMPONENT bundle)
endif()
# Add qt.conf - this makes Qt stop looking for things outside the bundle
install(