Bladeren bron

generated a package for debug/profile/release monolithic-profile/release

Signed-off-by: Esteban Papp <[email protected]>
Esteban Papp 3 jaren geleden
bovenliggende
commit
2fe1e51346

+ 8 - 3
Registry/CMakeLists.txt

@@ -12,6 +12,11 @@ endif()
 
 ly_install_directory(DIRECTORIES .)
 
-ly_install_directory(DIRECTORIES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/Registry
-    DESTINATION ${runtime_output_directory}
-)
+foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
+    string(TOUPPER ${conf} UCONF)
+    string(REPLACE "$<CONFIG>" "${conf}" output ${runtime_output_directory})
+    ly_install_directory(DIRECTORIES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${conf}/Registry
+        DESTINATION ${output}
+        COMPONENT ${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF}
+    )
+endforeach()

+ 23 - 6
cmake/Install.cmake

@@ -18,6 +18,7 @@ endif()
 # \arg:DIRECTORIES directories to install
 # \arg:DESTINATION (optional) destination to install the directory to (relative to CMAKE_PREFIX_PATH)
 # \arg:EXCLUDE_PATTERNS (optional) patterns to exclude
+# \arg:COMPONENT (optional) component to use (defaults to CMAKE_INSTALL_DEFAULT_COMPONENT_NAME)
 # \arg:VERBATIM (optional) copies the directories as they are, this excludes the default exclude patterns
 #
 # \notes: 
@@ -34,7 +35,7 @@ function(ly_install_directory)
     endif()
 
     set(options VERBATIM)
-    set(oneValueArgs DESTINATION)
+    set(oneValueArgs DESTINATION COMPONENT)
     set(multiValueArgs DIRECTORIES EXCLUDE_PATTERNS)
 
     cmake_parse_arguments(ly_install_directory "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@@ -77,11 +78,21 @@ function(ly_install_directory)
             list(APPEND exclude_patterns PATTERN *.egg-info EXCLUDE)
         endif()
 
-        install(DIRECTORY ${directory}
-            DESTINATION ${ly_install_directory_DESTINATION}
-            COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the deafult for the time being
-            ${exclude_patterns}
-        )
+        if(ly_install_directory_COMPONENT)
+            install(DIRECTORY ${directory}
+                DESTINATION ${ly_install_directory_DESTINATION}
+                COMPONENT ${ly_install_directory_COMPONENT}
+                ${exclude_patterns}
+            )
+        else()
+            install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
+            install(DIRECTORY ${directory}
+                DESTINATION ${ly_install_directory_DESTINATION}
+                COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
+                ${exclude_patterns}
+            )
+            install(CODE "endif()")
+        endif()
     endforeach()
 
 endfunction()
@@ -126,10 +137,12 @@ function(ly_install_files)
         set(install_type FILES)
     endif()
 
+    install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
     install(${install_type} ${files}
         DESTINATION ${ly_install_files_DESTINATION}
         COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the default for the time being
     )
+    install(CODE "endif()")
 
 endfunction()
 
@@ -144,9 +157,11 @@ function(ly_install_run_code CODE)
         return()
     endif()
 
+    install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
     install(CODE ${CODE}
         COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the default for the time being
     )
+    install(CODE "endif()")
 
 endfunction()
 
@@ -161,8 +176,10 @@ function(ly_install_run_script SCRIPT)
         return()
     endif()
 
+    install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
     install(SCRIPT ${SCRIPT}
         COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the default for the time being
     )
+    install(CODE "endif()")
 
 endfunction()

+ 58 - 66
cmake/Packaging.cmake

@@ -134,10 +134,12 @@ if(NOT EXISTS ${_cmake_package_dest})
     endif()
 endif()
 
+install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
 install(FILES ${_cmake_package_dest}
     DESTINATION ./Tools/Redistributables/CMake
     COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
 )
+install(CODE "endif()")
 
 # 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
@@ -158,10 +160,12 @@ if(${CPACK_PACKAGE_VERSION} VERSION_GREATER "0.0.0.0")
     list(POP_FRONT _status _status_code)
 
     if (${_status_code} EQUAL 0 AND EXISTS ${_3rd_party_license_dest})
+        install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
         install(FILES ${_3rd_party_license_dest}
             DESTINATION .
             COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
         )
+        install(CODE "endif()")
     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}")
