Skip to content

Commit 7d0de83

Browse files
committed
fix
1 parent bafbb06 commit 7d0de83

1 file changed

Lines changed: 54 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,14 +343,67 @@ if(WIN32)
343343
endif()
344344

345345
if(DEFINED _qt6_debug_bin AND DEFINED _qt6_debug_plugins)
346+
set(_qt_debug_script "${CMAKE_CURRENT_BINARY_DIR}/copy_qt_debug.cmake")
347+
file(WRITE "${_qt_debug_script}" [=[
348+
if(DEFINED DEPLOY_CONFIG AND NOT DEPLOY_CONFIG STREQUAL "Debug")
349+
return()
350+
endif()
351+
352+
if(NOT DEFINED RUN_DIR)
353+
message(FATAL_ERROR "RUN_DIR not set for Qt debug deployment")
354+
endif()
355+
356+
if(NOT DEFINED QT_DEBUG_BIN OR NOT EXISTS "${QT_DEBUG_BIN}")
357+
message(FATAL_ERROR "QT_DEBUG_BIN not found: ${QT_DEBUG_BIN}")
358+
endif()
359+
360+
if(NOT DEFINED QT_DEBUG_PLUGINS OR NOT EXISTS "${QT_DEBUG_PLUGINS}")
361+
message(FATAL_ERROR "QT_DEBUG_PLUGINS not found: ${QT_DEBUG_PLUGINS}")
362+
endif()
363+
364+
file(MAKE_DIRECTORY "${RUN_DIR}/platforms")
365+
366+
execute_process(
367+
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
368+
"${QT_DEBUG_BIN}/Qt6Cored.dll"
369+
"${QT_DEBUG_BIN}/Qt6Guid.dll"
370+
"${QT_DEBUG_BIN}/Qt6Widgetsd.dll"
371+
"${RUN_DIR}"
372+
RESULT_VARIABLE _copy_core_result
373+
)
374+
375+
execute_process(
376+
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
377+
"${QT_DEBUG_PLUGINS}/platforms/qwindowsd.dll"
378+
"${RUN_DIR}/platforms"
379+
RESULT_VARIABLE _copy_platform_result
380+
)
381+
382+
set(_copy_root_result 0)
383+
if(DEFINED QT_RELEASE_BIN AND EXISTS "${QT_RELEASE_BIN}")
384+
execute_process(
385+
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
386+
"${QT_DEBUG_BIN}/Qt6Cored.dll"
387+
"${QT_DEBUG_BIN}/Qt6Guid.dll"
388+
"${QT_DEBUG_BIN}/Qt6Widgetsd.dll"
389+
"${QT_RELEASE_BIN}"
390+
RESULT_VARIABLE _copy_root_result
391+
)
392+
endif()
393+
394+
if(NOT _copy_core_result EQUAL 0 OR NOT _copy_platform_result EQUAL 0 OR NOT _copy_root_result EQUAL 0)
395+
message(FATAL_ERROR "Qt debug deployment failed")
396+
endif()
397+
]=])
398+
346399
add_custom_command(TARGET editor POST_BUILD
347400
COMMAND ${CMAKE_COMMAND}
348401
-DDEPLOY_CONFIG=$<CONFIG>
349402
-DRUN_DIR="${CMAKE_CURRENT_LIST_DIR}/Run"
350403
-DQT_DEBUG_BIN="${_qt6_debug_bin}"
351404
-DQT_DEBUG_PLUGINS="${_qt6_debug_plugins}"
352405
-DQT_RELEASE_BIN="${_qt6_release_bin}"
353-
-P "${CMAKE_CURRENT_LIST_DIR}/cmake/copy_qt_debug.cmake"
406+
-P "${_qt_debug_script}"
354407
COMMENT "Copy Qt debug DLLs and platform plugin")
355408
endif()
356409
endif()

0 commit comments

Comments
 (0)