diff --git a/cmake/3rdParty.cmake b/cmake/3rdParty.cmake index 4599c282f0..0142a6a4b6 100644 --- a/cmake/3rdParty.cmake +++ b/cmake/3rdParty.cmake @@ -305,7 +305,7 @@ endfunction() # \arg:3RDPARTY_ROOT_DIRECTORY custom 3rd party directory which needs to be installed function(ly_install_external_target 3RDPARTY_ROOT_DIRECTORY) - # Install the Find file to our /cmake directory + # Install the Find file to our /cmake/3rdParty directory ly_install_files(FILES ${CMAKE_CURRENT_LIST_FILE} DESTINATION cmake/3rdParty ) diff --git a/cmake/Platform/Common/Install_common.cmake b/cmake/Platform/Common/Install_common.cmake index fb46a475e2..9a0fbbd872 100644 --- a/cmake/Platform/Common/Install_common.cmake +++ b/cmake/Platform/Common/Install_common.cmake @@ -38,9 +38,6 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar # Get the target source directory relative to the LY root folder ly_get_engine_relative_source_dir(${absolute_target_source_dir} relative_target_source_dir) - # get the component ID. if the property isn't set for the target, it will auto fallback to use CMAKE_INSTALL_DEFAULT_COMPONENT_NAME - get_property(install_component TARGET ${TARGET_NAME} PROPERTY INSTALL_COMPONENT) - # All include directories marked PUBLIC or INTERFACE will be installed. We dont use PUBLIC_HEADER because in order to do that # we need to set the PUBLIC_HEADER property of the target for all the headers we are exporting. After doing that, installing the # headers end up in one folder instead of duplicating the folder structure of the public/interface include directory. @@ -69,7 +66,7 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar install(DIRECTORY ${include_directory} DESTINATION ${destination_dir} - COMPONENT ${install_component} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} FILES_MATCHING PATTERN *.h PATTERN *.hpp @@ -108,13 +105,13 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar TARGETS ${TARGET_NAME} ARCHIVE DESTINATION ${archive_output_directory}/${PAL_PLATFORM_NAME}/$ - COMPONENT ${install_component} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} LIBRARY DESTINATION ${library_output_directory}/${PAL_PLATFORM_NAME}/$/${target_library_output_subdirectory} - COMPONENT ${install_component} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} RUNTIME DESTINATION ${runtime_output_directory}/${PAL_PLATFORM_NAME}/$/${target_runtime_output_subdirectory} - COMPONENT ${install_component} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} ) endif() @@ -271,7 +268,7 @@ set_property(TARGET ${NAME_PLACEHOLDER} file(GENERATE OUTPUT "${target_install_source_dir}/${NAME_PLACEHOLDER}_$.cmake" CONTENT "${target_file_contents}") install(FILES "${target_install_source_dir}/${NAME_PLACEHOLDER}_$.cmake" DESTINATION ${relative_target_source_dir} - COMPONENT ${install_component} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} ) # Since a CMakeLists.txt could contain multiple targets, we generate it in a folder per target @@ -320,12 +317,9 @@ function(ly_setup_subdirectory absolute_target_source_dir) "${ENABLE_GEMS_PLACEHOLDER}" ) - # get the component ID. if the property isn't set for the directory, it will auto fallback to use CMAKE_INSTALL_DEFAULT_COMPONENT_NAME - get_property(install_component DIRECTORY ${absolute_target_source_dir} PROPERTY INSTALL_COMPONENT) - install(FILES "${target_install_source_dir}/CMakeLists.txt" DESTINATION ${relative_target_source_dir} - COMPONENT ${install_component} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} ) endfunction() @@ -344,6 +338,7 @@ function(ly_setup_o3de_install) ${LY_ROOT_FOLDER}/LICENSE.txt ${LY_ROOT_FOLDER}/README.md DESTINATION . + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} ) endfunction() @@ -353,6 +348,7 @@ function(ly_setup_cmake_install) install(DIRECTORY "${LY_ROOT_FOLDER}/cmake" DESTINATION . + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} PATTERN "__pycache__" EXCLUDE REGEX "Findo3de.cmake" EXCLUDE REGEX "Platform\/.*\/BuiltInPackages_.*\.cmake" EXCLUDE @@ -380,6 +376,7 @@ function(ly_setup_cmake_install) "${LY_ROOT_FOLDER}/CMakeLists.txt" "${CMAKE_CURRENT_BINARY_DIR}/cmake/engine.json" DESTINATION . + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} ) # Collect all Find files that were added with ly_add_external_target_path @@ -400,9 +397,11 @@ function(ly_setup_cmake_install) endforeach() install(FILES ${additional_find_files} DESTINATION cmake/3rdParty + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} ) install(FILES ${additional_platform_files} DESTINATION cmake/3rdParty/Platform/${PAL_PLATFORM_NAME} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} ) # Findo3de.cmake file: we generate a different Findo3de.camke file than the one we have in cmake. This one is going to expose all @@ -419,6 +418,7 @@ function(ly_setup_cmake_install) configure_file(${LY_ROOT_FOLDER}/cmake/install/Findo3de.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/Findo3de.cmake @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/Findo3de.cmake" DESTINATION cmake + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} ) # BuiltInPackage_.cmake: since associations could happen in any cmake file across the engine. We collect @@ -438,6 +438,7 @@ function(ly_setup_cmake_install) ) install(FILES "${pal_builtin_file}" DESTINATION cmake/3rdParty/Platform/${PAL_PLATFORM_NAME} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} ) endfunction() @@ -453,6 +454,7 @@ function(ly_setup_runtime_dependencies) "function(ly_copy source_file target_directory) file(COPY \"\${source_file}\" DESTINATION \"\${target_directory}\" FILE_PERMISSIONS ${LY_COPY_PERMISSIONS}) endfunction()" + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} ) endif() @@ -487,7 +489,9 @@ endfunction()" list(REMOVE_DUPLICATES runtime_commands) list(JOIN runtime_commands " " runtime_commands_str) # the spaces are just to see the right identation in the cmake_install.cmake file - install(CODE "${runtime_commands_str}") + install(CODE "${runtime_commands_str}" + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} + ) endfunction() @@ -573,9 +577,15 @@ function(ly_setup_assets) cmake_path(SET gem_install_dest_dir .) endif() if(IS_DIRECTORY ${gem_absolute_path}) - install(DIRECTORY "${gem_absolute_path}" DESTINATION ${gem_install_dest_dir}) + install(DIRECTORY "${gem_absolute_path}" + DESTINATION ${gem_install_dest_dir} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} + ) elseif (EXISTS ${gem_absolute_path}) - install(FILES ${gem_absolute_path} DESTINATION ${gem_install_dest_dir}) + install(FILES ${gem_absolute_path} + DESTINATION ${gem_install_dest_dir} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} + ) endif() endforeach() diff --git a/cmake/Platform/Linux/Install_linux.cmake b/cmake/Platform/Linux/Install_linux.cmake index 87713fa5d6..dea26e5872 100644 --- a/cmake/Platform/Linux/Install_linux.cmake +++ b/cmake/Platform/Linux/Install_linux.cmake @@ -22,7 +22,9 @@ endfunction()]]) function(ly_install_code_function_override) string(CONFIGURE "${ly_copy_template}" ly_copy_function_linux @ONLY) - install(CODE "${ly_copy_function_linux}") + install(CODE "${ly_copy_function_linux}" + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} + ) endfunction() include(cmake/Platform/Common/Install_common.cmake) diff --git a/cmake/Platform/Mac/Install_mac.cmake b/cmake/Platform/Mac/Install_mac.cmake index c7f22e9149..f3c2b31b31 100644 --- a/cmake/Platform/Mac/Install_mac.cmake +++ b/cmake/Platform/Mac/Install_mac.cmake @@ -42,8 +42,6 @@ function(ly_install_target_override) set(multiValueArgs) cmake_parse_arguments(ly_platform_install_target "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - get_property(install_component TARGET ${ly_platform_install_target_TARGET} PROPERTY INSTALL_COMPONENT) - # For bundles on Mac, we set the icons by passing in a path to the Images.xcassets directory. # However, the CMake install command expects paths to files for the the RESOURCE property. # More details can be found in the CMake issue: https://gitlab.kitware.com/cmake/cmake/-/issues/22409 @@ -57,19 +55,19 @@ function(ly_install_target_override) TARGETS ${ly_platform_install_target_TARGET} ARCHIVE DESTINATION ${ly_platform_install_target_ARCHIVE_DIR}/${PAL_PLATFORM_NAME}/$ - COMPONENT ${install_component} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} LIBRARY DESTINATION ${ly_platform_install_target_LIBRARY_DIR}/${PAL_PLATFORM_NAME}/$/${ly_platform_install_target_LIBRARY_SUBDIR} - COMPONENT ${install_component} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} RUNTIME DESTINATION ${ly_platform_install_target_RUNTIME_DIR}/${PAL_PLATFORM_NAME}/$/${ly_platform_install_target_RUNTIME_SUBDIR} - COMPONENT ${install_component} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} BUNDLE DESTINATION ${ly_platform_install_target_RUNTIME_DIR}/${PAL_PLATFORM_NAME}/$/${ly_platform_install_target_RUNTIME_SUBDIR} - COMPONENT ${install_component} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} RESOURCE DESTINATION ${ly_platform_install_target_RUNTIME_DIR}/${PAL_PLATFORM_NAME}/$/${ly_platform_install_target_RUNTIME_SUBDIR}/ - COMPONENT ${install_component} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} ) if (${is_bundle}) @@ -95,7 +93,9 @@ function(ly_install_code_function_override) endif() file(COPY \"\${source_file}\" DESTINATION \"\${target_directory}\" FILE_PERMISSIONS ${LY_COPY_PERMISSIONS}) -endfunction()") +endfunction()" + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} + ) endfunction() diff --git a/cmake/Projects.cmake b/cmake/Projects.cmake index 627b31bc43..e70c8a4b14 100644 --- a/cmake/Projects.cmake +++ b/cmake/Projects.cmake @@ -145,17 +145,19 @@ foreach(project ${LY_PROJECTS}) # 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) - ly_install_run_code(" -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}\") - message(STATUS \"Generating \${install_output_folder}/Engine.pak from ${full_directory_path}/Cache\") - file(ARCHIVE_CREATE OUTPUT \${install_output_folder}/Engine.pak - PATHS ${full_directory_path}/Cache + 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}") + message(STATUS "Generating ${install_output_folder}/Engine.pak from @full_directory_path@/Cache") + file(ARCHIVE_CREATE OUTPUT ${install_output_folder}/Engine.pak + PATHS @full_directory_path@/Cache FORMAT zip ) - message(STATUS \"\${install_output_folder}/Engine.pak generated\") + message(STATUS "${install_output_folder}/Engine.pak generated") endif() -") +]=]) + string(CONFIGURE "${install_engine_pak_template}" install_engine_pak_code @ONLY) + ly_install_run_code("${install_engine_pak_code}") endforeach() diff --git a/cmake/SettingsRegistry.cmake b/cmake/SettingsRegistry.cmake index f84ecca334..c677aba7cf 100644 --- a/cmake/SettingsRegistry.cmake +++ b/cmake/SettingsRegistry.cmake @@ -120,6 +120,7 @@ endfunction() function(ly_delayed_generate_settings_registry) if(LY_MONOLITHIC_GAME) # No need to generate setregs for monolithic builds + set_property(GLOBAL PROPERTY LY_DELAYED_LOAD_DEPENDENCIES) # Clear out the load targets from the global load dependencies list return() endif() @@ -206,7 +207,7 @@ function(ly_delayed_generate_settings_registry) set_property(GLOBAL PROPERTY LY_DELAYED_LOAD_"${prefix_target}") endforeach() - # Clear out the load targets from the glboal load dependencies list + # Clear out the load targets from the global load dependencies list set_property(GLOBAL PROPERTY LY_DELAYED_LOAD_DEPENDENCIES) endfunction()