From f6c2f64d049530c97e8497ee54d817d746d06cdb Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 6 Jun 2024 10:46:12 -0400 Subject: Utilities/Release: Update MSI generation to use WIX 4 --- .gitlab/ci/env_windows_arm64_package.ps1 | 2 +- .gitlab/ci/env_windows_i386_package.ps1 | 2 +- .gitlab/ci/env_windows_x86_64_package.ps1 | 2 +- .gitlab/ci/wix3-env.ps1 | 6 -- .gitlab/ci/wix4-env.ps1 | 7 +++ CMakeCPackOptions.cmake.in | 18 +++--- Utilities/Release/WiX/WIX.template.in | 27 ++++---- .../Release/WiX/cmake_nsis_overwrite_dialog.wxs | 12 +--- Utilities/Release/WiX/custom_action_dll.wxs.in | 2 +- Utilities/Release/WiX/install_dir.wxs | 73 ++++++++++++---------- Utilities/Release/WiX/options.wxs | 20 +++--- Utilities/Release/WiX/options_dlg.wxs | 20 +++--- Utilities/Release/WiX/patch_desktop_shortcut.xml | 4 +- Utilities/Release/WiX/patch_path_env.xml | 6 +- 14 files changed, 101 insertions(+), 100 deletions(-) delete mode 100644 .gitlab/ci/wix3-env.ps1 create mode 100644 .gitlab/ci/wix4-env.ps1 diff --git a/.gitlab/ci/env_windows_arm64_package.ps1 b/.gitlab/ci/env_windows_arm64_package.ps1 index a898007..74c9c2b 100644 --- a/.gitlab/ci/env_windows_arm64_package.ps1 +++ b/.gitlab/ci/env_windows_arm64_package.ps1 @@ -1 +1 @@ -. .gitlab/ci/wix3-env.ps1 +. .gitlab/ci/wix4-env.ps1 diff --git a/.gitlab/ci/env_windows_i386_package.ps1 b/.gitlab/ci/env_windows_i386_package.ps1 index a898007..74c9c2b 100644 --- a/.gitlab/ci/env_windows_i386_package.ps1 +++ b/.gitlab/ci/env_windows_i386_package.ps1 @@ -1 +1 @@ -. .gitlab/ci/wix3-env.ps1 +. .gitlab/ci/wix4-env.ps1 diff --git a/.gitlab/ci/env_windows_x86_64_package.ps1 b/.gitlab/ci/env_windows_x86_64_package.ps1 index a898007..74c9c2b 100644 --- a/.gitlab/ci/env_windows_x86_64_package.ps1 +++ b/.gitlab/ci/env_windows_x86_64_package.ps1 @@ -1 +1 @@ -. .gitlab/ci/wix3-env.ps1 +. .gitlab/ci/wix4-env.ps1 diff --git a/.gitlab/ci/wix3-env.ps1 b/.gitlab/ci/wix3-env.ps1 deleted file mode 100644 index a872b74..0000000 --- a/.gitlab/ci/wix3-env.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -& "$pwsh" -File .gitlab/ci/wix3.ps1 - -$pwdpath = $pwd.Path -Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\wix3;$env:PATH" - -light -help | Select -First 1 diff --git a/.gitlab/ci/wix4-env.ps1 b/.gitlab/ci/wix4-env.ps1 new file mode 100644 index 0000000..f1fe8b6 --- /dev/null +++ b/.gitlab/ci/wix4-env.ps1 @@ -0,0 +1,7 @@ +& "$pwsh" -File .gitlab/ci/wix4.ps1 + +$pwdpath = $pwd.Path +Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\wix4;$env:PATH" +Set-Item -Force -Path "env:WIX_EXTENSIONS" -Value "$pwdpath\.gitlab\wix4" +Write-Host "wix version: $(wix --version)" +Write-Host "wix extensions: $(wix extension list -g)" diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index cbe73e7..65f266e 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -206,6 +206,9 @@ if("${CPACK_GENERATOR}" STREQUAL "DragNDrop") endif() if("${CPACK_GENERATOR}" STREQUAL "WIX") + set(CPACK_WIX_VERSION 4) + set(CPACK_WIX_BUILD_EXTRA_FLAGS "") + # Reset CPACK_PACKAGE_VERSION to deal with WiX restriction. # But the file names still use the full CMake_VERSION value: set(CPACK_PACKAGE_FILE_NAME @@ -246,14 +249,7 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") CPACK_START_MENU_SHORTCUTS "CMake Web Site" ) - set(CPACK_WIX_LIGHT_EXTRA_FLAGS "-dcl:high") - - if(NOT "$ENV{CMAKE_CI_PACKAGE}" STREQUAL "") - # Suppress validation. It does not work without - # an interactive session or an admin account. - # https://github.com/wixtoolset/issues/issues/3968 - list(APPEND CPACK_WIX_LIGHT_EXTRA_FLAGS "-sval") - endif() + list(APPEND CPACK_WIX_BUILD_EXTRA_FLAGS -dcl high) set(CPACK_WIX_UI_BANNER "@CMake_SOURCE_DIR@/Utilities/Release/WiX/ui_banner.jpg" @@ -274,7 +270,7 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") list(APPEND CPACK_WIX_EXTRA_SOURCES "@CMake_SOURCE_DIR@/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs" ) - list(APPEND CPACK_WIX_CANDLE_EXTRA_FLAGS -dCHECK_NSIS=1) + list(APPEND CPACK_WIX_BUILD_EXTRA_FLAGS -d CHECK_NSIS=1) set(_WIX_CUSTOM_ACTION_MULTI_CONFIG "@CMake_BUILD_WIX_CUSTOM_ACTION_MULTI_CONFIG@") if(_WIX_CUSTOM_ACTION_MULTI_CONFIG) @@ -292,7 +288,7 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") endif() endif() - set(CPACK_WIX_UI_REF "CMakeUI_InstallDir") + set(CPACK_WIX_UI_REF "CMakeUI_InstallDir_$(sys.BUILDARCHSHORT)") set(CPACK_WIX_PATCH_FILE "@CMake_SOURCE_DIR@/Utilities/Release/WiX/patch_path_env.xml" @@ -308,6 +304,6 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") list(APPEND CPACK_WIX_PATCH_FILE "@CMake_SOURCE_DIR@/Utilities/Release/WiX/patch_desktop_shortcut.xml" ) - list(APPEND CPACK_WIX_CANDLE_EXTRA_FLAGS -dBUILD_QtDialog=1) + list(APPEND CPACK_WIX_BUILD_EXTRA_FLAGS -d BUILD_QtDialog=1) endif() endif() diff --git a/Utilities/Release/WiX/WIX.template.in b/Utilities/Release/WiX/WIX.template.in index fb8fa59..afbd66f 100644 --- a/Utilities/Release/WiX/WIX.template.in +++ b/Utilities/Release/WiX/WIX.template.in @@ -2,17 +2,22 @@ - + - - - + UpgradeCode="$(var.CPACK_WIX_UPGRADE_GUID)" + ProductCode="$(var.CPACK_WIX_PRODUCT_GUID)" + Scope="perMachine" + InstallerVersion="500" + Language="1033" + Compressed="yes" + > @@ -26,7 +31,7 @@ - ProductIcon.ico + @@ -38,11 +43,11 @@ - + - + @@ -54,5 +59,5 @@ - + diff --git a/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs b/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs index 88335f8..deec0f0 100644 --- a/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs +++ b/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs @@ -1,18 +1,12 @@ - + - 1 + - - Uninstall.exe was detected in your chosen installation prefix. - This indicates a conflicting NSIS based installation of CMake. - - Please uninstall your old CMake installation or choose a different - installation directory. - + diff --git a/Utilities/Release/WiX/custom_action_dll.wxs.in b/Utilities/Release/WiX/custom_action_dll.wxs.in index 64e9762..a39bc0d 100644 --- a/Utilities/Release/WiX/custom_action_dll.wxs.in +++ b/Utilities/Release/WiX/custom_action_dll.wxs.in @@ -1,4 +1,4 @@ - + diff --git a/Utilities/Release/WiX/install_dir.wxs b/Utilities/Release/WiX/install_dir.wxs index d7debde..a13da97 100644 --- a/Utilities/Release/WiX/install_dir.wxs +++ b/Utilities/Release/WiX/install_dir.wxs @@ -1,17 +1,28 @@ - + + - + + + + + + + + + + + + - - + @@ -24,41 +35,39 @@ - 1 - "1"]]> + - 1 + - NOT Installed - Installed AND PATCH + + - 1 - LicenseAccepted = "1" + + - 1 - 1 + + - 1 - 1 - NOT WIXUI_DONTVALIDATEPATH - "1"]]> + + + - 1 - CMAKE_NSIS_OVERWRITE_DETECTED="1" - - 1]]> - 1 - 1 + + + + + + - NOT Installed - Installed AND NOT PATCH - Installed AND PATCH + + + - 1 + - 1 - 1 - 1 + + + @@ -66,7 +75,7 @@ - - + + diff --git a/Utilities/Release/WiX/options.wxs b/Utilities/Release/WiX/options.wxs index 0fd3527..28d4365 100644 --- a/Utilities/Release/WiX/options.wxs +++ b/Utilities/Release/WiX/options.wxs @@ -1,4 +1,4 @@ - + @@ -13,24 +13,24 @@ - _CMAKE_IN_PATH_REG = "#0" - _CMAKE_IN_PATH_REG = "#1" + + - ADD_CMAKE_TO_PATH = "0" - ADD_CMAKE_TO_PATH = "1" + + - ADD_CMAKE_TO_PATH = "None" - ADD_CMAKE_TO_PATH = "System" AND ALLUSERS + + - ADD_CMAKE_TO_PATH = "User" AND NOT ALLUSERS + - + - + diff --git a/Utilities/Release/WiX/options_dlg.wxs b/Utilities/Release/WiX/options_dlg.wxs index 4d27d00..ea2854f 100644 --- a/Utilities/Release/WiX/options_dlg.wxs +++ b/Utilities/Release/WiX/options_dlg.wxs @@ -1,27 +1,27 @@ - + - - + + - 1 + - - - - - + + + + + - + diff --git a/Utilities/Release/WiX/patch_desktop_shortcut.xml b/Utilities/Release/WiX/patch_desktop_shortcut.xml index 8ec2c12..6170d64 100644 --- a/Utilities/Release/WiX/patch_desktop_shortcut.xml +++ b/Utilities/Release/WiX/patch_desktop_shortcut.xml @@ -1,5 +1,3 @@ - - DESKTOP_SHORTCUT_REQUESTED - + diff --git a/Utilities/Release/WiX/patch_path_env.xml b/Utilities/Release/WiX/patch_path_env.xml index ba4316d..bf52b27 100644 --- a/Utilities/Release/WiX/patch_path_env.xml +++ b/Utilities/Release/WiX/patch_path_env.xml @@ -1,8 +1,7 @@ - - CMAKE_IN_PATH AND ALLUSERS + @@ -10,8 +9,7 @@ - - CMAKE_IN_PATH AND NOT ALLUSERS + -- cgit v0.12