Merge branch 'development' into test_artifact_collection

Signed-off-by: evanchia <evanchia@amazon.com>
This commit is contained in:
evanchia
2021-12-02 11:20:43 -08:00
2661 changed files with 61328 additions and 33906 deletions
+22
View File
@@ -25,6 +25,15 @@ define_property(TARGET PROPERTY LY_SYSTEM_LIBRARY
# \arg:output_third_party_path name of variable to set the default project directory into
# It defaults to the ~/.o3de/3rdParty directory
function(get_default_third_party_folder output_third_party_path)
# 1. Highest priority, cache variable, that will override the value of any of the cases below
# 2. if defined in an env variable, take it from there
if($ENV{LY_3RDPARTY_PATH})
set(${output_third_party_path} $ENV{LY_3RDPARTY_PATH} PARENT_SCOPE)
return()
endif()
# 3. If defined in the o3de_manifest.json, take it from there
cmake_path(SET home_directory "$ENV{USERPROFILE}") # Windows
if(NOT EXISTS ${home_directory})
cmake_path(SET home_directory "$ENV{HOME}") # Unix
@@ -33,7 +42,20 @@ function(get_default_third_party_folder output_third_party_path)
endif()
endif()
set(manifest_path ${home_directory}/.o3de/o3de_manifest.json)
if(EXISTS ${manifest_path})
file(READ ${manifest_path} manifest_json)
string(JSON default_third_party_folder ERROR_VARIABLE json_error GET ${manifest_json} default_third_party_folder)
if(NOT json_error)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${manifest_path})
set(${output_third_party_path} ${default_third_party_folder} PARENT_SCOPE)
return()
endif()
endif()
# 4. Lowest priority, use the home directory as the location for 3rdparty
set(${output_third_party_path} ${home_directory}/.o3de/3rdParty PARENT_SCOPE)
endfunction()
get_default_third_party_folder(o3de_default_third_party_path)
@@ -20,7 +20,7 @@ ly_associate_package(PACKAGE_NAME tiff-4.2.0.15-rev4-android TARGETS TIF
ly_associate_package(PACKAGE_NAME freetype-2.10.4.16-android TARGETS freetype PACKAGE_HASH df9e4d559ea0f03b0666b48c79813b1cd4d9624429148a249865de9f5c2c11cd)
ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.9.50-rev1-android TARGETS AWSNativeSDK PACKAGE_HASH 33771499f9080cbaab613459927e52911e68f94fa356397885e85005efbd1490)
ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev5-android TARGETS Lua PACKAGE_HASH 1f638e94a17a87fe9e588ea456d5893876094b4db191234380e4c4eb9e06c300)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev4-android TARGETS PhysX PACKAGE_HASH 60777cbd5279a45dd9d9ee65525f662ce32253b88359162e54e4bb8581a4a262)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev5-android TARGETS PhysX PACKAGE_HASH b346e8f9bc55f367a97d781d94c8a5c3bff8059478b8a7007e5fd17708dc1d07)
ly_associate_package(PACKAGE_NAME mikkelsen-1.0.0.4-android TARGETS mikkelsen PACKAGE_HASH 075e8e4940884971063b5a9963014e2e517246fa269c07c7dc55b8cf2cd99705)
ly_associate_package(PACKAGE_NAME googletest-1.8.1-rev4-android TARGETS googletest PACKAGE_HASH 95671be75287a61c9533452835c3647e9c1b30f81b34b43bcb0ec1997cc23894)
ly_associate_package(PACKAGE_NAME googlebenchmark-1.5.0-rev2-android TARGETS GoogleBenchmark PACKAGE_HASH 20b46e572211a69d7d94ddad1c89ec37bb958711d6ad4025368ac89ea83078fb)
+2 -1
View File
@@ -27,7 +27,7 @@ ly_associate_package(PACKAGE_NAME tiff-4.2.0.15-rev3-linux
ly_associate_package(PACKAGE_NAME freetype-2.10.4.16-linux TARGETS freetype PACKAGE_HASH 3f10c703d9001ecd2bb51a3bd003d3237c02d8f947ad0161c0252fdc54cbcf97)
ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.7.167-rev6-linux TARGETS AWSNativeSDK PACKAGE_HASH 490291e4c8057975c3ab86feb971b8a38871c58bac5e5d86abdd1aeb7141eec4)
ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev5-linux TARGETS Lua PACKAGE_HASH 1adc812abe3dd0dbb2ca9756f81d8f0e0ba45779ac85bf1d8455b25c531a38b0)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev4-linux TARGETS PhysX PACKAGE_HASH a5cba1c7e1f3df37869008ef18d99bdd15f8e9a44cbe259cf79374696f2b6515)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev5-linux TARGETS PhysX PACKAGE_HASH fa72365df409376aef02d1763194dc91d255bdfcb4e8febcfbb64d23a3e50b96)
ly_associate_package(PACKAGE_NAME mcpp-2.7.2_az.2-rev1-linux TARGETS mcpp PACKAGE_HASH df7a998d0bc3fedf44b5bdebaf69ddad6033355b71a590e8642445ec77bc6c41)
ly_associate_package(PACKAGE_NAME mikkelsen-1.0.0.4-linux TARGETS mikkelsen PACKAGE_HASH 5973b1e71a64633588eecdb5b5c06ca0081f7be97230f6ef64365cbda315b9c8)
ly_associate_package(PACKAGE_NAME googletest-1.8.1-rev4-linux TARGETS googletest PACKAGE_HASH 7b7ad330f369450c316a4c4592d17fbb4c14c731c95bd8f37757203e8c2bbc1b)
@@ -46,3 +46,4 @@ ly_associate_package(PACKAGE_NAME squish-ccr-deb557d-rev1-linux
ly_associate_package(PACKAGE_NAME astc-encoder-3.2-rev2-linux TARGETS astc-encoder PACKAGE_HASH 71549d1ca9e4d48391b92a89ea23656d3393810e6777879f6f8a9def2db1610c)
ly_associate_package(PACKAGE_NAME ISPCTexComp-36b80aa-rev1-linux TARGETS ISPCTexComp PACKAGE_HASH 065fd12abe4247dde247330313763cf816c3375c221da030bdec35024947f259)
ly_associate_package(PACKAGE_NAME lz4-1.9.3-vcpkg-rev4-linux TARGETS lz4 PACKAGE_HASH 5de3dbd3e2a3537c6555d759b3c5bb98e5456cf85c74ff6d046f809b7087290d)
ly_associate_package(PACKAGE_NAME pyside2-5.15.2-rev2-linux TARGETS pyside2 PACKAGE_HASH 7589c397c8224d0c3ad691ff02e1afd55d9a1f9de1967c14eb8105dd2b0c4dd1)
+1 -1
View File
@@ -28,7 +28,7 @@ ly_associate_package(PACKAGE_NAME tiff-4.2.0.15-rev3-mac
ly_associate_package(PACKAGE_NAME freetype-2.10.4.16-mac TARGETS freetype PACKAGE_HASH f159b346ac3251fb29cb8dd5f805c99b0015ed7fdb3887f656945ca701a61d0d)
ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.7.167-rev5-mac TARGETS AWSNativeSDK PACKAGE_HASH ffb890bd9cf23afb429b9214ad9bac1bf04696f07a0ebb93c42058c482ab2f01)
ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev6-mac TARGETS Lua PACKAGE_HASH b9079fd35634774c9269028447562c6b712dbc83b9c64975c095fd423ff04c08)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev4-mac TARGETS PhysX PACKAGE_HASH 5f65e798059ea945b53e8f308c0594f195118a64e3ce873f2fff971f4e207b4d)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev5-mac TARGETS PhysX PACKAGE_HASH 83940b3876115db82cd8ffcb9e902278e75846d6ad94a41e135b155cee1ee186)
ly_associate_package(PACKAGE_NAME mcpp-2.7.2_az.2-rev1-mac TARGETS mcpp PACKAGE_HASH be9558905c9c49179ef3d7d84f0a5472415acdf7fe2d76eb060d9431723ddf2e)
ly_associate_package(PACKAGE_NAME mikkelsen-1.0.0.4-mac TARGETS mikkelsen PACKAGE_HASH 83af99ca8bee123684ad254263add556f0cf49486c0b3e32e6d303535714e505)
ly_associate_package(PACKAGE_NAME googletest-1.8.1-rev4-mac TARGETS googletest PACKAGE_HASH cbf020d5ef976c5db8b6e894c6c63151ade85ed98e7c502729dd20172acae5a8)
@@ -29,7 +29,7 @@ ly_associate_package(PACKAGE_NAME tiff-4.2.0.15-rev3-windows
ly_associate_package(PACKAGE_NAME freetype-2.10.4.16-windows TARGETS freetype PACKAGE_HASH 9809255f1c59b07875097aa8d8c6c21c97c47a31fb35e30f2bb93188e99a85ff)
ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.7.167-rev4-windows TARGETS AWSNativeSDK PACKAGE_HASH a900e80f7259e43aed5c847afee2599ada37f29db70505481397675bcbb6c76c)
ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev5-windows TARGETS Lua PACKAGE_HASH 136faccf1f73891e3fa3b95f908523187792e56f5b92c63c6a6d7e72d1158d40)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev4-windows TARGETS PhysX PACKAGE_HASH 4591647debc80f9fd1db003206b25aeef0f0036fc4dba05b494558dcf045021b)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev5-windows TARGETS PhysX PACKAGE_HASH 4e31a3e1f5bf3952d8af8e28d1a29f04167995a6362fc3a7c20c25f74bf01e23)
ly_associate_package(PACKAGE_NAME mcpp-2.7.2_az.2-rev1-windows TARGETS mcpp PACKAGE_HASH 794789aba639bfe2f4e8fcb4424d679933dd6290e523084aa0a4e287ac44acb2)
ly_associate_package(PACKAGE_NAME mikkelsen-1.0.0.4-windows TARGETS mikkelsen PACKAGE_HASH 872c4d245a1c86139aa929f2b465b63ea4ea55b04ced50309135dd4597457a4e)
ly_associate_package(PACKAGE_NAME googletest-1.8.1-rev4-windows TARGETS googletest PACKAGE_HASH 7e8f03ae8a01563124e3daa06386f25a2b311c10bb95bff05cae6c41eff83837)
+1 -1
View File
@@ -21,7 +21,7 @@ ly_associate_package(PACKAGE_NAME tiff-4.2.0.15-rev3-ios TARGETS TIFF
ly_associate_package(PACKAGE_NAME freetype-2.10.4.16-ios TARGETS freetype PACKAGE_HASH 3ac3c35e056ae4baec2e40caa023d76a7a3320895ef172b6655e9261b0dc2e29)
ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.7.167-rev4-ios TARGETS AWSNativeSDK PACKAGE_HASH d10e7496ca705577032821011beaf9f2507689f23817bfa0ed4d2a2758afcd02)
ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev5-ios TARGETS Lua PACKAGE_HASH c2d3c4e67046c293049292317a7d60fdb8f23effeea7136aefaef667163e5ffe)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev4-ios TARGETS PhysX PACKAGE_HASH fb2295974eccd7a05b62efd774c5c4b1ce2b7e45ba65c0b9c1f59c0dab0d34f9)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev5-ios TARGETS PhysX PACKAGE_HASH 4a5e38b385837248590018eb133444b4e440190414e6756191200a10c8fa5615)
ly_associate_package(PACKAGE_NAME mikkelsen-1.0.0.4-ios TARGETS mikkelsen PACKAGE_HASH 976aaa3ccd8582346132a10af253822ccc5d5bcc9ea5ba44d27848f65ee88a8a)
ly_associate_package(PACKAGE_NAME googletest-1.8.1-rev4-ios TARGETS googletest PACKAGE_HASH 2f121ad9784c0ab73dfaa58e1fee05440a82a07cc556bec162eeb407688111a7)
ly_associate_package(PACKAGE_NAME googlebenchmark-1.5.0-rev2-ios TARGETS GoogleBenchmark PACKAGE_HASH c2ffaed2b658892b1bcf81dee4b44cd1cb09fc78d55584ef5cb8ab87f2d8d1ae)
+4 -7
View File
@@ -7,7 +7,7 @@
include_guard()
include(cmake/LySet.cmake)
include(${LY_ROOT_FOLDER}/cmake/LySet.cmake)
# OVERVIEW:
# this is the Open 3D Engine Package system.
@@ -80,10 +80,7 @@ macro(ly_package_message)
endif()
endmacro()
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/packages)
include(cmake/LYPackage_S3Downloader.cmake)
include(${LY_ROOT_FOLDER}/cmake/LYPackage_S3Downloader.cmake)
# Attempts one time to download a file.
# sets should_retry to true if the caller should retry due to an intermittent problem
@@ -711,11 +708,11 @@ if (NOT CMAKE_SCRIPT_MODE_FILE)
# include the built in 3rd party packages that are for every platform.
# you can put your package associations anywhere, but this provides
# a good starting point.
include(cmake/3rdParty/BuiltInPackages.cmake)
include(${LY_ROOT_FOLDER}/cmake/3rdParty/BuiltInPackages.cmake)
endif()
if(PAL_TRAIT_BUILD_HOST_TOOLS)
include(cmake/LYWrappers.cmake)
include(${LY_ROOT_FOLDER}/cmake/LYWrappers.cmake)
# Importing this globally to handle AUTOMOC, AUTOUIC, AUTORCC
ly_parse_third_party_dependencies(3rdParty::Qt)
endif()
+1 -1
View File
@@ -9,5 +9,5 @@
# File to tweak compiler settings before compiler detection happens (before project() is called)
# We dont have PAL enabled at this point, so we can only use pure-CMake variables
if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
include(cmake/Platform/${CMAKE_HOST_SYSTEM_NAME}/CompilerSettings.cmake)
include(cmake/Platform/Linux/CompilerSettings_linux.cmake)
endif()
-5
View File
@@ -10,8 +10,3 @@
set(LY_ASSET_DEPLOY_MODE "LOOSE" CACHE STRING "Set the Asset deployment when deploying to the target platform (LOOSE, PAK, VFS)")
set(LY_ASSET_OVERRIDE_PAK_FOLDER_ROOT "" CACHE STRING "Optional root path to where Pak file folders are stored. By default, blank will use a predefined 'paks' root.")
set(LY_ARCHIVE_FILE_SEARCH_MODE "$<$<CONFIG:release>:2>" CACHE STRING "Set the default file search mode to locate non-Pak files within the Archive System\n\
Valid values are:\n\
0 = Search FileSystem first, before searching within mounted Paks\n\
1 = Search mounted Paks first, before searching FileSystem\n\
2 = Search only mounted Paks(default in release)\n")
-1
View File
@@ -16,7 +16,6 @@ if(LY_MONOLITHIC_GAME)
ly_set(PAL_TRAIT_BUILD_HOST_TOOLS FALSE)
ly_set(PAL_TRAIT_BUILD_HOST_GUI_TOOLS FALSE)
ly_set(PAL_TRAIT_BUILD_TESTS_SUPPORTED FALSE)
ly_set(PAL_TRAIT_BUILD_SERVER_SUPPORTED FALSE)
else()
ly_set(PAL_TRAIT_MONOLITHIC_DRIVEN_LIBRARY_TYPE SHARED)
ly_set(PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE GEM_MODULE)
+52 -126
View File
@@ -24,18 +24,23 @@ number will automatically appended as '<version>/<host>'. If LY_INSTALLER_AUTO_
full URL format will be: <base_url>/<build_tag>/<host>"
)
set(LY_INSTALLER_UPLOAD_URL "" CACHE STRING
"Base URL used to upload the installer artifacts after generation, the host target and version number \
will automatically appended as '<version>/<host>'. If LY_INSTALLER_AUTO_GEN_TAG is set, the full URL \
format will be: <base_url>/<build_tag>/<host>. Can also be set via LY_INSTALLER_UPLOAD_URL environment \
variable. Currently only accepts S3 URLs e.g. s3://<bucket>/<prefix>"
set(CPACK_UPLOAD_URL "" CACHE STRING
"URL used to upload the installer artifacts after generation, the host target and version number \
will automatically appended as '<version>/<host>'. If LY_INSTALLER_AUTO_GEN_TAG is set, the full URL \
format will be: <base_url>/<build_tag>/<host>. Currently only accepts S3 URLs e.g. s3://<bucket>/<prefix>"
)
set(LY_INSTALLER_AWS_PROFILE "" CACHE STRING
"AWS CLI profile for uploading artifacts. Can also be set via LY_INSTALLER_AWS_PROFILE environment variable."
set(CPACK_AWS_PROFILE "" CACHE STRING
"AWS CLI profile for uploading artifacts."
)
set(CPACK_THREADS 0)
set(CPACK_DESIRED_CMAKE_VERSION 3.20.2)
if(${CPACK_DESIRED_CMAKE_VERSION} VERSION_LESS ${CMAKE_MINIMUM_REQUIRED_VERSION})
message(FATAL_ERROR
"The desired version of CMake to be included in the package is "
"below the minimum required version of CMake to run")
endif()
# 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
@@ -44,15 +49,16 @@ set(CPACK_DESIRED_CMAKE_VERSION 3.20.2)
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_FULL_NAME "Open3D Engine")
set(CPACK_PACKAGE_VENDOR "O3DE Binary Project a Series of LF Projects, LLC")
set(CPACK_PACKAGE_CONTACT "info@o3debinaries.org")
set(CPACK_PACKAGE_VERSION "${LY_VERSION_STRING}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Installation Tool")
string(TOLOWER "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}" CPACK_PACKAGE_FILE_NAME)
set(DEFAULT_LICENSE_NAME "Apache-2.0")
set(DEFAULT_LICENSE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
set(CPACK_RESOURCE_FILE_LICENSE ${DEFAULT_LICENSE_FILE})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_LICENSE_URL ${LY_INSTALLER_LICENSE_URL})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}")
@@ -60,6 +66,7 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSI
# 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
set(CPACK_OUTPUT_FILE_PREFIX CPackUploads)
# this config file allows the dynamic setting of cpack variables at cpack-time instead of cmake configure
set(CPACK_PROJECT_CONFIG_FILE ${CPACK_SOURCE_DIR}/PackagingConfig.cmake)
@@ -74,132 +81,38 @@ if(NOT CPACK_GENERATOR)
return()
endif()
if(${CPACK_DESIRED_CMAKE_VERSION} VERSION_LESS ${CMAKE_MINIMUM_REQUIRED_VERSION})
message(FATAL_ERROR
"The desired version of CMake to be included in the package is "
"below the minimum required version of CMake to run")
endif()
# pull down the desired copy of CMake so it can be included in the package
# We will download the desired copy of CMake so it can be included in the package, we defer the downloading
# to the install process, to do so we generate a script that will perform the download and execute such script
# during the install process (before packaging)
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})
# We download it to a different location because CPACK_PACKAGING_INSTALL_PREFIX will be removed during
# cpack generation. CPACK_BINARY_DIR persists across cpack invocations
set(LY_CMAKE_PACKAGE_DOWNLOAD_PATH ${CPACK_BINARY_DIR}/${CPACK_CMAKE_PACKAGE_FILE})
if(EXISTS ${_cmake_package_dest})
file(SHA256 ${_cmake_package_dest} hash_of_downloaded_file)
if (NOT "${hash_of_downloaded_file}" STREQUAL "${CPACK_CMAKE_PACKAGE_HASH}")
message(STATUS "CMake ${CPACK_DESIRED_CMAKE_VERSION} found at ${_cmake_package_dest} but expected hash missmatches, re-downloading...")
file(REMOVE ${_cmake_package_dest})
else()
message(STATUS "CMake ${CPACK_DESIRED_CMAKE_VERSION} found")
endif()
endif()
if(NOT EXISTS ${_cmake_package_dest})
# download it
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}")
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 ${_cmake_package_dest}
EXPECTED_HASH ${CPACK_CMAKE_PACKAGE_HASH}
RESULTS _results
)
list(GET _results 0 _status_code)
if (${_status_code} EQUAL 0 AND EXISTS ${_cmake_package_dest})
message(STATUS "CMake ${CPACK_DESIRED_CMAKE_VERSION} found")
else()
file(REMOVE ${_cmake_package_dest})
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()
ly_install(FILES ${_cmake_package_dest}
DESTINATION ./Tools/Redistributables/CMake
configure_file(${LY_ROOT_FOLDER}/cmake/Packaging/CMakeDownload.cmake.in
${CPACK_BINARY_DIR}/CMakeDownload.cmake
@ONLY
)
ly_install(SCRIPT ${CPACK_BINARY_DIR}/CMakeDownload.cmake
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
)
ly_install(FILES ${LY_CMAKE_PACKAGE_DOWNLOAD_PATH}
DESTINATION Tools/Redistributables/CMake
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
)
# the version string and git tags are intended to be synchronized so it should be safe to use that instead
# of directly calling into git which could get messy in certain scenarios
if(${CPACK_PACKAGE_VERSION} VERSION_GREATER "0.0.0.0")
set(_3rd_party_license_filename NOTICES.txt)
set(_3rd_party_license_url "https://raw.githubusercontent.com/o3de/3p-package-source/${CPACK_PACKAGE_VERSION}/${_3rd_party_license_filename}")
set(_3rd_party_license_dest ${CPACK_BINARY_DIR}/${_3rd_party_license_filename})
# use the plain file downloader as we don't have the file hash available and using a dummy will
# delete the file once it fails hash verification
file(DOWNLOAD
${_3rd_party_license_url}
${_3rd_party_license_dest}
STATUS _status
TLS_VERIFY ON
)
list(POP_FRONT _status _status_code)
if (${_status_code} EQUAL 0 AND EXISTS ${_3rd_party_license_dest})
ly_install(FILES ${_3rd_party_license_dest}
DESTINATION .
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
)
else()
file(REMOVE ${_3rd_party_license_dest})
message(FATAL_ERROR "Failed to acquire the 3rd Party license manifest file at ${_3rd_party_license_url}. Error: ${_status}")
endif()
endif()
# checks for and removes trailing slash
function(strip_trailing_slash in_url out_url)
string(LENGTH ${in_url} _url_length)
MATH(EXPR _url_length "${_url_length}-1")
string(SUBSTRING ${in_url} 0 ${_url_length} _clean_url)
if("${in_url}" STREQUAL "${_clean_url}/")
set(${out_url} ${_clean_url} PARENT_SCOPE)
else()
set(${out_url} ${in_url} PARENT_SCOPE)
endif()
endfunction()
if(NOT LY_INSTALLER_UPLOAD_URL AND DEFINED ENV{LY_INSTALLER_UPLOAD_URL})
set(LY_INSTALLER_UPLOAD_URL $ENV{LY_INSTALLER_UPLOAD_URL})
endif()
if(LY_INSTALLER_UPLOAD_URL)
ly_is_s3_url(${LY_INSTALLER_UPLOAD_URL} _is_s3_bucket)
if(NOT _is_s3_bucket)
message(FATAL_ERROR "Only S3 installer uploading is supported at this time")
endif()
if (LY_INSTALLER_AWS_PROFILE)
set(CPACK_AWS_PROFILE ${LY_INSTALLER_AWS_PROFILE})
elseif (DEFINED ENV{LY_INSTALLER_AWS_PROFILE})
set(CPACK_AWS_PROFILE $ENV{LY_INSTALLER_AWS_PROFILE})
endif()
strip_trailing_slash(${LY_INSTALLER_UPLOAD_URL} LY_INSTALLER_UPLOAD_URL)
set(CPACK_UPLOAD_URL ${LY_INSTALLER_UPLOAD_URL})
endif()
# Set common CPACK variables to all platforms/generators
set(CPACK_STRIP_FILES TRUE) # always strip symbols on packaging
set(CPACK_PACKAGE_CHECKSUM SHA256) # Generate checksum file
set(CPACK_PRE_BUILD_SCRIPTS ${pal_dir}/PackagingPreBuild_${PAL_HOST_PLATFORM_NAME_LOWERCASE}.cmake)
set(CPACK_POST_BUILD_SCRIPTS ${pal_dir}/PackagingPostBuild_${PAL_HOST_PLATFORM_NAME_LOWERCASE}.cmake)
set(CPACK_CODESIGN_SCRIPT ${pal_dir}/PackagingCodeSign_${PAL_HOST_PLATFORM_NAME_LOWERCASE}.cmake)
set(CPACK_LY_PYTHON_CMD ${LY_PYTHON_CMD})
# IMPORTANT: required to be included AFTER setting all property overrides
include(CPack REQUIRED)
@@ -268,13 +181,26 @@ foreach(external_dir ${LY_INSTALL_EXTERNAL_BUILD_DIRS})
)
endforeach()
# checks for and removes trailing slash
function(strip_trailing_slash in_url out_url)
string(LENGTH ${in_url} _url_length)
MATH(EXPR _url_length "${_url_length}-1")
string(SUBSTRING ${in_url} 0 ${_url_length} _clean_url)
if("${in_url}" STREQUAL "${_clean_url}/")
set(${out_url} ${_clean_url} PARENT_SCOPE)
else()
set(${out_url} ${in_url} PARENT_SCOPE)
endif()
endfunction()
if(LY_INSTALLER_DOWNLOAD_URL)
strip_trailing_slash(${LY_INSTALLER_DOWNLOAD_URL} LY_INSTALLER_DOWNLOAD_URL)
# this will set the following variables: CPACK_DOWNLOAD_SITE, CPACK_DOWNLOAD_ALL, and CPACK_UPLOAD_DIRECTORY (local)
cpack_configure_downloads(
${LY_INSTALLER_DOWNLOAD_URL}
UPLOAD_DIRECTORY ${CMAKE_BINARY_DIR}/_CPack_Uploads # to match the _CPack_Packages directory
UPLOAD_DIRECTORY ${CMAKE_BINARY_DIR}/CPackUploads # to match the _CPack_Packages directory
ALL
)
endif()
+54
View File
@@ -0,0 +1,54 @@
#
# 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()
@@ -11,10 +11,14 @@ if(LY_TOOLCHAIN_NDK_API_LEVEL)
endif()
# Verify that the NDK environment is set and points to the support NDK
if(NOT ${LY_NDK_DIR})
if($ENV{LY_NDK_DIR})
set(LY_NDK_DIR $ENV{LY_NDK_DIR})
endif()
endif()
file(TO_CMAKE_PATH "${LY_NDK_DIR}" LY_NDK_DIR)
if(NOT LY_NDK_DIR)
message(FATAL_ERROR "Environment var for NDK is empty. Could not find the NDK installation folder")
message(FATAL_ERROR "Environment and cache var for NDK is empty. Could not find the NDK installation folder")
endif()
set(LY_ANDROID_NDK_TOOLCHAIN ${LY_NDK_DIR}/build/cmake/android.toolchain.cmake)
+17 -12
View File
@@ -224,8 +224,14 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
if("${target_type}" STREQUAL "STATIC_LIBRARY")
set(build_deps_target "${build_deps_target};${build_deps_PRIVATE}")
endif()
# But we will also pass the private dependencies as runtime dependencies (note the comment above)
set(RUNTIME_DEPENDENCIES_PLACEHOLDER ${build_deps_PRIVATE})
# But we will also pass the private dependencies as runtime dependencies (as long as they are targets, note the comment above)
foreach(build_dep_private IN LISTS build_deps_PRIVATE)
if(TARGET ${build_dep_private})
list(APPEND RUNTIME_DEPENDENCIES_PLACEHOLDER "${build_dep_private}")
endif()
endforeach()
foreach(build_dependency IN LISTS build_deps_target)
# Skip wrapping produced when targets are not created in the same directory
if(build_dependency)
@@ -569,9 +575,13 @@ function(ly_setup_runtime_dependencies)
string(TOUPPER ${conf} UCONF)
ly_install(CODE
"function(ly_copy source_file target_directory)
cmake_path(GET source_file FILENAME file_name)
if(NOT EXISTS \${target_directory}/\${file_name})
file(COPY \"\${source_file}\" DESTINATION \"\${target_directory}\" FILE_PERMISSIONS ${LY_COPY_PERMISSIONS})
cmake_path(GET source_file FILENAME target_filename)
cmake_path(APPEND full_target_directory \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\" \"\${target_directory}\")
cmake_path(APPEND target_file \"\${full_target_directory}\" \"\${target_filename}\")
if(\"\${source_file}\" IS_NEWER_THAN \"\${target_file}\")
message(STATUS \"Copying \${source_file} to \${full_target_directory}...\")
file(COPY \"\${source_file}\" DESTINATION \"\${full_target_directory}\" FILE_PERMISSIONS ${LY_COPY_PERMISSIONS} FOLLOW_SYMLINK_CHAIN)
file(TOUCH_NOCREATE \"${target_file}\")
endif()
endfunction()"
COMPONENT ${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF}
@@ -596,12 +606,7 @@ endfunction()"
endif()
# runtime dependencies that need to be copied to the output
# Anywhere CMAKE_INSTALL_PREFIX is used, it has to be escaped so it is baked into the cmake_install.cmake script instead
# of baking the path. This is needed so `cmake --install --prefix <someprefix>` works regardless of the CMAKE_INSTALL_PREFIX
# used to generate the solution.
# CMAKE_INSTALL_PREFIX is still used when building the INSTALL target
set(install_output_folder "\${CMAKE_INSTALL_PREFIX}/${runtime_output_directory}")
set(target_file_dir "${install_output_folder}/${target_runtime_output_subdirectory}")
set(target_file_dir "${runtime_output_directory}/${target_runtime_output_subdirectory}")
ly_get_runtime_dependencies(runtime_dependencies ${target})
foreach(runtime_dependency ${runtime_dependencies})
unset(runtime_command)
@@ -810,4 +815,4 @@ set(LY_CORE_COMPONENT_ALREADY_INCLUDED FALSE)"
ly_post_install_steps()
endif()
endfunction()
endfunction()
@@ -0,0 +1,114 @@
#
# 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
#
#
message(STATUS "Executing packaging postbuild...")
# ly_is_s3_url
# if the given URL is a s3 url of thr form "s3://(stuff)" then sets
# the output_variable_name to TRUE otherwise unsets it.
function (ly_is_s3_url download_url output_variable_name)
if ("${download_url}" MATCHES "s3://.*")
set(${output_variable_name} TRUE PARENT_SCOPE)
else()
unset(${output_variable_name} PARENT_SCOPE)
endif()
endfunction()
function(ly_upload_to_url in_url in_local_path in_file_regex)
message(STATUS "Uploading ${in_local_path}/${in_file_regex} artifacts to ${CPACK_UPLOAD_URL}")
ly_is_s3_url(${in_url} _is_s3_bucket)
if(NOT _is_s3_bucket)
message(FATAL_ERROR "Only S3 installer uploading is supported at this time")
endif()
# strip the scheme and extract the bucket/key prefix from the URL
string(REPLACE "s3://" "" _stripped_url ${in_url})
string(REPLACE "/" ";" _tokens ${_stripped_url})
list(POP_FRONT _tokens _bucket)
string(JOIN "/" _prefix ${_tokens})
set(_extra_args [[{"ACL":"bucket-owner-full-control"}]])
file(TO_NATIVE_PATH "${LY_ROOT_FOLDER}/scripts/build/tools/upload_to_s3.py" _upload_script)
set(_upload_command
${CPACK_LY_PYTHON_CMD} -s
-u ${_upload_script}
--base_dir ${in_local_path}
--file_regex="${in_file_regex}"
--bucket ${_bucket}
--key_prefix ${_prefix}
--extra_args ${_extra_args}
)
if(CPACK_AWS_PROFILE)
list(APPEND _upload_command --profile ${CPACK_AWS_PROFILE})
endif()
execute_process(
COMMAND ${_upload_command}
RESULT_VARIABLE _upload_result
OUTPUT_VARIABLE _upload_output
ERROR_VARIABLE _upload_error
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (${_upload_result} EQUAL 0)
message(STATUS "Artifact uploading complete!")
else()
message(FATAL_ERROR "An error occurred uploading to s3.\n Output: ${_upload_output}\n\ Error: ${_upload_error}")
endif()
endfunction()
function(ly_upload_to_latest in_url in_path)
message(STATUS "Updating latest tagged build")
# make sure we can extra the commit info from the URL first
string(REGEX MATCH "([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9a-zA-Z]+)"
commit_info ${in_url}
)
if(NOT commit_info)
message(FATAL_ERROR "Failed to extract the build tag")
endif()
# Create a temp directory where we are going to rename the file to take out the version
# and then upload it
set(temp_dir ${CPACK_BINARY_DIR}/temp)
if(NOT EXISTS ${temp_dir})
file(MAKE_DIRECTORY ${temp_dir})
endif()
file(COPY ${in_path} DESTINATION ${temp_dir})
cmake_path(GET in_path FILENAME in_path_filename)
string(REPLACE "_${CPACK_PACKAGE_VERSION}" "" non_versioned_in_path_filename ${in_path_filename})
file(RENAME "${temp_dir}/${in_path_filename}" "${temp_dir}/${non_versioned_in_path_filename}")
# include the commit info in a text file that will live next to the exe
set(_temp_info_file ${temp_dir}/build_tag.txt)
file(WRITE ${_temp_info_file} ${commit_info})
# update the URL and upload
string(REPLACE
${commit_info} "Latest"
latest_upload_url ${in_url}
)
ly_upload_to_url(
${latest_upload_url}
${temp_dir}
".*(${non_versioned_in_path_filename}|build_tag.txt)$"
)
# cleanup the temp files
file(REMOVE_RECURSE ${temp_dir})
message(STATUS "Latest build update complete!")
endfunction()
@@ -0,0 +1,5 @@
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
@@ -22,6 +22,7 @@ function(ly_copy source_file target_directory)
endif()
if((NOT source_file_size EQUAL target_file_size) OR "${source_file}" IS_NEWER_THAN "${target_file}")
message(STATUS "Copying \"${source_file}\" to \"${target_directory}\"...")
file(MAKE_DIRECTORY "${full_target_directory}")
file(COPY "${source_file}" DESTINATION "${target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
file(TOUCH_NOCREATE ${target_file})
endif()
+21 -8
View File
@@ -9,14 +9,27 @@
#! ly_setup_runtime_dependencies_copy_function_override: Linux-specific copy function to handle RPATH fixes
set(ly_copy_template [[
function(ly_copy source_file target_directory)
file(COPY "${source_file}" DESTINATION "${target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
get_filename_component(target_filename_ext "${source_file}" LAST_EXT)
if("${source_file}" MATCHES "qt/plugins" AND "${target_filename_ext}" STREQUAL ".so")
get_filename_component(target_filename "${source_file}" NAME)
file(RPATH_CHANGE FILE "${target_directory}/${target_filename}" OLD_RPATH "\$ORIGIN/../../lib" NEW_RPATH "\$ORIGIN/..")
elseif("${source_file}" MATCHES "lrelease")
get_filename_component(target_filename "${source_file}" NAME)
file(RPATH_CHANGE FILE "${target_directory}/${target_filename}" OLD_RPATH "\$ORIGIN/../lib" NEW_RPATH "\$ORIGIN")
cmake_path(GET source_file FILENAME target_filename)
cmake_path(APPEND full_target_directory "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}" "${target_directory}")
cmake_path(APPEND target_file "${full_target_directory}" "${target_filename}")
if("${source_file}" IS_NEWER_THAN "${target_file}")
message(STATUS "Copying ${source_file} to ${full_target_directory}...")
file(MAKE_DIRECTORY "${full_target_directory}")
file(COPY "${source_file}" DESTINATION "${full_target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
file(TOUCH_NOCREATE "${target_file}")
# Special case for install
cmake_PATH(GET source_file EXTENSION target_filename_ext)
if("${target_filename_ext}" STREQUAL ".so")
if("${source_file}" MATCHES "qt/plugins")
file(RPATH_CHANGE FILE "${target_file}" OLD_RPATH "\$ORIGIN/../../lib" NEW_RPATH "\$ORIGIN/..")
endif()
if(CMAKE_INSTALL_DO_STRIP)
execute_process(COMMAND @CMAKE_STRIP@ "${target_file}")
endif()
elseif("${source_file}" MATCHES "lrelease")
file(RPATH_CHANGE FILE "${target_file}" OLD_RPATH "\$ORIGIN/../lib" NEW_RPATH "\$ORIGIN")
endif()
endif()
endfunction()]])
+1 -1
View File
@@ -16,7 +16,7 @@ ly_set(PAL_TRAIT_BUILD_TESTS_SUPPORTED TRUE)
ly_set(PAL_TRAIT_BUILD_UNITY_SUPPORTED TRUE)
ly_set(PAL_TRAIT_BUILD_UNITY_EXCLUDE_EXTENSIONS)
ly_set(PAL_TRAIT_BUILD_EXCLUDE_ALL_TEST_RUNS_FROM_IDE FALSE)
ly_set(PAL_TRAIT_BUILD_CPACK_SUPPORTED FALSE)
ly_set(PAL_TRAIT_BUILD_CPACK_SUPPORTED TRUE)
ly_set(PAL_TRAIT_PROF_PIX_SUPPORTED FALSE)
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
#
# 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 -o errexit # exit on the first failure encountered
{
if [[ ! -f "/usr/lib/x86_64-linux-gnu/libffi.so.6" ]]; then
sudo ln -s /usr/lib/x86_64-linux-gnu/libffi.so.7 /usr/lib/x86_64-linux-gnu/libffi.so.6
fi
pushd @CPACK_PACKAGING_INSTALL_PREFIX@
python/get_python.sh
chown -R $SUDO_USER .
popd
} &> /dev/null # hide output
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
#
# 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 -o errexit # exit on the first failure encountered
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
#
# 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 -o errexit # exit on the first failure encountered
{
# We dont remove this symlink that we potentially created because the user could have
# installed themselves.
#if [[ -L "/usr/lib/x86_64-linux-gnu/libffi.so.6" ]]; then
# sudo rm /usr/lib/x86_64-linux-gnu/libffi.so.6
#fi
pushd @CPACK_PACKAGING_INSTALL_PREFIX@
# delete python downloads
rm -rf python/downloaded_packages python/runtime
find . -type d -name *.egg-info -prune -exec rm -rf {} \;
popd
} &> /dev/null # hide output
@@ -0,0 +1,33 @@
#
# 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
#
#
function(ly_sign_binaries in_path)
message(STATUS "Executing package signing...")
file(REAL_PATH "${CPACK_SOURCE_DIR}/.." _root_path)
unset(_signing_command)
cmake_path(SET _sign_script "${_root_path}/scripts/signer/Platform/Linux/signer.sh")
list(APPEND _signing_command
${_sign_script}
)
message(STATUS "Signing package files in ${in_path}")
execute_process(
COMMAND ${_signing_command} ${in_path}
RESULT_VARIABLE _signing_result
ERROR_VARIABLE _signing_errors
OUTPUT_VARIABLE _signing_output
ECHO_OUTPUT_VARIABLE
)
if(NOT ${_signing_result} EQUAL 0)
message(FATAL_ERROR "An error occurred during signing files. ${_signing_errors}")
else()
message(STATUS "Signing complete!")
endif()
endfunction()
@@ -0,0 +1,64 @@
#
# 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
#
#
file(REAL_PATH "${CPACK_SOURCE_DIR}/.." LY_ROOT_FOLDER)
include(${LY_ROOT_FOLDER}/cmake/Platform/Common/PackagingPostBuild_common.cmake)
include(${CPACK_CODESIGN_SCRIPT})
file(${CPACK_PACKAGE_CHECKSUM} ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}.deb file_checksum)
file(WRITE ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}.deb.sha256 "${file_checksum} ${CPACK_PACKAGE_FILE_NAME}.deb")
if(CPACK_UPLOAD_URL)
# use the internal default path if somehow not specified from cpack_configure_downloads
if(NOT CPACK_UPLOAD_DIRECTORY)
set(CPACK_UPLOAD_DIRECTORY ${CPACK_PACKAGE_DIRECTORY}/CPackUploads)
endif()
# Sign and regenerate checksum
ly_sign_binaries("${CPACK_TOPLEVEL_DIRECTORY}/*.deb" "")
file(WRITE ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}.deb.sha256 "${file_checksum} ${CPACK_PACKAGE_FILE_NAME}.deb")
# Copy the artifacts intended to be uploaded to a remote server into the folder specified
# through CPACK_UPLOAD_DIRECTORY. This mimics the same process cpack does natively for
# some other frameworks that have built-in online installer support.
message(STATUS "Copying packaging artifacts to upload directory...")
file(REMOVE_RECURSE ${CPACK_UPLOAD_DIRECTORY})
file(GLOB _artifacts
"${CPACK_TOPLEVEL_DIRECTORY}/*.deb"
"${CPACK_TOPLEVEL_DIRECTORY}/*.sha256"
"${LY_ROOT_FOLDER}/scripts/signer/Platform/Linux/*.gpg"
)
file(COPY ${_artifacts}
DESTINATION ${CPACK_UPLOAD_DIRECTORY}
)
message(STATUS "Artifacts copied to ${CPACK_UPLOAD_DIRECTORY}")
ly_upload_to_url(
${CPACK_UPLOAD_URL}
${CPACK_UPLOAD_DIRECTORY}
".*(.deb|.gpg|.sha256)$"
)
# for auto tagged builds, we will also upload a second copy of just the boostrapper
# to a special "Latest" folder under the branch in place of the commit date/hash
if(CPACK_AUTO_GEN_TAG)
set(latest_deb_package "${CPACK_UPLOAD_DIRECTORY}/${CPACK_PACKAGE_NAME}_latest.deb")
file(COPY_FILE
${CPACK_UPLOAD_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}.deb
${latest_deb_package}
)
ly_upload_to_latest(${CPACK_UPLOAD_URL} ${latest_deb_package})
# Generate a checksum file for latest and upload it
set(latest_hash_file "${CPACK_UPLOAD_DIRECTORY}/${CPACK_PACKAGE_NAME}_latest.deb.sha256")
file(WRITE "${latest_hash_file}" "${file_checksum} ${CPACK_PACKAGE_NAME}_latest.deb")
ly_upload_to_latest(${CPACK_UPLOAD_URL} "${latest_hash_file}")
endif()
endif()
@@ -0,0 +1,14 @@
#
# 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
#
#
file(REAL_PATH "${CPACK_SOURCE_DIR}/.." LY_ROOT_FOLDER)
include(${LY_ROOT_FOLDER}/cmake/Platform/Common/PackagingPreBuild_common.cmake)
if(NOT CPACK_UPLOAD_URL) # Skip this step if we are not uploading the package
return()
endif()
@@ -0,0 +1,56 @@
#
# 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(CPACK_GENERATOR DEB)
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/${CPACK_PACKAGE_NAME}/${LY_VERSION_STRING}")
set(_cmake_package_name "cmake-${CPACK_DESIRED_CMAKE_VERSION}-linux-x86_64")
set(CPACK_CMAKE_PACKAGE_FILE "${_cmake_package_name}.tar.gz")
set(CPACK_CMAKE_PACKAGE_HASH "3f827544f9c82e74ddf5016461fdfcfea4ede58a26f82612f473bf6bfad8bfc2")
# get all the package dependencies, extracted from scripts\build\build_node\Platform\Linux\package-list.ubuntu-focal.txt
set(package_dependencies
libffi7
clang-12
ninja-build
# Build Libraries
libglu1-mesa-dev # For Qt (GL dependency)
libxcb-xinerama0 # For Qt plugins at runtime
libxcb-xinput0 # For Qt plugins at runtime
libfontconfig1-dev # For Qt plugins at runtime
libcurl4-openssl-dev # For HttpRequestor
# libsdl2-dev # for WWise/Audio
libxcb-xkb-dev # For xcb keyboard input
libxkbcommon-x11-dev # For xcb keyboard input
libxkbcommon-dev # For xcb keyboard input
libxcb-xfixes0-dev # For mouse input
libxcb-xinput-dev # For mouse input
zlib1g-dev
mesa-common-dev
)
list(JOIN package_dependencies "," CPACK_DEBIAN_PACKAGE_DEPENDS)
# Post-installation and pre/post removal scripts
configure_file("${LY_ROOT_FOLDER}/cmake/Platform/${PAL_PLATFORM_NAME}/Packaging/postinst.in"
"${CMAKE_BINARY_DIR}/cmake/Platform/${PAL_PLATFORM_NAME}/Packaging/postinst"
@ONLY
)
configure_file("${LY_ROOT_FOLDER}/cmake/Platform/${PAL_PLATFORM_NAME}/Packaging/prerm.in"
"${CMAKE_BINARY_DIR}/cmake/Platform/${PAL_PLATFORM_NAME}/Packaging/prerm"
@ONLY
)
configure_file("${LY_ROOT_FOLDER}/cmake/Platform/${PAL_PLATFORM_NAME}/Packaging/postrm.in"
"${CMAKE_BINARY_DIR}/cmake/Platform/${PAL_PLATFORM_NAME}/Packaging/postrm"
@ONLY
)
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
${CMAKE_BINARY_DIR}/cmake/Platform/Linux/Packaging/postinst
${CMAKE_BINARY_DIR}/cmake/Platform/Linux/Packaging/prerm
${CMAKE_BINARY_DIR}/cmake/Platform/Linux/Packaging/postrm
)
@@ -10,11 +10,20 @@ set(FILES
../Common/Configurations_common.cmake
../Common/Clang/Configurations_clang.cmake
../Common/Install_common.cmake
../Common/PackagingPostBuild_common.cmake
../Common/PackagingPreBuild_common.cmake
CompilerSettings_linux.cmake
Configurations_linux.cmake
Install_linux.cmake
LYTestWrappers_linux.cmake
LYWrappers_linux.cmake
Packaging_linux.cmake
PackagingCodeSign_linux.cmake
PackagingPostBuild_linux.cmake
PackagingPreBuild_linux.cmake
PAL_linux.cmake
PALDetection_linux.cmake
RPathChange.cmake
runtime_dependencies_linux.cmake.in
RuntimeDependencies_linux.cmake
)
@@ -10,6 +10,7 @@ cmake_policy(SET CMP0012 NEW) # new policy for the if that evaluates a boolean o
function(ly_copy source_file target_directory)
cmake_path(GET source_file FILENAME target_filename)
cmake_PATH(GET source_file EXTENSION target_filename_ext)
cmake_path(APPEND target_file "${target_directory}" "${target_filename}")
cmake_path(COMPARE "${source_file}" EQUAL "${target_file}" same_location)
if(NOT ${same_location})
@@ -22,6 +23,7 @@ function(ly_copy source_file target_directory)
endif()
if((NOT source_file_size EQUAL target_file_size) OR "${source_file}" IS_NEWER_THAN "${target_file}")
message(STATUS "Copying \"${source_file}\" to \"${target_directory}\"...")
file(MAKE_DIRECTORY "${full_target_directory}")
file(COPY "${source_file}" DESTINATION "${target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
file(TOUCH_NOCREATE "${target_file}")
+23 -14
View File
@@ -130,27 +130,36 @@ endfunction()
function(ly_copy source_file target_directory)
if("${source_file}" MATCHES "\\.[Ff]ramework[^\\.]")
if("${source_file}" MATCHES "\\.[Ff]ramework")
# fixup origin to copy the whole Framework folder
string(REGEX REPLACE "(.*\\.[Ff]ramework).*" "\\1" source_file "${source_file}")
endif()
get_filename_component(target_filename "${source_file}" NAME)
file(COPY "${source_file}" DESTINATION "${target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
# Our Qt and Python frameworks aren't in the correct bundle format to be codesigned.
if("${target_filename}" MATCHES "(Qt[^.]+)\\.[Ff]ramework")
fixup_qt_framework(${CMAKE_MATCH_1} "${target_directory}/${target_filename}")
# For some Qt frameworks(QtCore), signing the bundle doesn't work because of bundle
# format issues(despite the fixes above). But once we've patched the framework above, there's
# only one executable that we need to sign so we can do it directly.
set(target_filename "${target_filename}/Versions/5/${CMAKE_MATCH_1}")
elseif("${target_filename}" MATCHES "Python.framework")
fixup_python_framework("${target_directory}/${target_filename}")
codesign_python_framework_binaries("${target_directory}/${target_filename}")
cmake_path(GET source_file FILENAME target_filename)
cmake_path(APPEND full_target_directory "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}" "${target_directory}")
cmake_path(APPEND target_file "${full_target_directory}" "${target_filename}")
if("${source_file}" IS_NEWER_THAN "${target_file}")
message(STATUS "Copying ${source_file} to ${full_target_directory}...")
file(MAKE_DIRECTORY "${full_target_directory}")
file(COPY "${source_file}" DESTINATION "${full_target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
file(TOUCH_NOCREATE "${target_file}")
# Our Qt and Python frameworks aren't in the correct bundle format to be codesigned.
if("${target_filename}" MATCHES "(Qt[^.]+)\\.[Ff]ramework")
fixup_qt_framework(${CMAKE_MATCH_1} "${target_file}")
# For some Qt frameworks(QtCore), signing the bundle doesn't work because of bundle
# format issues(despite the fixes above). But once we've patched the framework above, there's
# only one executable that we need to sign so we can do it directly.
set(target_filename "${target_filename}/Versions/5/${CMAKE_MATCH_1}")
elseif("${target_filename}" MATCHES "Python.framework")
fixup_python_framework("${target_file}")
codesign_python_framework_binaries("${target_file}")
endif()
codesign_file("${target_file}" "none")
endif()
codesign_file("${target_directory}/${target_filename}" "none")
endfunction()
-1
View File
@@ -147,4 +147,3 @@ function(ly_post_install_steps)
")
endfunction()
@@ -0,0 +1,10 @@
#
# 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
#
#
file(REAL_PATH "${CPACK_SOURCE_DIR}/.." LY_ROOT_FOLDER)
include(${LY_ROOT_FOLDER}/cmake/Platform/Common/PackagingPostBuild_common.cmake)
@@ -0,0 +1,10 @@
#
# 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
#
#
file(REAL_PATH "${CPACK_SOURCE_DIR}/.." LY_ROOT_FOLDER)
include(${LY_ROOT_FOLDER}/cmake/Platform/Common/PackagingPreBuild_common.cmake)
@@ -120,19 +120,28 @@ function(ly_copy source_file target_directory)
file(MAKE_DIRECTORY "${target_directory}")
endif()
if(NOT target_is_bundle)
set(is_framework FALSE)
if("${source_file}" MATCHES "\\.[Ff]ramework")
set(is_framework TRUE)
endif()
if(NOT is_framework)
# if it is a bundle, there is no contention about the files in the destination, each bundle target will copy everything
# we dont want these files to invalidate the bundle and cause a new signature
file(LOCK ${target_file}.lock GUARD FUNCTION TIMEOUT 300)
endif()
file(SIZE "${source_file}" source_file_size)
if(EXISTS "${target_file}")
file(SIZE "${target_file}" target_file_size)
file(SIZE "${source_file}" source_file_size)
if(EXISTS "${target_file}")
file(SIZE "${target_file}" target_file_size)
else()
set(target_file_size 0)
endif()
else()
set(source_file_size 0)
set(target_file_size 0)
endif()
if((NOT source_file_size EQUAL target_file_size) OR "${source_file}" IS_NEWER_THAN "${target_file}")
message(STATUS "Copying \"${source_file}\" to \"${target_directory}\"...")
file(MAKE_DIRECTORY "${target_directory}")
file(COPY "${source_file}" DESTINATION "${target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
file(TOUCH_NOCREATE "${target_file}")
set(anything_new TRUE PARENT_SCOPE)
@@ -0,0 +1,56 @@
#
# 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
#
#
function(ly_sign_binaries in_path in_path_type)
message(STATUS "Executing package signing...")
file(REAL_PATH "${CPACK_SOURCE_DIR}/.." _root_path)
unset(_signing_command)
cmake_path(SET _sign_script "${_root_path}/scripts/signer/Platform/Windows/signer.ps1")
find_program(_psiexec_path psexec.exe)
if(_psiexec_path)
list(APPEND _signing_command
${_psiexec_path}
-accepteula
-nobanner
-s
)
endif()
find_program(_powershell_path powershell.exe REQUIRED)
list(APPEND _signing_command
${_powershell_path}
-NoLogo
-ExecutionPolicy Bypass
-File ${_sign_script}
)
# This requires to have a valid local certificate. In continuous integration, these certificates are stored
# in the machine directly.
# You can generate a test certificate to be able to run this in a PowerShell elevated promp with:
# New-SelfSignedCertificate -DnsName foo.o3de.com -Type CodeSigning -CertStoreLocation Cert:\CurrentUser\My
# Export-Certificate -Cert (Get-ChildItem Cert:\CurrentUser\My\<cert thumbprint>) -Filepath "c:\selfsigned.crt"
# Import-Certificate -FilePath "c:\selfsigned.crt" -Cert Cert:\CurrentUser\TrustedPublisher
# Import-Certificate -FilePath "c:\selfsigned.crt" -Cert Cert:\CurrentUser\Root
message(STATUS "Signing ${in_path_type} files in ${in_path}")
execute_process(
COMMAND ${_signing_command} -${in_path_type} ${in_path}
RESULT_VARIABLE _signing_result
ERROR_VARIABLE _signing_errors
OUTPUT_VARIABLE _signing_output
ECHO_OUTPUT_VARIABLE
)
if(NOT ${_signing_result} EQUAL 0)
message(FATAL_ERROR "An error occurred during signing files for ${in_path_type}. ${_signing_errors}")
else()
message(STATUS "Signing complete!")
endif()
endfunction()
@@ -1,249 +0,0 @@
#
# 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
#
#
# 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_wix_out_dir ${CPACK_TOPLEVEL_DIRECTORY})
set(_bootstrap_out_dir "${CPACK_TOPLEVEL_DIRECTORY}/bootstrap")
set(_bootstrap_filename "${CPACK_PACKAGE_FILE_NAME}_installer.exe")
set(_bootstrap_output_file ${_cpack_wix_out_dir}/${_bootstrap_filename})
set(_ext_flags
-ext WixBalExtension
)
set(_addtional_defines
-dCPACK_BOOTSTRAP_THEME_FILE=${CPACK_BINARY_DIR}/BootstrapperTheme
-dCPACK_BOOTSTRAP_UPGRADE_GUID=${CPACK_WIX_BOOTSTRAP_UPGRADE_GUID}
-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}
-dCPACK_WIX_PRODUCT_LOGO=${CPACK_WIX_PRODUCT_LOGO}
-dCPACK_RESOURCE_PATH=${CPACK_SOURCE_DIR}/Platform/Windows/Packaging
)
if(CPACK_LICENSE_URL)
list(APPEND _addtional_defines -dCPACK_LICENSE_URL=${CPACK_LICENSE_URL})
endif()
set(_candle_command
${CPACK_WIX_CANDLE_EXECUTABLE}
-nologo
-arch x64
"-I${_cpack_wix_out_dir}" # to include cpack_variables.wxi
${_addtional_defines}
${_ext_flags}
"${CPACK_SOURCE_DIR}/Platform/Windows/Packaging/Bootstrapper.wxs"
-o "${_bootstrap_out_dir}/"
)
set(_light_command
${CPACK_WIX_LIGHT_EXECUTABLE}
-nologo
${_ext_flags}
${_bootstrap_out_dir}/*.wixobj
-o "${_bootstrap_output_file}"
)
if(CPACK_UPLOAD_URL) # Skip signing if we are not uploading the package
file(REAL_PATH "${CPACK_SOURCE_DIR}/.." _root_path)
file(TO_NATIVE_PATH "${_root_path}/scripts/signer/Platform/Windows/signer.ps1" _sign_script)
unset(_signing_command)
find_program(_psiexec_path psexec.exe)
if(_psiexec_path)
list(APPEND _signing_command
${_psiexec_path}
-accepteula
-nobanner
-s
)
endif()
find_program(_powershell_path powershell.exe REQUIRED)
list(APPEND _signing_command
${_powershell_path}
-NoLogo
-ExecutionPolicy Bypass
-File ${_sign_script}
)
message(STATUS "Signing package files in ${_cpack_wix_out_dir}")
execute_process(
COMMAND ${_signing_command} -packagePath ${_cpack_wix_out_dir}
RESULT_VARIABLE _signing_result
ERROR_VARIABLE _signing_errors
OUTPUT_VARIABLE _signing_output
ECHO_OUTPUT_VARIABLE
)
if(NOT ${_signing_result} EQUAL 0)
message(FATAL_ERROR "An error occurred during signing package files. ${_signing_errors}")
endif()
endif()
message(STATUS "Creating Bootstrap Installer...")
execute_process(
COMMAND ${_candle_command}
RESULT_VARIABLE _candle_result
ERROR_VARIABLE _candle_errors
)
if(NOT ${_candle_result} EQUAL 0)
message(FATAL_ERROR "An error occurred invoking candle.exe. ${_candle_errors}")
endif()
execute_process(
COMMAND ${_light_command}
RESULT_VARIABLE _light_result
ERROR_VARIABLE _light_errors
)
if(NOT ${_light_result} EQUAL 0)
message(FATAL_ERROR "An error occurred invoking light.exe. ${_light_errors}")
endif()
file(COPY ${_bootstrap_output_file}
DESTINATION ${CPACK_PACKAGE_DIRECTORY}
)
message(STATUS "Bootstrap installer generated to ${CPACK_PACKAGE_DIRECTORY}/${_bootstrap_filename}")
if(CPACK_UPLOAD_URL) # Skip signing if we are not uploading the package
message(STATUS "Signing bootstrap installer in ${CPACK_PACKAGE_DIRECTORY}")
execute_process(
COMMAND ${_signing_command} -bootstrapPath ${CPACK_PACKAGE_DIRECTORY}/${_bootstrap_filename}
RESULT_VARIABLE _signing_result
ERROR_VARIABLE _signing_errors
OUTPUT_VARIABLE _signing_output
ECHO_OUTPUT_VARIABLE
)
if(NOT ${_signing_result} EQUAL 0)
message(FATAL_ERROR "An error occurred during signing bootstrap installer. ${_signing_errors}")
endif()
endif()
# use the internal default path if somehow not specified from cpack_configure_downloads
if(NOT CPACK_UPLOAD_DIRECTORY)
set(CPACK_UPLOAD_DIRECTORY ${CPACK_PACKAGE_DIRECTORY}/CPackUploads)
endif()
# copy the artifacts intended to be uploaded to a remote server into the folder specified
# through cpack_configure_downloads. this mimics the same process cpack does natively for
# some other frameworks that have built-in online installer support.
message(STATUS "Copying installer artifacts to upload directory...")
file(REMOVE_RECURSE ${CPACK_UPLOAD_DIRECTORY})
file(GLOB _artifacts "${_cpack_wix_out_dir}/*.msi" "${_cpack_wix_out_dir}/*.cab")
file(COPY ${_artifacts}
DESTINATION ${CPACK_UPLOAD_DIRECTORY}
)
message(STATUS "Artifacts copied to ${CPACK_UPLOAD_DIRECTORY}")
if(NOT CPACK_UPLOAD_URL)
return()
endif()
file(TO_NATIVE_PATH "${_cpack_wix_out_dir}" _cpack_wix_out_dir)
file(TO_NATIVE_PATH "${_root_path}/python/python.cmd" _python_cmd)
file(TO_NATIVE_PATH "${_root_path}/scripts/build/tools/upload_to_s3.py" _upload_script)
function(upload_to_s3 in_url in_local_path in_file_regex)
# strip the scheme and extract the bucket/key prefix from the URL
string(REPLACE "s3://" "" _stripped_url ${in_url})
string(REPLACE "/" ";" _tokens ${_stripped_url})
list(POP_FRONT _tokens _bucket)
string(JOIN "/" _prefix ${_tokens})
set(_extra_args [[{"ACL":"bucket-owner-full-control"}]])
set(_upload_command
${_python_cmd} -s
-u ${_upload_script}
--base_dir ${in_local_path}
--file_regex="${in_file_regex}"
--bucket ${_bucket}
--key_prefix ${_prefix}
--extra_args ${_extra_args}
)
if(CPACK_AWS_PROFILE)
list(APPEND _upload_command --profile ${CPACK_AWS_PROFILE})
endif()
execute_process(
COMMAND ${_upload_command}
RESULT_VARIABLE _upload_result
OUTPUT_VARIABLE _upload_output
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (NOT ${_upload_result} EQUAL 0)
message(FATAL_ERROR "An error occurred uploading to s3.\nOutput:\n${_upload_output}")
endif()
endfunction()
message(STATUS "Uploading artifacts to ${CPACK_UPLOAD_URL}")
upload_to_s3(
${CPACK_UPLOAD_URL}
${_cpack_wix_out_dir}
".*(cab|exe|msi)$"
)
message(STATUS "Artifact uploading complete!")
# for auto tagged builds, we will also upload a second copy of just the boostrapper
# to a special "Latest" folder under the branch in place of the commit date/hash
if(CPACK_AUTO_GEN_TAG)
message(STATUS "Updating latest tagged build")
# make sure we can extra the commit info from the URL first
string(REGEX MATCH "([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9a-zA-Z]+)"
_commit_info ${CPACK_UPLOAD_URL}
)
if(NOT _commit_info)
message(FATAL_ERROR "Failed to extract the build tag")
endif()
set(_temp_dir ${_cpack_wix_out_dir}/temp)
if(NOT EXISTS ${_temp_dir})
file(MAKE_DIRECTORY ${_temp_dir})
endif()
# strip the version number form the exe name in the one uploaded to latest
string(TOLOWER "${CPACK_PACKAGE_NAME}_installer.exe" _non_versioned_exe)
set(_temp_exe_copy ${_temp_dir}/${_non_versioned_exe})
file(COPY ${_bootstrap_output_file} DESTINATION ${_temp_dir})
file(RENAME "${_temp_dir}/${_bootstrap_filename}" ${_temp_exe_copy})
# include the commit info in a text file that will live next to the exe
set(_temp_info_file ${_temp_dir}/build_tag.txt)
file(WRITE ${_temp_info_file} ${_commit_info})
# update the URL and upload
string(REPLACE
${_commit_info} "Latest"
_latest_upload_url ${CPACK_UPLOAD_URL}
)
upload_to_s3(
${_latest_upload_url}
${_temp_dir}
".*(${_non_versioned_exe}|build_tag.txt)$"
)
# cleanup the temp files
file(REMOVE_RECURSE ${_temp_dir})
message(STATUS "Latest build update complete!")
endif()
@@ -0,0 +1,124 @@
#
# 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
#
#
file(REAL_PATH "${CPACK_SOURCE_DIR}/.." LY_ROOT_FOLDER)
include(${LY_ROOT_FOLDER}/cmake/Platform/Common/PackagingPostBuild_common.cmake)
include(${CPACK_CODESIGN_SCRIPT})
# 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_wix_out_dir ${CPACK_TOPLEVEL_DIRECTORY})
set(_bootstrap_out_dir "${CPACK_TOPLEVEL_DIRECTORY}/bootstrap")
set(_bootstrap_filename "${CPACK_PACKAGE_FILE_NAME}_installer.exe")
set(_bootstrap_output_file ${_cpack_wix_out_dir}/${_bootstrap_filename})
set(_ext_flags
-ext WixBalExtension
)
set(_addtional_defines
-dCPACK_BOOTSTRAP_THEME_FILE=${CPACK_BINARY_DIR}/BootstrapperTheme
-dCPACK_BOOTSTRAP_UPGRADE_GUID=${CPACK_WIX_BOOTSTRAP_UPGRADE_GUID}
-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}
-dCPACK_WIX_PRODUCT_LOGO=${CPACK_WIX_PRODUCT_LOGO}
-dCPACK_RESOURCE_PATH=${CPACK_SOURCE_DIR}/Platform/Windows/Packaging
)
if(CPACK_LICENSE_URL)
list(APPEND _addtional_defines -dCPACK_LICENSE_URL=${CPACK_LICENSE_URL})
endif()
set(_candle_command
${CPACK_WIX_CANDLE_EXECUTABLE}
-nologo
-arch x64
"-I${_cpack_wix_out_dir}" # to include cpack_variables.wxi
${_addtional_defines}
${_ext_flags}
"${CPACK_SOURCE_DIR}/Platform/Windows/Packaging/Bootstrapper.wxs"
-o "${_bootstrap_out_dir}/"
)
set(_light_command
${CPACK_WIX_LIGHT_EXECUTABLE}
-nologo
${_ext_flags}
${_bootstrap_out_dir}/*.wixobj
-o "${_bootstrap_output_file}"
)
if(CPACK_UPLOAD_URL) # Skip signing if we are not uploading the package
ly_sign_binaries("${_cpack_wix_out_dir}" "packagePath")
endif()
message(STATUS "Creating Bootstrap Installer...")
execute_process(
COMMAND ${_candle_command}
RESULT_VARIABLE _candle_result
ERROR_VARIABLE _candle_errors
)
if(NOT ${_candle_result} EQUAL 0)
message(FATAL_ERROR "An error occurred invoking candle.exe. ${_candle_errors}")
endif()
execute_process(
COMMAND ${_light_command}
RESULT_VARIABLE _light_result
ERROR_VARIABLE _light_errors
)
if(NOT ${_light_result} EQUAL 0)
message(FATAL_ERROR "An error occurred invoking light.exe. ${_light_errors}")
endif()
message(STATUS "Bootstrap installer generated to ${_bootstrap_output_file}")
if(CPACK_UPLOAD_URL) # Skip signing if we are not uploading the package
ly_sign_binaries("${_bootstrap_output_file}" "bootstrapPath")
endif()
# use the internal default path if somehow not specified from cpack_configure_downloads
if(NOT CPACK_UPLOAD_DIRECTORY)
set(CPACK_UPLOAD_DIRECTORY ${CPACK_PACKAGE_DIRECTORY}/CPackUploads)
endif()
# Copy the artifacts intended to be uploaded to a remote server into the folder specified
# through CPACK_UPLOAD_DIRECTORY. This mimics the same process cpack does natively for
# some other frameworks that have built-in online installer support.
message(STATUS "Copying packaging artifacts to upload directory...")
file(REMOVE_RECURSE ${CPACK_UPLOAD_DIRECTORY})
file(GLOB _artifacts
"${_cpack_wix_out_dir}/*.msi"
"${_cpack_wix_out_dir}/*.cab"
"${_cpack_wix_out_dir}/*.exe"
)
file(COPY ${_artifacts}
DESTINATION ${CPACK_UPLOAD_DIRECTORY}
)
message(STATUS "Artifacts copied to ${CPACK_UPLOAD_DIRECTORY}")
if(CPACK_UPLOAD_URL)
file(TO_NATIVE_PATH "${_cpack_wix_out_dir}" _cpack_wix_out_dir)
ly_upload_to_url(
${CPACK_UPLOAD_URL}
${_cpack_wix_out_dir}
".*(cab|exe|msi)$"
)
# for auto tagged builds, we will also upload a second copy of just the boostrapper
# to a special "Latest" folder under the branch in place of the commit date/hash
if(CPACK_AUTO_GEN_TAG)
ly_upload_to_latest(${CPACK_UPLOAD_URL} ${_bootstrap_output_file})
endif()
endif()
@@ -1,57 +0,0 @@
#
# 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
#
#
if(NOT CPACK_UPLOAD_URL) # Skip signing if we are not uploading the package
return()
endif()
file(REAL_PATH "${CPACK_SOURCE_DIR}/.." _root_path)
set(_cpack_wix_out_dir ${CPACK_TOPLEVEL_DIRECTORY})
file(TO_NATIVE_PATH "${_root_path}/scripts/signer/Platform/Windows/signer.ps1" _sign_script)
unset(_signing_command)
find_program(_psiexec_path psexec.exe)
if(_psiexec_path)
list(APPEND _signing_command
${_psiexec_path}
-accepteula
-nobanner
-s
)
endif()
find_program(_powershell_path powershell.exe REQUIRED)
list(APPEND _signing_command
${_powershell_path}
-NoLogo
-ExecutionPolicy Bypass
-File ${_sign_script}
)
# This requires to have a valid local certificate. In continuous integration, these certificates are stored
# in the machine directly.
# You can generate a test certificate to be able to run this in a PowerShell elevated promp with:
# New-SelfSignedCertificate -DnsName foo.o3de.com -Type CodeSigning -CertStoreLocation Cert:\CurrentUser\My
# Export-Certificate -Cert (Get-ChildItem Cert:\CurrentUser\My\<cert thumbprint>) -Filepath "c:\selfsigned.crt"
# Import-Certificate -FilePath "c:\selfsigned.crt" -Cert Cert:\CurrentUser\TrustedPublisher
# Import-Certificate -FilePath "c:\selfsigned.crt" -Cert Cert:\CurrentUser\Root
message(STATUS "Signing executable files in ${_cpack_wix_out_dir}")
execute_process(
COMMAND ${_signing_command} -exePath ${_cpack_wix_out_dir}
RESULT_VARIABLE _signing_result
ERROR_VARIABLE _signing_errors
OUTPUT_VARIABLE _signing_output
ECHO_OUTPUT_VARIABLE
)
if(NOT ${_signing_result} EQUAL 0)
message(FATAL_ERROR "An error occurred during signing executable files. ${_signing_errors}")
else()
message(STATUS "Signing exes complete!")
endif()
@@ -0,0 +1,18 @@
#
# 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
#
#
file(REAL_PATH "${CPACK_SOURCE_DIR}/.." LY_ROOT_FOLDER)
include(${LY_ROOT_FOLDER}/cmake/Platform/Common/PackagingPreBuild_common.cmake)
include(${CPACK_CODESIGN_SCRIPT})
if(NOT CPACK_UPLOAD_URL) # Skip signing if we are not uploading the package
return()
endif()
set(_cpack_wix_out_dir ${CPACK_TOPLEVEL_DIRECTORY})
ly_sign_binaries("${_cpack_wix_out_dir}" "exePath")
+26 -39
View File
@@ -23,7 +23,6 @@ set(CPACK_WIX_ROOT ${LY_INSTALLER_WIX_ROOT})
set(CPACK_GENERATOR WIX)
set(CPACK_THREADS 0)
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")
@@ -105,47 +104,35 @@ set(_raw_text_license [[
<Text Name="EulaAcceptance" X="42" Y="-56" Width="-42" Height="18" TabStop="yes" FontId="1" HideWhenDisabled="yes">#(loc.InstallEulaAcceptance)</Text>
]])
# The offline installer generation will be a single monolithic MSI. The WIX burn tool for the bootstrapper EXE has a size limitation.
# So we will exclude the generation of the boostrapper EXE in the offline case.
if(LY_INSTALLER_DOWNLOAD_URL)
set(WIX_THEME_WARNING_IMAGE ${CPACK_SOURCE_DIR}/Platform/Windows/Packaging/warning.png)
set(WIX_THEME_WARNING_IMAGE ${CPACK_SOURCE_DIR}/Platform/Windows/Packaging/warning.png)
if(LY_INSTALLER_LICENSE_URL)
set(WIX_THEME_INSTALL_LICENSE_ELEMENTS ${_hyperlink_license})
set(WIX_THEME_EULA_ACCEPTANCE_TEXT "&lt;a href=\"#\"&gt;Terms of Use&lt;/a&gt;")
else()
set(WIX_THEME_INSTALL_LICENSE_ELEMENTS ${_raw_text_license})
set(WIX_THEME_EULA_ACCEPTANCE_TEXT "Terms of Use above")
endif()
# theme ux file
configure_file(
"${CPACK_SOURCE_DIR}/Platform/Windows/Packaging/BootstrapperTheme.xml.in"
"${CPACK_BINARY_DIR}/BootstrapperTheme.xml"
@ONLY
)
# theme localization file
configure_file(
"${CPACK_SOURCE_DIR}/Platform/Windows/Packaging/BootstrapperTheme.wxl.in"
"${CPACK_BINARY_DIR}/BootstrapperTheme.wxl"
@ONLY
)
set(_embed_artifacts "no")
# the bootstrapper will at the very least need a different upgrade guid
generate_wix_guid(CPACK_WIX_BOOTSTRAP_UPGRADE_GUID "${_guid_seed_base}_Bootstrap_UpgradeCode")
set(CPACK_PRE_BUILD_SCRIPTS
${CPACK_SOURCE_DIR}/Platform/Windows/PackagingPreBuild.cmake
)
set(CPACK_POST_BUILD_SCRIPTS
${CPACK_SOURCE_DIR}/Platform/Windows/PackagingPostBuild.cmake
)
if(LY_INSTALLER_LICENSE_URL)
set(WIX_THEME_INSTALL_LICENSE_ELEMENTS ${_hyperlink_license})
set(WIX_THEME_EULA_ACCEPTANCE_TEXT "&lt;a href=\"#\"&gt;Terms of Use&lt;/a&gt;")
else()
set(WIX_THEME_INSTALL_LICENSE_ELEMENTS ${_raw_text_license})
set(WIX_THEME_EULA_ACCEPTANCE_TEXT "Terms of Use above")
endif()
# theme ux file
configure_file(
"${CPACK_SOURCE_DIR}/Platform/Windows/Packaging/BootstrapperTheme.xml.in"
"${CPACK_BINARY_DIR}/BootstrapperTheme.xml"
@ONLY
)
# theme localization file
configure_file(
"${CPACK_SOURCE_DIR}/Platform/Windows/Packaging/BootstrapperTheme.wxl.in"
"${CPACK_BINARY_DIR}/BootstrapperTheme.wxl"
@ONLY
)
set(_embed_artifacts "no")
# the bootstrapper will at the very least need a different upgrade guid
generate_wix_guid(CPACK_WIX_BOOTSTRAP_UPGRADE_GUID "${_guid_seed_base}_Bootstrap_UpgradeCode")
set(CPACK_WIX_CANDLE_EXTRA_FLAGS
-dCPACK_EMBED_ARTIFACTS=${_embed_artifacts}
-dCPACK_CMAKE_PACKAGE_NAME=${_cmake_package_name}
@@ -15,6 +15,8 @@ set(FILES
../Common/MSVC/VisualStudio_common.cmake
../Common/Install_common.cmake
../Common/LYWrappers_default.cmake
../Common/PackagingPostBuild_common.cmake
../Common/PackagingPreBuild_common.cmake
../Common/TargetIncludeSystemDirectories_unsupported.cmake
Configurations_windows.cmake
LYTestWrappers_windows.cmake
@@ -23,7 +25,9 @@ set(FILES
PALDetection_windows.cmake
Install_windows.cmake
Packaging_windows.cmake
PackagingPostBuild.cmake
PackagingCodeSign_windows.cmake
PackagingPostBuild_windows.cmake
PackagingPreBuild_windows.cmake
Packaging/Bootstrapper.wxs
Packaging/BootstrapperTheme.wxl.in
Packaging/BootstrapperTheme.xml.in
+43 -1
View File
@@ -33,6 +33,34 @@ set(gems_json_template [[
[=[ }]=]
)
#!ly_detect_cycle_through_visitation: Detects if there is a cycle based on a list of visited
# items. If the passed item is in the list, then there is a cycle.
# \arg:item - item being checked for the cycle
# \arg:visited_items - list of visited items
# \arg:visited_items_var - list of visited items variable, "item" will be added to the list
# \arg:cycle(variable) - empty string if there is no cycle (an empty string in cmake evaluates
# to false). If there is a cycle a cycle dependency string detailing the sequence of items
# that produce a cycle, e.g. A --> B --> C --> A
#
function(ly_detect_cycle_through_visitation item visited_items visited_items_var cycle)
if(item IN_LIST visited_items)
unset(dependency_cycle_loop)
foreach(visited_item IN LISTS visited_items)
string(APPEND dependency_cycle_loop ${visited_item})
if(visited_item STREQUAL item)
string(APPEND dependency_cycle_loop " (cycle starts)")
endif()
string(APPEND dependency_cycle_loop " --> ")
endforeach()
string(APPEND dependency_cycle_loop "${item} (cycle ends)")
set(${cycle} "${dependency_cycle_loop}" PARENT_SCOPE)
else()
set(cycle "" PARENT_SCOPE) # no cycles
endif()
list(APPEND visited_items ${item})
set(${visited_items_var} "${visited_items}" PARENT_SCOPE)
endfunction()
#!ly_get_gem_load_dependencies: Retrieves the list of "load" dependencies for a target
# Visits through only MANUALLY_ADDED_DEPENDENCIES of targets with a GEM_MODULE property
# to determine which gems a target needs to load
@@ -44,6 +72,13 @@ function(ly_get_gem_load_dependencies ly_GEM_LOAD_DEPENDENCIES ly_TARGET)
if(NOT TARGET ${ly_TARGET})
return() # Nothing to do
endif()
# Internally we use a third parameter to pass the list of targets that we have traversed. This is
# used to detect runtime cycles
if(ARGC EQUAL 3)
set(ly_CYCLE_DETECTION_TARGETS ${ARGV2})
else()
set(ly_CYCLE_DETECTION_TARGETS "")
endif()
# Optimize the search by caching gem load dependencies
get_property(are_dependencies_cached GLOBAL PROPERTY LY_GEM_LOAD_DEPENDENCIES_${ly_TARGET} SET)
@@ -54,6 +89,13 @@ function(ly_get_gem_load_dependencies ly_GEM_LOAD_DEPENDENCIES ly_TARGET)
return()
endif()
# detect cycles
unset(cycle_detected)
ly_detect_cycle_through_visitation(${ly_TARGET} "${ly_CYCLE_DETECTION_TARGETS}" ly_CYCLE_DETECTION_TARGETS cycle_detected)
if(cycle_detected)
message(FATAL_ERROR "Runtime dependency detected: ${cycle_detected}")
endif()
unset(all_gem_load_dependencies)
# For load dependencies, we want to copy over the dependency and traverse them
@@ -69,7 +111,7 @@ function(ly_get_gem_load_dependencies ly_GEM_LOAD_DEPENDENCIES ly_TARGET)
# and recurse into its manually added dependencies
if (is_gem_target)
unset(dependencies)
ly_get_gem_load_dependencies(dependencies ${dealias_load_dependency})
ly_get_gem_load_dependencies(dependencies ${dealias_load_dependency} "${ly_CYCLE_DETECTION_TARGETS}")
list(APPEND all_gem_load_dependencies ${dependencies})
list(APPEND all_gem_load_dependencies ${dealias_load_dependency})
endif()
+5
View File
@@ -11,3 +11,8 @@ set(LY_VERSION_COPYRIGHT_YEAR ${current_year} CACHE STRING "Open 3D Engine's cop
set(LY_VERSION_STRING "0.0.0.0" CACHE STRING "Open 3D Engine's version")
set(LY_VERSION_BUILD_NUMBER 0 CACHE STRING "Open 3D Engine's build number")
set(LY_VERSION_ENGINE_NAME "o3de" CACHE STRING "Open 3D Engine's engine name")
if("$ENV{O3DE_VERSION}")
# Overriding through environment
set(LY_VERSION_STRING "$ENV{O3DE_VERSION}")
endif()