diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp index d0f277a6b8..6ba985d032 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp @@ -1215,7 +1215,7 @@ namespace AZ // So auto load is turned off if option "AutoLoad" key is bool that is false if (valueName == "AutoLoad" && !value) { - // Strip off the AutoLoead entry from the path + // Strip off the AutoLoad entry from the path auto autoLoadKey = AZ::StringFunc::TokenizeLast(path, "/"); if (!autoLoadKey) { diff --git a/Code/Framework/AzCore/AzCore/Module/ModuleManager.cpp b/Code/Framework/AzCore/AzCore/Module/ModuleManager.cpp index fe41050b00..0ce3ee5d8d 100644 --- a/Code/Framework/AzCore/AzCore/Module/ModuleManager.cpp +++ b/Code/Framework/AzCore/AzCore/Module/ModuleManager.cpp @@ -512,7 +512,7 @@ namespace AZ // Load DLLs specified in the application descriptor for (const auto& moduleDescriptor : modules) { - // For each module that is loaded, attempt to set the module's folder as a path for dependent module resolution + // For each module that is loaded, attempt to set the module's folder as a path for dependent module resolution moduleSearchPathHelper.SetModuleSearchPath(moduleDescriptor); LoadModuleOutcome result = LoadDynamicModule(moduleDescriptor.m_dynamicLibraryPath.c_str(), lastStepToPerform, maintainReferences); diff --git a/Code/LauncherUnified/Launcher.cpp b/Code/LauncherUnified/Launcher.cpp index 033169ac6d..26962dfe03 100644 --- a/Code/LauncherUnified/Launcher.cpp +++ b/Code/LauncherUnified/Launcher.cpp @@ -488,8 +488,8 @@ namespace O3DELauncher const AZStd::string_view buildTargetName = GetBuildTargetName(); AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddBuildSystemTargetSpecialization(*settingsRegistry, buildTargetName); - AZ_TracePrintf("Launcher", R"(Running project "%.*s.)" "\n" - R"(The project name value has been successfully set in the Settings Registry at key "%s/project_name)" + AZ_TracePrintf("Launcher", R"(Running project "%.*s")" "\n" + R"(The project name has been successfully set in the Settings Registry at key "%s/project_name")" R"( for Launcher target "%.*s")" "\n", aznumeric_cast(launcherProjectName.size()), launcherProjectName.data(), AZ::SettingsRegistryMergeUtils::ProjectSettingsRootKey, diff --git a/Code/LauncherUnified/Platform/Windows/launcher_project_windows.cmake b/Code/LauncherUnified/Platform/Windows/launcher_project_windows.cmake index bcef59ec5a..35c89caf15 100644 --- a/Code/LauncherUnified/Platform/Windows/launcher_project_windows.cmake +++ b/Code/LauncherUnified/Platform/Windows/launcher_project_windows.cmake @@ -10,6 +10,11 @@ # set(ICON_FILE ${project_real_path}/Gem/Resources/GameSDK.ico) +if(NOT EXISTS ${ICON_FILE}) + # Try another project-relative path + set(ICON_FILE ${project_real_path}/Resources/GameSDK.ico) +endif() + if(NOT EXISTS ${ICON_FILE}) # Try the common LauncherUnified icon instead set(ICON_FILE Resources/GameSDK.ico) diff --git a/cmake/LYWrappers.cmake b/cmake/LYWrappers.cmake index 8640b460de..fcf205238c 100644 --- a/cmake/LYWrappers.cmake +++ b/cmake/LYWrappers.cmake @@ -85,7 +85,7 @@ function(ly_add_target) if(NOT ly_add_target_NAME) message(FATAL_ERROR "You must provide a name for the target") endif() - if(NOT ly_add_target_IMPORTED) + if(NOT ly_add_target_IMPORTED AND NOT ly_add_target_HEADERONLY) if(NOT ly_add_target_FILES_CMAKE) message(FATAL_ERROR "You must provide a list of _files.cmake files for the target") endif() diff --git a/cmake/Platform/Common/Install_common.cmake b/cmake/Platform/Common/Install_common.cmake index 99ff0bbbe2..e8ad598277 100644 --- a/cmake/Platform/Common/Install_common.cmake +++ b/cmake/Platform/Common/Install_common.cmake @@ -32,7 +32,7 @@ function(ly_setup_target ALIAS_TARGET_NAME) ly_de_alias_target(${ALIAS_TARGET_NAME} TARGET_NAME) get_target_property(absolute_target_source_dir ${TARGET_NAME} SOURCE_DIR) - file(RELATIVE_PATH target_source_dir ${CMAKE_SOURCE_DIR} ${absolute_target_source_dir}) + file(RELATIVE_PATH target_source_dir ${LY_ROOT_FOLDER} ${absolute_target_source_dir}) # All include directories marked PUBLIC or INTERFACE will be installed set(include_location "include") @@ -98,6 +98,12 @@ function(ly_setup_target ALIAS_TARGET_NAME) set(NAME_PLACEHOLDER ${TARGET_NAME}) endif() + set(TARGET_TYPE_PLACEHOLDER "IMPORTED") + get_target_property(target_type ${NAME_PLACEHOLDER} TYPE) + if(target_type STREQUAL INTERFACE_LIBRARY) + set(TARGET_TYPE_PLACEHOLDER "HEADERONLY") + endif() + get_target_property(COMPILE_DEFINITIONS_PLACEHOLDER ${TARGET_NAME} INTERFACE_COMPILE_DEFINITIONS) if(COMPILE_DEFINITIONS_PLACEHOLDER) string(REPLACE ";" "\n" COMPILE_DEFINITIONS_PLACEHOLDER "${COMPILE_DEFINITIONS_PLACEHOLDER}") @@ -153,8 +159,6 @@ function(ly_setup_target ALIAS_TARGET_NAME) ) # Config file - get_target_property(target_type ${TARGET_NAME} TYPE) - set(target_file_contents "# Generated by O3DE install\n\n") if(NOT target_type STREQUAL INTERFACE_LIBRARY) @@ -208,16 +212,20 @@ endfunction() #! ly_setup_cmake_install: install the "cmake" folder function(ly_setup_cmake_install) - install(DIRECTORY "${CMAKE_SOURCE_DIR}/cmake" + install(DIRECTORY "${LY_ROOT_FOLDER}/cmake" DESTINATION . COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} + PATTERN "__pycache__" EXCLUDE REGEX "Findo3de.cmake" EXCLUDE REGEX "Platform\/.*\/BuiltInPackages_.*\.cmake" EXCLUDE ) + + configure_file(${LY_ROOT_FOLDER}/cmake/install/engine.json.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/engine.json @ONLY) + install( FILES - "${CMAKE_SOURCE_DIR}/CMakeLists.txt" - "${CMAKE_SOURCE_DIR}/engine.json" + "${LY_ROOT_FOLDER}/CMakeLists.txt" + "${CMAKE_CURRENT_BINARY_DIR}/cmake/engine.json" DESTINATION . COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) @@ -241,7 +249,7 @@ function(ly_setup_cmake_install) unset(FIND_PACKAGES_PLACEHOLDER) foreach(target IN LISTS all_targets) get_target_property(target_source_dir ${target} SOURCE_DIR) - file(RELATIVE_PATH target_source_dir_relative ${CMAKE_SOURCE_DIR} ${target_source_dir}) + file(RELATIVE_PATH target_source_dir_relative ${LY_ROOT_FOLDER} ${target_source_dir}) string(APPEND FIND_PACKAGES_PLACEHOLDER " add_subdirectory(${target_source_dir_relative}/${target})\n") endforeach() @@ -352,15 +360,16 @@ function(ly_setup_others) set(install_path .) endif() - install(DIRECTORY "${CMAKE_SOURCE_DIR}/${dir}" + install(DIRECTORY "${LY_ROOT_FOLDER}/${dir}" DESTINATION ${install_path} COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} + PATTERN "__pycache__" EXCLUDE ) endforeach() # Scripts - file(GLOB o3de_scripts "${CMAKE_SOURCE_DIR}/scripts/o3de.*") + file(GLOB o3de_scripts "${LY_ROOT_FOLDER}/scripts/o3de.*") install(FILES ${o3de_scripts} DESTINATION ./scripts @@ -368,8 +377,8 @@ function(ly_setup_others) ) install(DIRECTORY - ${CMAKE_SOURCE_DIR}/scripts/bundler - ${CMAKE_SOURCE_DIR}/scripts/project_manager + ${LY_ROOT_FOLDER}/scripts/bundler + ${LY_ROOT_FOLDER}/scripts/project_manager DESTINATION ./scripts COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} PATTERN "__pycache__" EXCLUDE @@ -377,7 +386,7 @@ function(ly_setup_others) PATTERN "tests" EXCLUDE ) - install(DIRECTORY "${CMAKE_SOURCE_DIR}/python" + install(DIRECTORY "${LY_ROOT_FOLDER}/python" DESTINATION . COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} REGEX "downloaded_packages" EXCLUDE @@ -391,14 +400,14 @@ function(ly_setup_others) COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) install(DIRECTORY - ${CMAKE_SOURCE_DIR}/Registry + ${LY_ROOT_FOLDER}/Registry DESTINATION . COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) # Engine Source Assets install(DIRECTORY - ${CMAKE_SOURCE_DIR}/Assets + ${LY_ROOT_FOLDER}/Assets DESTINATION . COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) @@ -408,13 +417,13 @@ function(ly_setup_others) file(GLOB_RECURSE gems_assets_path LIST_DIRECTORIES TRUE - RELATIVE "${CMAKE_SOURCE_DIR}/" + RELATIVE "${LY_ROOT_FOLDER}/" "Gems/*" ) list(FILTER gems_assets_path INCLUDE REGEX "/(Assets|Registry)$") foreach (gem_assets_path ${gems_assets_path}) - set(gem_abs_assets_path ${CMAKE_SOURCE_DIR}/${gem_assets_path}/) + set(gem_abs_assets_path ${LY_ROOT_FOLDER}/${gem_assets_path}/) if (EXISTS ${gem_abs_assets_path}) # The trailing slash is IMPORTANT here as that is needed to prevent # the "Assets" folder from being copied underneath the /Assets folder @@ -429,36 +438,36 @@ function(ly_setup_others) file(GLOB_RECURSE gems_json_path LIST_DIRECTORIES FALSE - RELATIVE "${CMAKE_SOURCE_DIR}" + RELATIVE "${LY_ROOT_FOLDER}" "Gems/*/gem.json" ) foreach(gem_json_path ${gems_json_path}) get_filename_component(gem_relative_path ${gem_json_path} DIRECTORY) install(FILES ${gem_json_path} DESTINATION ${gem_relative_path} - COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} + COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) endforeach() # Additional files needed by gems install(DIRECTORY - ${CMAKE_SOURCE_DIR}/Gems/Atom/Asset/ImageProcessingAtom/Config + ${LY_ROOT_FOLDER}/Gems/Atom/Asset/ImageProcessingAtom/Config DESTINATION Gems/Atom/Asset/ImageProcessingAtom COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) # Templates install(DIRECTORY - ${CMAKE_SOURCE_DIR}/Templates + ${LY_ROOT_FOLDER}/Templates DESTINATION . COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) # Misc install(FILES - ${CMAKE_SOURCE_DIR}/ctest_pytest.ini - ${CMAKE_SOURCE_DIR}/LICENSE.txt - ${CMAKE_SOURCE_DIR}/README.md + ${LY_ROOT_FOLDER}/ctest_pytest.ini + ${LY_ROOT_FOLDER}/LICENSE.txt + ${LY_ROOT_FOLDER}/README.md DESTINATION . COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) @@ -469,18 +478,18 @@ endfunction() function(ly_setup_target_generator) install(FILES - ${CMAKE_SOURCE_DIR}/Code/LauncherUnified/launcher_generator.cmake - ${CMAKE_SOURCE_DIR}/Code/LauncherUnified/launcher_project_files.cmake - ${CMAKE_SOURCE_DIR}/Code/LauncherUnified/LauncherProject.cpp - ${CMAKE_SOURCE_DIR}/Code/LauncherUnified/StaticModules.in + ${LY_ROOT_FOLDER}/Code/LauncherUnified/launcher_generator.cmake + ${LY_ROOT_FOLDER}/Code/LauncherUnified/launcher_project_files.cmake + ${LY_ROOT_FOLDER}/Code/LauncherUnified/LauncherProject.cpp + ${LY_ROOT_FOLDER}/Code/LauncherUnified/StaticModules.in DESTINATION LauncherGenerator COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) - install(DIRECTORY ${CMAKE_SOURCE_DIR}/Code/LauncherUnified/Platform + install(DIRECTORY ${LY_ROOT_FOLDER}/Code/LauncherUnified/Platform DESTINATION LauncherGenerator COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) - install(FILES ${CMAKE_SOURCE_DIR}/Code/LauncherUnified/FindLauncherGenerator.cmake + install(FILES ${LY_ROOT_FOLDER}/Code/LauncherUnified/FindLauncherGenerator.cmake DESTINATION cmake COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT} ) diff --git a/cmake/SettingsRegistry.cmake b/cmake/SettingsRegistry.cmake index af6ef42e31..31ce36c516 100644 --- a/cmake/SettingsRegistry.cmake +++ b/cmake/SettingsRegistry.cmake @@ -125,9 +125,13 @@ function(ly_delayed_generate_settings_registry) endif() get_property(gem_relative_source_dir TARGET ${gem_target} PROPERTY SOURCE_DIR) if(gem_relative_source_dir) - # Most gems SOURCE dir is nested in the path, we need to find the path to the gem.json file - while(NOT EXISTS ${gem_relative_source_dir}/gem.json) - get_filename_component(gem_relative_source_dir ${gem_relative_source_dir} DIRECTORY) + # Most gems SOURCE dir is nested in the path, we need to find the path to the gem.json or project.json file + while(NOT EXISTS ${gem_relative_source_dir}/gem.json AND NOT EXISTS ${gem_relative_source_dir}/project.json) + get_filename_component(parent_dir ${gem_relative_source_dir} DIRECTORY) + if (${parent_dir} STREQUAL ${gem_relative_source_dir}) + message(FATAL_ERROR "Did not find gem.json or project.json while processing target ${gem_target}!") + endif() + set(gem_relative_source_dir ${parent_dir}) endwhile() file(TO_CMAKE_PATH ${LY_ROOT_FOLDER} ly_root_folder_cmake) file(RELATIVE_PATH gem_relative_source_dir ${ly_root_folder_cmake} ${gem_relative_source_dir}) diff --git a/cmake/Version.cmake b/cmake/Version.cmake index 08d79d4ce6..1d484fb059 100644 --- a/cmake/Version.cmake +++ b/cmake/Version.cmake @@ -12,4 +12,5 @@ string(TIMESTAMP current_year "%Y") set(LY_VERSION_COPYRIGHT_YEAR ${current_year} CACHE STRING "Open 3D Engine's copyright year") set(LY_VERSION_STRING "0.0.0.0" CACHE STRING "Open 3D Engine's version") -set(LY_VERSION_BUILD_NUMBER 0 CACHE STRING "Open 3D Engine's build number") \ No newline at end of file +set(LY_VERSION_BUILD_NUMBER 0 CACHE STRING "Open 3D Engine's build number") +set(LY_VERSION_ENGINE_NAME "o3de" CACHE STRING "Open 3D Engine's engine name") diff --git a/cmake/install/TargetCMakeLists.txt.in b/cmake/install/TargetCMakeLists.txt.in index 5542184b89..784448aeb0 100644 --- a/cmake/install/TargetCMakeLists.txt.in +++ b/cmake/install/TargetCMakeLists.txt.in @@ -12,7 +12,7 @@ # Generated by O3DE ly_add_target( - NAME @NAME_PLACEHOLDER@ IMPORTED + NAME @NAME_PLACEHOLDER@ @TARGET_TYPE_PLACEHOLDER@ @NAMESPACE_PLACEHOLDER@ COMPILE_DEFINITIONS INTERFACE diff --git a/cmake/install/engine.json.in b/cmake/install/engine.json.in new file mode 100644 index 0000000000..9899b169ed --- /dev/null +++ b/cmake/install/engine.json.in @@ -0,0 +1,7 @@ +{ + "engine_name": "@LY_VERSION_ENGINE_NAME@", + "FileVersion": 1, + "O3DEVersion": "@LY_VERSION_STRING@", + "O3DECopyrightYear": @LY_VERSION_COPYRIGHT_YEAR@, + "O3DEBuildNumber": @LY_VERSION_BUILD_NUMBER@ +} diff --git a/engine.json b/engine.json index 5091605f4c..f933886c44 100644 --- a/engine.json +++ b/engine.json @@ -2,5 +2,6 @@ "engine_name": "o3de", "FileVersion": 1, "O3DEVersion": "0.0.0.0", - "O3DECopyrightYear": 2021 + "O3DECopyrightYear": 2021, + "O3DEBuildNumber": 0 }