diff --git a/.github/actions/install-dependencies/action.yml b/.github/actions/install-dependencies/action.yml index 6778ff7d8..c4d011619 100644 --- a/.github/actions/install-dependencies/action.yml +++ b/.github/actions/install-dependencies/action.yml @@ -95,6 +95,8 @@ runs: - name: Install Wix if: ${{ runner.os == 'Windows' }} run: | - dotnet tool install --global wix --version 4.0.4 - wix extension add --global WixToolset.UI.wixext/4.0.4 + dotnet tool install --global wix --version 5.0.2 + wix extension add --global WixToolset.UI.wixext/5.0.2 + wix extension add --global WixToolset.Util.wixext/5.0.2 + wix extension add --global WixToolset.Firewall.wixext/5.0.2 shell: pwsh diff --git a/cmake/Libraries.cmake b/cmake/Libraries.cmake index 2eeebec26..4f4bd1d2c 100644 --- a/cmake/Libraries.cmake +++ b/cmake/Libraries.cmake @@ -50,6 +50,13 @@ macro(configure_libs) message(VERBOSE "Set OPENSSL_ROOT_DIR: ${OPENSSL_ROOT_DIR}") set(OPENSSL_EXE_DIR "${OPENSSL_ROOT_DIR}/tools/openssl") add_definitions(-DOPENSSL_EXE_DIR="${OPENSSL_EXE_DIR}") + # HACK Install a copy of openssl on windows + install( + FILES + ${OPENSSL_EXE_DIR}/openssl.exe + ${OPENSSL_EXE_DIR}/openssl.cnf + DESTINATION . + ) endif() diff --git a/deploy/CMakeLists.txt b/deploy/CMakeLists.txt index a7bd845cf..800bf9867 100644 --- a/deploy/CMakeLists.txt +++ b/deploy/CMakeLists.txt @@ -46,9 +46,14 @@ elseif(NOT APPLE) ) endif() +if(WIN32) + set(CPACK_PACKAGE_NAME "Deskflow") +else() + set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME}) +endif() + # Generic Package Items set(CPACK_STRIP_FILES TRUE) -set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME}) set(CPACK_PACKAGE_CONTACT "Deskflow ") set(CPACK_PACKAGE_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION}) set(CPACK_PACKAGE_VENDOR "Deskflow") @@ -66,16 +71,49 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) set(CPACK_RPM_PACKAGE_LICENSE "GPLv2") set(CPACK_RPM_PACKAGE_GROUP "Applications/System") + if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - cmake_path(SET QT_PATH NORMALIZE "${Qt6_DIR}../../") set(CPACK_WIX_UPGRADE_GUID "027D1C8A-E7A5-4754-BB93-B2D45BFDBDC8") + # TODO RM with legacy WIX Builder + cmake_path(SET QT_PATH NORMALIZE "${Qt6_DIR}../../") + + # TODO RM with legacy WIX Builder configure_files( ${PROJECT_SOURCE_DIR}/deploy/dist/wix ${PROJECT_BINARY_DIR}/installer ) + set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/wix-banner.png") + set(CPACK_WIX_UI_DIALOG "${CMAKE_CURRENT_SOURCE_DIR}/wix-dialog.png") + set(CPACK_WIX_MSM_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Microsoft_VC142_CRT_x64.msm") + + + # Required Extra Extenstions + list(APPEND CPACK_WIX_EXTENSIONS "WixToolset.Util.wixext" "WixToolset.Firewall.wixext") + + # Make sure to also put the xmlns for the ext into the wix block on generated files + list(APPEND CPACK_WIX_CUSTOM_XMLNS "util=http://wixtoolset.org/schemas/v4/wxs/util" "firewall=http://wixtoolset.org/schemas/v4/wxs/firewall") + + # Inject Service and Firewall changes into geneated Wix File. + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/wix-patch.xml.in "${CMAKE_CURRENT_BINARY_DIR}/wix-patch.xml" @ONLY) + set(CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_BINARY_DIR}/wix-patch.xml") + + # Menu Entry + set(CPACK_WIX_PROGRAM_MENU_FOLDER "Deskflow") + set(CPACK_PACKAGE_EXECUTABLES "deskflow" "Deskflow") + + # Default Install Path + set(CPACK_PACKAGE_INSTALL_DIRECTORY "Deskflow") + + # If Wix4+ is installed make a package + find_program(WIX_APP wix) + if (NOT "${WIX_APP}" STREQUAL "") + set(CPACK_WIX_VERSION 4) + list(APPEND CPACK_GENERATOR "WIX") + endif() + if(CMAKE_SYSTEM_PROCESSOR MATCHES AMD64) set(OS_STRING "win-x64") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES ARM64) @@ -105,7 +143,8 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "|.*BSD") set(OS_STRING ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}) endif() -set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${PACKAGE_VERSION_LABEL}-${OS_STRING}") +# Always use "deskflow" for start of name +set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${PACKAGE_VERSION_LABEL}-${OS_STRING}") message(STATUS "Package Basename: ${CPACK_PACKAGE_FILE_NAME}") include(CPack) diff --git a/deploy/dist/wix/msm/Microsoft_VC142_CRT_x64.msm b/deploy/Microsoft_VC142_CRT_x64.msm similarity index 100% rename from deploy/dist/wix/msm/Microsoft_VC142_CRT_x64.msm rename to deploy/Microsoft_VC142_CRT_x64.msm diff --git a/deploy/dist/wix/images/banner.png b/deploy/dist/wix/images/banner.png deleted file mode 100644 index 90f52a114..000000000 Binary files a/deploy/dist/wix/images/banner.png and /dev/null differ diff --git a/deploy/wix-banner.png b/deploy/wix-banner.png new file mode 100644 index 000000000..d94e5c65b Binary files /dev/null and b/deploy/wix-banner.png differ diff --git a/deploy/dist/wix/images/dialog.png b/deploy/wix-dialog.png similarity index 100% rename from deploy/dist/wix/images/dialog.png rename to deploy/wix-dialog.png diff --git a/deploy/wix-patch.xml.in b/deploy/wix-patch.xml.in new file mode 100644 index 000000000..d4ef02b39 --- /dev/null +++ b/deploy/wix-patch.xml.in @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/lib/gui/tls/TlsCertificate.cpp b/src/lib/gui/tls/TlsCertificate.cpp index c927348ee..46cac09a7 100644 --- a/src/lib/gui/tls/TlsCertificate.cpp +++ b/src/lib/gui/tls/TlsCertificate.cpp @@ -30,7 +30,6 @@ static const char *const kCertificateHashAlgorithm = "-sha256"; static const char *const kCertificateLifetime = "365"; #if defined(Q_OS_WIN) -static const char *const kWinOpenSslDir = "OpenSSL"; static const char *const kWinOpenSslBinary = "openssl.exe"; static const char *const kConfigFile = "openssl.cnf"; #elif defined(Q_OS_UNIX) @@ -44,12 +43,12 @@ namespace deskflow::gui { QString openSslWindowsDir() { - auto appDir = QDir(QCoreApplication::applicationDirPath()); - auto openSslDir = QDir(appDir.filePath(kWinOpenSslDir)); + auto openSslDir = QDir(QCoreApplication::applicationDirPath()); + auto openSslBin = QFile(QStringLiteral("%1/%2").arg(openSslDir.absolutePath(), kWinOpenSslBinary)); // in production, openssl is deployed with the app. // in development, we can use the openssl path available at compile-time. - if (!openSslDir.exists()) { + if (!openSslBin.exists()) { openSslDir = QDir(OPENSSL_EXE_DIR); }