External Project Build Path Support using SDK Binaries (#690)
* Updated the DynamicModuleHandle code to search within the
SettingsRegistry for the FilePathKey_ProjectBuildPath setting in order
to determine the binary directory for the Project.
This is used to locate shared libraries and executables built by the
project when running and Engine SDK binary from within the Engine SDK
* Added a generation step within the Projects.cmake file to generate a
.setreg file containing the CMake build directory root.
The file is output to the <project-root>/user/Registry/build_path.setreg
file.
This occurs only on non-host platforms when configuring for
non-Monolithic builds, since the Build Directory is used to located the
project binary directory in order to located the project's generated
${CMAKE_BINARY_DIR}/bin/$<CONFIG>/Registry directory containing the
cmake_dependencies.<project-name>.<application-name>.setreg file
containing the list of gem modules to load for a given application
Updated the SettingsRegistryMergeUtils AddRuntimeFilePaths function to
be read in the new "/Amazon/Project/Settings/Build/project_build_path"
and use that to form an absolute path to the project build directory by
appending it to the FilePathKey_ProjectPath key.
That key is set in the 'FilePathKey_ProjectBuildPath' constant
Next updated the SettingsRegistryMergeUtils
MergeSettingsToRegistry_TargetBuildDependencyRegistry function to look
within the project build directory to locate the
cmake_dependencies.*.setreg file to load
Tweaked the Settings Registry merge order of the ComponentApplication,
GameApplication and Settings Registry builder to merge the command line
after merging the global user registry and after merging the project
user registry.
Moved the call to MergeSettingsToRegistry_TargetBuildDependencyRegistry
to occur after the above calls to make sure the properly overriden
projects' user registry was merged in order for the correct project
build path to be stored in the SettingsRegistry
* Added a ProjectConfigurationBinPath key which contains the path to the <build-dir>/bin/$<CONFIG> directory for a project which is used to load gem dlls and the Registry/cmake_dependencies.*.setreg files when using an pre-built Editor/AssetProcessor on an external project
* Fixed variable reference to fileNamePath variable
* Removing the default Project Build Path from the Settings Registry
Runtime Filepaths.
Any paths would have to be set explicitly via .setreg/.setregpatch file
or the --project-build-path parameter
Updated the setting of the project build path and project binary
directory to perform existance checks on the paths before setting the
keys of /Amazon/AzCore/Runtime/FilePaths/ProjectBuildPath and
/Amazon/AzCore/Runtime/FilePaths/ProjectConfigurationBinPath
Added a backup project binary path of
<project-build-path>/bin/$<PLATFORM>/$<CONFIG> which is used if the path
of <project-build-path>/bin/$<CONFIG> has not been found
Fixed compile error in DynamicModuleHandle_Apple.cpp
* UnixLike Platform Build fix for the DynamicModuleHandle code
This commit is contained in:
committed by
GitHub
parent
711db7e0f7
commit
8b8a582f02
+47
-1
@@ -105,9 +105,54 @@ function(ly_add_project_dependencies)
|
||||
)
|
||||
endfunction()
|
||||
|
||||
#template for generating the project build_path setreg
|
||||
set(project_build_path_template [[
|
||||
{
|
||||
"Amazon": {
|
||||
"Project": {
|
||||
"Settings": {
|
||||
"Build": {
|
||||
"project_build_path": "@project_bin_path@"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]]
|
||||
)
|
||||
|
||||
|
||||
#! ly_generate_project_build_path_setreg: Generates a .setreg file that contains an absolute path to the ${CMAKE_BINARY_DIR}
|
||||
# This allows locate the directory where the project it's binaries are built to be located within the engine.
|
||||
# Which are the shared libraries and launcher executables
|
||||
# When an a pre-built engine application runs from a directory other than the project build directory, it needs
|
||||
# to be able to locate the project build directory to determine the list of gems that the project depends on to load
|
||||
# as well the location of those gems.
|
||||
# For example if the project uses an external gem not associated with the engine, that gem's dlls/so/dylib files
|
||||
# would be located within the project build directory and the engine SDK binary directory would need that info
|
||||
|
||||
# NOTE: This only needed for non-monolithic host platforms.
|
||||
# This is because there are no dynamic gems to load on monolithic builds
|
||||
# Furthermore the pre-built SDK engine applications such as the Editor and AssetProcessor
|
||||
# can only run on the host platform
|
||||
# \arg:project_real_path Full path to the o3de project directory
|
||||
function(ly_generate_project_build_path_setreg project_real_path)
|
||||
# The build path isn't needed on non-monolithic platforms
|
||||
# Nor on any non-host platforms
|
||||
if (LY_MONOLITHIC_GAME OR NOT PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Set the project_bin_path to the ${CMAKE_BINARY_DIR} to provide the configure template
|
||||
# with the project build directory
|
||||
set(project_bin_path ${CMAKE_BINARY_DIR})
|
||||
string(CONFIGURE ${project_build_path_template} project_build_path_setreg_content @ONLY)
|
||||
set(project_user_build_path_setreg_file ${project_real_path}/user/Registry/Platform/${PAL_PLATFORM_NAME}/build_path.setreg)
|
||||
file(GENERATE OUTPUT ${project_user_build_path_setreg_file} CONTENT ${project_build_path_setreg_content})
|
||||
endfunction()
|
||||
|
||||
# Add the projects here so the above function is found
|
||||
foreach(project ${LY_PROJECTS})
|
||||
get_filename_component(full_directory_path ${project} REALPATH ${CMAKE_SOURCE_DIR})
|
||||
file(REAL_PATH ${project} full_directory_path BASE_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
string(SHA256 full_directory_hash ${full_directory_path})
|
||||
|
||||
# Truncate the full_directory_hash down to 8 characters to avoid hitting the Windows 260 character path limit
|
||||
@@ -117,5 +162,6 @@ foreach(project ${LY_PROJECTS})
|
||||
get_filename_component(project_folder_name ${project} NAME)
|
||||
list(APPEND LY_PROJECTS_FOLDER_NAME ${project_folder_name})
|
||||
add_subdirectory(${project} "${project_folder_name}-${full_directory_hash}")
|
||||
ly_generate_project_build_path_setreg(${full_directory_path})
|
||||
endforeach()
|
||||
ly_set(LY_PROJECTS_FOLDER_NAME ${LY_PROJECTS_FOLDER_NAME})
|
||||
|
||||
Reference in New Issue
Block a user