From 480b787552f9d8339ee9ac5dc579d347792c1082 Mon Sep 17 00:00:00 2001 From: Tom Dewey Date: Fri, 2 Aug 2024 16:45:31 +0100 Subject: [PATCH] cmake: Windows: MINGW64_ROOT Add an option for the MinGW64 root path. This is used to find the supporting libraries for deployment on Windows. --- src/CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 221cd31..519a88a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,6 +20,10 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) # You _must_ set your Qt6 root for the build to progress. set(Qt6_ROOT "/opt/Qt/6.7.2/gcc_arm64" CACHE PATH "Your Qt6 root path") +if (WIN32) + set(MINGW64_ROOT "" CACHE PATH "Your MinGW64 root path, likely provided by QtCreator") +endif() + ## Preferentially build the bundled code. Full vendoring is to follow in a later version. # Bundled liblzma @@ -348,6 +352,14 @@ if (WIN32) "${CMAKE_CURRENT_BINARY_DIR}/rpi-imager.nsi" @ONLY) + add_custom_command(TARGET ${PROJECT_NAME} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${MINGW64_ROOT}/bin/libgcc_s_seh-1.dll" + "${MINGW64_ROOT}/bin/libstdc++-6.dll" + "${MINGW64_ROOT}/bin/libwinpthread-1.dll" + "${CMAKE_BINARY_DIR}/deploy") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND "${WINDEPLOYQT}" --no-translations --no-webkit2 --no-opengl-sw --angle --qmldir "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/deploy/rpi-imager.exe")