@@ -204,76 +208,73 @@ endif()
 # IMPORTANT: required to be included AFTER setting all property overrides
 include(CPack REQUIRED)
 
-function(ly_configure_cpack_component ly_configure_cpack_component_NAME)
-
-    set(options REQUIRED DISABLED)
-    set(oneValueArgs DISPLAY_NAME DESCRIPTION LICENSE_NAME LICENSE_FILE DEPENDS)
-    set(multiValueArgs)
-
-    cmake_parse_arguments(ly_configure_cpack_component "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-
-    unset(component_type)
-
-    if(ly_configure_cpack_component_DISABLED)
-        list(APPEND component_type DISABLED)
-    endif()
-    if(ly_configure_cpack_component_REQUIRED)
-        list(APPEND component_type REQUIRED)
-    endif()
-
-    set(license_name ${DEFAULT_LICENSE_NAME})
-    set(license_file ${DEFAULT_LICENSE_FILE})
-
-    if(ly_configure_cpack_component_LICENSE_NAME AND ly_configure_cpack_component_LICENSE_FILE)
-        set(license_name ${ly_configure_cpack_component_LICENSE_NAME})
-        set(license_file ${ly_configure_cpack_component_LICENSE_FILE})
-    elseif(ly_configure_cpack_component_LICENSE_NAME OR ly_configure_cpack_component_LICENSE_FILE)
-        message(FATAL_ERROR "Invalid argument configuration. Both LICENSE_NAME and LICENSE_FILE must be set for ly_configure_cpack_component")
-    endif()
-
-    cpack_add_component(
-        ${ly_configure_cpack_component_NAME} ${component_type}
-        DISPLAY_NAME ${ly_configure_cpack_component_DISPLAY_NAME}
-        DESCRIPTION ${ly_configure_cpack_component_DESCRIPTION}
-    )
-endfunction()
-
 # configure ALL components here
-ly_configure_cpack_component(
-    ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} REQUIRED
-    DISPLAY_NAME "${PROJECT_NAME}"
-    DESCRIPTION "${PROJECT_NAME} Headers, scripts and common files"
-)
-
-file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "set(LY_CPACK_COMPONENTS_ALL ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})\n")
+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 \"${PROJECT_NAME}\")
+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 \"${PROJECT_NAME} (${LY_BUILD_PERMUTATION})\")
+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)
-    unset(flags)
-    if(${conf} STREQUAL profile AND ${LY_BUILD_PERMUTATION} STREQUAL Default)
-        set(flags REQUIRED)
+    set(required "FALSE")
+    set(disabled "FALSE")
+    if(${conf} STREQUAL profile AND ${LY_INSTALL_PERMUTATION_COMPONENT} STREQUAL DEFAULT)
+        set(required "TRUE")
     else()
-        set(flags DISABLED)
+        set(disabled "TRUE")
     endif()
 
     unset(permutation_description)
-    if(${LY_BUILD_PERMUTATION} STREQUAL Monolithic)
-        set(permutation_description " monolithic ")
+    if(${LY_INSTALL_PERMUTATION_COMPONENT} STREQUAL MONOLITHIC)
+        set(permutation_description "monolithic ")
     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
