diff --git a/Assets/CMakeLists.txt b/Assets/CMakeLists.txt index 11b30db8c3..300e11ac3e 100644 --- a/Assets/CMakeLists.txt +++ b/Assets/CMakeLists.txt @@ -6,4 +6,4 @@ # # -ly_install_directory(DIRECTORY .) +ly_install_directory(DIRECTORIES .) diff --git a/Code/LauncherUnified/CMakeLists.txt b/Code/LauncherUnified/CMakeLists.txt index d496e4fae6..c3d152a777 100644 --- a/Code/LauncherUnified/CMakeLists.txt +++ b/Code/LauncherUnified/CMakeLists.txt @@ -100,19 +100,17 @@ endif() ly_install_files( FILES - ${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 + launcher_generator.cmake + launcher_project_files.cmake + LauncherProject.cpp + StaticModules.in DESTINATION LauncherGenerator ) ly_install_directory( - DIRECTORY Platform/${PAL_PLATFORM_NAME} - DESTINATION LauncherGenerator -) -ly_install_directory( - DIRECTORY Platform/Common - DESTINATION LauncherGenerator + DIRECTORIES + Platform/${PAL_PLATFORM_NAME} + Platform/Common + DESTINATION LauncherGenerator/Platform ) ly_install_files( FILES FindLauncherGenerator.cmake diff --git a/Registry/CMakeLists.txt b/Registry/CMakeLists.txt index 4e0d433496..f78df700e7 100644 --- a/Registry/CMakeLists.txt +++ b/Registry/CMakeLists.txt @@ -6,11 +6,10 @@ # # -ly_install_directory(DIRECTORY .) +ly_install_directory(DIRECTORIES .) cmake_path(RELATIVE_PATH CMAKE_RUNTIME_OUTPUT_DIRECTORY BASE_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE runtime_output_directory) -ly_install_directory(DIRECTORY - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$/Registry +ly_install_directory(DIRECTORIES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$/Registry DESTINATION ${runtime_output_directory}/${PAL_PLATFORM_NAME}/$ ) diff --git a/Templates/CMakeLists.txt b/Templates/CMakeLists.txt index 11b30db8c3..300e11ac3e 100644 --- a/Templates/CMakeLists.txt +++ b/Templates/CMakeLists.txt @@ -6,4 +6,4 @@ # # -ly_install_directory(DIRECTORY .) +ly_install_directory(DIRECTORIES .) diff --git a/Tools/LyTestTools/CMakeLists.txt b/Tools/LyTestTools/CMakeLists.txt index 72321a8915..5506099842 100644 --- a/Tools/LyTestTools/CMakeLists.txt +++ b/Tools/LyTestTools/CMakeLists.txt @@ -11,4 +11,4 @@ if(NOT PAL_PLATFORM_NAME STREQUAL "Mac") add_subdirectory(tests) endif() -ly_install_directory(DIRECTORY .) +ly_install_directory(DIRECTORIES .) diff --git a/Tools/RemoteConsole/CMakeLists.txt b/Tools/RemoteConsole/CMakeLists.txt index cabe27c7ea..5504d9b46d 100644 --- a/Tools/RemoteConsole/CMakeLists.txt +++ b/Tools/RemoteConsole/CMakeLists.txt @@ -11,4 +11,6 @@ if(NOT PAL_PLATFORM_NAME STREQUAL "Mac") add_subdirectory(ly_remote_console/tests) endif() -ly_install_directory(DIRECTORY .) +ly_install_directory(DIRECTORIES . + EXCLUDE_PATTERNS tests +) diff --git a/cmake/Install.cmake b/cmake/Install.cmake index 81f323dc95..9135e141d5 100644 --- a/cmake/Install.cmake +++ b/cmake/Install.cmake @@ -13,7 +13,7 @@ endif() #! ly_install_directory: specifies a directory to be copied to the install layout at install time # -# \arg:DIRECTORY directory to install +# \arg:DIRECTORIES directories to install # \arg:DESTINATION (optional) destination to install the directory to (relative to CMAKE_PREFIX_PATH) # \arg:EXCLUDE_PATTERNS (optional) patterns to exclude # @@ -22,40 +22,53 @@ endif() function(ly_install_directory) set(options) - set(oneValueArgs DIRECTORY DESTINATION) - set(multiValueArgs EXCLUDE_PATTERNS) + set(oneValueArgs DESTINATION) + set(multiValueArgs DIRECTORIES EXCLUDE_PATTERNS) cmake_parse_arguments(ly_install_directory "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if(NOT ly_install_directory_DIRECTORY) - message(FATAL_ERROR "You must provide a directory to install") + if(NOT ly_install_directory_DIRECTORIES) + message(FATAL_ERROR "You must provide at least a directory to install") endif() - if(NOT ly_install_directory_DESTINATION) - # maintain the same structure relative to LY_ROOT_FOLDER - set(ly_install_directory_DESTINATION ${ly_install_directory_DIRECTORY}) - if(${ly_install_directory_DESTINATION} STREQUAL ".") - set(ly_install_directory_DESTINATION ${CMAKE_CURRENT_LIST_DIR}) - else() - cmake_path(ABSOLUTE_PATH ly_install_directory_DESTINATION BASE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) + foreach(directory ${ly_install_directory_DIRECTORIES}) + + cmake_path(ABSOLUTE_PATH directory) + + if(NOT ly_install_directory_DESTINATION) + # maintain the same structure relative to LY_ROOT_FOLDER + set(ly_install_directory_DESTINATION ${directory}) + if(${ly_install_directory_DESTINATION} STREQUAL ".") + set(ly_install_directory_DESTINATION ${CMAKE_CURRENT_LIST_DIR}) + else() + cmake_path(ABSOLUTE_PATH ly_install_directory_DESTINATION BASE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) + endif() + # take out the last directory since install asks for the destination of the folder, without including the fodler itself + cmake_path(GET ly_install_directory_DESTINATION PARENT_PATH ly_install_directory_DESTINATION) + cmake_path(RELATIVE_PATH ly_install_directory_DESTINATION BASE_DIRECTORY ${LY_ROOT_FOLDER}) endif() - # take out the last directory since install asks for the destination of the folder, without including the fodler itself - cmake_path(GET ly_install_directory_DESTINATION PARENT_PATH ly_install_directory_DESTINATION) - cmake_path(RELATIVE_PATH ly_install_directory_DESTINATION BASE_DIRECTORY ${LY_ROOT_FOLDER}) - endif() - unset(exclude_patterns) - if(ly_install_directory_EXCLUDE_PATTERNS) - foreach(exclude_pattern ${ly_install_directory_EXCLUDE_PATTERNS}) - list(APPEND exclude_patterns PATTERN ${exclude_pattern} EXCLUDE) - endforeach() - endif() - - install(DIRECTORY ${ly_install_directory_DIRECTORY} - DESTINATION ${ly_install_directory_DESTINATION} - COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the deafult for the time being - ${exclude_patterns} - ) + unset(exclude_patterns) + if(ly_install_directory_EXCLUDE_PATTERNS) + foreach(exclude_pattern ${ly_install_directory_EXCLUDE_PATTERNS}) + list(APPEND exclude_patterns PATTERN ${exclude_pattern} EXCLUDE) + endforeach() + endif() + + # Exclude cmake since that has to be generated + list(APPEND exclude_patterns PATTERN CMakeLists.txt EXCLUDE) + list(APPEND exclude_patterns PATTERN *.cmake EXCLUDE) + + # Exclude python-related things that dont need to be installed + list(APPEND exclude_patterns PATTERN __pycache__ EXCLUDE) + list(APPEND exclude_patterns PATTERN *.egg-info EXCLUDE) + + install(DIRECTORY ${directory} + DESTINATION ${ly_install_directory_DESTINATION} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the deafult for the time being + ${exclude_patterns} + ) + endforeach() endfunction() @@ -65,7 +78,7 @@ endfunction() # \arg:DESTINATION (optional) destination to install the directory to (relative to CMAKE_PREFIX_PATH) # \arg:PROGRAMS (optional) indicates if the files are programs that should be installed with EXECUTE permissions # -# \notes: refer to cmake's install(DIRECTORY documentation for more information +# \notes: refer to cmake's install(FILES/PROGRAMS documentation for more information # function(ly_install_files) @@ -82,13 +95,19 @@ function(ly_install_files) message(FATAL_ERROR "You must provide a destination to install filest to") endif() + unset(files) + foreach(file ${ly_install_files_FILES}) + cmake_path(ABSOLUTE_PATH file) + list(APPEND files ${file}) + endforeach() + if(ly_install_files_PROGRAMS) set(install_type PROGRAMS) else() set(install_type FILES) endif() - install(${install_type} ${ly_install_files_FILES} + install(${install_type} ${files} DESTINATION ${ly_install_files_DESTINATION} COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the deafult for the time being ) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 5dcd739fb4..5c55c58209 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -6,8 +6,10 @@ # # -add_subdirectory(bundler) -add_subdirectory(detect_file_changes) -add_subdirectory(commit_validation) -add_subdirectory(o3de) -add_subdirectory(ctest) +if(PAL_TRAIT_BUILD_HOST_TOOLS) + add_subdirectory(bundler) + add_subdirectory(detect_file_changes) + add_subdirectory(commit_validation) + add_subdirectory(o3de) + add_subdirectory(ctest) +endif() diff --git a/scripts/bundler/CMakeLists.txt b/scripts/bundler/CMakeLists.txt index 3642b34cbc..c2670d465c 100644 --- a/scripts/bundler/CMakeLists.txt +++ b/scripts/bundler/CMakeLists.txt @@ -6,8 +6,6 @@ # # -ly_install_directory(DIRECTORY . - EXCLUDE_PATTERNS - __pycache__ - CMakeLists.txt +ly_install_directory(DIRECTORIES . + EXCLUDE_PATTERNS tests ) diff --git a/scripts/o3de/CMakeLists.txt b/scripts/o3de/CMakeLists.txt index 3c60fa4b16..79836305c0 100644 --- a/scripts/o3de/CMakeLists.txt +++ b/scripts/o3de/CMakeLists.txt @@ -8,15 +8,22 @@ add_subdirectory(tests) -file(GLOB o3de_scripts "${LY_ROOT_FOLDER}/scripts/o3de.*") -ly_install_files(FILES ${o3de_scripts} -PROGRAMS - DESTINATION ./scripts +ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}) +include(${pal_dir}/o3de_install_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) + +ly_install_files(FILES ../o3de.py + DESTINATION scripts +) + +ly_install_files(FILES setup.py PROGRAMS + DESTINATION scripts/o3de +) +ly_install_files(FILES README.txt + DESTINATION scripts/o3de ) -ly_install_directory(DIRECTORY . +ly_install_directory(DIRECTORIES . EXCLUDE_PATTERNS - __pycache__ - CMakeLists.txt tests + Platform ) diff --git a/scripts/o3de/Platform/Linux/o3de_install_linux.cmake b/scripts/o3de/Platform/Linux/o3de_install_linux.cmake new file mode 100644 index 0000000000..3dff9ebaad --- /dev/null +++ b/scripts/o3de/Platform/Linux/o3de_install_linux.cmake @@ -0,0 +1,12 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +ly_install_files(FILES ../o3de.sh PROGRAMS + DESTINATION scripts +) + diff --git a/scripts/o3de/Platform/Mac/o3de_install_mac.cmake b/scripts/o3de/Platform/Mac/o3de_install_mac.cmake new file mode 100644 index 0000000000..56488c1cf4 --- /dev/null +++ b/scripts/o3de/Platform/Mac/o3de_install_mac.cmake @@ -0,0 +1,11 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +ly_install_files(FILES ../o3de.sh PROGRAMS + DESTINATION scripts +) diff --git a/scripts/o3de/Platform/Windows/o3de_install_windows.cmake b/scripts/o3de/Platform/Windows/o3de_install_windows.cmake new file mode 100644 index 0000000000..8503ad8345 --- /dev/null +++ b/scripts/o3de/Platform/Windows/o3de_install_windows.cmake @@ -0,0 +1,11 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +ly_install_files(FILES ../o3de.bat PROGRAMS + DESTINATION scripts +)