[main] new windows offline installer implementation
Merge pull request #630 from aws-lumberyard-dev/cpack_installer
This commit is contained in:
@@ -13,7 +13,13 @@ if(NOT PAL_TRAIT_BUILD_CPACK_SUPPORTED)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(CPACK_GENERATOR "ZIP")
|
||||
ly_get_absolute_pal_filename(pal_dir ${CMAKE_SOURCE_DIR}/cmake/Platform/${PAL_HOST_PLATFORM_NAME})
|
||||
include(${pal_dir}/Packaging_${PAL_HOST_PLATFORM_NAME_LOWERCASE}.cmake)
|
||||
|
||||
# if we get here and the generator hasn't been set, then a non fatal error occurred disabling packaging support
|
||||
if(NOT CPACK_GENERATOR)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_VENDOR "${PROJECT_NAME}")
|
||||
set(CPACK_PACKAGE_VERSION "${LY_VERSION_STRING}")
|
||||
@@ -27,6 +33,8 @@ set(DEFAULT_LICENSE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
|
||||
|
||||
set(CPACK_RESOURCE_FILE_LICENSE ${DEFAULT_LICENSE_FILE})
|
||||
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_VERSION}")
|
||||
|
||||
# IMPORTANT: required to be included AFTER setting all property overrides
|
||||
include(CPack REQUIRED)
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?include "cpack_variables.wxi"?>
|
||||
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" @CPACK_WIX_CUSTOM_XMLNS_EXPANDED@
|
||||
RequiredVersion="3.6.3303.0">
|
||||
|
||||
<Product Id="$(var.CPACK_WIX_PRODUCT_GUID)"
|
||||
Name="$(var.CPACK_PACKAGE_NAME)"
|
||||
Language="1033"
|
||||
Version="$(var.CPACK_PACKAGE_VERSION)"
|
||||
Manufacturer="$(var.CPACK_PACKAGE_VENDOR)"
|
||||
UpgradeCode="$(var.CPACK_WIX_UPGRADE_GUID)">
|
||||
|
||||
<Package InstallerVersion="301" Compressed="yes"/>
|
||||
|
||||
<!-- auto distribute the installable files across N cab files and embed them in the final MSI -->
|
||||
<MediaTemplate EmbedCab="yes"/>
|
||||
|
||||
<MajorUpgrade
|
||||
Schedule="afterInstallInitialize"
|
||||
AllowSameVersionUpgrades="yes"
|
||||
DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
|
||||
|
||||
<WixVariable Id="WixUILicenseRtf" Value="$(var.CPACK_WIX_LICENSE_RTF)"/>
|
||||
<Property Id="WIXUI_INSTALLDIR" Value="INSTALL_ROOT"/>
|
||||
|
||||
<?ifdef CPACK_WIX_PRODUCT_ICON?>
|
||||
<Property Id="ARPPRODUCTICON">ProductIcon.ico</Property>
|
||||
<Icon Id="ProductIcon.ico" SourceFile="$(var.CPACK_WIX_PRODUCT_ICON)"/>
|
||||
<?endif?>
|
||||
|
||||
<?ifdef CPACK_WIX_UI_BANNER?>
|
||||
<WixVariable Id="WixUIBannerBmp" Value="$(var.CPACK_WIX_UI_BANNER)"/>
|
||||
<?endif?>
|
||||
|
||||
<?ifdef CPACK_WIX_UI_DIALOG?>
|
||||
<WixVariable Id="WixUIDialogBmp" Value="$(var.CPACK_WIX_UI_DIALOG)"/>
|
||||
<?endif?>
|
||||
|
||||
<FeatureRef Id="ProductFeature"/>
|
||||
|
||||
<UIRef Id="$(var.CPACK_WIX_UI_REF)" />
|
||||
|
||||
<?include "properties.wxi"?>
|
||||
<?include "product_fragment.wxi"?>
|
||||
</Product>
|
||||
</Wix>
|
||||
@@ -0,0 +1,92 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(LY_WIX_PATH "" CACHE PATH "Path to the WiX install path")
|
||||
|
||||
if(LY_WIX_PATH)
|
||||
file(TO_CMAKE_PATH ${LY_QTIFW_PATH} CPACK_WIX_ROOT)
|
||||
elseif(DEFINED ENV{WIX})
|
||||
file(TO_CMAKE_PATH $ENV{WIX} CPACK_WIX_ROOT)
|
||||
endif()
|
||||
|
||||
if(CPACK_WIX_ROOT)
|
||||
if(NOT EXISTS ${CPACK_WIX_ROOT})
|
||||
message(FATAL_ERROR "Invalid path supplied for LY_WIX_PATH argument or WIX environment variable")
|
||||
endif()
|
||||
else()
|
||||
# early out as no path to WiX has been supplied effectively disabling support
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(CPACK_GENERATOR "WIX")
|
||||
|
||||
# CPack will generate the WiX product/upgrade GUIDs further down the chain if they weren't supplied
|
||||
# however, they are unique for each run. instead, let's do the auto generation here and add it to
|
||||
# the cache for run persistence. an additional cache file will be used to store the information on
|
||||
# the original generation so we still have the ability to detect if they are still being used.
|
||||
set(_guid_cache_file "${CMAKE_BINARY_DIR}/installer/wix_guid_cache.cmake")
|
||||
if(NOT EXISTS ${_guid_cache_file})
|
||||
set(_wix_guid_namespace "6D43F57A-2917-4AD9-B758-1F13CDB08593")
|
||||
|
||||
# based the ISO-8601 standard (YYYY-MM-DDTHH-mm-ssTZD) e.g., 20210506145533
|
||||
string(TIMESTAMP _guid_gen_timestamp "%Y%m%d%H%M%S")
|
||||
|
||||
file(WRITE ${_guid_cache_file} "set(_wix_guid_gen_timestamp ${_guid_gen_timestamp})\n")
|
||||
|
||||
string(UUID _default_product_guid
|
||||
NAMESPACE ${_wix_guid_namespace}
|
||||
NAME "ProductID_${_guid_gen_timestamp}"
|
||||
TYPE SHA1
|
||||
UPPER
|
||||
)
|
||||
file(APPEND ${_guid_cache_file} "set(_wix_default_product_guid ${_default_product_guid})\n")
|
||||
|
||||
string(UUID _default_upgrade_guid
|
||||
NAMESPACE ${_wix_guid_namespace}
|
||||
NAME "UpgradeCode_${_guid_gen_timestamp}"
|
||||
TYPE SHA1
|
||||
UPPER
|
||||
)
|
||||
file(APPEND ${_guid_cache_file} "set(_wix_default_upgrade_guid ${_default_upgrade_guid})\n")
|
||||
endif()
|
||||
include(${_guid_cache_file})
|
||||
|
||||
set(LY_WIX_PRODUCT_GUID "${_wix_default_product_guid}" CACHE STRING "GUID for the Product ID field. Format: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")
|
||||
set(LY_WIX_UPGRADE_GUID "${_wix_default_upgrade_guid}" CACHE STRING "GUID for the Upgrade Code field. Format: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")
|
||||
|
||||
set(_uses_default_product_guid FALSE)
|
||||
if(NOT LY_WIX_PRODUCT_GUID OR LY_WIX_PRODUCT_GUID STREQUAL ${_wix_default_product_guid})
|
||||
set(_uses_default_product_guid TRUE)
|
||||
set(LY_WIX_PRODUCT_GUID ${_wix_default_product_guid})
|
||||
endif()
|
||||
|
||||
set(_uses_default_upgrade_guid FALSE)
|
||||
if(NOT LY_WIX_UPGRADE_GUID OR LY_WIX_UPGRADE_GUID STREQUAL ${_wix_default_upgrade_guid})
|
||||
set(_uses_default_upgrade_guid TRUE)
|
||||
set(LY_WIX_UPGRADE_GUID ${_wix_default_upgrade_guid})
|
||||
endif()
|
||||
|
||||
if(_uses_default_product_guid OR _uses_default_upgrade_guid)
|
||||
message(STATUS "One or both WiX GUIDs were auto generated. It is recommended you supply your own GUIDs through LY_WIX_PRODUCT_GUID and LY_WIX_UPGRADE_GUID.")
|
||||
|
||||
if(_uses_default_product_guid)
|
||||
message(STATUS "-> Default LY_WIX_PRODUCT_GUID = ${LY_WIX_PRODUCT_GUID}")
|
||||
endif()
|
||||
|
||||
if(_uses_default_upgrade_guid)
|
||||
message(STATUS "-> Default LY_WIX_UPGRADE_GUID = ${LY_WIX_UPGRADE_GUID}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CPACK_WIX_PRODUCT_GUID ${LY_WIX_PRODUCT_GUID})
|
||||
set(CPACK_WIX_UPGRADE_GUID ${LY_WIX_UPGRADE_GUID})
|
||||
|
||||
set(CPACK_WIX_TEMPLATE "${CMAKE_SOURCE_DIR}/cmake/Platform/Windows/PackagingTemplate.wxs.in")
|
||||
@@ -23,4 +23,6 @@ set(FILES
|
||||
PAL_windows.cmake
|
||||
PALDetection_windows.cmake
|
||||
Install_windows.cmake
|
||||
Packaging_windows.cmake
|
||||
PackagingTemplate.wxs.in
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user