[cpack_installer] cpack variable usage cleanup

This commit is contained in:
scottr
2021-05-17 15:28:32 -07:00
parent b3b930d716
commit b19779e491
3 changed files with 36 additions and 32 deletions
+4 -4
View File
@@ -31,12 +31,12 @@ set(CPACK_RESOURCE_FILE_LICENSE ${DEFAULT_LICENSE_FILE})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_VERSION}")
# custom cpack cache variables for use in pre/post build scripts
# CMAKE_SOURCE_DIR doesn't equate to anything during execution of pre/post build scripts.
# to pass it down, we can utilize the auto-caching of any variable with prefix "CPACK_"
set(CPACK_SOURCE_DIR ${CMAKE_SOURCE_DIR}/cmake)
set(CPACK_BINARY_DIR ${CMAKE_BINARY_DIR}/installer)
# attempt to apply platform specific settings
ly_get_absolute_pal_filename(pal_dir ${CMAKE_SOURCE_DIR}/cmake/Platform/${PAL_HOST_PLATFORM_NAME})
ly_get_absolute_pal_filename(pal_dir ${CPACK_SOURCE_DIR}/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
@@ -89,7 +89,7 @@ ly_configure_cpack_component(
if(LY_INSTALLER_DOWNLOAD_URL)
cpack_configure_downloads(
${LY_INSTALLER_DOWNLOAD_URL}
UPLOAD_DIRECTORY artifacts
UPLOAD_DIRECTORY ${CMAKE_BINARY_DIR}/_CPack_Uploads # to match the _CPack_Packages directory
ALL
)
endif()
+31 -27
View File
@@ -9,49 +9,53 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# convert the path to a windows style path
string(REPLACE "/" "\\" _install_dir ${CPACK_PACKAGE_INSTALL_DIRECTORY})
# convert the path to a windows style path using string replace because TO_NATIVE_PATH
# only works on real paths
string(REPLACE "/" "\\" _fixed_package_install_dir ${CPACK_PACKAGE_INSTALL_DIRECTORY})
# directory where the auto generated files live e.g <build>/_CPack_Package/win64/WIX
set(_cpack_out_dir "${CPACK_TOPLEVEL_DIRECTORY}")
set(_out_dir "${CPACK_BINARY_DIR}/wixobj_bootstrap")
set(_cpack_wix_out_dir ${CPACK_TOPLEVEL_DIRECTORY})
set(_bootstrap_out_dir "${CPACK_TOPLEVEL_DIRECTORY}/bootstrap")
set(_wix_ext_flags
set(_bootstrap_filename "${CPACK_PACKAGE_FILE_NAME}.exe")
set(_bootstrap_output_file ${_cpack_wix_out_dir}/${_bootstrap_filename})
set(_ext_flags
-ext WixBalExtension
)
set(_addtional_defines
-dCPACK_DOWNLOAD_SITE=${CPACK_DOWNLOAD_SITE}
-dCPACK_LOCAL_INSTALLER_DIR=${_cpack_wix_out_dir}
-dCPACK_PACKAGE_FILE_NAME=${CPACK_PACKAGE_FILE_NAME}
-dCPACK_PACKAGE_INSTALL_DIRECTORY=${_fixed_package_install_dir}
)
set(_candle_command
${CPACK_WIX_ROOT}/bin/candle.exe
${CPACK_WIX_CANDLE_EXECUTABLE}
-nologo
-arch x64
"-I${_cpack_out_dir}"
${_wix_ext_flags}
-dCPACK_DOWNLOAD_SITE=${CPACK_DOWNLOAD_SITE}
-dCPACK_LOCAL_INSTALLER_DIR=${_cpack_out_dir}
-dCPACK_PACKAGE_FILE_NAME=${CPACK_PACKAGE_FILE_NAME}
-dCPACK_PACKAGE_INSTALL_DIRECTORY=${_install_dir}
"-I${_cpack_wix_out_dir}" # to include cpack_variables.wxi
${_addtional_defines}
${_ext_flags}
"${CPACK_SOURCE_DIR}/Platform/Windows/PackagingBootstrapper.wxs"
-o "${_out_dir}"
-o "${_bootstrap_out_dir}/"
)
set(_light_command
${CPACK_WIX_ROOT}/bin/light.exe
${CPACK_WIX_LIGHT_EXECUTABLE}
-nologo
${_wix_ext_flags}
${_out_dir}/*.wixobj
-o "${CPACK_BINARY_DIR}/installer.exe"
${_ext_flags}
${_bootstrap_out_dir}/*.wixobj
-o "${_bootstrap_output_file}"
)
message(STATUS "Creating Installer Bootstrapper...")
execute_process(
COMMAND
${_candle_command}
COMMAND
${_light_command}
COMMAND ${_candle_command}
COMMAND_ERROR_IS_FATAL ANY
)
execute_process(
COMMAND ${_light_command}
COMMAND_ERROR_IS_FATAL ANY
)
@@ -32,7 +32,7 @@ set(CPACK_GENERATOR "WIX")
# 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 "${CPACK_BINARY_DIR}/wix_guid_cache.cmake")
set(_guid_cache_file "${CMAKE_BINARY_DIR}/CPackWiXConfig.cmake")
if(NOT EXISTS ${_guid_cache_file})
set(_wix_guid_namespace "6D43F57A-2917-4AD9-B758-1F13CDB08593")