|
@@ -23,12 +23,12 @@ ly_set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME Core)
|
|
|
|
|
|
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)
|
|
|
-# Anywhere CMAKE_INSTALL_PREFIX is used, it has to be escaped so it is baked into the cmake_install.cmake script instead
|
|
|
-# of baking the path. This is needed so `cmake --install --prefix <someprefix>` works regardless of the CMAKE_INSTALL_PREFIX
|
|
|
-# used to generate the solution.
|
|
|
-# CMAKE_INSTALL_PREFIX is still used when building the INSTALL target
|
|
|
-set(install_output_folder "\${CMAKE_INSTALL_PREFIX}/${runtime_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>")
|
|
|
|
|
|
+if(LY_MONOLITHIC_GAME)
|
|
|
+ set(LY_BUILD_PERMUTATION Monolithic)
|
|
|
+else()
|
|
|
+ set(LY_BUILD_PERMUTATION Default)
|
|
|
+endif()
|
|
|
|
|
|
#! ly_setup_target: Setup the data needed to re-create the cmake target commands for a single target
|
|
|
function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_target_source_dir)
|
|
@@ -91,6 +91,10 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
|
|
|
cmake_path(RELATIVE_PATH target_library_output_directory BASE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} OUTPUT_VARIABLE target_library_output_subdirectory)
|
|
|
endif()
|
|
|
|
|
|
+ cmake_path(APPEND archive_output_directory "${PAL_PLATFORM_NAME}/$<CONFIG>/${LY_BUILD_PERMUTATION}")
|
|
|
+ cmake_path(APPEND library_output_directory "${PAL_PLATFORM_NAME}/$<CONFIG>/${LY_BUILD_PERMUTATION}")
|
|
|
+ cmake_path(APPEND runtime_output_directory "${PAL_PLATFORM_NAME}/$<CONFIG>/${LY_BUILD_PERMUTATION}")
|
|
|
+
|
|
|
if(COMMAND ly_install_target_override)
|
|
|
# Mac needs special handling because of a cmake issue
|
|
|
ly_install_target_override(TARGET ${TARGET_NAME}
|
|
@@ -104,18 +108,18 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
|
|
|
install(
|
|
|
TARGETS ${TARGET_NAME}
|
|
|
ARCHIVE
|
|
|
- DESTINATION ${archive_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>
|
|
|
+ DESTINATION ${archive_output_directory}
|
|
|
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
|
|
|
LIBRARY
|
|
|
- DESTINATION ${library_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_library_output_subdirectory}
|
|
|
+ DESTINATION ${library_output_directory}/${target_library_output_subdirectory}
|
|
|
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
|
|
|
RUNTIME
|
|
|
- DESTINATION ${runtime_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_runtime_output_subdirectory}
|
|
|
+ DESTINATION ${runtime_output_directory}/${target_runtime_output_subdirectory}
|
|
|
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
|
|
|
)
|
|
|
endif()
|
|
|
|
|
|
- # CMakeLists.txt file
|
|
|
+ # CMakeLists.txt related files
|
|
|
string(REGEX MATCH "(.*)::(.*)$" match ${ALIAS_TARGET_NAME})
|
|
|
if(match)
|
|
|
set(NAMESPACE_PLACEHOLDER "NAMESPACE ${CMAKE_MATCH_1}")
|
|
@@ -140,7 +144,7 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
|
|
|
if(TARGET_TYPE_PLACEHOLDER IN_LIST GEM_LIBRARY_TYPES)
|
|
|
get_target_property(gem_module ${TARGET_NAME} GEM_MODULE)
|
|
|
if(gem_module)
|
|
|
- set(TARGET_TYPE_PLACEHOLDER "GEM_MODULE")
|
|
|
+ string(PREPEND TARGET_TYPE_PLACEHOLDER "GEM_")
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
@@ -222,32 +226,32 @@ set_target_properties(${RUN_TARGET_NAME} PROPERTIES
|
|
|
)
|
|
|
endif()
|
|
|
|
|
|
- # Config file
|
|
|
+ # Config files
|
|
|
set(target_file_contents "# Generated by O3DE install\n\n")
|
|
|
if(NOT target_type STREQUAL INTERFACE_LIBRARY)
|
|
|
|
|
|
unset(target_location)
|
|
|
set(runtime_types EXECUTABLE APPLICATION)
|
|
|
if(target_type IN_LIST runtime_types)
|
|
|
- set(target_location "\${LY_ROOT_FOLDER}/${runtime_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_runtime_output_subdirectory}/$<TARGET_FILE_NAME:${TARGET_NAME}>")
|
|
|
+ set(target_location "\${LY_ROOT_FOLDER}/${runtime_output_directory}/${target_runtime_output_subdirectory}/$<TARGET_FILE_NAME:${TARGET_NAME}>")
|
|
|
elseif(target_type STREQUAL MODULE_LIBRARY)
|
|
|
- set(target_location "\${LY_ROOT_FOLDER}/${library_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_library_output_subdirectory}/$<TARGET_FILE_NAME:${TARGET_NAME}>")
|
|
|
+ set(target_location "\${LY_ROOT_FOLDER}/${library_output_directory}/${target_library_output_subdirectory}/$<TARGET_FILE_NAME:${TARGET_NAME}>")
|
|
|
elseif(target_type STREQUAL SHARED_LIBRARY)
|
|
|
string(APPEND target_file_contents
|
|
|
"set_property(TARGET ${NAME_PLACEHOLDER}
|
|
|
APPEND_STRING PROPERTY IMPORTED_IMPLIB
|
|
|
- $<$<CONFIG:$<CONFIG>$<ANGLE-R>:\"\${LY_ROOT_FOLDER}/${archive_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}>\"$<ANGLE-R>
|
|
|
+ $<$<CONFIG:$<CONFIG>$<ANGLE-R>:\"\${LY_ROOT_FOLDER}/${archive_output_directory}/$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}>\"$<ANGLE-R>
|
|
|
)
|
|
|
")
|
|
|
string(APPEND target_file_contents
|
|
|
"set_property(TARGET ${NAME_PLACEHOLDER}
|
|
|
PROPERTY IMPORTED_IMPLIB_$<UPPER_CASE:$<CONFIG>>
|
|
|
- \"\${LY_ROOT_FOLDER}/${archive_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}>\"
|
|
|
+ \"\${LY_ROOT_FOLDER}/${archive_output_directory}/$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}>\"
|
|
|
)
|
|
|
")
|
|
|
- set(target_location "\${LY_ROOT_FOLDER}/${library_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_library_output_subdirectory}/$<TARGET_FILE_NAME:${TARGET_NAME}>")
|
|
|
+ set(target_location "\${LY_ROOT_FOLDER}/${library_output_directory}/${target_library_output_subdirectory}/$<TARGET_FILE_NAME:${TARGET_NAME}>")
|
|
|
else() # STATIC_LIBRARY, OBJECT_LIBRARY, INTERFACE_LIBRARY
|
|
|
- set(target_location "\${LY_ROOT_FOLDER}/${archive_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}>")
|
|
|
+ set(target_location "\${LY_ROOT_FOLDER}/${archive_output_directory}/$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}>")
|
|
|
endif()
|
|
|
|
|
|
if(target_location)
|
|
@@ -265,9 +269,9 @@ set_property(TARGET ${NAME_PLACEHOLDER}
|
|
|
endif()
|
|
|
|
|
|
set(target_install_source_dir ${CMAKE_CURRENT_BINARY_DIR}/install/${relative_target_source_dir})
|
|
|
- file(GENERATE OUTPUT "${target_install_source_dir}/${NAME_PLACEHOLDER}_$<CONFIG>.cmake" CONTENT "${target_file_contents}")
|
|
|
- install(FILES "${target_install_source_dir}/${NAME_PLACEHOLDER}_$<CONFIG>.cmake"
|
|
|
- DESTINATION ${relative_target_source_dir}
|
|
|
+ file(GENERATE OUTPUT "${target_install_source_dir}/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}/${NAME_PLACEHOLDER}_$<CONFIG>.cmake" CONTENT "${target_file_contents}")
|
|
|
+ install(FILES "${target_install_source_dir}/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}/${NAME_PLACEHOLDER}_$<CONFIG>.cmake"
|
|
|
+ DESTINATION ${relative_target_source_dir}/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}
|
|
|
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
|
|
|
)
|
|
|
|
|
@@ -299,16 +303,44 @@ function(ly_setup_subdirectory absolute_target_source_dir)
|
|
|
string(APPEND all_configured_targets "${configured_target}")
|
|
|
endforeach()
|
|
|
|
|
|
+ # Initialize the target install source directory to path underneath the current binary directory
|
|
|
+ set(target_install_source_dir "${CMAKE_CURRENT_BINARY_DIR}/install/${relative_target_source_dir}")
|
|
|
+
|
|
|
+ ly_file_read(${LY_ROOT_FOLDER}/cmake/install/Copyright.in cmake_copyright_comment)
|
|
|
+
|
|
|
+ # 1. Create the base CMakeLists.txt that will just include a cmake file per platform
|
|
|
+ file(CONFIGURE OUTPUT "${target_install_source_dir}/CMakeLists.txt" CONTENT [[
|
|
|
+@cmake_copyright_comment@
|
|
|
+include(Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
|
|
|
+]] @ONLY)
|
|
|
+ install(FILES "${target_install_source_dir}/CMakeLists.txt"
|
|
|
+ DESTINATION ${relative_target_source_dir}
|
|
|
+ COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
|
|
|
+ )
|
|
|
+
|
|
|
+ # 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)
|
|
|
+ file(CONFIGURE OUTPUT "${target_install_source_dir}/Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake" CONTENT [[
|
|
|
+@cmake_copyright_comment@
|
|
|
+if(LY_MONOLITHIC_GAME)
|
|
|
+ include(Platform/${PAL_PLATFORM_NAME}/Monolithic/permutation.cmake)
|
|
|
+else()
|
|
|
+ include(Platform/${PAL_PLATFORM_NAME}/Default/permutation.cmake)
|
|
|
+endif()
|
|
|
+]])
|
|
|
+ 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}
|
|
|
+ )
|
|
|
+
|
|
|
+ # 3. For this configuration permutation, generate a Platform/${PAL_PLATFORM_NAME}/${permutation}/permutation.cmake
|
|
|
+ # that will declare the target and configure it
|
|
|
ly_setup_subdirectory_create_alias("${absolute_target_source_dir}" CREATE_ALIASES_PLACEHOLDER)
|
|
|
ly_setup_subdirectory_set_gem_variant_to_load("${absolute_target_source_dir}" GEM_VARIANT_TO_LOAD_PLACEHOLDER)
|
|
|
ly_setup_subdirectory_enable_gems("${absolute_target_source_dir}" ENABLE_GEMS_PLACEHOLDER)
|
|
|
|
|
|
- ly_file_read(${LY_ROOT_FOLDER}/cmake/install/Copyright.in cmake_copyright_comment)
|
|
|
-
|
|
|
- # Initialize the target install source directory to path underneath the current binary directory
|
|
|
- set(target_install_source_dir ${CMAKE_CURRENT_BINARY_DIR}/install/${relative_target_source_dir})
|
|
|
# Write out all the aggregated ly_add_target function calls and the final ly_create_alias() calls to the target CMakeLists.txt
|
|
|
- file(WRITE ${target_install_source_dir}/CMakeLists.txt
|
|
|
+ file(WRITE "${target_install_source_dir}/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}/permutation.cmake"
|
|
|
"${cmake_copyright_comment}"
|
|
|
"${all_configured_targets}"
|
|
|
"\n"
|
|
@@ -316,9 +348,8 @@ function(ly_setup_subdirectory absolute_target_source_dir)
|
|
|
"${GEM_VARIANT_TO_LOAD_PLACEHOLDER}"
|
|
|
"${ENABLE_GEMS_PLACEHOLDER}"
|
|
|
)
|
|
|
-
|
|
|
- install(FILES "${target_install_source_dir}/CMakeLists.txt"
|
|
|
- DESTINATION ${relative_target_source_dir}
|
|
|
+ install(FILES "${target_install_source_dir}/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}/permutation.cmake"
|
|
|
+ DESTINATION ${relative_target_source_dir}//Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}
|
|
|
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
|
|
|
)
|
|
|
|
|
@@ -362,10 +393,10 @@ function(ly_setup_cmake_install)
|
|
|
# Inject code that will generate each ConfigurationType_<CONFIG>.cmake file
|
|
|
set(install_configuration_type_template [=[
|
|
|
configure_file(@LY_ROOT_FOLDER@/cmake/install/ConfigurationType_config.cmake.in
|
|
|
- ${CMAKE_INSTALL_PREFIX}/cmake/ConfigurationTypes_${CMAKE_INSTALL_CONFIG_NAME}.cmake
|
|
|
+ ${CMAKE_INSTALL_PREFIX}/cmake/Platform/@PAL_PLATFORM_NAME@/@LY_BUILD_PERMUTATION@/ConfigurationTypes_${CMAKE_INSTALL_CONFIG_NAME}.cmake
|
|
|
@ONLY
|
|
|
)
|
|
|
- message(STATUS "Generated ${CMAKE_INSTALL_PREFIX}/cmake/ConfigurationTypes_${CMAKE_INSTALL_CONFIG_NAME}.cmake")
|
|
|
+ message(STATUS "Generated ${CMAKE_INSTALL_PREFIX}/cmake/Platform/@PAL_PLATFORM_NAME@/@LY_BUILD_PERMUTATION@/ConfigurationTypes_${CMAKE_INSTALL_CONFIG_NAME}.cmake")
|
|
|
]=])
|
|
|
string(CONFIGURE "${install_configuration_type_template}" install_configuration_type @ONLY)
|
|
|
install(CODE "${install_configuration_type}"
|
|
@@ -493,6 +524,11 @@ endfunction()"
|
|
|
endif()
|
|
|
|
|
|
# runtime dependencies that need to be copied to the output
|
|
|
+ # Anywhere CMAKE_INSTALL_PREFIX is used, it has to be escaped so it is baked into the cmake_install.cmake script instead
|
|
|
+ # of baking the path. This is needed so `cmake --install --prefix <someprefix>` works regardless of the CMAKE_INSTALL_PREFIX
|
|
|
+ # used to generate the solution.
|
|
|
+ # CMAKE_INSTALL_PREFIX is still used when building the INSTALL target
|
|
|
+ set(install_output_folder "\${CMAKE_INSTALL_PREFIX}/${runtime_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${LY_BUILD_PERMUTATION}")
|
|
|
set(target_file_dir "${install_output_folder}/${target_runtime_output_subdirectory}")
|
|
|
ly_get_runtime_dependencies(runtime_dependencies ${target})
|
|
|
foreach(runtime_dependency ${runtime_dependencies})
|