SPEC-6437 Dlls should go to bin instead of profile (#287)
* renaming and organizing files * removed unused files * Removing unnecessary file * moved file * reverting movement of 3rdparty associations from gems to global * removing unnecessary calls to ly_add_external_target_path * fixing install prefix of ci_build * Fixes to get 3rdparties declared in gems to be installed * Allowing to install just one configuration * Adding empty line at the end * removing commented code * setting IMPORETD_LOCATION_<CONFIG> and defaulting IMPORTED_LOCATION to the profile config in case other configs are not installed * putting dlls/exe in the right place, with the right output subdirectory * setting runtime dependencies for the dlls that we link against * singular target location * code review comments/fixes * Fixing identation
This commit is contained in:
@@ -21,6 +21,7 @@ if(CMAKE_VERSION VERSION_EQUAL 3.19)
|
||||
cmake_policy(SET CMP0111 OLD)
|
||||
endif()
|
||||
|
||||
include(cmake/LySet.cmake)
|
||||
include(cmake/Version.cmake)
|
||||
include(cmake/OutputDirectory.cmake)
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
include(cmake/LySet.cmake)
|
||||
|
||||
# Turn on the ability to create folders to organize projects (.vcproj)
|
||||
# It creates "CMakePredefinedTargets" folder by default and adds CMake
|
||||
# defined projects like INSTALL.vcproj and ZERO_CHECK.vcproj
|
||||
|
||||
@@ -18,6 +18,7 @@ ly_set(LY_DEFAULT_INSTALL_COMPONENT "Core")
|
||||
# \arg:NAME name of the target
|
||||
# \arg:COMPONENT the grouping string of the target used for splitting up the install
|
||||
# into smaller packages.
|
||||
# All other parameters are forwarded to ly_generate_target_find_file
|
||||
function(ly_install_target ly_install_target_NAME)
|
||||
|
||||
set(options)
|
||||
@@ -39,27 +40,41 @@ function(ly_install_target ly_install_target_NAME)
|
||||
string(APPEND include_location "/${relative_path}")
|
||||
endif()
|
||||
|
||||
ly_generate_target_find_file(
|
||||
NAME ${ly_install_target_NAME}
|
||||
${ARGN}
|
||||
)
|
||||
# Get the output folders, archive is always the same, but runtime/library can be in subfolders defined per target
|
||||
file(RELATIVE_PATH archive_output_directory ${CMAKE_BINARY_DIR} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
|
||||
|
||||
get_target_property(target_runtime_output_directory ${ly_install_target_NAME} RUNTIME_OUTPUT_DIRECTORY)
|
||||
if(target_runtime_output_directory)
|
||||
file(RELATIVE_PATH target_runtime_output_subdirectory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${target_runtime_output_directory})
|
||||
endif()
|
||||
file(RELATIVE_PATH runtime_output_directory ${CMAKE_BINARY_DIR} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
|
||||
get_target_property(target_library_output_directory ${ly_install_target_NAME} LIBRARY_OUTPUT_DIRECTORY)
|
||||
if(target_library_output_directory)
|
||||
file(RELATIVE_PATH target_library_output_subdirectory ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${target_library_output_directory})
|
||||
endif()
|
||||
file(RELATIVE_PATH library_output_directory ${CMAKE_BINARY_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
||||
|
||||
install(
|
||||
TARGETS ${ly_install_target_NAME}
|
||||
LIBRARY
|
||||
DESTINATION lib/$<CONFIG>
|
||||
COMPONENT ${ly_install_target_COMPONENT}
|
||||
ARCHIVE
|
||||
DESTINATION lib/$<CONFIG>
|
||||
DESTINATION ${archive_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>
|
||||
COMPONENT ${ly_install_target_COMPONENT}
|
||||
LIBRARY
|
||||
DESTINATION ${library_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_library_output_subdirectory}
|
||||
COMPONENT ${ly_install_target_COMPONENT}
|
||||
RUNTIME
|
||||
DESTINATION bin/$<CONFIG>
|
||||
DESTINATION ${runtime_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_runtime_output_subdirectory}
|
||||
COMPONENT ${ly_install_target_COMPONENT}
|
||||
PUBLIC_HEADER
|
||||
DESTINATION ${include_location}
|
||||
COMPONENT ${ly_install_target_COMPONENT}
|
||||
)
|
||||
|
||||
ly_generate_target_find_file(
|
||||
NAME ${ly_install_target_NAME}
|
||||
${ARGN}
|
||||
)
|
||||
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}
|
||||
@@ -134,26 +149,27 @@ function(ly_generate_target_config_file NAME)
|
||||
|
||||
get_target_property(target_type ${NAME} TYPE)
|
||||
|
||||
unset(target_file_contents)
|
||||
set(target_file_contents "# Generated by O3DE install\n\n")
|
||||
if(NOT target_type STREQUAL INTERFACE_LIBRARY)
|
||||
|
||||
set(BINARY_DIR_OUTPUTS EXECUTABLE APPLICATION)
|
||||
set(target_file_contents "")
|
||||
if(${target_type} IN_LIST BINARY_DIR_OUTPUTS)
|
||||
set(out_file_generator TARGET_FILE_NAME)
|
||||
set(out_dir bin)
|
||||
else()
|
||||
set(out_file_generator TARGET_LINKER_FILE_NAME)
|
||||
set(out_dir lib)
|
||||
unset(target_location)
|
||||
set(runtime_types EXECUTABLE APPLICATION)
|
||||
if(target_type IN_LIST runtime_types)
|
||||
string(APPEND target_location "\"\${LY_ROOT_FOLDER}/${runtime_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_runtime_output_subdirectory}/$<TARGET_FILE_NAME:${NAME}>\"")
|
||||
elseif(target_type STREQUAL MODULE_LIBRARY)
|
||||
string(APPEND target_location "\"\${LY_ROOT_FOLDER}/${library_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_library_output_subdirectory}/$<TARGET_FILE_NAME:${NAME}>\"")
|
||||
elseif(target_type STREQUAL SHARED_LIBRARY)
|
||||
string(APPEND target_location "\"\${LY_ROOT_FOLDER}/${archive_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/$<TARGET_LINKER_FILE_NAME:${NAME}>\"")
|
||||
string(APPEND target_file_contents "ly_add_dependencies(${NAME} \"\${LY_ROOT_FOLDER}/${library_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_library_output_subdirectory}/$<TARGET_FILE_NAME:${NAME}>\")\n")
|
||||
else() # STATIC_LIBRARY, OBJECT_LIBRARY, INTERFACE_LIBRARY
|
||||
string(APPEND target_location "\"\${LY_ROOT_FOLDER}/${archive_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/$<TARGET_LINKER_FILE_NAME:${NAME}>\"")
|
||||
endif()
|
||||
|
||||
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}
|
||||
string(APPEND target_file_contents
|
||||
"set(target_location ${target_location})
|
||||
set_target_properties(${NAME}
|
||||
PROPERTIES
|
||||
$<$<CONFIG:profile>:IMPORTED_LOCATION \"\${target_location}>\"
|
||||
$<$<CONFIG:profile>:IMPORTED_LOCATION \"\${target_location}\">
|
||||
IMPORTED_LOCATION_$<UPPER_CASE:$<CONFIG>> \"\${target_location}\"
|
||||
)
|
||||
if(EXISTS \"\${target_location}\")
|
||||
@@ -270,7 +286,7 @@ endfunction()
|
||||
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)
|
||||
set(DIRECTORIES_TO_INSTALL Tools/LyTestTools Tools/RemoteConsole scripts)
|
||||
foreach(dir ${DIRECTORIES_TO_INSTALL})
|
||||
|
||||
get_filename_component(install_path ${dir} DIRECTORY)
|
||||
|
||||
Reference in New Issue
Block a user