-    file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" 
-        "if(EXISTS \"${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${conf}/${CMAKE_STATIC_LIBRARY_PREFIX}AzCore${CMAKE_STATIC_LIBRARY_SUFFIX}\")\n")
-    ly_configure_cpack_component(
-        ${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF} ${flags}
-        DISPLAY_NAME "${PROJECT_NAME} (${conf})"
-        DESCRIPTION "${PROJECT_NAME} Libraries and Tools in${permutation_description}${conf}"
-    )
-    file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" 
-"list(APPEND LY_CPACK_COMPONENTS_ALL ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}_${UCONF})
-endif()\n")
+    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 \"${PROJECT_NAME} (${permutation_description}${conf})\")
+    set(CPACK_COMPONENT_${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF}_DESCRIPTION \"${PROJECT_NAME} Libraries and Applications in ${permutation_description}${conf}\")
+    set(CPACK_COMPONENT_${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF}_DEPENDS ${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF})
+    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()
 
 if(LY_INSTALLER_DOWNLOAD_URL)
@@ -286,12 +287,3 @@ if(LY_INSTALLER_DOWNLOAD_URL)
         ALL
     )
 endif()
-
-# Inject other build directories
-foreach(external_dir ${LY_INSTALL_EXTERNAL_BUILD_DIRS})
-    file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}"
-        "include(${external_dir}/CPackConfig.cmake)\n"
-    )
-endforeach()
-
-file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "set(CPACK_COMPONENTS_ALL \${LY_CPACK_COMPONENTS_ALL})\n")

+ 43 - 7
cmake/Platform/Common/Install_common.cmake

@@ -33,14 +33,13 @@ define_property(TARGET PROPERTY LY_INSTALL_GENERATE_RUN_TARGET
 # CPack is able to put the two together by taking Core from one permutation and then taking
 # each permutation.
 
-ly_set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME Core)
+ly_set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME CORE)
 if(LY_MONOLITHIC_GAME)
     set(LY_BUILD_PERMUTATION Monolithic)
-    set(LY_INSTALL_PERMUTATION_COMPONENT Monolithic)
 else()
     set(LY_BUILD_PERMUTATION Default)
-    set(LY_INSTALL_PERMUTATION_COMPONENT Default)
 endif()
+string(TOUPPER ${LY_BUILD_PERMUTATION} LY_INSTALL_PERMUTATION_COMPONENT)
 
 cmake_path(RELATIVE_PATH CMAKE_RUNTIME_OUTPUT_DIRECTORY BASE_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE runtime_output_directory)
 cmake_path(RELATIVE_PATH CMAKE_LIBRARY_OUTPUT_DIRECTORY BASE_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE library_output_directory)
@@ -84,7 +83,8 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
                 cmake_path(RELATIVE_PATH include_directory BASE_DIRECTORY ${LY_ROOT_FOLDER} OUTPUT_VARIABLE rel_include_dir)
                 cmake_path(APPEND rel_include_dir "..")
                 cmake_path(NORMAL_PATH rel_include_dir OUTPUT_VARIABLE destination_dir)
-
+                
+                install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
                 install(DIRECTORY ${include_directory}
                     DESTINATION ${destination_dir}
                     COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
@@ -95,6 +95,7 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
                         PATTERN *.hxx
                         PATTERN *.jinja # LyAutoGen files
                 )
+                install(CODE "endif()")
             endif()
         endforeach()
     endif()
@@ -337,10 +338,13 @@ function(ly_setup_subdirectory absolute_target_source_dir)
 @cmake_copyright_comment@
 include(Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
 ]] @ONLY)
+    
+    install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
     install(FILES "${target_install_source_dir}/CMakeLists.txt"
         DESTINATION ${relative_target_source_dir}
         COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
     )
+    install(CODE "endif()")
 
     # 2. For this platform file, create a Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake file 
     #    that will include different configuration permutations (e.g. monolithic vs non-monolithic)
@@ -352,10 +356,12 @@ else()
     include(Platform/${PAL_PLATFORM_NAME}/Default/permutation.cmake)
 endif()
 ]])
