1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-16 18:06:35 -04:00
sdrangel/cmake/Modules/DeployQt.cmake
Jon Beniston 1a9b6d1763 Add ADS-B Demodulator plugin.
Add GS232 Rotator Controller feature plugin.
Add altitude and station name to My Positon.
Use QtDeploy to ensure all required Qt libraries are included (Should
fix OpenGL issues)
2020-10-27 16:22:10 +00:00

50 lines
1.9 KiB
CMake

find_package(Qt5Core REQUIRED)
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}")
if(WIN32 AND NOT WINDEPLOYQT_EXECUTABLE)
message(FATAL_ERROR "windeployqt not found")
endif()
# Add commands that copy the required Qt files to ${bindir} as well as including
# them in final installation (by first copying them to a winqt subdir)
# We need to specify ${bindir} as we run this on plugins as well as the main .exe
# Preferably, it would be nicer to skip the extra copy to winqt subdir, but how?
# Also, we should possibly only call install once, after all deployments are made
function(windeployqt target bindir qmldir)
# Run windeployqt after build
# First deploy in to bin directory, so we can run from the build bin directory
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E
env PATH="${_qt_bin_dir}" "${WINDEPLOYQT_EXECUTABLE}"
--verbose 1
--no-compiler-runtime
--dir "${bindir}"
--qmldir "${qmldir}"
--multimedia
\"$<TARGET_FILE:${target}>\"
COMMENT "Deploying Qt..."
)
# Then, deploy again in to separate directory for install to pick up
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E
env PATH="${_qt_bin_dir}" "${WINDEPLOYQT_EXECUTABLE}"
--verbose 1
--no-compiler-runtime
--dir "${bindir}/winqt"
--qmldir "${qmldir}"
--multimedia
\"$<TARGET_FILE:${target}>\"
COMMENT "Deploying Qt..."
)
install(DIRECTORY "${bindir}/winqt/" DESTINATION .)
endfunction()
mark_as_advanced(WINDEPLOYQT_EXECUTABLE)