Windows packaging & merge two workflow yaml files (#898)

* chore: add win setup assets & using CPack

* chore: add windows packaging & merge the previous cmake-windows.yml into build_cmake.yml
This commit is contained in:
Ahmed Zetao Yang
2020-09-13 20:49:04 +08:00
committed by GitHub
parent 5f2132f91e
commit 53a9d44c46
10 changed files with 1032 additions and 95 deletions

View File

@@ -67,6 +67,7 @@ target_sources(
${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/src/color_wheel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/include/color_wheel.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../data/graphics.qrc
${CMAKE_CURRENT_SOURCE_DIR}/../data/icon.rc # flamshot binary icon resource file
${QM_FILES}
main.cpp)
@@ -172,3 +173,33 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/share/ DESTINATION ${CMAKE_INSTALL
# Install Translations
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/flameshot/translations)
# windeployqt
if(WIN32)
if(EXISTS $ENV{QTDIR}/bin/windeployqt.exe)
if(CMAKE_BUILD_TYPE MATCHES Release)
set(BINARIES_TYPE --release)
else()
set(BINARIES_TYPE --debug)
endif()
add_custom_command(
TARGET flameshot POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/windeployqt_stuff
COMMAND $ENV{QTDIR}/bin/windeployqt.exe ${BINARIES_TYPE} --no-translations --compiler-runtime --no-system-d3d-compiler --no-angle --no-webkit2 --no-quick-import --dir ${CMAKE_BINARY_DIR}/windeployqt_stuff $<TARGET_FILE:flameshot>
# copy translations manually
# QM_FILES
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/windeployqt_stuff/translations
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/src/translations ${CMAKE_BINARY_DIR}/windeployqt_stuff/translations
)
install(
DIRECTORY ${CMAKE_BINARY_DIR}/windeployqt_stuff/
DESTINATION bin
)
else()
message("Unable to find executable QTDIR/bin/windeployqt.")
endif()
endif()