Limits configuration types a project sees when using an engine SDK (#4033)

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
monroegm-disable-blank-issue-2
Esteban Papp 4 years ago committed by GitHub
parent d9cbc97ec0
commit 5909e471e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,14 @@
#
# 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
#
#
include_guard(GLOBAL)
# By default, CMAKE_CONFIGURATION_TYPES = LY_CONFIGURATION_TYPES, but in installed SDKs, this
# file will be replaced with cmake/install/ConfigurationTypes.cmake and discover configurations
# that are available from the SDK
set(CMAKE_CONFIGURATION_TYPES ${LY_CONFIGURATION_TYPES} CACHE STRING "" FORCE)

@ -8,6 +8,17 @@
include_guard(GLOBAL)
# LY_CONFIGURATION_TYPES defines all the configuration types that O3DE supports
# We dont set CMAKE_CONFIGURATION_TYPES directly because we want to be able to configure which
# configuration types are supported in an SDK installation. SDK installations will fill a
# CMAKE_CONFIGURATION_TYPES based on the configurations that were generated during the install process.
# ly_append_configurations_options depends on LY_CONFIGURATION_TYPES being
# set in order to successfully parse the arguments. Even for non-multi-config
# generators, it needs to be set.
set(LY_CONFIGURATION_TYPES "debug;profile;release" CACHE STRING "" FORCE)
include(cmake/ConfigurationTypes.cmake)
#! ly_append_configurations_options: adds options to the different configurations (debug, profile, release, etc)
#
# \arg:DEFINES
@ -43,7 +54,9 @@ function(ly_append_configurations_options)
)
foreach(arg IN LISTS multiArgs)
list(APPEND multiValueArgs ${arg})
foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
# we parse the parameters based on all configuration types so unknown configurations
# are not passed as values to other parameters
foreach(conf IN LISTS LY_CONFIGURATION_TYPES)
string(TOUPPER ${conf} UCONF)
list(APPEND multiValueArgs ${arg}_${UCONF})
endforeach()
@ -96,6 +109,7 @@ function(ly_append_configurations_options)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINK_STR}" PARENT_SCOPE)
endif()
# We only iterate for the actual configuration types
foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
string(TOUPPER ${conf} UCONF)
@ -143,11 +157,6 @@ endfunction()
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ Standard to target")
ly_set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ly_append_configurations_options depends on CMAKE_CONFIGURATION_TYPES being
# set in order to successfully parse the arguments. Even for non-multi-config
# generators, it needs to be set.
set(CMAKE_CONFIGURATION_TYPES "debug;profile;release" CACHE STRING "" FORCE)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT _isMultiConfig)
# No reason set CMAKE_BUILD_TYPE if it's a multiconfig generator.

@ -350,8 +350,26 @@ function(ly_setup_cmake_install)
DESTINATION .
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
PATTERN "__pycache__" EXCLUDE
REGEX "Findo3de.cmake" EXCLUDE
REGEX "Platform\/.*\/BuiltInPackages_.*\.cmake" EXCLUDE
PATTERN "Findo3de.cmake" EXCLUDE
PATTERN "ConfigurationTypes.cmake" EXCLUDE
REGEX "3rdParty/Platform\/.*\/BuiltInPackages_.*\.cmake" EXCLUDE
)
# Connect configuration types
install(FILES "${LY_ROOT_FOLDER}/cmake/install/ConfigurationTypes.cmake"
DESTINATION cmake
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
)
# Inject code that will generate each ConfigurationType_<CONFIG>.cmake file
set(install_configuration_type_template [=[
configure_file(@LY_ROOT_FOLDER@/cmake/install/ConfigurationType_config.cmake.in
${CMAKE_INSTALL_PREFIX}/cmake/ConfigurationTypes_${CMAKE_INSTALL_CONFIG_NAME}.cmake
@ONLY
)
message(STATUS "Generated ${CMAKE_INSTALL_PREFIX}/cmake/ConfigurationTypes_${CMAKE_INSTALL_CONFIG_NAME}.cmake")
]=])
string(CONFIGURE "${install_configuration_type_template}" install_configuration_type @ONLY)
install(CODE "${install_configuration_type}"
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
)
# Transform the LY_EXTERNAL_SUBDIRS list into a json array

@ -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
#
#
include_guard(GLOBAL)
list(APPEND CMAKE_CONFIGURATION_TYPES @CMAKE_INSTALL_CONFIG_NAME@)

@ -0,0 +1,22 @@
#
# 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
#
#
include_guard(GLOBAL)
# In SDK builds CMAKE_CONFIGURATION_TYPES will be filled by entries generated per configuration build.
# At install time we generate `cmake/ConfigurationTypes_<config>.cmake` files that append the configuration
# to CMAKE_CONFIGURATION_TYPES
set(CMAKE_CONFIGURATION_TYPES "" CACHE STRING "" FORCE)
# For the SDK case, we want to only define the confiuguration types that have been added to the SDK
file(GLOB configuration_type_files "cmake/ConfigurationTypes_*.cmake")
foreach(configuration_type_file ${configuration_type_files})
include(${configuration_type_file})
endforeach()
ly_set(CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES}) # propagate to parent
Loading…
Cancel
Save