Skip to content

Commit

Permalink
Add install script to install dependent dlls.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sibras committed Nov 17, 2021
1 parent 474a5e1 commit 6694f1b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ qt_add_qml_module(ShiftIntrinsicGuide
"source/IntrinsicView.qml"
)

include(InstallRequiredSystemLibraries)
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
include(GNUInstallDirs)
install(TARGETS ShiftIntrinsicGuide
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand All @@ -126,3 +128,10 @@ qt_finalize_executable(ShiftIntrinsicGuide)
# Include Qt deployment helper function
include(DeployQt)
deployqt(ShiftIntrinsicGuide "${CMAKE_CURRENT_SOURCE_DIR}/source/")

set(CPACK_GENERATOR "ZIP")
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
include(CPack)
27 changes: 27 additions & 0 deletions cmake/DeployQt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,33 @@ function(windeployqt target qmldir)
\"$<TARGET_FILE:${target}>\"
COMMENT "Deploying Qt..."
)

install(CODE
"
execute_process(
COMMAND \"${CMAKE_COMMAND}\" -E
env PATH=\"${_qt_bin_dir}\" \"${WINDEPLOYQT_EXECUTABLE}\"
--verbose 0
--dry-run
--no-compiler-runtime
--qmldir ${qmldir}
--list mapping
\"$<TARGET_FILE:${target}>\"
OUTPUT_VARIABLE _output
OUTPUT_STRIP_TRAILING_WHITESPACE
)
separate_arguments(_files WINDOWS_COMMAND \${_output})
while(_files)
list(GET _files 0 _src)
list(GET _files 1 _dest)
execute_process(
COMMAND \"${CMAKE_COMMAND}\" -E
copy \${_src} \"\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/\${_dest}\"
)
list(REMOVE_AT _files 0 1)
endwhile()
"
)
endfunction()

# Add commands that copy the required Qt files to the application bundle
Expand Down

0 comments on commit 6694f1b

Please sign in to comment.