fixes some install paths issues in monolithic release (#4422)

* fixes some install paths issues in monolithic release

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

* PR comments

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
monroegm-disable-blank-issue-2
Esteban Papp 4 years ago committed by GitHub
parent fec77632ef
commit bf393ec85c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,20 +19,11 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC
# Otherwise the the absolute project_path is returned with symlinks resolved
file(REAL_PATH ${project_path} project_real_path BASE_DIRECTORY ${LY_ROOT_FOLDER})
if(NOT project_name)
if(NOT EXISTS ${project_real_path}/project.json)
message(FATAL_ERROR "The specified project path of ${project_real_path} does not contain a project.json file")
else()
# Add the project_name to global LY_PROJECTS_TARGET_NAME property
ly_file_read("${project_real_path}/project.json" project_json)
string(JSON project_name ERROR_VARIABLE json_error GET ${project_json} "project_name")
if(json_error)
message(FATAL_ERROR "There is an error reading the \"project_name\" key from the '${project_real_path}/project.json' file: ${json_error}")
endif()
o3de_read_json_key(project_name ${project_real_path}/project.json "project_name")
message(WARNING "The project located at path ${project_real_path} has a valid \"project name\" of '${project_name}' read from it's project.json file."
" This indicates that the ${project_real_path}/CMakeLists.txt is not properly appending the \"project name\" "
"to the LY_PROJECTS_TARGET_NAME global property. Other configuration errors might occur")
endif()
endif()
################################################################################
# Assets

@ -81,9 +81,6 @@
#include AZ_RESTRICTED_FILE(ProjectDefines_h)
#else
#define PROJECTDEFINES_H_TRAIT_DISABLE_MONOLITHIC_PROFILING_MARKERS 1
#if !defined(LINUX) && !defined(APPLE)
#define PROJECTDEFINES_H_TRAIT_ENABLE_SOFTCODE_SYSTEM 1
#endif
#if defined(WIN32) || defined(WIN64) || defined(LINUX) || defined(APPLE)
#define PROJECTDEFINES_H_TRAIT_USE_GPU_PARTICLES 1
#endif

@ -71,7 +71,6 @@ void InitCRTHandlers()
void InitCRTHandlers() {}
#endif
#ifndef SOFTCODE
//////////////////////////////////////////////////////////////////////////
// This is an entry to DLL initialization function that must be called for each loaded module
//////////////////////////////////////////////////////////////////////////
@ -136,8 +135,6 @@ void* GetDetachEnvironmentSymbol()
return reinterpret_cast<void*>(&DetachEnvironment);
}
#endif // !defined(SOFTCODE)
bool g_bProfilerEnabled = false;
//////////////////////////////////////////////////////////////////////////

@ -12,8 +12,6 @@ endif()
ly_install_directory(DIRECTORIES .)
cmake_path(RELATIVE_PATH CMAKE_RUNTIME_OUTPUT_DIRECTORY BASE_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE runtime_output_directory)
ly_install_directory(DIRECTORIES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/Registry
DESTINATION ${runtime_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>
DESTINATION ${runtime_output_directory}
)

@ -89,25 +89,36 @@ 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)
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}")
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(
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)
)
list(GET _results 0 _status_code)
if (${_status_code} EQUAL 0 AND EXISTS ${_cmake_package_dest})
message(STATUS "Package found and verified!")
else()
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)
@ -120,6 +131,7 @@ else()
endif()
message(FATAL_ERROR ${_error_message})
endif()
endif()
install(FILES ${_cmake_package_dest}

@ -430,6 +430,21 @@ function(ly_setup_cmake_install)
DESTINATION .
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
)
string(CONFIGURE [=[
if("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$")
set(install_output_folder "${CMAKE_INSTALL_PREFIX}/@runtime_output_directory@")
file(WRITE ${install_output_folder}/engine.json
"{
\"engine_name\": \"@LY_VERSION_ENGINE_NAME@\"
}")
endif()
]=]
install_engine_json_release
@ONLY
)
install(CODE ${install_engine_json_release}
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the default for the time being
)
# Collect all Find files that were added with ly_add_external_target_path
unset(additional_find_files)

@ -23,6 +23,7 @@ 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")

@ -10,7 +10,7 @@
include_guard()
set(LY_PROJECTS "${LY_PROJECTS}" CACHE STRING "List of projects to enable, this can be a relative path to the engine root or an absolute path")
set(LY_PROJECTS "" CACHE STRING "List of projects to enable, this can be a relative path to the engine root or an absolute path")
#! ly_add_target_dependencies: adds module load dependencies for this target.
#
@ -143,21 +143,25 @@ foreach(project ${LY_PROJECTS})
ly_generate_project_build_path_setreg(${full_directory_path})
add_project_json_external_subdirectories(${full_directory_path})
# Get project name
o3de_read_json_key(project_name ${full_directory_path}/project.json "project_name")
# Generate pak for project in release installs
cmake_path(RELATIVE_PATH CMAKE_RUNTIME_OUTPUT_DIRECTORY BASE_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE runtime_output_directory)
cmake_path(RELATIVE_PATH CMAKE_RUNTIME_OUTPUT_DIRECTORY BASE_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE install_base_runtime_output_directory)
set(install_engine_pak_template [=[
if("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$")
set(install_output_folder "${CMAKE_INSTALL_PREFIX}/@runtime_output_directory@/@PAL_PLATFORM_NAME@/${CMAKE_INSTALL_CONFIG_NAME}/@LY_BUILD_PERMUTATION@")
set(install_output_folder "${CMAKE_INSTALL_PREFIX}/@install_base_runtime_output_directory@/@PAL_PLATFORM_NAME@/${CMAKE_INSTALL_CONFIG_NAME}/@LY_BUILD_PERMUTATION@")
set(install_pak_output_folder "${install_output_folder}/Cache/@LY_ASSET_DEPLOY_ASSET_TYPE@")
if(NOT DEFINED LY_ASSET_DEPLOY_ASSET_TYPE)
set(LY_ASSET_DEPLOY_ASSET_TYPE @LY_ASSET_DEPLOY_ASSET_TYPE@)
endif()
message(STATUS "Generating ${install_output_folder}/engine.pak from @full_directory_path@/Cache/${LY_ASSET_DEPLOY_ASSET_TYPE}")
file(MAKE_DIRECTORY "${install_output_folder}")
message(STATUS "Generating ${install_pak_output_folder}/engine.pak from @full_directory_path@/Cache/${LY_ASSET_DEPLOY_ASSET_TYPE}")
file(MAKE_DIRECTORY "${install_pak_output_folder}")
cmake_path(SET cache_product_path "@full_directory_path@/Cache/${LY_ASSET_DEPLOY_ASSET_TYPE}")
file(GLOB product_assets "${cache_product_path}/*")
if(product_assets)
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar "cf" "${install_output_folder}/engine.pak" --format=zip -- ${product_assets}
COMMAND ${CMAKE_COMMAND} -E tar "cf" "${install_pak_output_folder}/engine.pak" --format=zip -- ${product_assets}
WORKING_DIRECTORY "${cache_product_path}"
RESULT_VARIABLE archive_creation_result
)
@ -165,6 +169,10 @@ if("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$")
message(STATUS "${install_output_folder}/engine.pak generated")
endif()
endif()
file(WRITE ${install_output_folder}/project.json
"{
\"project_name\": \"@project_name@\"
}")
endif()
]=])
string(CONFIGURE "${install_engine_pak_template}" install_engine_pak_code @ONLY)

Loading…
Cancel
Save