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
main
Esteban Papp 5 years ago committed by GitHub
parent d04057d2a6
commit 5d13ad963a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,6 +21,7 @@ if(CMAKE_VERSION VERSION_EQUAL 3.19)
cmake_policy(SET CMP0111 OLD) cmake_policy(SET CMP0111 OLD)
endif() endif()
include(cmake/LySet.cmake)
include(cmake/Version.cmake) include(cmake/Version.cmake)
include(cmake/OutputDirectory.cmake) include(cmake/OutputDirectory.cmake)

@ -9,8 +9,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # 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) # Turn on the ability to create folders to organize projects (.vcproj)
# It creates "CMakePredefinedTargets" folder by default and adds CMake # It creates "CMakePredefinedTargets" folder by default and adds CMake
# defined projects like INSTALL.vcproj and ZERO_CHECK.vcproj # 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:NAME name of the target
# \arg:COMPONENT the grouping string of the target used for splitting up the install # \arg:COMPONENT the grouping string of the target used for splitting up the install
# into smaller packages. # into smaller packages.
# All other parameters are forwarded to ly_generate_target_find_file
function(ly_install_target ly_install_target_NAME) function(ly_install_target ly_install_target_NAME)
set(options) set(options)
@ -39,27 +40,41 @@ function(ly_install_target ly_install_target_NAME)
string(APPEND include_location "/${relative_path}") string(APPEND include_location "/${relative_path}")
endif() endif()
ly_generate_target_find_file( # Get the output folders, archive is always the same, but runtime/library can be in subfolders defined per target
NAME ${ly_install_target_NAME} file(RELATIVE_PATH archive_output_directory ${CMAKE_BINARY_DIR} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
${ARGN}
) 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( install(
TARGETS ${ly_install_target_NAME} TARGETS ${ly_install_target_NAME}
LIBRARY
DESTINATION lib/$<CONFIG>
COMPONENT ${ly_install_target_COMPONENT}
ARCHIVE 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} COMPONENT ${ly_install_target_COMPONENT}
RUNTIME RUNTIME
DESTINATION bin/$<CONFIG> DESTINATION ${runtime_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_runtime_output_subdirectory}
COMPONENT ${ly_install_target_COMPONENT} COMPONENT ${ly_install_target_COMPONENT}
PUBLIC_HEADER PUBLIC_HEADER
DESTINATION ${include_location} DESTINATION ${include_location}
COMPONENT ${ly_install_target_COMPONENT} 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}) ly_generate_target_config_file(${ly_install_target_NAME})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${ly_install_target_NAME}_$<CONFIG>.cmake" install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${ly_install_target_NAME}_$<CONFIG>.cmake"
DESTINATION cmake_autogen/${ly_install_target_NAME} 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) 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) if(NOT target_type STREQUAL INTERFACE_LIBRARY)
set(BINARY_DIR_OUTPUTS EXECUTABLE APPLICATION) unset(target_location)
set(target_file_contents "") set(runtime_types EXECUTABLE APPLICATION)
if(${target_type} IN_LIST BINARY_DIR_OUTPUTS) if(target_type IN_LIST runtime_types)
set(out_file_generator TARGET_FILE_NAME) string(APPEND target_location "\"\${LY_ROOT_FOLDER}/${runtime_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_runtime_output_subdirectory}/$<TARGET_FILE_NAME:${NAME}>\"")
set(out_dir bin) elseif(target_type STREQUAL MODULE_LIBRARY)
else() string(APPEND target_location "\"\${LY_ROOT_FOLDER}/${library_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_library_output_subdirectory}/$<TARGET_FILE_NAME:${NAME}>\"")
set(out_file_generator TARGET_LINKER_FILE_NAME) elseif(target_type STREQUAL SHARED_LIBRARY)
set(out_dir lib) 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() endif()
string(APPEND target_file_contents string(APPEND target_file_contents
"# Generated by O3DE install "set(target_location ${target_location})
set_target_properties(${NAME}
set(target_location \"\${LY_ROOT_FOLDER}/${out_dir}/$<CONFIG>/$<${out_file_generator}:${NAME}>\")
set_target_properties(${NAME}
PROPERTIES PROPERTIES
$<$<CONFIG:profile>:IMPORTED_LOCATION \"\${target_location}>\" $<$<CONFIG:profile>:IMPORTED_LOCATION \"\${target_location}\">
IMPORTED_LOCATION_$<UPPER_CASE:$<CONFIG>> \"\${target_location}\" IMPORTED_LOCATION_$<UPPER_CASE:$<CONFIG>> \"\${target_location}\"
) )
if(EXISTS \"\${target_location}\") if(EXISTS \"\${target_location}\")
@ -270,7 +286,7 @@ endfunction()
function(ly_setup_others) function(ly_setup_others)
# List of directories we want to install relative to engine root # 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}) foreach(dir ${DIRECTORIES_TO_INSTALL})
get_filename_component(install_path ${dir} DIRECTORY) get_filename_component(install_path ${dir} DIRECTORY)

Loading…
Cancel
Save