[cpack_installer] re-applying install component support after merge. added some missing doc comments.

This commit is contained in:
scottr
2021-04-21 14:41:18 -07:00
parent 22f34d953a
commit 56dfaca6cf
2 changed files with 48 additions and 16 deletions
+2
View File
@@ -74,6 +74,8 @@ define_property(TARGET PROPERTY GEM_MODULE
# for the list of variables that will be used by the target
# \arg:TARGET_PROPERTIES additional properties to set to the target
# \arg:AUTOGEN_RULES a set of AutoGeneration rules to be passed to the AzAutoGen expansion system
# \arg:INSTALL_COMPONENT (optional) the grouping string of the target used for splitting up the install into smaller
# packages. If none is specified, LY_DEFAULT_INSTALL_COMPONENT will be used
function(ly_add_target)
set(options STATIC SHARED MODULE GEM_MODULE HEADERONLY EXECUTABLE APPLICATION UNKNOWN IMPORTED AUTOMOC AUTOUIC AUTORCC NO_UNITY)
+46 -16
View File
@@ -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/$<CONFIG>
ARCHIVE DESTINATION lib/$<CONFIG>
RUNTIME DESTINATION bin/$<CONFIG>
PUBLIC_HEADER DESTINATION ${include_location}
LIBRARY
DESTINATION lib/$<CONFIG>
COMPONENT ${ly_install_target_COMPONENT}
ARCHIVE
DESTINATION lib/$<CONFIG>
COMPONENT ${ly_install_target_COMPONENT}
RUNTIME
DESTINATION bin/$<CONFIG>
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}_$<CONFIG>.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}/$<CONFIG>/$<${out_file_generator}:${NAME}>\")
set_target_properties(${NAME}
set_target_properties(${NAME}
PROPERTIES
$<$<CONFIG:profile>:IMPORTED_LOCATION \"\${target_location}>\"
IMPORTED_LOCATION_$<UPPER_CASE:$<CONFIG>> \"\${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_<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
# 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
)
@@ -277,12 +304,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()