[cpack_installer] removed static cmake package in favor of using file(DOWNLOAD ...)

main
scottr 5 years ago
parent cccb68fa38
commit 883ddf667e

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e95d70549f306adb46e0f131dcecdbcbc6412d3a1e073c2c0078812391bf21d3
size 36098689

@ -17,6 +17,8 @@ endif()
set(LY_INSTALLER_DOWNLOAD_URL "" CACHE STRING "URL embedded into the installer to download additional artifacts")
set(LY_INSTALLER_LICENSE_URL "" CACHE STRING "Optionally embed a link to the license instead of raw text")
set(CPACK_DESIRED_CMAKE_VERSION 3.20.2)
# set all common cpack variable overrides first so they can be accessible via configure_file
# when the platform specific settings are applied below. additionally, any variable with
# the "CPACK_" prefix will automatically be cached for use in any phase of cpack namely
@ -38,6 +40,7 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_VER
# neither of the SOURCE_DIR variables equate to anything during execution of pre/post build scripts
set(CPACK_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CPACK_BINARY_DIR ${CMAKE_BINARY_DIR}/_CPack) # to match other CPack out dirs
# attempt to apply platform specific settings
ly_get_absolute_pal_filename(pal_dir ${CPACK_SOURCE_DIR}/Platform/${PAL_HOST_PLATFORM_NAME})
@ -48,6 +51,40 @@ if(NOT CPACK_GENERATOR)
return()
endif()
# pull down the desired copy of CMake so it can be included in the package
if(NOT (CPACK_CMAKE_PACKAGE_FILE AND CPACK_CMAKE_PACKAGE_HASH))
message(FATAL_ERROR
"Packaging is missing one or more following properties required to include CMake: "
" CPACK_CMAKE_PACKAGE_FILE, CPACK_CMAKE_PACKAGE_HASH")
endif()
set(_cmake_package_dest ${CPACK_BINARY_DIR}/${CPACK_CMAKE_PACKAGE_FILE})
string(REPLACE "." ";" _version_componets "${CPACK_DESIRED_CMAKE_VERSION}")
list(GET _version_componets 0 _major_version)
list(GET _version_componets 1 _minor_version)
set(_url_version_tag "v${_major_version}.${_minor_version}")
message(STATUS "Ensuring CMake ${CPACK_DESIRED_CMAKE_VERSION} is avaiable for packaging...")
file(DOWNLOAD
https://cmake.org/files/${_url_version_tag}/${CPACK_CMAKE_PACKAGE_FILE}
${_cmake_package_dest}
)
file(SHA256 ${_cmake_package_dest} _package_hash)
if (NOT "${_package_hash}" STREQUAL "${CPACK_CMAKE_PACKAGE_HASH}")
file(REMOVE ${_cmake_package_dest})
message(FATAL_ERROR "Donwload package of CMake does not match expected hash value. "
"Please double check the properies CPACK_CMAKE_PACKAGE_FILE and CPACK_CMAKE_PACKAGE_HASH "
"before trying again.")
endif()
install(FILES ${_cmake_package_dest}
DESTINATION ./Tools/Redistributables/CMake
COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT}
)
# IMPORTANT: required to be included AFTER setting all property overrides
include(CPack REQUIRED)

@ -286,7 +286,7 @@ endfunction()
function(ly_setup_others)
# List of directories we want to install relative to engine root
set(DIRECTORIES_TO_INSTALL Tools/LyTestTools Tools/RemoteConsole Tools/Redistributables/CMake)
set(DIRECTORIES_TO_INSTALL Tools/LyTestTools Tools/RemoteConsole)
foreach(dir ${DIRECTORIES_TO_INSTALL})
get_filename_component(install_path ${dir} DIRECTORY)

@ -43,16 +43,14 @@
</Directory>
</DirectoryRef>
<Property Id="CMakeArchvieName" Value="cmake-3.19.1-win64-x64"/>
<CustomAction Id="ExtractCMake"
ExeCommand="&quot;[SystemFolder]cmd.exe&quot; /C tar -x -f &quot;[root.tools.redist.cmake][CMakeArchvieName].zip&quot; -C &quot;[root.tools.redist]CMake&quot;"
ExeCommand="&quot;[SystemFolder]cmd.exe&quot; /C tar -x -f &quot;[root.tools.redist.cmake]$(var.CPACK_CMAKE_PACKAGE_NAME).zip&quot; -C &quot;[root.tools.redist]CMake&quot;"
Directory="INSTALL_ROOT"
Execute="deferred"
Impersonate="no"/>
<CustomAction Id="MoveCMake"
ExeCommand="&quot;[SystemFolder]cmd.exe&quot; /C move &quot;[root.tools.redist.cmake][CMakeArchvieName]&quot; &quot;[root.cmake]runtime&quot;"
ExeCommand="&quot;[SystemFolder]cmd.exe&quot; /C move &quot;[root.tools.redist.cmake]$(var.CPACK_CMAKE_PACKAGE_NAME)&quot; &quot;[root.cmake]runtime&quot;"
Directory="INSTALL_ROOT"
Execute="deferred"
Impersonate="no"/>

@ -28,6 +28,10 @@ endif()
set(CPACK_GENERATOR "WIX")
set(_cmake_package_name "cmake-${CPACK_DESIRED_CMAKE_VERSION}-windows-x86_64")
set(CPACK_CMAKE_PACKAGE_FILE "${_cmake_package_name}.zip")
set(CPACK_CMAKE_PACKAGE_HASH "15a49e2ab81c1822d75b1b1a92f7863f58e31f6d6aac1c4103eef2b071be3112")
# 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 and have the ability to detect if they are still being used.
@ -106,4 +110,5 @@ endif()
set(CPACK_WIX_CANDLE_EXTRA_FLAGS
-dCPACK_EMBED_ARTIFACTS=${_embed_artifacts}
-dCPACK_CMAKE_PACKAGE_NAME=${_cmake_package_name}
)

Loading…
Cancel
Save