diff --git a/cmake/Packaging.cmake b/cmake/Packaging.cmake index 25fddb90d0..4f6565edc7 100644 --- a/cmake/Packaging.cmake +++ b/cmake/Packaging.cmake @@ -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) diff --git a/cmake/Platform/Windows/PackagingTemplate.wxs.in b/cmake/Platform/Windows/PackagingTemplate.wxs.in new file mode 100644 index 0000000000..3e5db03ec2 --- /dev/null +++ b/cmake/Platform/Windows/PackagingTemplate.wxs.in @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + ProductIcon.ico + + + + + + + + + + + + + + + + + + + diff --git a/cmake/Platform/Windows/Packaging_windows.cmake b/cmake/Platform/Windows/Packaging_windows.cmake new file mode 100644 index 0000000000..ee8bf66d69 --- /dev/null +++ b/cmake/Platform/Windows/Packaging_windows.cmake @@ -0,0 +1,31 @@ +# +# 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") + +set(CPACK_WIX_TEMPLATE "${CMAKE_SOURCE_DIR}/cmake/Platform/Windows/PackagingTemplate.wxs.in") diff --git a/cmake/Platform/Windows/platform_windows_files.cmake b/cmake/Platform/Windows/platform_windows_files.cmake index bf9cb05d17..2fc869b43e 100644 --- a/cmake/Platform/Windows/platform_windows_files.cmake +++ b/cmake/Platform/Windows/platform_windows_files.cmake @@ -23,4 +23,6 @@ set(FILES PAL_windows.cmake PALDetection_windows.cmake Install_windows.cmake + Packaging_windows.cmake + PackagingTemplate.wxs.in )