+    install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
     install(FILES "${target_install_source_dir}/Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake"
         DESTINATION ${relative_target_source_dir}/Platform/${PAL_PLATFORM_NAME}
         COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
     )
+    install(CODE "endif()")
 
     # 3. For this configuration permutation, generate a Platform/${PAL_PLATFORM_NAME}/${permutation}/permutation.cmake
     #    that will declare the target and configure it
@@ -389,6 +395,7 @@ function(ly_setup_o3de_install)
     ly_setup_assets()
 
     # Misc
+    install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
     install(FILES
         ${LY_ROOT_FOLDER}/ctest_pytest.ini
         ${LY_ROOT_FOLDER}/LICENSE.txt
@@ -396,10 +403,13 @@ function(ly_setup_o3de_install)
         DESTINATION .
         COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
     )
+    install(CODE "endif()")
 
     # Inject other build directories
     foreach(external_dir ${LY_INSTALL_EXTERNAL_BUILD_DIRS})
-        install(CODE "include(${external_dir}/cmake_install.cmake)")
+        install(CODE "set(LY_CORE_COMPONENT_ALREADY_INCLUDED TRUE)
+include(${external_dir}/cmake_install.cmake)"
+ALL_COMPONENTS)
     endforeach()
 
     if(COMMAND ly_post_install_steps)
@@ -411,6 +421,7 @@ endfunction()
 #! ly_setup_cmake_install: install the "cmake" folder
 function(ly_setup_cmake_install)
 
+    install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
     install(DIRECTORY "${LY_ROOT_FOLDER}/cmake"
         DESTINATION .
         COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
@@ -418,11 +429,16 @@ function(ly_setup_cmake_install)
         PATTERN "Findo3de.cmake" EXCLUDE
         REGEX "3rdParty/Platform\/.*\/BuiltInPackages_.*\.cmake" EXCLUDE
     )
+    install(CODE "endif()")
+
     # Connect configuration types
+    install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
     install(FILES "${LY_ROOT_FOLDER}/cmake/install/ConfigurationTypes.cmake"
         DESTINATION cmake
         COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
     )
+    install(CODE "endif()")
+
     # generate each ConfigurationType_<CONFIG>.cmake file and install it under that configuration
     foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
         string(TOUPPER ${conf} UCONF)
@@ -430,11 +446,13 @@ function(ly_setup_cmake_install)
             "${CMAKE_BINARY_DIR}/cmake/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}/ConfigurationTypes_${conf}.cmake"
             @ONLY
         )
+        install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
         install(FILES "${CMAKE_BINARY_DIR}/cmake/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}/ConfigurationTypes_${conf}.cmake"
             DESTINATION cmake/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}
             COMPONENT ${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF}
             CONFIGURATIONS ${conf}
         )
+        install(CODE "endif()")
     endforeach()
 
     # Transform the LY_EXTERNAL_SUBDIRS list into a json array
@@ -454,12 +472,14 @@ function(ly_setup_cmake_install)
 
     configure_file(${LY_ROOT_FOLDER}/cmake/install/engine.json.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/engine.json @ONLY)
 
+    install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
     install(FILES
             "${LY_ROOT_FOLDER}/CMakeLists.txt"
             "${CMAKE_CURRENT_BINARY_DIR}/cmake/engine.json"
         DESTINATION .
         COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
     )
+    install(CODE "endif()")
 
     # Collect all Find files that were added with ly_add_external_target_path
     unset(additional_find_files)
@@ -477,6 +497,8 @@ function(ly_setup_cmake_install)
             list(APPEND additional_platform_files "${plat_files}")
         endforeach()
     endforeach()
+
+    install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
     install(FILES ${additional_find_files}
         DESTINATION cmake/3rdParty
         COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
@@ -485,6 +507,7 @@ function(ly_setup_cmake_install)
         DESTINATION cmake/3rdParty/Platform/${PAL_PLATFORM_NAME}
         COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
     )
