LYN-3069 Revert some 3rdparty changes and address issue (#185)

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

@ -22,6 +22,7 @@ if(CMAKE_VERSION VERSION_EQUAL 3.19)
endif() endif()
include(cmake/Version.cmake) include(cmake/Version.cmake)
include(cmake/OutputDirectory.cmake)
if(NOT PROJECT_NAME) if(NOT PROJECT_NAME)
project(O3DE project(O3DE
@ -30,7 +31,7 @@ if(NOT PROJECT_NAME)
) )
endif() endif()
include(cmake/Initialize.cmake) include(cmake/GeneralSettings.cmake)
include(cmake/FileUtil.cmake) include(cmake/FileUtil.cmake)
include(cmake/PAL.cmake) include(cmake/PAL.cmake)
include(cmake/PALTools.cmake) include(cmake/PALTools.cmake)

@ -9,13 +9,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# #
set(sdkwrapper_dir ${CMAKE_CURRENT_LIST_DIR}/../SDKWrapper)
if (NOT PAL_TRAIT_BUILD_HOST_TOOLS) if (NOT PAL_TRAIT_BUILD_HOST_TOOLS)
return() return()
endif() endif()
ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}) set(sdkwrapper_dir ${CMAKE_CURRENT_LIST_DIR}/../SDKWrapper)
ly_add_target( ly_add_target(
NAME FbxSDKWrapper STATIC NAME FbxSDKWrapper STATIC

@ -1,9 +0,0 @@
{
"name": "cubemapgen",
"source": "@GEM@/External/CubeMapGen",
"description": "CubeMapGen",
"defines": [],
"lib_required": "False",
"includes": [""]
}

@ -10,6 +10,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# #
ly_add_external_target_path(${CMAKE_CURRENT_LIST_DIR}/3rdParty)
add_subdirectory(Code) add_subdirectory(Code)

@ -9,6 +9,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# #
ly_add_external_target_path(${CMAKE_CURRENT_LIST_DIR}/3rdParty)
add_subdirectory(Code) add_subdirectory(Code)

@ -9,6 +9,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# #
ly_add_external_target_path(${CMAKE_CURRENT_LIST_DIR}/3rdParty)
add_subdirectory(Code) add_subdirectory(Code)

@ -9,6 +9,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# #
ly_add_external_target_path(${CMAKE_CURRENT_LIST_DIR}/3rdParty)
add_subdirectory(Code) add_subdirectory(Code)

@ -10,3 +10,5 @@
# #
set(PAL_TRAIT_NVCLOTH_USE_STUB FALSE) set(PAL_TRAIT_NVCLOTH_USE_STUB FALSE)
ly_associate_package(PACKAGE_NAME NvCloth-1.1.6-rev1-multiplatform TARGETS NvCloth PACKAGE_HASH 05fc62634ca28644e7659a89e97f4520d791e6ddf4b66f010ac669e4e2ed4454)

@ -9,6 +9,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# #
ly_add_external_target_path(${CMAKE_CURRENT_LIST_DIR}/3rdParty)
add_subdirectory(Code) add_subdirectory(Code)

@ -71,6 +71,9 @@ ly_add_target(
if(PAL_TRAIT_BUILD_HOST_TOOLS) if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_associate_package(PACKAGE_NAME poly2tri-0.3.3-rev2-multiplatform TARGETS poly2tri PACKAGE_HASH 04092d06716f59b936b61906eaf3647db23b685d81d8b66131eb53e0aeaa1a38)
ly_associate_package(PACKAGE_NAME v-hacd-2.0-rev1-multiplatform TARGETS v-hacd PACKAGE_HASH 5c71aef19cc9787d018d64eec076e9f51ea5a3e0dc6b6e22e57c898f6cc4afe3)
ly_add_target( ly_add_target(
NAME PhysX.Editor.Static STATIC NAME PhysX.Editor.Static STATIC
NAMESPACE Gem NAMESPACE Gem

@ -9,5 +9,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# #
ly_add_external_target_path(${CMAKE_CURRENT_LIST_DIR}/3rdParty)
add_subdirectory(Code) add_subdirectory(Code)

@ -10,6 +10,9 @@
# #
if(PAL_TRAIT_BUILD_HOST_TOOLS) if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_associate_package(PACKAGE_NAME OpenMesh-8.1-rev1-windows TARGETS OpenMesh PACKAGE_HASH 1c1df639358526c368e790dfce40c45cbdfcfb1c9a041b9d7054a8949d88ee77)
set(LY_BUILD_DEPENDENCIES set(LY_BUILD_DEPENDENCIES
PRIVATE PRIVATE
3rdParty::OpenMesh) 3rdParty::OpenMesh)

@ -31,8 +31,6 @@ ly_associate_package(PACKAGE_NAME glad-2.0.0-beta-rev2-multiplatform TARG
ly_associate_package(PACKAGE_NAME lux_core-2.2-rev5-multiplatform TARGETS lux_core PACKAGE_HASH c8c13cf7bc351643e1abd294d0841b24dee60e51647dff13db7aec396ad1e0b5) ly_associate_package(PACKAGE_NAME lux_core-2.2-rev5-multiplatform TARGETS lux_core PACKAGE_HASH c8c13cf7bc351643e1abd294d0841b24dee60e51647dff13db7aec396ad1e0b5)
ly_associate_package(PACKAGE_NAME xxhash-0.7.4-rev1-multiplatform TARGETS xxhash PACKAGE_HASH e81f3e6c4065975833996dd1fcffe46c3cf0f9e3a4207ec5f4a1b564ba75861e) ly_associate_package(PACKAGE_NAME xxhash-0.7.4-rev1-multiplatform TARGETS xxhash PACKAGE_HASH e81f3e6c4065975833996dd1fcffe46c3cf0f9e3a4207ec5f4a1b564ba75861e)
ly_associate_package(PACKAGE_NAME PVRTexTool-4.24.0-rev4-multiplatform TARGETS PVRTexTool PACKAGE_HASH d0d6da61c7557de0d2c71fc35ba56c3be49555b703f0e853d4c58225537acf1e) ly_associate_package(PACKAGE_NAME PVRTexTool-4.24.0-rev4-multiplatform TARGETS PVRTexTool PACKAGE_HASH d0d6da61c7557de0d2c71fc35ba56c3be49555b703f0e853d4c58225537acf1e)
ly_associate_package(PACKAGE_NAME poly2tri-0.3.3-rev2-multiplatform TARGETS poly2tri PACKAGE_HASH 04092d06716f59b936b61906eaf3647db23b685d81d8b66131eb53e0aeaa1a38)
ly_associate_package(PACKAGE_NAME v-hacd-2.0-rev1-multiplatform TARGETS v-hacd PACKAGE_HASH 5c71aef19cc9787d018d64eec076e9f51ea5a3e0dc6b6e22e57c898f6cc4afe3)
# platform-specific: # platform-specific:
ly_associate_package(PACKAGE_NAME freetype-2.10.4.14-linux TARGETS freetype PACKAGE_HASH 9ad246873067717962c6b780d28a5ce3cef3321b73c9aea746a039c798f52e93) ly_associate_package(PACKAGE_NAME freetype-2.10.4.14-linux TARGETS freetype PACKAGE_HASH 9ad246873067717962c6b780d28a5ce3cef3321b73c9aea746a039c798f52e93)

@ -36,8 +36,6 @@ ly_associate_package(PACKAGE_NAME glad-2.0.0-beta-rev2-multiplatform
ly_associate_package(PACKAGE_NAME lux_core-2.2-rev5-multiplatform TARGETS lux_core PACKAGE_HASH c8c13cf7bc351643e1abd294d0841b24dee60e51647dff13db7aec396ad1e0b5) ly_associate_package(PACKAGE_NAME lux_core-2.2-rev5-multiplatform TARGETS lux_core PACKAGE_HASH c8c13cf7bc351643e1abd294d0841b24dee60e51647dff13db7aec396ad1e0b5)
ly_associate_package(PACKAGE_NAME xxhash-0.7.4-rev1-multiplatform TARGETS xxhash PACKAGE_HASH e81f3e6c4065975833996dd1fcffe46c3cf0f9e3a4207ec5f4a1b564ba75861e) ly_associate_package(PACKAGE_NAME xxhash-0.7.4-rev1-multiplatform TARGETS xxhash PACKAGE_HASH e81f3e6c4065975833996dd1fcffe46c3cf0f9e3a4207ec5f4a1b564ba75861e)
ly_associate_package(PACKAGE_NAME PVRTexTool-4.24.0-rev4-multiplatform TARGETS PVRTexTool PACKAGE_HASH d0d6da61c7557de0d2c71fc35ba56c3be49555b703f0e853d4c58225537acf1e) ly_associate_package(PACKAGE_NAME PVRTexTool-4.24.0-rev4-multiplatform TARGETS PVRTexTool PACKAGE_HASH d0d6da61c7557de0d2c71fc35ba56c3be49555b703f0e853d4c58225537acf1e)
ly_associate_package(PACKAGE_NAME poly2tri-0.3.3-rev2-multiplatform TARGETS poly2tri PACKAGE_HASH 04092d06716f59b936b61906eaf3647db23b685d81d8b66131eb53e0aeaa1a38)
ly_associate_package(PACKAGE_NAME v-hacd-2.0-rev1-multiplatform TARGETS v-hacd PACKAGE_HASH 5c71aef19cc9787d018d64eec076e9f51ea5a3e0dc6b6e22e57c898f6cc4afe3)
# platform-specific: # platform-specific:
ly_associate_package(PACKAGE_NAME freetype-2.10.4.14-mac-ios TARGETS freetype PACKAGE_HASH 67b4f57aed92082d3fd7c16aa244a7d908d90122c296b0a63f73e0a0b8761977) ly_associate_package(PACKAGE_NAME freetype-2.10.4.14-mac-ios TARGETS freetype PACKAGE_HASH 67b4f57aed92082d3fd7c16aa244a7d908d90122c296b0a63f73e0a0b8761977)

@ -37,9 +37,6 @@ ly_associate_package(PACKAGE_NAME lux_core-2.2-rev5-multiplatform
ly_associate_package(PACKAGE_NAME xxhash-0.7.4-rev1-multiplatform TARGETS xxhash PACKAGE_HASH e81f3e6c4065975833996dd1fcffe46c3cf0f9e3a4207ec5f4a1b564ba75861e) ly_associate_package(PACKAGE_NAME xxhash-0.7.4-rev1-multiplatform TARGETS xxhash PACKAGE_HASH e81f3e6c4065975833996dd1fcffe46c3cf0f9e3a4207ec5f4a1b564ba75861e)
ly_associate_package(PACKAGE_NAME Blast-1.1.7-rev1-multiplatform TARGETS Blast PACKAGE_HASH 36b8f393bcd25d0f85cfc7a831ebbdac881e6054c4f0735649966aa6aa86e6f0) ly_associate_package(PACKAGE_NAME Blast-1.1.7-rev1-multiplatform TARGETS Blast PACKAGE_HASH 36b8f393bcd25d0f85cfc7a831ebbdac881e6054c4f0735649966aa6aa86e6f0)
ly_associate_package(PACKAGE_NAME PVRTexTool-4.24.0-rev4-multiplatform TARGETS PVRTexTool PACKAGE_HASH d0d6da61c7557de0d2c71fc35ba56c3be49555b703f0e853d4c58225537acf1e) ly_associate_package(PACKAGE_NAME PVRTexTool-4.24.0-rev4-multiplatform TARGETS PVRTexTool PACKAGE_HASH d0d6da61c7557de0d2c71fc35ba56c3be49555b703f0e853d4c58225537acf1e)
ly_associate_package(PACKAGE_NAME NvCloth-1.1.6-rev1-multiplatform TARGETS NvCloth PACKAGE_HASH 05fc62634ca28644e7659a89e97f4520d791e6ddf4b66f010ac669e4e2ed4454)
ly_associate_package(PACKAGE_NAME poly2tri-0.3.3-rev2-multiplatform TARGETS poly2tri PACKAGE_HASH 04092d06716f59b936b61906eaf3647db23b685d81d8b66131eb53e0aeaa1a38)
ly_associate_package(PACKAGE_NAME v-hacd-2.0-rev1-multiplatform TARGETS v-hacd PACKAGE_HASH 5c71aef19cc9787d018d64eec076e9f51ea5a3e0dc6b6e22e57c898f6cc4afe3)
# platform-specific: # platform-specific:
ly_associate_package(PACKAGE_NAME freetype-2.10.4.14-windows TARGETS freetype PACKAGE_HASH 88dedc86ccb8c92f14c2c033e51ee7d828fa08eafd6475c6aa963938a99f4bf3) ly_associate_package(PACKAGE_NAME freetype-2.10.4.14-windows TARGETS freetype PACKAGE_HASH 88dedc86ccb8c92f14c2c033e51ee7d828fa08eafd6475c6aa963938a99f4bf3)

@ -621,7 +621,6 @@ endfunction()
# - this waill cause it to automatically download and activate this package if it finds a target that # - this waill cause it to automatically download and activate this package if it finds a target that
# depends on '3rdParty::zlib' in its runtime or its build time dependency list. # depends on '3rdParty::zlib' in its runtime or its build time dependency list.
# - note that '3rdParty' is implied, do not specify it in the TARGETS list. # - note that '3rdParty' is implied, do not specify it in the TARGETS list.
function(ly_associate_package) function(ly_associate_package)
set(_oneValueArgs PACKAGE_NAME PACKAGE_HASH) set(_oneValueArgs PACKAGE_NAME PACKAGE_HASH)
set(_multiValueArgs TARGETS) set(_multiValueArgs TARGETS)
@ -643,6 +642,9 @@ function(ly_associate_package)
set_property(GLOBAL PROPERTY LY_PACKAGE_ASSOCIATION_${find_package_name} ${ly_associate_package_PACKAGE_NAME}) set_property(GLOBAL PROPERTY LY_PACKAGE_ASSOCIATION_${find_package_name} ${ly_associate_package_PACKAGE_NAME})
set_property(GLOBAL PROPERTY LY_PACKAGE_HASH_${ly_associate_package_PACKAGE_NAME} ${ly_associate_package_PACKAGE_HASH}) set_property(GLOBAL PROPERTY LY_PACKAGE_HASH_${ly_associate_package_PACKAGE_NAME} ${ly_associate_package_PACKAGE_HASH})
endforeach() endforeach()
set_property(GLOBAL APPEND PROPERTY LY_PACKAGE_NAMES ${ly_associate_package_PACKAGE_NAME})
set_property(GLOBAL PROPERTY LY_PACKAGE_TARGETS_${ly_associate_package_PACKAGE_NAME} ${ly_associate_package_TARGETS})
endfunction() endfunction()
#! Given a package find_package name (eg, 'zlib' not the actual package name) #! Given a package find_package name (eg, 'zlib' not the actual package name)

@ -14,32 +14,21 @@
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
ly_add_target( ly_add_target(
NAME @NAME_PLACEHOLDER@ UNKNOWN IMPORTED
NAME @NAME_PLACEHOLDER@ UNKNOWN IMPORTED @NAMESPACE_PLACEHOLDER@
COMPILE_DEFINITIONS
@NAMESPACE_PLACEHOLDER@ INTERFACE
@COMPILE_DEFINITIONS_PLACEHOLDER@
INCLUDE_DIRECTORIES
INTERFACE
@INCLUDE_DIRECTORIES_PLACEHOLDER@ @INCLUDE_DIRECTORIES_PLACEHOLDER@
BUILD_DEPENDENCIES
INTERFACE
@BUILD_DEPENDENCIES_PLACEHOLDER@ @BUILD_DEPENDENCIES_PLACEHOLDER@
RUNTIME_DEPENDENCIES
@RUNTIME_DEPENDENCIES_PLACEHOLDER@ @RUNTIME_DEPENDENCIES_PLACEHOLDER@
@COMPILE_DEFINITIONS_PLACEHOLDER@
) )
# The below if was generated from if (NOT HEADER_ONLY_PLACEHOLDER) foreach(config @CMAKE_CONFIGURATION_TYPES@)
# HEADER_ONLY_PLACEHOLDER evaluates to TRUE or FALSE include("${LY_ROOT_FOLDER}/cmake_autogen/@NAME_PLACEHOLDER@/@NAME_PLACEHOLDER@_${config}.cmake" OPTIONAL)
if (NOT @HEADER_ONLY_PLACEHOLDER@) endforeach()
# Load information for each installed configuration.
foreach(config @ALL_CONFIGS@)
set(@NAME_PLACEHOLDER@_${config}_FOUND FALSE)
include("${LY_ROOT_FOLDER}/cmake_autogen/@NAME_PLACEHOLDER@/@NAME_PLACEHOLDER@_${config}.cmake")
endforeach()
find_package_handle_standard_args(@NAME_PLACEHOLDER@
"Could not find package @NAME_PLACEHOLDER@"
@TARGET_CONFIG_FOUND_VARS_PLACEHOLDER@)
else()
set(@NAME_PLACEHOLDER@_FOUND TRUE)
endif()

@ -1,45 +0,0 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# Generated by O3DE
include(FindPackageHandleStandardArgs)
ly_add_target(
NAME @NAME_PLACEHOLDER@ UNKNOWN IMPORTED
@NAMESPACE_PLACEHOLDER@
@INCLUDE_DIRECTORIES_PLACEHOLDER@
@BUILD_DEPENDENCIES_PLACEHOLDER@
@RUNTIME_DEPENDENCIES_PLACEHOLDER@
@COMPILE_DEFINITIONS_PLACEHOLDER@
)
# The below if was generated from if (NOT HEADER_ONLY_PLACEHOLDER)
# HEADER_ONLY_PLACEHOLDER evaluates to TRUE or FALSE
if (NOT @HEADER_ONLY_PLACEHOLDER@)
# Load information for each installed configuration.
foreach(config @ALL_CONFIGS@)
set(@NAME_PLACEHOLDER@_${config}_FOUND FALSE)
include("${LY_ROOT_FOLDER}/cmake_autogen/@NAME_PLACEHOLDER@/@NAME_PLACEHOLDER@_${config}.cmake")
endforeach()
find_package_handle_standard_args(@NAME_PLACEHOLDER@
"Could not find package @NAME_PLACEHOLDER@"
@TARGET_CONFIG_FOUND_VARS_PLACEHOLDER@)
else()
set(@NAME_PLACEHOLDER@_FOUND TRUE)
endif()

@ -15,7 +15,7 @@ include(FindPackageHandleStandardArgs)
# This will be called from within the installed engine's CMakeLists.txt # This will be called from within the installed engine's CMakeLists.txt
macro(ly_find_o3de_packages) macro(ly_find_o3de_packages)
@FIND_PACKAGES_PLACEHOLDER@ @FIND_PACKAGES_PLACEHOLDER@
find_package(LauncherGenerator) find_package(LauncherGenerator)
endmacro() endmacro()

@ -1,35 +0,0 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# Generated by O3DE
include(FindPackageHandleStandardArgs)
# This will be called from within the installed engine's CMakeLists.txt
macro(ly_find_o3de_packages)
@FIND_PACKAGES_PLACEHOLDER@
find_package(LauncherGenerator)
endmacro()
function(o3de_current_file_path path)
set(${path} ${CMAKE_CURRENT_FUNCTION_LIST_DIR} PARENT_SCOPE)
endfunction()
# We are using the engine's CMakeLists.txt to handle initialization/importing targets
# Since this is external to the project's source, we need to specify an output directory
# even though we don't build
macro(o3de_initialize)
set(LY_PROJECTS ${CMAKE_SOURCE_DIR})
o3de_current_file_path(current_path)
add_subdirectory(${current_path}/.. o3de)
endmacro()

@ -17,12 +17,6 @@ include(cmake/LySet.cmake)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
ly_set(CMAKE_WARN_DEPRECATED ON) ly_set(CMAKE_WARN_DEPRECATED ON)
# Set output directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib CACHE PATH "Build directory for static libraries and import libraries")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin CACHE PATH "Build directory for shared libraries")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin CACHE PATH "Build directory for executables")
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "Installation prefix")
set(LY_EXTERNAL_SUBDIRS "" CACHE STRING "Additional list of subdirectory to recurse into via the cmake `add_subdirectory()` command. \ set(LY_EXTERNAL_SUBDIRS "" CACHE STRING "Additional list of subdirectory to recurse into via the cmake `add_subdirectory()` command. \
The subdirectories are included after the restricted platform folders have been visited by a call to `add_subdirectory(restricted/\${restricted_platform})`") The subdirectories are included after the restricted platform folders have been visited by a call to `add_subdirectory(restricted/\${restricted_platform})`")

@ -0,0 +1,16 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# Set output directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib CACHE PATH "Build directory for static libraries and import libraries")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin CACHE PATH "Build directory for shared libraries")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin CACHE PATH "Build directory for executables")
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "Installation prefix")

@ -9,6 +9,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# #
set(CMAKE_INSTALL_MESSAGE NEVER) # Simplify messages to reduce output noise
#! ly_install_target: registers the target to be installed by cmake install. #! ly_install_target: registers the target to be installed by cmake install.
# #
@ -35,27 +36,16 @@ function(ly_install_target ly_install_target_NAME)
install( install(
TARGETS ${ly_install_target_NAME} TARGETS ${ly_install_target_NAME}
EXPORT ${ly_install_target_NAME}Targets
LIBRARY DESTINATION lib/$<CONFIG> LIBRARY DESTINATION lib/$<CONFIG>
ARCHIVE DESTINATION lib/$<CONFIG> ARCHIVE DESTINATION lib/$<CONFIG>
RUNTIME DESTINATION bin/$<CONFIG> RUNTIME DESTINATION bin/$<CONFIG>
PUBLIC_HEADER DESTINATION ${include_location} PUBLIC_HEADER DESTINATION ${include_location}
) )
install(EXPORT ${ly_install_target_NAME}Targets 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} DESTINATION cmake_autogen/${ly_install_target_NAME}
) )
# Header only targets(i.e., INTERFACE) don't have outputs
get_target_property(target_type ${ly_install_target_NAME} TYPE)
if(NOT ${target_type} STREQUAL "INTERFACE_LIBRARY")
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}
)
endif()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Find${ly_install_target_NAME}.cmake" install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Find${ly_install_target_NAME}.cmake"
DESTINATION cmake DESTINATION cmake
) )
@ -66,8 +56,8 @@ endfunction()
#! ly_generate_target_find_file: generates the Find${target}.cmake file which is used when importing installed packages. #! ly_generate_target_find_file: generates the Find${target}.cmake file which is used when importing installed packages.
# #
# \arg:NAME name of the target # \arg:NAME name of the target
# \arg:INCLUDE_DIRECTORIES paths to the include directories
# \arg:NAMESPACE namespace declaration for this target. It will be used for IDE and dependencies # \arg:NAMESPACE namespace declaration for this target. It will be used for IDE and dependencies
# \arg:INCLUDE_DIRECTORIES paths to the include directories
# \arg:BUILD_DEPENDENCIES list of interfaces this target depends on (could be a compilation dependency # \arg:BUILD_DEPENDENCIES list of interfaces this target depends on (could be a compilation dependency
# if the dependency is only exposing an include path, or could be a linking # if the dependency is only exposing an include path, or could be a linking
# dependency is exposing a lib) # dependency is exposing a lib)
@ -77,64 +67,38 @@ function(ly_generate_target_find_file)
set(options) set(options)
set(oneValueArgs NAME NAMESPACE) set(oneValueArgs NAME NAMESPACE)
set(multiValueArgs COMPILE_DEFINITIONS BUILD_DEPENDENCIES RUNTIME_DEPENDENCIES INCLUDE_DIRECTORIES) set(multiValueArgs INCLUDE_DIRECTORIES COMPILE_DEFINITIONS BUILD_DEPENDENCIES RUNTIME_DEPENDENCIES)
cmake_parse_arguments(ly_generate_target_find_file "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) cmake_parse_arguments(ly_generate_target_find_file "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# These targets will be imported. So we strip PRIVATE properties.
# We can only set INTERFACE properties on imported targets
unset(build_dependencies_interface_props)
unset(compile_definitions_interface_props)
unset(include_directories_interface_props)
unset(installed_include_directories_interface_props)
ly_strip_non_interface_properties(build_dependencies_interface_props ${ly_generate_target_find_file_BUILD_DEPENDENCIES})
ly_strip_non_interface_properties(compile_definitions_interface_props ${ly_generate_target_find_file_COMPILE_DEFINITIONS})
ly_strip_non_interface_properties(include_directories_interface_props ${ly_generate_target_find_file_INCLUDE_DIRECTORIES})
set(NAME_PLACEHOLDER ${ly_generate_target_find_file_NAME}) set(NAME_PLACEHOLDER ${ly_generate_target_find_file_NAME})
unset(NAMESPACE_PLACEHOLDER)
unset(COMPILE_DEFINITIONS_PLACEHOLDER)
unset(include_directories_interface_props)
unset(INCLUDE_DIRECTORIES_PLACEHOLDER)
set(RUNTIME_DEPENDENCIES_PLACEHOLDER ${ly_generate_target_find_file_RUNTIME_DEPENDENCIES})
# Includes need additional processing to add the install root # These targets will be imported. We will expose PUBLIC and INTERFACE properties as INTERFACE properties since
foreach(include ${include_directories_interface_props}) # only INTERFACE properties can be exposed on imported targets
set(installed_include_prefix "\${LY_ROOT_FOLDER}/include/") ly_strip_private_properties(COMPILE_DEFINITIONS_PLACEHOLDER ${ly_generate_target_find_file_COMPILE_DEFINITIONS})
file(RELATIVE_PATH relative_path ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${include}) ly_strip_private_properties(include_directories_interface_props ${ly_generate_target_find_file_INCLUDE_DIRECTORIES})
string(APPEND installed_include_prefix ${relative_path}) ly_strip_private_properties(BUILD_DEPENDENCIES_PLACEHOLDER ${ly_generate_target_find_file_BUILD_DEPENDENCIES})
list(APPEND installed_include_directories_interface_props ${installed_include_prefix})
endforeach()
if(ly_generate_target_find_file_NAMESPACE) if(ly_generate_target_find_file_NAMESPACE)
set(NAMESPACE_PLACEHOLDER "NAMESPACE ${ly_generate_target_find_file_NAMESPACE}") set(NAMESPACE_PLACEHOLDER "NAMESPACE ${ly_generate_target_find_file_NAMESPACE}")
endif() endif()
if(installed_include_directories_interface_props)
string(REPLACE ";" "\n" include_dirs "${installed_include_directories_interface_props}")
set(INCLUDE_DIRECTORIES_PLACEHOLDER "INCLUDE_DIRECTORIES\nINTERFACE\n${include_dirs}")
endif()
if(build_dependencies_interface_props)
string(REPLACE ";" "\n" build_deps "${build_dependencies_interface_props}")
set(BUILD_DEPENDENCIES_PLACEHOLDER "BUILD_DEPENDENCIES\nINTERFACE\n${build_deps}")
endif()
if(ly_generate_target_find_file_RUNTIME_DEPENDENCIES)
string(REPLACE ";" "\n" runtime_deps "${ly_generate_target_find_file_RUNTIME_DEPENDENCIES}")
set(RUNTIME_DEPENDENCIES_PLACEHOLDER "RUNTIME_DEPENDENCIES\n${runtime_deps}")
endif()
if(compile_definitions_interface_props)
string(REPLACE ";" "\n" compile_defs "${compile_definitions_interface_props}")
set(COMPILE_DEFINITIONS_PLACEHOLDER "COMPILE_DEFINITIONS\nINTERFACE\n${compile_defs}")
endif()
string(REPLACE ";" " " ALL_CONFIGS "${CMAKE_CONFIGURATION_TYPES}") string(REPLACE ";" "\n" COMPILE_DEFINITIONS_PLACEHOLDER "${COMPILE_DEFINITIONS_PLACEHOLDER}")
set(target_config_found_vars "") # Includes need additional processing to add the install root
foreach(config ${CMAKE_CONFIGURATION_TYPES}) foreach(include ${include_directories_interface_props})
string(APPEND target_config_found_vars "\n${ly_generate_target_find_file_NAME}_${config}_FOUND") set(installed_include_prefix "\${LY_ROOT_FOLDER}/include/")
file(RELATIVE_PATH relative_path ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${include})
list(APPEND INCLUDE_DIRECTORIES_PLACEHOLDER "include/${relative_path}")
endforeach() endforeach()
set(TARGET_CONFIG_FOUND_VARS_PLACEHOLDER "${target_config_found_vars}") string(REPLACE ";" "\n" INCLUDE_DIRECTORIES_PLACEHOLDER "${INCLUDE_DIRECTORIES_PLACEHOLDER}")
# Interface libs aren't built so they don't generate a library. These are our HEADER_ONLY targets. string(REPLACE ";" "\n" BUILD_DEPENDENCIES_PLACEHOLDER "${BUILD_DEPENDENCIES_PLACEHOLDER}")
get_target_property(target_type ${ly_generate_target_find_file_NAME} TYPE) string(REPLACE ";" "\n" RUNTIME_DEPENDENCIES_PLACEHOLDER "${RUNTIME_DEPENDENCIES_PLACEHOLDER}")
if(NOT ${target_type} STREQUAL "INTERFACE_LIBRARY")
set(HEADER_ONLY_PLACEHOLDER FALSE)
else()
set(HEADER_ONLY_PLACEHOLDER TRUE)
endif()
configure_file(${LY_ROOT_FOLDER}/cmake/FindTarget.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/Find${ly_generate_target_find_file_NAME}.cmake @ONLY) configure_file(${LY_ROOT_FOLDER}/cmake/FindTarget.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/Find${ly_generate_target_find_file_NAME}.cmake @ONLY)
@ -148,37 +112,47 @@ endfunction()
# \arg:NAME name of the target # \arg:NAME name of the target
function(ly_generate_target_config_file NAME) function(ly_generate_target_config_file NAME)
# SHARED_LIBRARY is omitted from this list because we link to the implib on Windows get_target_property(target_type ${NAME} TYPE)
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)
endif()
string(APPEND target_file_contents " unset(target_file_contents)
# Generated by O3DE 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)
endif()
set_target_properties(${NAME} PROPERTIES IMPORTED_LOCATION \"\${LY_ROOT_FOLDER}/${out_dir}/$<CONFIG>/$<${out_file_generator}:${NAME}>\") string(APPEND target_file_contents
"# Generated by O3DE install
if(EXISTS \"\${LY_ROOT_FOLDER}/${out_dir}/$<CONFIG>/$<${out_file_generator}:${NAME}>\") set(target_location \"\${LY_ROOT_FOLDER}/${out_dir}/$<CONFIG>/$<${out_file_generator}:${NAME}>\")
set_target_properties(${NAME}
PROPERTIES
$<$<CONFIG:profile>:IMPORTED_LOCATION \"\${target_location}>\"
IMPORTED_LOCATION_$<UPPER_CASE:$<CONFIG>> \"\${target_location}\"
)
if(EXISTS \"\${target_location}\")
set(${NAME}_$<CONFIG>_FOUND TRUE) set(${NAME}_$<CONFIG>_FOUND TRUE)
else() else()
set(${NAME}_$<CONFIG>_FOUND FALSE) set(${NAME}_$<CONFIG>_FOUND FALSE)
endif()") endif()
")
endif()
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${NAME}_$<CONFIG>.cmake" CONTENT ${target_file_contents}) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${NAME}_$<CONFIG>.cmake" CONTENT "${target_file_contents}")
endfunction() endfunction()
#! ly_strip_non_interface_properties: strips private properties since we're exporting an interface target #! ly_strip_private_properties: strips private properties since we're exporting an interface target
# #
# \arg:INTERFACE_PROPERTIES list of interface properties to be returned # \arg:INTERFACE_PROPERTIES list of interface properties to be returned
function(ly_strip_non_interface_properties INTERFACE_PROPERTIES) function(ly_strip_private_properties INTERFACE_PROPERTIES)
set(reserved_keywords PRIVATE PUBLIC INTERFACE) set(reserved_keywords PRIVATE PUBLIC INTERFACE)
unset(last_keyword) unset(last_keyword)
unset(stripped_props) unset(stripped_props)
@ -196,36 +170,79 @@ function(ly_strip_non_interface_properties INTERFACE_PROPERTIES)
endfunction() endfunction()
#! ly_setup_o3de_install: generates the Findo3de.cmake file and setup install locations for scripts, tools, assets etc., #! ly_setup_o3de_install: orchestrates the installation of the different parts. This is the entry point from the root CMakeLists.txt
function(ly_setup_o3de_install) function(ly_setup_o3de_install)
get_property(all_targets GLOBAL PROPERTY LY_ALL_TARGETS) ly_setup_cmake_install()
unset(find_package_list) ly_setup_target_generator()
foreach(target IN LISTS all_targets) ly_setup_others()
list(APPEND find_package_list "find_package(${target})")
endforeach()
string(REPLACE ";" "\n" FIND_PACKAGES_PLACEHOLDER "${find_package_list}") endfunction()
configure_file(${LY_ROOT_FOLDER}/cmake/Findo3de.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/Findo3de.cmake @ONLY) #! ly_setup_cmake_install: install the "cmake" folder
function(ly_setup_cmake_install)
ly_install_launcher_target_generator() install(DIRECTORY "${CMAKE_SOURCE_DIR}/cmake"
DESTINATION .
REGEX "Findo3de.cmake" EXCLUDE
REGEX "Platform\/.*\/BuiltInPackages_.*\.cmake" EXCLUDE
)
install(
FILES
"${CMAKE_SOURCE_DIR}/CMakeLists.txt"
"${CMAKE_SOURCE_DIR}/engine.json"
DESTINATION .
)
ly_install_o3de_directories() # Collect all Find files that were added with ly_add_external_target_path
unset(additional_find_files)
get_property(additional_module_paths GLOBAL PROPERTY LY_ADDITIONAL_MODULE_PATH)
foreach(additional_module_path ${additional_module_paths})
unset(find_files)
file(GLOB find_files "${additional_module_path}/Find*.cmake")
list(APPEND additional_find_files "${find_files}")
endforeach()
install(FILES ${additional_find_files}
DESTINATION cmake/3rdParty
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Findo3de.cmake" # Findo3de.cmake file: we generate a different Findo3de.camke file than the one we have in cmake. This one is going to expose all
# targets that are pre-built
get_property(all_targets GLOBAL PROPERTY LY_ALL_TARGETS)
unset(FIND_PACKAGES_PLACEHOLDER)
foreach(target IN LISTS all_targets)
string(APPEND FIND_PACKAGES_PLACEHOLDER " find_package(${target})\n")
endforeach()
configure_file(${LY_ROOT_FOLDER}/cmake/Findo3de.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/Findo3de.cmake @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/Findo3de.cmake"
DESTINATION cmake DESTINATION cmake
) )
install(FILES "${CMAKE_SOURCE_DIR}/CMakeLists.txt" # BuiltInPackage_<platform>.cmake: since associations could happen in any cmake file across the engine. We collect
DESTINATION . # all the associations in ly_associate_package and then generate them into BuiltInPackages_<platform>.cmake. This
# will consolidate all associations in one file
get_property(all_package_names GLOBAL PROPERTY LY_PACKAGE_NAMES)
set(builtinpackages "# Generated by O3DE install\n\n")
foreach(package_name IN LISTS all_package_names)
get_property(package_hash GLOBAL PROPERTY LY_PACKAGE_HASH_${package_name})
get_property(targets GLOBAL PROPERTY LY_PACKAGE_TARGETS_${package_name})
string(APPEND builtinpackages "ly_associate_package(PACKAGE_NAME ${package_name} TARGETS ${targets} PACKAGE_HASH ${package_hash})\n")
endforeach()
ly_get_absolute_pal_filename(pal_builtin_file ${CMAKE_CURRENT_BINARY_DIR}/cmake/3rdParty/Platform/${PAL_PLATFORM_NAME}/BuiltInPackages_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
file(GENERATE OUTPUT ${pal_builtin_file}
CONTENT ${builtinpackages}
)
install(FILES "${pal_builtin_file}"
DESTINATION cmake/3rdParty/Platform/${PAL_PLATFORM_NAME}
) )
endfunction() endfunction()
#! ly_setup_others: install directories required by the engine
#! ly_install_o3de_directories: install directories required by the engine function(ly_setup_others)
function(ly_install_o3de_directories)
# 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 ctest_scripts scripts)
@ -242,12 +259,6 @@ function(ly_install_o3de_directories)
endforeach() endforeach()
# Directories which have excludes
install(DIRECTORY "${CMAKE_SOURCE_DIR}/cmake"
DESTINATION .
REGEX "Findo3de.cmake" EXCLUDE
)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/python" install(DIRECTORY "${CMAKE_SOURCE_DIR}/python"
DESTINATION . DESTINATION .
REGEX "downloaded_packages" EXCLUDE REGEX "downloaded_packages" EXCLUDE
@ -257,8 +268,8 @@ function(ly_install_o3de_directories)
endfunction() endfunction()
#! ly_install_launcher_target_generator: install source files needed for project launcher generation #! ly_setup_target_generator: install source files needed for project launcher generation
function(ly_install_launcher_target_generator) function(ly_setup_target_generator)
install(FILES install(FILES
${CMAKE_SOURCE_DIR}/Code/LauncherUnified/launcher_generator.cmake ${CMAKE_SOURCE_DIR}/Code/LauncherUnified/launcher_generator.cmake

@ -290,7 +290,7 @@
"PARAMETERS": { "PARAMETERS": {
"CONFIGURATION": "profile", "CONFIGURATION": "profile",
"OUTPUT_DIRECTORY": "build\\windows_vs2019", "OUTPUT_DIRECTORY": "build\\windows_vs2019",
"CMAKE_OPTIONS": "-G \"Visual Studio 16 2019\" -DCMAKE_SYSTEM_VERSION=10.0 -DLY_UNITY_BUILD=TRUE -DLY_DISABLE_TEST_MODULES=TRUE -DCMAKE_INSTALL_PREFIX=build\\install", "CMAKE_OPTIONS": "-G \"Visual Studio 16 2019\" -DCMAKE_SYSTEM_VERSION=10.0 -DLY_UNITY_BUILD=TRUE -DLY_DISABLE_TEST_MODULES=TRUE -DCMAKE_INSTALL_PREFIX=install",
"CMAKE_LY_PROJECTS": "", "CMAKE_LY_PROJECTS": "",
"CMAKE_TARGET": "INSTALL", "CMAKE_TARGET": "INSTALL",
"CMAKE_NATIVE_BUILD_ARGS": "/m /nologo" "CMAKE_NATIVE_BUILD_ARGS": "/m /nologo"

Loading…
Cancel
Save