diff --git a/CMakeLists.txt b/CMakeLists.txt index 91cea3f0bb..e685c8501b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,7 +119,10 @@ endif() include(cmake/RuntimeDependencies.cmake) # 5. Perform test impact framework post steps once all of the targets have been enumerated ly_test_impact_post_step() -# 6. Generate the O3DE find file and setup install locations for scripts, tools, assets etc., required by the engine +# 6. Generate the O3DE find file and setup install locations for scripts, tools, assets etc., required by the engine if(NOT INSTALLED_ENGINE) ly_setup_o3de_install() -endif() \ No newline at end of file + + # IMPORTANT: must be included last + include(cmake/CPack.cmake) +endif() diff --git a/cmake/3rdParty.cmake b/cmake/3rdParty.cmake index 8d0c030302..7385f34e5a 100644 --- a/cmake/3rdParty.cmake +++ b/cmake/3rdParty.cmake @@ -10,7 +10,7 @@ # # Do not overcomplicate searching for the 3rdParty path, if it is not easy to find, -# the user should define it. +# the user should define it. set(LY_3RDPARTY_PATH "" CACHE PATH "Path to the 3rdParty folder") @@ -42,7 +42,7 @@ endfunction() # \arg:PACKAGE if defined, defines the name of the external library "package". This is used when a package exposes multiple interfaces # if not defined, NAME is used # \arg:COMPILE_DEFINITIONS compile definitions to be added to the interface -# \arg:BUILD_DEPENDENCIES list of interfaces this target depends on (could be a compilation dependency if the dependency is only +# \arg:BUILD_DEPENDENCIES list of interfaces this target depends on (could be a compilation dependency if the dependency is only # exposing an include path, or could be a linking dependency is exposing a lib) # \arg:RUNTIME_DEPENDENCIES list of files this target depends on (could be a dynamic libraries, text files, executables, # applications, other 3rdParty targets, etc) @@ -129,7 +129,7 @@ function(ly_add_external_target) INTERFACE ${ly_add_external_target_INCLUDE_DIRECTORIES} ) endif() - + # Check if there is a pal file ly_get_absolute_pal_filename(pal_file ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}/${ly_add_external_target_PACKAGE}_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) if(NOT EXISTS ${pal_file}) @@ -138,7 +138,7 @@ function(ly_add_external_target) if(EXISTS ${pal_file}) include(${pal_file}) endif() - + if(${PACKAGE_AND_NAME}_INCLUDE_DIRECTORIES) list(TRANSFORM ${PACKAGE_AND_NAME}_INCLUDE_DIRECTORIES PREPEND ${BASE_PATH}/) foreach(include_path ${${PACKAGE_AND_NAME}_INCLUDE_DIRECTORIES}) @@ -259,7 +259,7 @@ function(ly_add_external_target) list(APPEND ly_add_external_target_BUILD_DEPENDENCIES "${${PACKAGE_AND_NAME}_BUILD_DEPENDENCIES}") list(REMOVE_DUPLICATES ly_add_external_target_BUILD_DEPENDENCIES) endif() - + # Interface dependencies may require to find_packages. So far, we are just using packages for 3rdParty, so we will # search for those and automatically bring those packages. The naming convention used is 3rdParty::PackageName::OptionalInterface foreach(dependency ${ly_add_external_target_BUILD_DEPENDENCIES}) @@ -274,7 +274,7 @@ function(ly_add_external_target) if(ly_add_external_target_BUILD_DEPENDENCIES) target_link_libraries(3rdParty::${NAME_WITH_NAMESPACE} - INTERFACE + INTERFACE ${ly_add_external_target_BUILD_DEPENDENCIES} ) endif() @@ -287,9 +287,12 @@ 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(FILES ${CMAKE_CURRENT_LIST_FILE} DESTINATION cmake) + + # Install the Find file to our /cmake directory + install(FILES ${CMAKE_CURRENT_LIST_FILE} + DESTINATION cmake + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} + ) # We only want to install external targets that are part of our source tree # Checking for relative path beginning with "../" also works when the path @@ -297,7 +300,10 @@ function(ly_install_external_target 3RDPARTY_ROOT_DIRECTORY) file(RELATIVE_PATH rel_path ${CMAKE_SOURCE_DIR} ${3RDPARTY_ROOT_DIRECTORY}) if (NOT ${rel_path} MATCHES "^../") get_filename_component(rel_path ${rel_path} DIRECTORY) - install(DIRECTORY ${3RDPARTY_ROOT_DIRECTORY} DESTINATION ${rel_path}) + install(DIRECTORY ${3RDPARTY_ROOT_DIRECTORY} + DESTINATION ${rel_path} + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} + ) endif() endfunction() diff --git a/cmake/CPack.cmake b/cmake/CPack.cmake new file mode 100644 index 0000000000..687021587b --- /dev/null +++ b/cmake/CPack.cmake @@ -0,0 +1,103 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +if(NOT PAL_TRAIT_BUILD_CPACK_SUPPORTED) + return() +endif() + +set(LY_QTIFW_PATH "" CACHE PATH "Path to the Qt Installer Framework install path") + +if(LY_QTIFW_PATH) + file(TO_CMAKE_PATH ${LY_QTIFW_PATH} CPACK_IFW_ROOT) +elseif(DEFINED ENV{QTIFWDIR}) + file(TO_CMAKE_PATH $ENV{QTIFWDIR} CPACK_IFW_ROOT) +endif() + +if(CPACK_IFW_ROOT) + if(NOT EXISTS ${CPACK_IFW_ROOT}) + message(FATAL_ERROR "Invalid path supplied for LY_QTIFW_PATH argument or QTIFWDIR environment variable") + endif() +else() + # early out as no path to QtIFW has been supplied effectively disabling support + return() +endif() + +set(CPACK_GENERATOR "IFW") + +set(CPACK_PACKAGE_VENDOR "${PROJECT_NAME}") +set(CPACK_PACKAGE_VERSION "${LY_VERSION_STRING}") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Installation Tool") + +string(TOLOWER ${PROJECT_NAME} _project_name_lower) +set(CPACK_PACKAGE_FILE_NAME "${_project_name_lower}_installer") + +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_IFW_PACKAGE_TITLE "${PROJECT_NAME} Installer") +set(CPACK_IFW_PACKAGE_PUBLISHER "${PROJECT_NAME}") + +set(CPACK_IFW_TARGET_DIRECTORY "@ApplicationsDir@/${PROJECT_NAME}/${LY_VERSION_STRING}") +set(CPACK_IFW_PACKAGE_START_MENU_DIRECTORY "${PROJECT_NAME}") + +# IMPORTANT: required to be included AFTER setting all property overrides +include(CPack REQUIRED) +include(CPackIFW REQUIRED) + +function(ly_configure_cpack_component ly_configure_cpack_component_NAME) + + set(options REQUIRED) + set(oneValueArgs DISPLAY_NAME DESCRIPTION LICENSE_NAME LICENSE_FILE) + set(multiValueArgs) + + cmake_parse_arguments(ly_configure_cpack_component "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + # default to optional + set(component_type DISABLED) + set(ifw_component_type) + + if(ly_configure_cpack_component_REQUIRED) + set(component_type REQUIRED) + set(ifw_component_type FORCED_INSTALLATION) + 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} + ) + + cpack_ifw_configure_component( + ${ly_configure_cpack_component_NAME} ${ifw_component_type} + LICENSES + ${license_name} + ${license_file} + ) +endfunction() + +# configure ALL components here +ly_configure_cpack_component( + ${LY_DEFAULT_INSTALL_COMPONENT} REQUIRED + DISPLAY_NAME "${PROJECT_NAME} Core" + DESCRIPTION "${PROJECT_NAME} Headers, Libraries and Tools" +) diff --git a/cmake/LYWrappers.cmake b/cmake/LYWrappers.cmake index bd904adaa3..a860bcfd20 100644 --- a/cmake/LYWrappers.cmake +++ b/cmake/LYWrappers.cmake @@ -37,7 +37,7 @@ define_property(TARGET PROPERTY GEM_MODULE # # Adds a target (static/dynamic library, executable) and convenient wrappers around most # common parameters that need to be set. -# This function also creates an interface to use for dependencies. The interface will be +# This function also creates an interface to use for dependencies. The interface will be # named as "NAMESPACE::NAME" # Some examples: # ly_add_target(NAME mystaticlib STATIC FILES_CMAKE somestatic_files.cmake) @@ -81,7 +81,7 @@ function(ly_add_target) set(multiValueArgs FILES_CMAKE GENERATED_FILES INCLUDE_DIRECTORIES COMPILE_DEFINITIONS BUILD_DEPENDENCIES RUNTIME_DEPENDENCIES PLATFORM_INCLUDE_FILES TARGET_PROPERTIES AUTOGEN_RULES) cmake_parse_arguments(ly_add_target "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - + # Validate input arguments if(NOT ly_add_target_NAME) message(FATAL_ERROR "You must provide a name for the target") @@ -189,7 +189,7 @@ function(ly_add_target) endif() if(ly_add_target_OUTPUT_NAME) - set_target_properties(${ly_add_target_NAME} PROPERTIES + set_target_properties(${ly_add_target_NAME} PROPERTIES OUTPUT_NAME ${ly_add_target_OUTPUT_NAME} ) endif() @@ -214,7 +214,7 @@ function(ly_add_target) ) endif() - # Parse the 3rdParty library dependencies + # Parse the 3rdParty library dependencies ly_parse_third_party_dependencies("${ly_add_target_BUILD_DEPENDENCIES}") ly_target_link_libraries(${ly_add_target_NAME} ${ly_add_target_BUILD_DEPENDENCIES} @@ -252,7 +252,7 @@ function(ly_add_target) ) endif() endif() - + # IDE organization ly_source_groups_from_folders("${ALLFILES}") source_group("Generated Files" REGULAR_EXPRESSION "(${CMAKE_BINARY_DIR})") # Any file coming from the output folder @@ -276,8 +276,8 @@ function(ly_add_target) # Handle Qt MOC, RCC, UIC # https://gitlab.kitware.com/cmake/cmake/issues/18749 - # AUTOMOC is supposed to always rebuild because it checks files that are not listed in the sources (like extra - # "_p.h" headers) and which may change outside the visibility of the generator. + # AUTOMOC is supposed to always rebuild because it checks files that are not listed in the sources (like extra + # "_p.h" headers) and which may change outside the visibility of the generator. # We are not using AUTOUIC because of: # https://gitlab.kitware.com/cmake/cmake/-/issues/18741 # To overcome this problem, we manually wrap all the ui files listed in the target with qt5_wrap_ui @@ -332,12 +332,16 @@ function(ly_add_target) ly_add_autogen( NAME ${ly_add_target_NAME} INCLUDE_DIRECTORIES ${ly_add_target_INCLUDE_DIRECTORIES} - AUTOGEN_RULES ${ly_add_target_AUTOGEN_RULES} + AUTOGEN_RULES ${ly_add_target_AUTOGEN_RULES} ALLFILES ${ALLFILES} ) endif() if(NOT ly_add_target_IMPORTED) + if(NOT ly_add_target_INSTALL_COMPONENT) + set(ly_add_target_INSTALL_COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT}) + endif() + ly_install_target( ${ly_add_target_NAME} NAMESPACE ${ly_add_target_NAMESPACE} @@ -345,15 +349,16 @@ function(ly_add_target) BUILD_DEPENDENCIES ${ly_add_target_BUILD_DEPENDENCIES} RUNTIME_DEPENDENCIES ${ly_add_target_RUNTIME_DEPENDENCIES} COMPILE_DEFINITIONS ${ly_add_target_COMPILE_DEFINITIONS} + COMPONENT ${ly_add_target_INSTALL_COMPONENT} ) endif() endfunction() #! ly_target_link_libraries: wraps target_link_libraries handling also MODULE linkage. -# MODULE libraries cannot be passed to target_link_libraries. MODULE libraries are shared libraries that we +# MODULE libraries cannot be passed to target_link_libraries. MODULE libraries are shared libraries that we # dont want to link against because they will be loaded dynamically. However, we want to include their public headers -# and transition their public dependencies. +# and transition their public dependencies. # To achieve this, we delay the target_link_libraries call to after all targets are declared (see ly_delayed_target_link_libraries) # # Signature is the same as target_link_libraries: @@ -364,26 +369,26 @@ function(ly_target_link_libraries TARGET) if(NOT TARGET) message(FATAL_ERROR "You must provide a target") endif() - + set_property(GLOBAL APPEND PROPERTY LY_DELAYED_LINK_${TARGET} ${ARGN}) set_property(GLOBAL APPEND PROPERTY LY_DELAYED_LINK_TARGETS ${TARGET}) # to walk them at the end endfunction() #! ly_delayed_target_link_libraries: internal function called by the root CMakeLists.txt after all targets -# have been declared to determine if they are regularly +# have been declared to determine if they are regularly # 1) If a MODULE is passed in the list of items, it will add the INTERFACE_INCLUDE_DIRECTORIES as include # directories of TARGET. It will also add the "INTERFACE_LINK_LIBRARIES" to TARGET. MODULEs cannot be # directly linked, but we can include the public headers and link against the things the MODULE expose # to link. # 2) If a target that has not yet been declared is passed, then it will defer it to after all targets are -# declared. This way we can do a check again. We could delay the link to when +# declared. This way we can do a check again. We could delay the link to when # target is declared. This is needed for (1) since we dont know the type of target. This also addresses # another issue with target_link_libraries where it will only validate that a MODULE is not being passed # if the target is already declared, if not, it will fail later at linking time. function(ly_delayed_target_link_libraries) - + set(visibilities PRIVATE PUBLIC INTERFACE) get_property(additional_module_paths GLOBAL PROPERTY LY_ADDITIONAL_MODULE_PATH) @@ -391,15 +396,15 @@ function(ly_delayed_target_link_libraries) get_property(delayed_targets GLOBAL PROPERTY LY_DELAYED_LINK_TARGETS) foreach(target ${delayed_targets}) - + get_property(delayed_link GLOBAL PROPERTY LY_DELAYED_LINK_${target}) if(delayed_link) - + cmake_parse_arguments(ly_delayed_target_link_libraries "" "" "${visibilities}" ${delayed_link}) foreach(visibility ${visibilities}) foreach(item ${ly_delayed_target_link_libraries_${visibility}}) - + if(TARGET ${item}) get_target_property(item_type ${item} TYPE) else() @@ -412,7 +417,7 @@ function(ly_delayed_target_link_libraries) target_compile_definitions(${target} ${visibility} $) target_compile_options(${target} ${visibility} $) # Add it also as a manual dependency so runtime_dependencies walks it through - ly_add_dependencies(${target} ${item}) + ly_add_dependencies(${target} ${item}) else() ly_parse_third_party_dependencies(${item}) target_link_libraries(${target} ${visibility} ${item}) @@ -484,7 +489,7 @@ function(detect_qt_dependency TARGET_NAME OUTPUT_VARIABLE) endfunction() #! ly_parse_third_party_dependencies: Validates any 3rdParty library dependencies through the find_package command -# +# # \arg:ly_THIRD_PARTY_LIBRARIES name of the target libraries to validate existance of through the find_package command. # function(ly_parse_third_party_dependencies ly_THIRD_PARTY_LIBRARIES) @@ -518,7 +523,7 @@ endfunction() # macro(ly_configure_target_platform_properties) foreach(platform_include_file ${ly_add_target_PLATFORM_INCLUDE_FILES}) - + set(LY_FILES_CMAKE) set(LY_FILES) set(LY_INCLUDE_DIRECTORIES) @@ -528,7 +533,7 @@ macro(ly_configure_target_platform_properties) set(LY_BUILD_DEPENDENCIES) set(LY_RUNTIME_DEPENDENCIES) set(LY_TARGET_PROPERTIES) - + include(${platform_include_file} RESULT_VARIABLE ly_platform_cmake_file) if(NOT ly_platform_cmake_file) message(FATAL_ERROR "The supplied PLATFORM_INCLUDE_FILE(${platform_include_file}) cannot be included.\ @@ -578,7 +583,7 @@ endmacro() # # \arg:TARGETS name of the targets that depends on this file # \arg:FILES files to copy -# \arg:OUTPUT_SUBDIRECTORY (OPTIONAL) where to place the files relative to TARGET_NAME's output dir. +# \arg:OUTPUT_SUBDIRECTORY (OPTIONAL) where to place the files relative to TARGET_NAME's output dir. # If not specified, they are located in the same folder as TARGET_NAME # function(ly_add_target_files) @@ -596,9 +601,9 @@ function(ly_add_target_files) if(NOT ly_add_target_files_FILES) message(FATAL_ERROR "You must provide at least a file to copy") endif() - + foreach(target ${ly_add_target_files_TARGETS}) - + foreach(file ${ly_add_target_files_FILES}) set_property(TARGET ${target} APPEND PROPERTY INTERFACE_LY_TARGET_FILES "${file}\n${ly_add_target_files_OUTPUT_SUBDIRECTORY}") endforeach() diff --git a/cmake/Platform/Android/PAL_android.cmake b/cmake/Platform/Android/PAL_android.cmake index 80739d4208..bd76076467 100644 --- a/cmake/Platform/Android/PAL_android.cmake +++ b/cmake/Platform/Android/PAL_android.cmake @@ -19,6 +19,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 TRUE) +ly_set(PAL_TRAIT_BUILD_CPACK_SUPPORTED FALSE) # Test library support ly_set(PAL_TRAIT_TEST_GOOGLE_TEST_SUPPORTED FALSE) diff --git a/cmake/Platform/Common/Install_common.cmake b/cmake/Platform/Common/Install_common.cmake index 105b208338..3daddabaa6 100644 --- a/cmake/Platform/Common/Install_common.cmake +++ b/cmake/Platform/Common/Install_common.cmake @@ -11,11 +11,21 @@ set(CMAKE_INSTALL_MESSAGE NEVER) # Simplify messages to reduce output noise +ly_set(LY_DEFAULT_INSTALL_COMPONENT "Core") + #! ly_install_target: registers the target to be installed by cmake install. # # \arg:NAME name of the target +# \arg:COMPONENT the grouping string of the target used for splitting up the install +# into smaller packages. function(ly_install_target ly_install_target_NAME) + set(options) + set(oneValueArgs NAMESPACE COMPONENT) + set(multiValueArgs INCLUDE_DIRECTORIES BUILD_DEPENDENCIES RUNTIME_DEPENDENCIES COMPILE_DEFINITIONS) + + cmake_parse_arguments(ly_install_target "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + # All include directories marked PUBLIC or INTERFACE will be installed set(include_location "include") get_target_property(include_directories ${ly_install_target_NAME} INTERFACE_INCLUDE_DIRECTORIES) @@ -36,18 +46,28 @@ function(ly_install_target ly_install_target_NAME) install( TARGETS ${ly_install_target_NAME} - LIBRARY DESTINATION lib/$ - ARCHIVE DESTINATION lib/$ - RUNTIME DESTINATION bin/$ - PUBLIC_HEADER DESTINATION ${include_location} + LIBRARY + DESTINATION lib/$ + COMPONENT ${ly_install_target_COMPONENT} + ARCHIVE + DESTINATION lib/$ + COMPONENT ${ly_install_target_COMPONENT} + RUNTIME + DESTINATION bin/$ + COMPONENT ${ly_install_target_COMPONENT} + PUBLIC_HEADER + DESTINATION ${include_location} + COMPONENT ${ly_install_target_COMPONENT} ) - + ly_generate_target_config_file(${ly_install_target_NAME}) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${ly_install_target_NAME}_$.cmake" DESTINATION cmake_autogen/${ly_install_target_NAME} + COMPONENT ${ly_install_target_COMPONENT} ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Find${ly_install_target_NAME}.cmake" DESTINATION cmake + COMPONENT ${ly_install_target_COMPONENT} ) endfunction() @@ -64,7 +84,7 @@ endfunction() # \arg:RUNTIME_DEPENDENCIES list of dependencies this target depends on at runtime # \arg:COMPILE_DEFINITIONS list of compilation definitions this target will use to compile function(ly_generate_target_find_file) - + set(options) set(oneValueArgs NAME NAMESPACE) set(multiValueArgs INCLUDE_DIRECTORIES COMPILE_DEFINITIONS BUILD_DEPENDENCIES RUNTIME_DEPENDENCIES) @@ -81,7 +101,7 @@ function(ly_generate_target_find_file) # only INTERFACE properties can be exposed on imported targets ly_strip_private_properties(COMPILE_DEFINITIONS_PLACEHOLDER ${ly_generate_target_find_file_COMPILE_DEFINITIONS}) ly_strip_private_properties(include_directories_interface_props ${ly_generate_target_find_file_INCLUDE_DIRECTORIES}) - ly_strip_private_properties(BUILD_DEPENDENCIES_PLACEHOLDER ${ly_generate_target_find_file_BUILD_DEPENDENCIES}) + ly_strip_private_properties(BUILD_DEPENDENCIES_PLACEHOLDER ${ly_generate_target_find_file_BUILD_DEPENDENCIES}) if(ly_generate_target_find_file_NAMESPACE) set(NAMESPACE_PLACEHOLDER "NAMESPACE ${ly_generate_target_find_file_NAMESPACE}") @@ -111,9 +131,9 @@ endfunction() # These per config files will be included by the target's find file to set the location of the binary/ # \arg:NAME name of the target function(ly_generate_target_config_file NAME) - + get_target_property(target_type ${NAME} TYPE) - + unset(target_file_contents) if(NOT target_type STREQUAL INTERFACE_LIBRARY) @@ -127,11 +147,11 @@ function(ly_generate_target_config_file NAME) set(out_dir lib) endif() - string(APPEND target_file_contents + string(APPEND target_file_contents "# Generated by O3DE install set(target_location \"\${LY_ROOT_FOLDER}/${out_dir}/$/$<${out_file_generator}:${NAME}>\") -set_target_properties(${NAME} +set_target_properties(${NAME} PROPERTIES $<$:IMPORTED_LOCATION \"\${target_location}>\" IMPORTED_LOCATION_$> \"\${target_location}\" @@ -172,7 +192,7 @@ endfunction() #! ly_setup_o3de_install: orchestrates the installation of the different parts. This is the entry point from the root CMakeLists.txt function(ly_setup_o3de_install) - + ly_setup_cmake_install() ly_setup_target_generator() ly_setup_others() @@ -184,14 +204,16 @@ function(ly_setup_cmake_install) install(DIRECTORY "${CMAKE_SOURCE_DIR}/cmake" DESTINATION . + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} REGEX "Findo3de.cmake" EXCLUDE REGEX "Platform\/.*\/BuiltInPackages_.*\.cmake" EXCLUDE ) install( - FILES + FILES "${CMAKE_SOURCE_DIR}/CMakeLists.txt" "${CMAKE_SOURCE_DIR}/engine.json" DESTINATION . + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) # Collect all Find files that were added with ly_add_external_target_path @@ -204,6 +226,7 @@ function(ly_setup_cmake_install) endforeach() install(FILES ${additional_find_files} DESTINATION cmake/3rdParty + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) # Findo3de.cmake file: we generate a different Findo3de.camke file than the one we have in cmake. This one is going to expose all @@ -218,8 +241,9 @@ function(ly_setup_cmake_install) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/Findo3de.cmake" DESTINATION cmake + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) - + # BuiltInPackage_.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_.cmake. This # will consolidate all associations in one file @@ -237,6 +261,7 @@ function(ly_setup_cmake_install) ) install(FILES "${pal_builtin_file}" DESTINATION cmake/3rdParty/Platform/${PAL_PLATFORM_NAME} + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) endfunction() @@ -247,20 +272,22 @@ function(ly_setup_others) # List of directories we want to install relative to engine root set(DIRECTORIES_TO_INSTALL Tools/LyTestTools Tools/RemoteConsole ctest_scripts scripts) foreach(dir ${DIRECTORIES_TO_INSTALL}) - + get_filename_component(install_path ${dir} DIRECTORY) if (NOT install_path) set(install_path .) endif() - + install(DIRECTORY "${CMAKE_SOURCE_DIR}/${dir}" DESTINATION ${install_path} + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) endforeach() install(DIRECTORY "${CMAKE_SOURCE_DIR}/python" DESTINATION . + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} REGEX "downloaded_packages" EXCLUDE REGEX "runtime" EXCLUDE ) @@ -269,15 +296,18 @@ function(ly_setup_others) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin/$/Registry DESTINATION ./bin/$ + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) install(DIRECTORY # This one will change soon, Engine/Registry files will be relocated to Registry ${CMAKE_SOURCE_DIR}/Engine/Registry DESTINATION ./Engine + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) install(FILES ${CMAKE_SOURCE_DIR}/AssetProcessorPlatformConfig.setreg DESTINATION ./Registry + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) # Qt Binaries @@ -286,6 +316,7 @@ function(ly_setup_others) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin/$/${qt_dir} DESTINATION ./bin/$ + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) endforeach() @@ -293,6 +324,7 @@ function(ly_setup_others) install(DIRECTORY ${CMAKE_SOURCE_DIR}/Templates DESTINATION . + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) # Misc @@ -301,6 +333,7 @@ function(ly_setup_others) ${CMAKE_SOURCE_DIR}/LICENSE.txt ${CMAKE_SOURCE_DIR}/README.md DESTINATION . + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) endfunction() @@ -315,12 +348,15 @@ function(ly_setup_target_generator) ${CMAKE_SOURCE_DIR}/Code/LauncherUnified/LauncherProject.cpp ${CMAKE_SOURCE_DIR}/Code/LauncherUnified/StaticModules.in DESTINATION LauncherGenerator + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) install(DIRECTORY ${CMAKE_SOURCE_DIR}/Code/LauncherUnified/Platform DESTINATION LauncherGenerator + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) install(FILES ${CMAKE_SOURCE_DIR}/Code/LauncherUnified/FindLauncherGenerator.cmake DESTINATION cmake + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) -endfunction() \ No newline at end of file +endfunction() diff --git a/cmake/Platform/Linux/PAL_linux.cmake b/cmake/Platform/Linux/PAL_linux.cmake index ba2296bfb9..1d9f02a461 100644 --- a/cmake/Platform/Linux/PAL_linux.cmake +++ b/cmake/Platform/Linux/PAL_linux.cmake @@ -19,6 +19,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) # Test library support ly_set(PAL_TRAIT_TEST_GOOGLE_TEST_SUPPORTED TRUE) diff --git a/cmake/Platform/Mac/PAL_mac.cmake b/cmake/Platform/Mac/PAL_mac.cmake index daf3331795..10df4849dd 100644 --- a/cmake/Platform/Mac/PAL_mac.cmake +++ b/cmake/Platform/Mac/PAL_mac.cmake @@ -19,6 +19,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 ".mm") ly_set(PAL_TRAIT_BUILD_EXCLUDE_ALL_TEST_RUNS_FROM_IDE FALSE) +ly_set(PAL_TRAIT_BUILD_CPACK_SUPPORTED FALSE) # Test library support ly_set(PAL_TRAIT_TEST_GOOGLE_TEST_SUPPORTED TRUE) diff --git a/cmake/Platform/Windows/PAL_windows.cmake b/cmake/Platform/Windows/PAL_windows.cmake index 780f3354f7..7493a95bd6 100644 --- a/cmake/Platform/Windows/PAL_windows.cmake +++ b/cmake/Platform/Windows/PAL_windows.cmake @@ -19,6 +19,7 @@ ly_set(PAL_TRAIT_BUILD_SERVER_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 TRUE) # Test library support ly_set(PAL_TRAIT_TEST_GOOGLE_TEST_SUPPORTED TRUE) diff --git a/cmake/Platform/iOS/PAL_ios.cmake b/cmake/Platform/iOS/PAL_ios.cmake index b084a1aac3..a910f6c1be 100644 --- a/cmake/Platform/iOS/PAL_ios.cmake +++ b/cmake/Platform/iOS/PAL_ios.cmake @@ -19,6 +19,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 ".mm") ly_set(PAL_TRAIT_BUILD_EXCLUDE_ALL_TEST_RUNS_FROM_IDE TRUE) +ly_set(PAL_TRAIT_BUILD_CPACK_SUPPORTED FALSE) # Test library support ly_set(PAL_TRAIT_TEST_GOOGLE_TEST_SUPPORTED FALSE) diff --git a/cmake/cmake_files.cmake b/cmake/cmake_files.cmake index b0277e96f5..5045a42cbe 100644 --- a/cmake/cmake_files.cmake +++ b/cmake/cmake_files.cmake @@ -14,6 +14,7 @@ set(FILES 3rdPartyPackages.cmake CommandExecution.cmake Configurations.cmake + CPack.cmake Dependencies.cmake Deployment.cmake EngineFinder.cmake