49e8f35858
* configure/generation working Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Generates deb package forLinux Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Fixes to EngineFinder Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * changes the owner of the installed folder so it is writable by the user Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * jenkins scripts Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Fixes execution permission for scripts Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Fixes wrong parameter to build for linux Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * removal of clang parameters in build_config.json Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Simplifies and fixes build configs Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * fixes to EngineFinder Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Adds linux deb package upload and small fixes/organization cleanup Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * fixes checksum generation Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Some more small fixes for reviewing Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Test if this space is necessary for cpack Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * More fixes for installer jobs Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Adding eval to variables that need to double-expand Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Removing unused variables being passed Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Do not remove symlink Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Use cmake_path for concatenating paths Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * removing quotes so the variable expands Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * cleaned up some variables that have way too many ways to be passed Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Multiple fixes for Jenkins Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Cleanup/re-organization Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * fixes some temp variables so we can run cpack jenkins jobs locally Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Delays cmake download to install step Cleanup on installer_windows.cmd, we already have the path to cpack (same as cmake, which is added to the path) Some simplification in the windows installer generation, we now generate the same even if we dont upload Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Fixes mac install Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * CPack can generate hashes for us Defiine CPACK_OUTPUT_FILE_PREFIX to prevent the exe/msi from ending in the bin dir Remove unnecessary generation of folder from 3rdPartyPacakges which fails when including from cpack Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * multiple fixes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * fixes typo Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * more fixes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Fixes for linux/mac/windows (fixing discrepancies with Jenkins) Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * uploads to S3 from the upload directory and fixes the latest upload Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Adds ERROR_VARIABLE to S3 upload to find a Jenkins issue Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * printing command invocation to try to figure out the errors Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Changes the hashing algorithm to sha256 and fixes the cmd used to call to pythojn Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * wrong path being passed in mac Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * removes compiler parameters from a config job (after rebase) Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * more fixes fro deb packaging job Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * small fix for fingerprint patching for latest Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Changing extension of public key and leaving better TODO places for code signing Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Removes sdl as a dependency, leaving it commented since it is needed for wwise Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * fixes runtime copy during install, makes it more consistent with regular runtime dependencies and optimizes copy when there is already an install Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * $ENV{DESTDIR} and CMAKE_INSTALL_PREFIX cannot be used in cmake_path because the CMAKE_INSTALL_PREFIX is absolute Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Fixing some runtime_dependencies optimizations, we cannot take size of a bundle Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Fixes warning in mac for an unused variable Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Fixes a variable that was being passed to fix qt frameworks Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * More fixes for Jenkins Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Updates email to use for maintainer to match certificate Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * make directory because in some cases the dependency is copied before the actual library and the directory has to be created Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * Fix for a new warning/error in linux Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * The sha file is created after the upload happens, so creating it Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * remove the size comparison for install since it stomps over the copy from the target and doesnt trigger stripping Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
206 lines
9.2 KiB
CMake
206 lines
9.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
|
|
#
|
|
#
|
|
|
|
if(NOT PAL_TRAIT_BUILD_CPACK_SUPPORTED)
|
|
return()
|
|
endif()
|
|
|
|
# public facing options will be used for conversion into cpack specific ones below.
|
|
set(LY_INSTALLER_LICENSE_URL "" CACHE STRING "Optionally embed a link to the license instead of raw text")
|
|
|
|
set(LY_INSTALLER_AUTO_GEN_TAG OFF CACHE BOOL
|
|
"Automatically generate a build tag based on the git repo and append it to the download/upload URLs. \
|
|
Format: <branch>/<commit_date>-<commit_hash>"
|
|
)
|
|
|
|
set(LY_INSTALLER_DOWNLOAD_URL "" CACHE STRING
|
|
"Base URL embedded into the installer to download additional artifacts, 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>"
|
|
)
|
|
|
|
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(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
|
|
# the "CPACK_" prefix will automatically be cached for use in any phase of cpack namely
|
|
# pre/post build
|
|
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(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}")
|
|
|
|
# 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)
|
|
set(CPACK_AUTO_GEN_TAG ${LY_INSTALLER_AUTO_GEN_TAG})
|
|
|
|
# attempt to apply platform specific settings
|
|
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
|
|
if(NOT CPACK_GENERATOR)
|
|
return()
|
|
endif()
|
|
|
|
# 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()
|
|
|
|
# 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})
|
|
|
|
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}
|
|
)
|
|
|
|
# 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_LY_PYTHON_CMD ${LY_PYTHON_CMD})
|
|
|
|
# IMPORTANT: required to be included AFTER setting all property overrides
|
|
include(CPack REQUIRED)
|
|
|
|
# configure ALL components here
|
|
file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "
|
|
set(CPACK_COMPONENTS_ALL ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
|
|
set(CPACK_COMPONENT_${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}_DISPLAY_NAME \"Common files\")
|
|
set(CPACK_COMPONENT_${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}_DESCRIPTION \"${PROJECT_NAME} Headers, scripts and common files\")
|
|
set(CPACK_COMPONENT_${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}_REQUIRED TRUE)
|
|
set(CPACK_COMPONENT_${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}_DISABLED FALSE)
|
|
|
|
include(CPackComponents.cmake)
|
|
")
|
|
|
|
# Generate a file (CPackComponents.config) that we will include that defines the components
|
|
# for this build permutation. This way we can get components for other permutations being passed
|
|
# through LY_INSTALL_EXTERNAL_BUILD_DIRS
|
|
unset(cpack_components_contents)
|
|
|
|
set(required "FALSE")
|
|
set(disabled "FALSE")
|
|
if(${LY_INSTALL_PERMUTATION_COMPONENT} STREQUAL DEFAULT)
|
|
set(required "TRUE")
|
|
else()
|
|
set(disabled "TRUE")
|
|
endif()
|
|
string(APPEND cpack_components_contents "
|
|
list(APPEND CPACK_COMPONENTS_ALL ${LY_INSTALL_PERMUTATION_COMPONENT})
|
|
set(CPACK_COMPONENT_${LY_INSTALL_PERMUTATION_COMPONENT}_DISPLAY_NAME \"${LY_BUILD_PERMUTATION} common files\")
|
|
set(CPACK_COMPONENT_${LY_INSTALL_PERMUTATION_COMPONENT}_DESCRIPTION \"${PROJECT_NAME} scripts and common files for ${LY_BUILD_PERMUTATION}\")
|
|
set(CPACK_COMPONENT_${LY_INSTALL_PERMUTATION_COMPONENT}_DEPENDS ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
|
|
set(CPACK_COMPONENT_${LY_INSTALL_PERMUTATION_COMPONENT}_REQUIRED ${required})
|
|
set(CPACK_COMPONENT_${LY_INSTALL_PERMUTATION_COMPONENT}_DISABLED ${disabled})
|
|
")
|
|
|
|
foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
|
|
string(TOUPPER ${conf} UCONF)
|
|
set(required "FALSE")
|
|
set(disabled "FALSE")
|
|
if(${conf} STREQUAL profile AND ${LY_INSTALL_PERMUTATION_COMPONENT} STREQUAL DEFAULT)
|
|
set(required "TRUE")
|
|
else()
|
|
set(disabled "TRUE")
|
|
endif()
|
|
|
|
# Inject a check to not declare components that have not been built. We are using AzCore since that is a
|
|
# common target that will always be build, in every permutation and configuration
|
|
string(APPEND cpack_components_contents "
|
|
if(EXISTS \"${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${conf}/${CMAKE_STATIC_LIBRARY_PREFIX}AzCore${CMAKE_STATIC_LIBRARY_SUFFIX}\")
|
|
list(APPEND CPACK_COMPONENTS_ALL ${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF})
|
|
set(CPACK_COMPONENT_${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF}_DISPLAY_NAME \"Binaries for ${LY_BUILD_PERMUTATION} ${conf}\")
|
|
set(CPACK_COMPONENT_${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF}_DESCRIPTION \"${PROJECT_NAME} libraries and applications for ${LY_BUILD_PERMUTATION} ${conf}\")
|
|
set(CPACK_COMPONENT_${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF}_DEPENDS ${LY_INSTALL_PERMUTATION_COMPONENT})
|
|
set(CPACK_COMPONENT_${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF}_REQUIRED ${required})
|
|
set(CPACK_COMPONENT_${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF}_DISABLED ${disabled})
|
|
endif()
|
|
")
|
|
endforeach()
|
|
file(WRITE "${CMAKE_BINARY_DIR}/CPackComponents.cmake" ${cpack_components_contents})
|
|
|
|
# Inject other build directories
|
|
foreach(external_dir ${LY_INSTALL_EXTERNAL_BUILD_DIRS})
|
|
file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}"
|
|
"include(${external_dir}/CPackComponents.cmake)\n"
|
|
)
|
|
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}/CPackUploads # to match the _CPack_Packages directory
|
|
ALL
|
|
)
|
|
endif()
|