Files
o3de/cmake/Packaging/CMakeDownload.cmake.in
T
Esteban Papp dbc5d7a8bc Cherry-pick of Linux deb package to stabilization (#5778)
* Cherry-pick 49e8f35858

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

* Merging differences from development of other changes that need to be there for deb packaging

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

* Picks a needed change for the installer

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

* Fixes warning in mac

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

* Takes version from environment if defined

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

* Do not pick up version if it is empty string since that will also break version comparison

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

* creating temp directories if they dont exist

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

* removing a dependency to itself (Multiplayer.Builders is an alias of Multiplayer.Editor)

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

* Filters which runtime dependencies are passed from private build dependencies to only those that are actual targets.
This avoids something like a "d3d12" private build dependency from being passed to the runtime dependencies

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
2021-11-19 14:07:25 -08:00

55 lines
2.2 KiB
CMake

#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
set(LY_ROOT_FOLDER "@LY_ROOT_FOLDER@")
set(CMAKE_SCRIPT_MODE_FILE TRUE)
include(@LY_ROOT_FOLDER@/cmake/3rdPartyPackages.cmake)
if(EXISTS "@LY_CMAKE_PACKAGE_DOWNLOAD_PATH@")
file(SHA256 "@LY_CMAKE_PACKAGE_DOWNLOAD_PATH@" hash_of_downloaded_file)
if (NOT "${hash_of_downloaded_file}" STREQUAL "@CPACK_CMAKE_PACKAGE_HASH@")
message(STATUS "CMake @CPACK_DESIRED_CMAKE_VERSION@ found at @LY_CMAKE_PACKAGE_DOWNLOAD_PATH@ but expected hash missmatches, re-downloading...")
file(REMOVE "@LY_CMAKE_PACKAGE_DOWNLOAD_PATH@")
else()
message(STATUS "CMake @CPACK_DESIRED_CMAKE_VERSION@ found")
endif()
endif()
if(NOT EXISTS "@LY_CMAKE_PACKAGE_DOWNLOAD_PATH@")
# download it
string(REPLACE "." ";" _version_components "@CPACK_DESIRED_CMAKE_VERSION@")
list(GET _version_components 0 _major_version)
list(GET _version_components 1 _minor_version)
set(_url_version_tag "v${_major_version}.${_minor_version}")
set(_package_url "https://cmake.org/files/${_url_version_tag}/@CPACK_CMAKE_PACKAGE_FILE@")
message(STATUS "Downloading CMake @CPACK_DESIRED_CMAKE_VERSION@ for packaging...")
download_file(
URL ${_package_url}
TARGET_FILE @LY_CMAKE_PACKAGE_DOWNLOAD_PATH@
EXPECTED_HASH @CPACK_CMAKE_PACKAGE_HASH@
RESULTS _results
)
list(GET _results 0 _status_code)
if (${_status_code} EQUAL 0 AND EXISTS "@LY_CMAKE_PACKAGE_DOWNLOAD_PATH@")
message(STATUS "CMake @CPACK_DESIRED_CMAKE_VERSION@ found")
else()
file(REMOVE "@LY_CMAKE_PACKAGE_DOWNLOAD_PATH@")
list(REMOVE_AT _results 0)
set(_error_message "An error occurred, code ${_status_code}. URL ${_package_url} - ${_results}")
if(${_status_code} EQUAL 1)
string(APPEND _error_message
" Please double check the CPACK_CMAKE_PACKAGE_FILE and "
"CPACK_CMAKE_PACKAGE_HASH properties before trying again.")
endif()
message(FATAL_ERROR ${_error_message})
endif()
endif()