0ad2fe2294
* Implemented the RFC to allow projects to need to specify the Gems Projects no longer need to specify CMake Targets to associate a Gem variant with. In order to associate a CMake Target with a gem variant a new `ly_set_gem_variant_to_load` function has been added that maps CMake Targets -> Gem Variants. This allows CMake Targets to self describe which gem variants they desire to build and load This implementation is backwards compatible: The `ly_enable_gems` function still accepts the TARGETS and VARIANTS arguments which it will forward to the new `ly_set_gem_variant_to_load` function to allow the input Targets to be associated with input Gem Variants This changes fixes the issue with gems that are required by an Application regardless of the Project in use, not replicating it's "requiredness" to the SDK layout Fixes #3430 Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Added an LY_PROJECT_NAME property to the Launcher targets The `ly_enable_gems_delayed` now command queries the LY_PROJECT_NAME property associated with each target to determine if the gems being enabled are match the project the target is associated with. In this case the target only adds dependencies if the gems is being enabled without a specific project or if the gems is being enabled for the matching project. If the LY_PROJECT_NAME property is not set for target, it indicates the gems for each project can be added as dependencies to the target. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * The INSTALL step now forwards the LY_PROJECT_NAME property for a target The Install_common.cmake has been updated to support configuring TARGET_PROPERTIES into the generated CMakeLists.txt for install targets. Furthermore the indentation of the generated CMakeLists.txt has been normalized to help with readability Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updating the Atom_Bootstrap CMakeLists.txt to enable the Atom_Bootstrap Gem Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Added a deprecation message to ly_enable_gems when supplying TARGETS and VARIANTS Added a define_property call for the LY_PROJECT_NAME target property Removed the .Builders alias for the PrefabBuilder and renamed the GEM_MODULE target o PrefabBuilder.Builders. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Removed superflous space from AutomatedTesting Gem CMakeLists.txt Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
273 lines
8.6 KiB
CMake
273 lines
8.6 KiB
CMake
#
|
|
# 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
|
|
#
|
|
#
|
|
|
|
if(NOT PAL_TRAIT_BUILD_HOST_TOOLS)
|
|
return()
|
|
endif()
|
|
|
|
# Builders need to be defined first because we collect the builders and pass them
|
|
# to AssetBuilder and AssetProcessor so it loads them.
|
|
add_subdirectory(AssetBuilderSDK)
|
|
add_subdirectory(AssetBuilder)
|
|
|
|
ly_add_target(
|
|
NAME AssetProcessor.Static STATIC
|
|
NAMESPACE AZ
|
|
AUTOMOC
|
|
AUTORCC
|
|
FILES_CMAKE
|
|
assetprocessor_static_files.cmake
|
|
Platform/${PAL_PLATFORM_NAME}/assetprocessor_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
|
|
INCLUDE_DIRECTORIES
|
|
PUBLIC
|
|
.
|
|
Platform/${PAL_PLATFORM_NAME}
|
|
PRIVATE
|
|
native
|
|
BUILD_DEPENDENCIES
|
|
PUBLIC
|
|
3rdParty::Qt::Core
|
|
3rdParty::Qt::Gui
|
|
3rdParty::Qt::Network
|
|
3rdParty::RapidJSON
|
|
3rdParty::SQLite
|
|
3rdParty::xxhash
|
|
AZ::AzCore
|
|
AZ::AzFramework
|
|
AZ::AzQtComponents
|
|
AZ::AzToolsFramework
|
|
AZ::AssetBuilderSDK
|
|
${additional_dependencies}
|
|
RUNTIME_DEPENDENCIES
|
|
AZ::AssetBuilder
|
|
)
|
|
|
|
# Aggregates all combined AssetBuilders into a single LY_ASSET_BUILDERS #define
|
|
get_property(asset_builders GLOBAL PROPERTY LY_ASSET_BUILDERS)
|
|
string (REPLACE ";" "," asset_builders "${asset_builders}")
|
|
ly_add_source_properties(
|
|
SOURCES native/utilities/ApplicationManager.cpp
|
|
PROPERTY COMPILE_DEFINITIONS
|
|
VALUES LY_ASSET_BUILDERS="${asset_builders}"
|
|
)
|
|
|
|
ly_add_target(
|
|
NAME AssetProcessor APPLICATION
|
|
NAMESPACE AZ
|
|
AUTOMOC
|
|
AUTOUIC
|
|
AUTORCC
|
|
FILES_CMAKE
|
|
assetprocessor_gui_files.cmake
|
|
Platform/${PAL_PLATFORM_NAME}/assetprocessor_gui_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
|
|
PLATFORM_INCLUDE_FILES
|
|
Platform/${PAL_PLATFORM_NAME}/assetprocessor_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
|
|
INCLUDE_DIRECTORIES
|
|
PUBLIC
|
|
.
|
|
PRIVATE
|
|
native
|
|
BUILD_DEPENDENCIES
|
|
PRIVATE
|
|
AZ::AssetProcessor.Static
|
|
)
|
|
|
|
# Adds the AssetProcessor target as a C preprocessor define so that it can be used as a Settings Registry
|
|
# specialization in order to look up the generated .setreg which contains the dependencies
|
|
# specified for the target.
|
|
if(TARGET AssetProcessor)
|
|
ly_set_gem_variant_to_load(TARGETS AssetProcessor VARIANTS Builders)
|
|
set_source_files_properties(
|
|
native/AssetProcessorBuildTarget.cpp
|
|
PROPERTIES
|
|
COMPILE_DEFINITIONS
|
|
LY_CMAKE_TARGET="AssetProcessor"
|
|
)
|
|
else()
|
|
message(FATAL_ERROR "Cannot set LY_CMAKE_TARGET define to AssetProcessor as the target doesn't exist anymore."
|
|
" Perhaps it has been renamed")
|
|
endif()
|
|
|
|
ly_add_target(
|
|
NAME AssetProcessorBatch.Static STATIC
|
|
NAMESPACE AZ
|
|
AUTOMOC
|
|
FILES_CMAKE
|
|
assetprocessor_static_batch_files.cmake
|
|
INCLUDE_DIRECTORIES
|
|
PUBLIC
|
|
.
|
|
PRIVATE
|
|
native
|
|
BUILD_DEPENDENCIES
|
|
PUBLIC
|
|
AZ::AssetProcessor.Static
|
|
)
|
|
ly_add_target(
|
|
NAME AssetProcessorBatch EXECUTABLE
|
|
NAMESPACE AZ
|
|
AUTOMOC
|
|
FILES_CMAKE
|
|
assetprocessor_batch_files.cmake
|
|
INCLUDE_DIRECTORIES
|
|
PRIVATE
|
|
.
|
|
native
|
|
BUILD_DEPENDENCIES
|
|
PRIVATE
|
|
AZ::AssetProcessorBatch.Static
|
|
)
|
|
|
|
if(LY_DEFAULT_PROJECT_PATH)
|
|
set_property(TARGET AssetProcessor AssetProcessorBatch APPEND PROPERTY VS_DEBUGGER_COMMAND_ARGUMENTS "--project-path=\"${LY_DEFAULT_PROJECT_PATH}\"")
|
|
endif()
|
|
|
|
# Adds the AssetProcessorBatch target as a C preprocessor define so that it can be used as a Settings Registry
|
|
# specialization in order to look up the generated .setreg which contains the dependencies
|
|
# specified for the target.
|
|
if(TARGET AssetProcessorBatch)
|
|
ly_set_gem_variant_to_load(TARGETS AssetProcessorBatch VARIANTS Builders)
|
|
set_source_files_properties(
|
|
native/AssetProcessorBatchBuildTarget.cpp
|
|
PROPERTIES
|
|
COMPILE_DEFINITIONS
|
|
LY_CMAKE_TARGET="AssetProcessorBatch"
|
|
)
|
|
else()
|
|
message(FATAL_ERROR "Cannot set LY_CMAKE_TARGET define to AssetProcessorBatch as the target doesn't exist anymore."
|
|
" Perhaps it has been renamed")
|
|
endif()
|
|
|
|
################################################################################
|
|
# Tests
|
|
################################################################################
|
|
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
|
|
|
ly_add_target(
|
|
NAME AssetProcessor.Tests EXECUTABLE
|
|
NAMESPACE AZ
|
|
AUTOMOC
|
|
AUTORCC
|
|
FILES_CMAKE
|
|
assetprocessor_test_files.cmake
|
|
INCLUDE_DIRECTORIES
|
|
PRIVATE
|
|
native
|
|
.
|
|
BUILD_DEPENDENCIES
|
|
PRIVATE
|
|
AZ::AzTest
|
|
AZ::AssetProcessorBatch.Static
|
|
AZ::AzToolsFrameworkTestCommon
|
|
)
|
|
ly_add_source_properties(
|
|
SOURCES native/tests/assetBuilderSDK/assetBuilderSDKTest.cpp
|
|
PROPERTY COMPILE_DEFINITIONS
|
|
VALUES ${LY_PAL_TOOLS_DEFINES}
|
|
)
|
|
ly_add_source_properties(
|
|
SOURCES native/unittests/AssetProcessorManagerUnitTests.cpp
|
|
PROPERTY COMPILE_DEFINITIONS
|
|
VALUES LY_CMAKE_BINARY_DIR="${CMAKE_BINARY_DIR}"
|
|
)
|
|
|
|
ly_add_target_files(
|
|
TARGETS
|
|
AssetProcessor.Tests
|
|
FILES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_badplatform/AssetProcessorPlatformConfig.setreg
|
|
OUTPUT_SUBDIRECTORY
|
|
testdata/config_broken_badplatform
|
|
)
|
|
ly_add_target_files(
|
|
TARGETS
|
|
AssetProcessor.Tests
|
|
FILES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_noscans/AssetProcessorPlatformConfig.setreg
|
|
OUTPUT_SUBDIRECTORY
|
|
testdata/config_broken_noscans
|
|
)
|
|
ly_add_target_files(
|
|
TARGETS
|
|
AssetProcessor.Tests
|
|
FILES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_recognizers/AssetProcessorPlatformConfig.setreg
|
|
OUTPUT_SUBDIRECTORY
|
|
testdata/config_broken_recognizers
|
|
)
|
|
ly_add_target_files(
|
|
TARGETS
|
|
AssetProcessor.Tests
|
|
FILES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_noplatform/AssetProcessorPlatformConfig.setreg
|
|
OUTPUT_SUBDIRECTORY
|
|
testdata/config_broken_noplatform
|
|
)
|
|
ly_add_target_files(
|
|
TARGETS
|
|
AssetProcessor.Tests
|
|
FILES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_regular/AssetProcessorPlatformConfig.setreg
|
|
OUTPUT_SUBDIRECTORY
|
|
testdata/config_regular
|
|
)
|
|
ly_add_target_files(
|
|
TARGETS
|
|
AssetProcessor.Tests
|
|
FILES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_regular_platform_scanfolder/AssetProcessorPlatformConfig.setreg
|
|
OUTPUT_SUBDIRECTORY
|
|
testdata/config_regular_platform_scanfolder
|
|
)
|
|
ly_add_target_files(
|
|
TARGETS
|
|
AssetProcessor.Tests
|
|
FILES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/testdata/EmptyDummyProject/AssetProcessorGamePlatformConfig.setreg
|
|
OUTPUT_SUBDIRECTORY
|
|
testdata/EmptyDummyProject
|
|
)
|
|
ly_add_target_files(
|
|
TARGETS
|
|
AssetProcessor.Tests
|
|
FILES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/testdata/DummyProject/AssetProcessorGamePlatformConfig.setreg
|
|
OUTPUT_SUBDIRECTORY
|
|
testdata/DummyProject
|
|
)
|
|
ly_add_target_files(
|
|
TARGETS
|
|
AssetProcessor.Tests
|
|
FILES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_metadata/AssetProcessorPlatformConfig.setreg
|
|
OUTPUT_SUBDIRECTORY
|
|
testdata/config_metadata
|
|
)
|
|
|
|
# Have the AssetProcessorTest use the LY_CMAKE_TARGET define of AssetProcessorBatch for the purpose
|
|
# of looking up the generated cmake build dependencies settings registry .setreg file
|
|
# It is tied to the UnitTestRunner.cpp file
|
|
if(TARGET AssetProcessorBatch)
|
|
set_source_files_properties(
|
|
native/unittests/UnitTestRunner.cpp
|
|
PROPERTIES
|
|
COMPILE_DEFINITIONS
|
|
LY_CMAKE_TARGET="AssetProcessorBatch"
|
|
)
|
|
else()
|
|
message(FATAL_ERROR "Cannot set LY_CMAKE_TARGET define to AssetProcessorBatch as the target doesn't exist anymore."
|
|
" Perhaps it has been renamed")
|
|
endif()
|
|
|
|
ly_add_googletest(
|
|
NAME AZ::AssetProcessor.Tests
|
|
TEST_COMMAND $<TARGET_FILE:AZ::AssetProcessor.Tests> --unittest --gtest_filter=-*.SUITE_sandbox*
|
|
)
|
|
|
|
endif()
|