From c128760ed001b891b2c9b68dfb87d56ccd21714a Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 31 Aug 2021 09:31:42 -0700 Subject: [PATCH 01/12] removes leftover of performance build Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Assets/Engine/Config/performance.cfg | 6 ------ Code/Framework/AzCore/AzCore/Debug/Trace.h | 2 +- Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h | 6 +++--- Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp | 4 ++-- .../AzFramework/AzFramework/Asset/AssetCatalog.cpp | 4 ++-- Code/Legacy/CryCommon/ProjectDefines.h | 6 +++--- Code/Legacy/CrySystem/SystemInit.cpp | 4 ---- Code/Legacy/CrySystem/XConsole.cpp | 2 +- .../Source/Platform/Windows/RHI/WSISurface_Windows.cpp | 1 + .../Code/Include/ScriptCanvas/Execution/ExecutionBus.h | 2 +- .../Execution/Interpreted/ExecutionInterpretedAPI.cpp | 9 ++------- .../Include/ScriptCanvas/Execution/RuntimeComponent.cpp | 2 +- Gems/ScriptCanvas/Code/Source/SystemComponent.cpp | 2 +- 13 files changed, 18 insertions(+), 32 deletions(-) delete mode 100644 Assets/Engine/Config/performance.cfg diff --git a/Assets/Engine/Config/performance.cfg b/Assets/Engine/Config/performance.cfg deleted file mode 100644 index 153209c20d..0000000000 --- a/Assets/Engine/Config/performance.cfg +++ /dev/null @@ -1,6 +0,0 @@ -e_StatoscopeScreenshotCapturePeriod = 1 - -e_StatoscopeDataGroups = Oulm -sys_pakLogInvalidFileAccess = 1 -e_StatoscopeWriteTimeout = 10 -e_StatoscopeConnectTimeout = 10 \ No newline at end of file diff --git a/Code/Framework/AzCore/AzCore/Debug/Trace.h b/Code/Framework/AzCore/AzCore/Debug/Trace.h index bae074281c..e2727a407a 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Trace.h +++ b/Code/Framework/AzCore/AzCore/Debug/Trace.h @@ -276,7 +276,7 @@ namespace AZ #define AZ_Printf(window, ...) AZ::Debug::Trace::Instance().Printf(window, __VA_ARGS__); -#if !defined(RELEASE) || defined(PERFORMANCE_BUILD) +#if !defined(RELEASE) // Unconditional critical error log, enabled up to Performance config #define AZ_Fatal(window, format, ...) AZ::Debug::Trace::Instance().Printf(window, "[FATAL] " format "\n", ##__VA_ARGS__); #define AZ_Crash() AZ::Debug::Trace::Instance().Crash(); diff --git a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h index f02c37492b..fe586ce078 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h +++ b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h @@ -1290,13 +1290,13 @@ namespace AZ const EventArray& GetEvents() const; -#if defined(PERFORMANCE_BUILD) || !defined(_RELEASE) // m_scriptPath is only available in non-Release mode +#if !defined(_RELEASE) // m_scriptPath is only available in non-Release mode AZStd::string m_scriptPath; #endif AZStd::string GetScriptPath() const { -#if defined(PERFORMANCE_BUILD) || !defined(_RELEASE) // m_scriptPath is only available in non-Release mode +#if !defined(_RELEASE) // m_scriptPath is only available in non-Release mode return m_scriptPath; #else return{}; @@ -1305,7 +1305,7 @@ namespace AZ void SetScriptPath(const char* scriptPath) { -#if defined(PERFORMANCE_BUILD) || !defined(_RELEASE) // m_scriptPath is only available in non-Release mode +#if !defined(_RELEASE) // m_scriptPath is only available in non-Release mode m_scriptPath = scriptPath; #else AZ_UNUSED(scriptPath); diff --git a/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp b/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp index 531c91bcf4..7cfc57cb7e 100644 --- a/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp +++ b/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp @@ -3727,7 +3727,7 @@ LUA_API const Node* lua_getDummyNode() if (m_handler) { -#if defined(PERFORMANCE_BUILD) || !defined(_RELEASE) +#if !defined(_RELEASE) const AZStd::string_view luaString("Lua"); lua_Debug info; for (int level = 0; lua_getstack(m_lua, level, &info); ++level) @@ -3739,7 +3739,7 @@ LUA_API const Node* lua_getDummyNode() break; } } -#endif//defined(PERFORMANCE_BUILD) || !defined(_RELEASE) +#endif BindEvents(scriptTable); diff --git a/Code/Framework/AzFramework/AzFramework/Asset/AssetCatalog.cpp b/Code/Framework/AzFramework/AzFramework/Asset/AssetCatalog.cpp index 3411c06f28..9b1946701c 100644 --- a/Code/Framework/AzFramework/AzFramework/Asset/AssetCatalog.cpp +++ b/Code/Framework/AzFramework/AzFramework/Asset/AssetCatalog.cpp @@ -987,7 +987,7 @@ namespace AzFramework void AssetCatalog::AddCatalogEntry(AZStd::shared_ptr deltaCatalog) { AZStd::lock_guard lock(m_deltaCatalogMutex); -#if defined(PERFORMANCE_BUILD) || !defined(_RELEASE) +#if !defined(_RELEASE) for (const auto& thisElement : m_deltaCatalogList) { if (thisElement == deltaCatalog) @@ -1010,7 +1010,7 @@ namespace AzFramework AZ_Warning("AssetCatalog", false, "Catalog name %p can't be inserted at slot %u", deltaCatalog.get(), catalogIndex); return; } -#if defined(PERFORMANCE_BUILD) || !defined(_RELEASE) +#if !defined(_RELEASE) for (const auto& thisElement : m_deltaCatalogList) { if (thisElement == deltaCatalog) diff --git a/Code/Legacy/CryCommon/ProjectDefines.h b/Code/Legacy/CryCommon/ProjectDefines.h index f7f73f111b..b443fc9ce0 100644 --- a/Code/Legacy/CryCommon/ProjectDefines.h +++ b/Code/Legacy/CryCommon/ProjectDefines.h @@ -27,7 +27,7 @@ #define AZ_RESTRICTED_SECTION PROJECTDEFINES_H_SECTION_STATS_AGENT #include AZ_RESTRICTED_FILE(ProjectDefines_h) #elif defined(WIN32) || defined(WIN64) - #if !defined(_RELEASE) || defined(PERFORMANCE_BUILD) + #if !defined(_RELEASE) #define ENABLE_STATS_AGENT #endif #endif @@ -71,7 +71,7 @@ #define REMOTE_ASSET_PROCESSOR #endif -#if (!defined(_RELEASE) || defined(PERFORMANCE_BUILD)) +#if (!defined(_RELEASE) #define USE_HTTP_WEBSOCKETS 0 #endif @@ -97,7 +97,7 @@ #endif #endif -#if (!defined(_RELEASE) || defined(PERFORMANCE_BUILD)) +#if (!defined(_RELEASE) #ifndef ENABLE_PROFILING_CODE #define ENABLE_PROFILING_CODE #endif diff --git a/Code/Legacy/CrySystem/SystemInit.cpp b/Code/Legacy/CrySystem/SystemInit.cpp index d5efff2748..a335dae112 100644 --- a/Code/Legacy/CrySystem/SystemInit.cpp +++ b/Code/Legacy/CrySystem/SystemInit.cpp @@ -1433,10 +1433,6 @@ AZ_POP_DISABLE_WARNING #endif } -#if defined(PERFORMANCE_BUILD) - LoadConfiguration("performance.cfg"); -#endif - ////////////////////////////////////////////////////////////////////////// if (g_cvars.sys_asserts == 0) { diff --git a/Code/Legacy/CrySystem/XConsole.cpp b/Code/Legacy/CrySystem/XConsole.cpp index bb8316981a..1cc9696a06 100644 --- a/Code/Legacy/CrySystem/XConsole.cpp +++ b/Code/Legacy/CrySystem/XConsole.cpp @@ -297,7 +297,7 @@ void CXConsole::Init(ISystem* pSystem) AzFramework::InputChannelEventListener::Connect(); AzFramework::InputTextEventListener::Connect(); -#if defined(_RELEASE) && !defined(PERFORMANCE_BUILD) +#if defined(_RELEASE) static const int kDeactivateConsoleDefault = 1; #else static const int kDeactivateConsoleDefault = 0; diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/Platform/Windows/RHI/WSISurface_Windows.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/Platform/Windows/RHI/WSISurface_Windows.cpp index 02c776293d..d7e4bd2556 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/Platform/Windows/RHI/WSISurface_Windows.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/Platform/Windows/RHI/WSISurface_Windows.cpp @@ -8,6 +8,7 @@ #include #include #include +#include namespace AZ { diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/ExecutionBus.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/ExecutionBus.h index 37a78a88f4..ebe591e15f 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/ExecutionBus.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/ExecutionBus.h @@ -15,7 +15,7 @@ #include -#if defined(PERFORMANCE_BUILD) || !defined(_RELEASE) +#if !defined(_RELEASE) // the markers are defined in test, but the system that listens for calls won't always be enabled #define SCRIPT_CANVAS_PERFORMANCE_TRACKING_ENABLED #endif diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp index d7a4c360ac..e93fd1263d 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp @@ -465,12 +465,7 @@ namespace ScriptCanvas lua_register(lua, k_UnpackDependencyConstructionArgsFunctionName, &UnpackDependencyConstructionArgs); lua_register(lua, k_UnpackDependencyConstructionArgsLeafFunctionName, &UnpackDependencyConstructionArgsLeaf); -#if defined(PERFORMANCE_BUILD) - lua_pushboolean(lua, true); - lua_setglobal(lua, k_InterpretedConfigurationPerformance); - lua_pushboolean(lua, false); - lua_setglobal(lua, k_InterpretedConfigurationRelease); -#elif defined(_RELEASE) +#if defined(_RELEASE) lua_pushboolean(lua, false); lua_setglobal(lua, k_InterpretedConfigurationPerformance); lua_pushboolean(lua, true); @@ -481,7 +476,7 @@ namespace ScriptCanvas lua_setglobal(lua, k_InterpretedConfigurationPerformance); lua_pushboolean(lua, false); lua_setglobal(lua, k_InterpretedConfigurationRelease); -#endif//defined(PERFORMANCE_BUILD) +#endif lua_register(lua, k_GetRandomSwitchControlNumberName, &GetRandomSwitchControlNumber); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp index 6d652136cd..c1b0d51ac8 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp @@ -19,7 +19,7 @@ #include #include -#if !defined(_RELEASE) && !defined(PERFORMANCE_BUILD) +#if !defined(_RELEASE) #define SCRIPT_CANVAS_RUNTIME_ASSET_CHECK #endif diff --git a/Gems/ScriptCanvas/Code/Source/SystemComponent.cpp b/Gems/ScriptCanvas/Code/Source/SystemComponent.cpp index ba02fa8a62..5d6b98f7cb 100644 --- a/Gems/ScriptCanvas/Code/Source/SystemComponent.cpp +++ b/Gems/ScriptCanvas/Code/Source/SystemComponent.cpp @@ -34,7 +34,7 @@ namespace ScriptCanvasSystemComponentCpp { -#if !defined(_RELEASE) && !defined(PERFORMANCE_BUILD) +#if !defined(_RELEASE) const int k_infiniteLoopDetectionMaxIterations = 1000000; const int k_maxHandlerStackDepth = 25; #else From 37c7c6884b68bc15d64dd3d2bea30c0abec92669 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 31 Aug 2021 11:46:45 -0700 Subject: [PATCH 02/12] Fixes typos from PERFORMANCE_BUILD removal Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Legacy/CryCommon/ProjectDefines.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Legacy/CryCommon/ProjectDefines.h b/Code/Legacy/CryCommon/ProjectDefines.h index b443fc9ce0..203bd304c9 100644 --- a/Code/Legacy/CryCommon/ProjectDefines.h +++ b/Code/Legacy/CryCommon/ProjectDefines.h @@ -71,7 +71,7 @@ #define REMOTE_ASSET_PROCESSOR #endif -#if (!defined(_RELEASE) +#if !defined(_RELEASE) #define USE_HTTP_WEBSOCKETS 0 #endif @@ -97,7 +97,7 @@ #endif #endif -#if (!defined(_RELEASE) +#if !defined(_RELEASE) #ifndef ENABLE_PROFILING_CODE #define ENABLE_PROFILING_CODE #endif From 9585096829ead603044d67de60fa600f1c829990 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 31 Aug 2021 13:29:54 -0700 Subject: [PATCH 03/12] adds include paths for Atom Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/Atom/RHI/Vulkan/Code/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gems/Atom/RHI/Vulkan/Code/CMakeLists.txt b/Gems/Atom/RHI/Vulkan/Code/CMakeLists.txt index 39c49ab07f..f4148b435e 100644 --- a/Gems/Atom/RHI/Vulkan/Code/CMakeLists.txt +++ b/Gems/Atom/RHI/Vulkan/Code/CMakeLists.txt @@ -37,6 +37,7 @@ if(NOT PAL_TRAIT_ATOM_RHI_VULKAN_SUPPORTED) NAMESPACE Gem FILES_CMAKE ${pal_source_dir}/platform_builders_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake + ${pal_include_dir}/platform_builders_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake atom_rhi_vulkan_reflect_common_files.cmake atom_rhi_vulkan_glad_files.cmake atom_rhi_vulkan_builders_common_files.cmake @@ -90,6 +91,7 @@ ly_add_target( FILES_CMAKE atom_rhi_vulkan_private_common_files.cmake ${pal_source_dir}/platform_private_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake + ${pal_include_dir}/platform_private_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake PLATFORM_INCLUDE_FILES ${pal_source_dir}/platform_private_static_${PAL_PLATFORM_NAME_LOWERCASE}.cmake INCLUDE_DIRECTORIES From 4e699138b8033b63843d6814d819786c2fd05e86 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 31 Aug 2021 16:46:02 -0700 Subject: [PATCH 04/12] better handling of CMAKE_MODULE_PATH when passed to another project Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../DefaultProject/Template/EngineFinder.cmake | 15 +++++++++++++++ .../MinimalProject/Template/EngineFinder.cmake | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Templates/DefaultProject/Template/EngineFinder.cmake b/Templates/DefaultProject/Template/EngineFinder.cmake index ccbfcbecfd..1bb4950e7d 100644 --- a/Templates/DefaultProject/Template/EngineFinder.cmake +++ b/Templates/DefaultProject/Template/EngineFinder.cmake @@ -21,6 +21,21 @@ if(json_error) message(FATAL_ERROR "Unable to read key 'engine' from 'project.json', error: ${json_error}") endif() +if(CMAKE_MODULE_PATH) + foreach(module_path ${CMAKE_MODULE_PATH}) + if(EXISTS ${module_path}/Findo3de.cmake) + file(READ ${module_path}/../engine.json engine_json) + string(JSON engine_name ERROR_VARIABLE json_error GET ${engine_json} engine_name) + if(json_error) + message(FATAL_ERROR "Unable to read key 'engine_name' from 'engine.json', error: ${json_error}") + endif() + if(LY_ENGINE_NAME_TO_USE STREQUAL engine_name) + return() # Engine being forced through CMAKE_MODULE_PATH + endif() + endif() + endforeach() +endif() + if(DEFINED ENV{USERPROFILE} AND EXISTS $ENV{USERPROFILE}) set(manifest_path $ENV{USERPROFILE}/.o3de/o3de_manifest.json) # Windows else() diff --git a/Templates/MinimalProject/Template/EngineFinder.cmake b/Templates/MinimalProject/Template/EngineFinder.cmake index ccbfcbecfd..1bb4950e7d 100644 --- a/Templates/MinimalProject/Template/EngineFinder.cmake +++ b/Templates/MinimalProject/Template/EngineFinder.cmake @@ -21,6 +21,21 @@ if(json_error) message(FATAL_ERROR "Unable to read key 'engine' from 'project.json', error: ${json_error}") endif() +if(CMAKE_MODULE_PATH) + foreach(module_path ${CMAKE_MODULE_PATH}) + if(EXISTS ${module_path}/Findo3de.cmake) + file(READ ${module_path}/../engine.json engine_json) + string(JSON engine_name ERROR_VARIABLE json_error GET ${engine_json} engine_name) + if(json_error) + message(FATAL_ERROR "Unable to read key 'engine_name' from 'engine.json', error: ${json_error}") + endif() + if(LY_ENGINE_NAME_TO_USE STREQUAL engine_name) + return() # Engine being forced through CMAKE_MODULE_PATH + endif() + endif() + endforeach() +endif() + if(DEFINED ENV{USERPROFILE} AND EXISTS $ENV{USERPROFILE}) set(manifest_path $ENV{USERPROFILE}/.o3de/o3de_manifest.json) # Windows else() From 185e7ffbfc9c7e1c4d9fa2f2e32c96aa440eef70 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 31 Aug 2021 16:46:27 -0700 Subject: [PATCH 05/12] get the Platform files for 3rdparty also copied Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/Platform/Common/Install_common.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/Platform/Common/Install_common.cmake b/cmake/Platform/Common/Install_common.cmake index 0bd598f70e..92d261607c 100644 --- a/cmake/Platform/Common/Install_common.cmake +++ b/cmake/Platform/Common/Install_common.cmake @@ -404,15 +404,26 @@ function(ly_setup_cmake_install) # Collect all Find files that were added with ly_add_external_target_path unset(additional_find_files) + unset(additional_platform_files) get_property(additional_module_paths GLOBAL PROPERTY LY_ADDITIONAL_MODULE_PATH) foreach(additional_module_path ${additional_module_paths}) unset(find_files) file(GLOB find_files "${additional_module_path}/Find*.cmake") list(APPEND additional_find_files "${find_files}") + foreach(find_file ${find_files}) + # also copy the Platform/ to the destination + cmake_path(GET find_file PARENT_PATH find_file_parent) + unset(plat_files) + file(GLOB plat_files "${find_file_parent}/Platform/${PAL_PLATFORM_NAME}/*.cmake") + list(APPEND additional_platform_files "${plat_files}") + endforeach() endforeach() install(FILES ${additional_find_files} DESTINATION cmake/3rdParty ) + install(FILES ${additional_platform_files} + DESTINATION cmake/3rdParty/Platform/${PAL_PLATFORM_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 # targets that are pre-built From 553cf52c86cd723bdcbcc47589bda1da46881f71 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 31 Aug 2021 18:03:06 -0700 Subject: [PATCH 06/12] some install fixes, now I dont see the INSTALL target on projects using the prebuilt-SDK Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- CMakeLists.txt | 2 +- Code/LauncherUnified/CMakeLists.txt | 1 + cmake/3rdParty.cmake | 16 +++------------- cmake/Install.cmake | 15 ++++++++++++++- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a668af6a1..43b0dd240e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,7 +132,7 @@ ly_delayed_generate_runtime_dependencies() ly_test_impact_post_step() # 7. Generate the O3DE find file and setup install locations for scripts, tools, assets etc., required by the engine -if(NOT INSTALLED_ENGINE) +if(LY_INSTALL_ENABLED) # 8. Generate the O3DE find file and setup install locations for scripts, tools, assets etc., required by the engine ly_setup_o3de_install() # 9. CPack information (to be included after install) diff --git a/Code/LauncherUnified/CMakeLists.txt b/Code/LauncherUnified/CMakeLists.txt index c3d152a777..845c2cd6c7 100644 --- a/Code/LauncherUnified/CMakeLists.txt +++ b/Code/LauncherUnified/CMakeLists.txt @@ -111,6 +111,7 @@ ly_install_directory( Platform/${PAL_PLATFORM_NAME} Platform/Common DESTINATION LauncherGenerator/Platform + VERBATIM ) ly_install_files( FILES FindLauncherGenerator.cmake diff --git a/cmake/3rdParty.cmake b/cmake/3rdParty.cmake index cd72faa78d..4599c282f0 100644 --- a/cmake/3rdParty.cmake +++ b/cmake/3rdParty.cmake @@ -306,20 +306,10 @@ endfunction() function(ly_install_external_target 3RDPARTY_ROOT_DIRECTORY) # Install the Find file to our /cmake directory - install(FILES ${CMAKE_CURRENT_LIST_FILE} - DESTINATION cmake + ly_install_files(FILES ${CMAKE_CURRENT_LIST_FILE} + DESTINATION cmake/3rdParty ) - - # 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 - # given is on another drive letter on windows(i.e., RELATIVE_PATH returns an absolute path) - 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} - ) - endif() + ly_install_directory(DIRECTORIES ${3RDPARTY_ROOT_DIRECTORY}) endfunction() diff --git a/cmake/Install.cmake b/cmake/Install.cmake index 34f316e31e..b71b01eb7d 100644 --- a/cmake/Install.cmake +++ b/cmake/Install.cmake @@ -6,7 +6,12 @@ # # -if(NOT INSTALLED_ENGINE) +ly_set(LY_INSTALL_ENABLED TRUE) +if(INSTALLED_ENGINE) + ly_set(LY_INSTALL_ENABLED FALSE) +endif() + +if(LY_INSTALL_ENABLED) ly_get_absolute_pal_filename(pal_dir ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Platform/${PAL_PLATFORM_NAME}) include(${pal_dir}/Install_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) endif() @@ -27,6 +32,10 @@ endif() # function(ly_install_directory) + if(NOT LY_INSTALL_ENABLED) + return() + endif() + set(options VERBATIM) set(oneValueArgs DESTINATION) set(multiValueArgs DIRECTORIES EXCLUDE_PATTERNS) @@ -91,6 +100,10 @@ endfunction() # function(ly_install_files) + if(NOT LY_INSTALL_ENABLED) + return() + endif() + set(options PROGRAMS) set(oneValueArgs DESTINATION) set(multiValueArgs FILES) From af9fbc9ae9cf3802f2f5a4c0cb2a2072f22ce4c8 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 1 Sep 2021 07:46:39 -0700 Subject: [PATCH 07/12] this fixes it, but we need to be able to set it properly with a cache variable instead Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/OutputDirectory.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/OutputDirectory.cmake b/cmake/OutputDirectory.cmake index 116ddfbecc..3b8e1b90eb 100644 --- a/cmake/OutputDirectory.cmake +++ b/cmake/OutputDirectory.cmake @@ -14,4 +14,4 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin CACHE PATH "Build dir # We install outside of the binary dir because our install support muliple platforms to # be installed together. We also have an exclusion rule in the AP that filters out the # "build" folder which is a common binary dir -set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install CACHE PATH "Installation prefix") +ly_set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install) From 404d6864fde0f6e8b45e9a3009bec55a87599497 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 1 Sep 2021 08:44:46 -0700 Subject: [PATCH 08/12] proper set of CMAKE_INSTALL_PREFIX Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/OutputDirectory.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/OutputDirectory.cmake b/cmake/OutputDirectory.cmake index 3b8e1b90eb..c1409bd825 100644 --- a/cmake/OutputDirectory.cmake +++ b/cmake/OutputDirectory.cmake @@ -13,5 +13,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin CACHE PATH "Build dir # We install outside of the binary dir because our install support muliple platforms to # be installed together. We also have an exclusion rule in the AP that filters out the -# "build" folder which is a common binary dir -ly_set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install) +# "install" folder to avoid the AP picking it up +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + ly_set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install) +endif() From b7291cf7404f9456c0c28ec1a2af1602a5988e6a Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 1 Sep 2021 08:45:22 -0700 Subject: [PATCH 09/12] adding ignore rule in AP for install folder and making exclusion rule in gitignore to match the one of build Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .gitignore | 2 +- Registry/AssetProcessorPlatformConfig.setreg | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c28f6ab123..3a9b8f6f8e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ AssetProcessorTemp/** [Oo]ut/** CMakeUserPresets.json [Cc]ache/ -/install/ +/[Ii]nstall/ Editor/EditorEventLog.xml Editor/EditorLayout.xml **/*egg-info/** diff --git a/Registry/AssetProcessorPlatformConfig.setreg b/Registry/AssetProcessorPlatformConfig.setreg index 1c09ef4e83..3e90b063b5 100644 --- a/Registry/AssetProcessorPlatformConfig.setreg +++ b/Registry/AssetProcessorPlatformConfig.setreg @@ -172,6 +172,9 @@ "Exclude Build": { "pattern": ".*/[Bb]uild/.*" }, + "Exclude Install": { + "pattern": ".*/[Ii]nstall/.*" + }, "Exclude UserSettings": { "pattern": ".*/UserSettings.xml" }, From 9a6a1ba97a28512e44cb241c55b455d151ae5b0a Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 2 Sep 2021 18:24:25 -0700 Subject: [PATCH 10/12] fixes monolithic release Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Frontend/Console/Code/CMakeLists.txt | 4 +++ Gems/Atom/Feature/Common/Code/CMakeLists.txt | 4 +-- .../Platform/Windows/platform_windows.cmake | 4 +++ Gems/CrashReporting/Code/CMakeLists.txt | 29 ++++++++++--------- Registry/CMakeLists.txt | 4 +++ cmake/OutputDirectory.cmake | 2 +- cmake/SettingsRegistry.cmake | 5 ++++ 7 files changed, 36 insertions(+), 16 deletions(-) diff --git a/Code/Tools/TestImpactFramework/Frontend/Console/Code/CMakeLists.txt b/Code/Tools/TestImpactFramework/Frontend/Console/Code/CMakeLists.txt index 1aed0aadc6..9c1ccb2255 100644 --- a/Code/Tools/TestImpactFramework/Frontend/Console/Code/CMakeLists.txt +++ b/Code/Tools/TestImpactFramework/Frontend/Console/Code/CMakeLists.txt @@ -6,6 +6,10 @@ # # +if(LY_MONOLITHIC_GAME) + return() +endif() + ly_add_target( NAME TestImpact.Frontend.Console.Static STATIC NAMESPACE AZ diff --git a/Gems/Atom/Feature/Common/Code/CMakeLists.txt b/Gems/Atom/Feature/Common/Code/CMakeLists.txt index 8ed02f2c2f..b8c414dcc6 100644 --- a/Gems/Atom/Feature/Common/Code/CMakeLists.txt +++ b/Gems/Atom/Feature/Common/Code/CMakeLists.txt @@ -39,7 +39,7 @@ ly_add_target( Gem::Atom_Utils.Static Gem::Atom_Feature_Common.Public Gem::ImGui.imguilib - 3rdParty::lux_core + #3rdParty::lux_core # AZ_TRAIT_LUXCORE_SUPPORTED is disabled in every platform, Issue #3915 will remove ) ly_add_target( @@ -87,7 +87,7 @@ ly_add_target( AZ::AzFramework Gem::Atom_Feature_Common.Static Gem::Atom_Feature_Common.Public - 3rdParty::lux_core + #3rdParty::lux_core # AZ_TRAIT_LUXCORE_SUPPORTED is disabled in every platform, Issue #3915 will remove ) if(PAL_TRAIT_BUILD_HOST_TOOLS) diff --git a/Gems/Atom/Feature/Common/Code/Source/Platform/Windows/platform_windows.cmake b/Gems/Atom/Feature/Common/Code/Source/Platform/Windows/platform_windows.cmake index b74260a5de..ecdc7d59ab 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Platform/Windows/platform_windows.cmake +++ b/Gems/Atom/Feature/Common/Code/Source/Platform/Windows/platform_windows.cmake @@ -6,6 +6,10 @@ # # +if(LY_MONOLITHIC_GAME) # Do not use OpenImageIO in monolithic game + return() +endif() + set(LY_BUILD_DEPENDENCIES PRIVATE 3rdParty::OpenImageIO diff --git a/Gems/CrashReporting/Code/CMakeLists.txt b/Gems/CrashReporting/Code/CMakeLists.txt index b12b5d8944..8bcb143d1c 100644 --- a/Gems/CrashReporting/Code/CMakeLists.txt +++ b/Gems/CrashReporting/Code/CMakeLists.txt @@ -35,17 +35,20 @@ ly_add_target( ly_create_alias(NAME CrashReporting.Clients NAMESPACE Gem TARGETS Gem::CrashReporting) ly_create_alias(NAME CrashReporting.Servers NAMESPACE Gem TARGETS Gem::CrashReporting) +if(NOT LY_MONOLITHIC_GAME) -ly_add_target( - NAME CrashReporting.Uploader APPLICATION - NAMESPACE AZ - FILES_CMAKE - game_crash_uploader_files.cmake - Platform/${PAL_PLATFORM_NAME}/game_crash_uploader_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake - INCLUDE_DIRECTORIES - PRIVATE - Include - BUILD_DEPENDENCIES - PRIVATE - AZ::CrashUploaderSupport -) + ly_add_target( + NAME CrashReporting.Uploader APPLICATION + NAMESPACE AZ + FILES_CMAKE + game_crash_uploader_files.cmake + Platform/${PAL_PLATFORM_NAME}/game_crash_uploader_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake + INCLUDE_DIRECTORIES + PRIVATE + Include + BUILD_DEPENDENCIES + PRIVATE + AZ::CrashUploaderSupport + ) + +endif() diff --git a/Registry/CMakeLists.txt b/Registry/CMakeLists.txt index f78df700e7..100867010d 100644 --- a/Registry/CMakeLists.txt +++ b/Registry/CMakeLists.txt @@ -6,6 +6,10 @@ # # +if(LY_MONOLITHIC_GAME) + return() +endif() + ly_install_directory(DIRECTORIES .) cmake_path(RELATIVE_PATH CMAKE_RUNTIME_OUTPUT_DIRECTORY BASE_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE runtime_output_directory) diff --git a/cmake/OutputDirectory.cmake b/cmake/OutputDirectory.cmake index c1409bd825..a75b47e818 100644 --- a/cmake/OutputDirectory.cmake +++ b/cmake/OutputDirectory.cmake @@ -15,5 +15,5 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin CACHE PATH "Build dir # be installed together. We also have an exclusion rule in the AP that filters out the # "install" folder to avoid the AP picking it up if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - ly_set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install) + set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install CACHE PATH "Install directory" FORCE) endif() diff --git a/cmake/SettingsRegistry.cmake b/cmake/SettingsRegistry.cmake index 58beba089c..f84ecca334 100644 --- a/cmake/SettingsRegistry.cmake +++ b/cmake/SettingsRegistry.cmake @@ -118,6 +118,11 @@ endfunction() # The generated file contains the file to the each dependent targets # This can be used for example to determine which list of gems to load with an application function(ly_delayed_generate_settings_registry) + + if(LY_MONOLITHIC_GAME) # No need to generate setregs for monolithic builds + return() + endif() + get_property(ly_delayed_load_targets GLOBAL PROPERTY LY_DELAYED_LOAD_DEPENDENCIES) foreach(prefix_target ${ly_delayed_load_targets}) string(REPLACE "," ";" prefix_target_list "${prefix_target}") From 1aa7059d0102e5f215077132b51816571caf6a15 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 2 Sep 2021 18:24:49 -0700 Subject: [PATCH 11/12] generates paks for release Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/Install.cmake | 19 ++++++++++++++++++- cmake/Projects.cmake | 15 +++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/cmake/Install.cmake b/cmake/Install.cmake index b71b01eb7d..6f50c78fd7 100644 --- a/cmake/Install.cmake +++ b/cmake/Install.cmake @@ -134,4 +134,21 @@ function(ly_install_files) COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the default for the time being ) -endfunction() \ No newline at end of file +endfunction() + +#! ly_install_run_code: specifies code to be added to the install process (will run at install time) +# +# \notes: +# - refer to cmake's install(CODE documentation for more information +# +function(ly_install_run_code CODE) + + if(NOT LY_INSTALL_ENABLED) + return() + endif() + + install(CODE ${CODE} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the default for the time being + ) + +endfunction() diff --git a/cmake/Projects.cmake b/cmake/Projects.cmake index 6e5b5c5f78..627b31bc43 100644 --- a/cmake/Projects.cmake +++ b/cmake/Projects.cmake @@ -142,6 +142,21 @@ foreach(project ${LY_PROJECTS}) add_subdirectory(${project} "${project_folder_name}-${full_directory_hash}") ly_generate_project_build_path_setreg(${full_directory_path}) add_project_json_external_subdirectories(${full_directory_path}) + + # 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 + FORMAT zip + ) + message(STATUS \"\${install_output_folder}/Engine.pak generated\") +endif() +") + endforeach() # If just one project is defined we pass it as a parameter to the applications From bfdcf74ea05f8ec7566fff52a7c326212ba17810 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 3 Sep 2021 09:10:47 -0700 Subject: [PATCH 12/12] PR comments/suggestions Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/3rdParty.cmake | 2 +- cmake/Platform/Common/Install_common.cmake | 40 ++++++++++++++-------- cmake/Platform/Linux/Install_linux.cmake | 4 ++- cmake/Platform/Mac/Install_mac.cmake | 16 ++++----- cmake/Projects.cmake | 18 +++++----- cmake/SettingsRegistry.cmake | 3 +- 6 files changed, 49 insertions(+), 34 deletions(-) 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()