+    install(CODE "endif()")
 
     # Findo3de.cmake file: we generate a different Findo3de.camke file than the one we have in cmake. This one is going to expose all
     # targets that are pre-built
@@ -498,10 +521,12 @@ function(ly_setup_cmake_install)
     endforeach()
 
     configure_file(${LY_ROOT_FOLDER}/cmake/install/Findo3de.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/Findo3de.cmake @ONLY)
+    install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
     install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/Findo3de.cmake"
         DESTINATION cmake
         COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
     )
+    install(CODE "endif()")
 
     # BuiltInPackage_<platform>.cmake: since associations could happen in any cmake file across the engine. We collect
     # all the associations in ly_associate_package and then generate them into BuiltInPackages_<platform>.cmake. This
@@ -518,10 +543,12 @@ function(ly_setup_cmake_install)
     file(GENERATE OUTPUT ${pal_builtin_file}
         CONTENT ${builtinpackages}
     )
+    install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
     install(FILES "${pal_builtin_file}"
         DESTINATION cmake/3rdParty/Platform/${PAL_PLATFORM_NAME}
         COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
     )
+    install(CODE "endif()")
 
 endfunction()
 
@@ -536,9 +563,12 @@ function(ly_setup_runtime_dependencies)
             string(TOUPPER ${conf} UCONF)
             install(CODE
 "function(ly_copy source_file target_directory)
-    file(COPY \"\${source_file}\" DESTINATION \"\${target_directory}\" FILE_PERMISSIONS ${LY_COPY_PERMISSIONS})
+    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})
+    endif()
 endfunction()"
-                COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}_${UCONF}
+                COMPONENT ${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF}
             )
         endforeach()
     endif()
@@ -672,17 +702,23 @@ function(ly_setup_assets)
             if (NOT gem_install_dest_dir)
                 cmake_path(SET gem_install_dest_dir .)
             endif()
+
             if(IS_DIRECTORY ${gem_absolute_path})
+                install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
                 install(DIRECTORY "${gem_absolute_path}" 
                     DESTINATION ${gem_install_dest_dir}
                     COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
                 )
+                install(CODE "endif()")
             elseif (EXISTS ${gem_absolute_path})
+                install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
                 install(FILES ${gem_absolute_path} 
                     DESTINATION ${gem_install_dest_dir}
                     COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
                 )
+                install(CODE "endif()")
             endif()
+
         endforeach()
 
     endforeach()

+ 2 - 0
cmake/Platform/Linux/Install_linux.cmake

@@ -22,9 +22,11 @@ endfunction()]])
 
 function(ly_install_code_function_override)
     string(CONFIGURE "${ly_copy_template}" ly_copy_function_linux @ONLY)
+    install(CODE "if(NOT LY_CORE_COMPONENT_ALREADY_INCLUDED)")
     install(CODE "${ly_copy_function_linux}" 
         COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
     )
+    install(CODE "endif()")
 endfunction()
 
 include(cmake/Platform/Common/Install_common.cmake)

+ 2 - 5
cmake/Platform/Windows/Packaging_windows.cmake

@@ -28,11 +28,8 @@ 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")
 
-# workaround for shortening the path cpack installs to by stripping the platform directory and forcing monolithic
-# mode to strip out component folders.  this unfortunately is the closest we can get to changing the install location
-# as CPACK_PACKAGING_INSTALL_PREFIX/CPACK_SET_DESTDIR isn't supported for the WiX generator
-#set(CPACK_TOPLEVEL_TAG "")
-#set(CPACK_MONOLITHIC_INSTALL ON)
+# workaround for shortening the path cpack installs to by stripping the platform directory
+set(CPACK_TOPLEVEL_TAG "")
 
 # CPack will generate the WiX product/upgrade GUIDs further down the chain if they weren't supplied
 # however, they are unique for each run.  instead, let's do the auto generation here and add it to