Files
o3de/Code/Tools/AssetProcessor/CMakeLists.txt
T
lumberyard-employee-dm 3dec5d3b71 LYN-2537 engine assets (#254)
* LYN-2537 Moved the Engine and Editor folder to be within the EngineAssets folder

* Fixed Documentation in bootstrap.cfg to correct the path to the user project specific registry file

* Adding a newline to the output of AssetCatalog 'Registering asset..., but type is not set' message

* Updating the AssetProcessorPlatformConfig.setreg Scan Folder to detect
the @ENGINEROOT@/EngineAssets/Engine path for engine runtime assets and
@ENGINEROOT@/EngineAssets/Editor path for engine tool assets

* Updating references to Icons and other assets to account for moving the
Engine and Editor folder under a single EngineAssets folder

* Moving the Engine Settings Registry folder from Engine/Registry -> Registry

* Removed the LY_PROJECT_CMAKE_PATH define as it is not portable to other locations. It is hard coded to the project location that was used for the CMake configuration. Furthermore it paths with backslashes within it are treated as escape characters and not a path separator

* Updated the LyTestTools asset_processor.py script to copy the exclude.filetag from the EngineAssets/Engine directory now

* Fixed Atom Shader Preprocessing when running using an External Project

* Updated the TSGenerateAction.cpp to fix the build error with using a renamed variable

* Updated the Install_Common.cmake ly_setup_others function to install the
EngineAssets directory and the each of the Gem's Assets directory while
maintaining the relative directory structure to the Engine Root
Also updated the install step to install the Registry folder at the
engine root

* Fixed the copying of the Registry folder to be in the install root, instead of under a second 'Registry' folder

* Moving the AssetProcessorPlatformConfig.setreg file over to the Registry folder

* Updated the LyTestTools and C++ code to point that the new location of
the AssetProcessorPlatformConfig.setreg file inside of the Registry
folder

* Renamed Test AssetProcessor*Config.ini files to have the .setreg extension

* Converted the AssetProcessor test setreg files from ini format to json
format using the SerializeContextTools convert-ini command

* Updated the AssetProcessor CMakeLists.txt to copy over the test setreg files to the build folder

* Updated the assetprocessor test file list to point at the renamed AsssetProcessor*Config setreg filenames

* Removed the Output Prefix code from the AssetProcessor. The complexity that it brought to the AP code is not needed, as users can replicate the behavior by just moving there assets underneath a another folder, underneath the scan folder

* Adding back support to read the AssetProcessorPlatformConfig.setreg file from the asset root. This is only needed for C++ UnitTests as they run in an environment where the accessing the Engine Settings Registry is not available

* Updating the Install_common.cmake logic to copy any "Assets" folder to
the install layout.
The Script has also been updated to copy over the "Assets" folder in the
Engine Root to the install layout instead of an "EngineAssets" folder

* Updating References to EngineAssets source asset folder in code to be the Assets source folder

* Moved the Engine Source Asset folder of 'EngineAssets' to a new folder name of 'Assets'. This is inline with the naming scheme we use for Gem asset folders

* Adding the EngineFinder.cmake to the AutomatedTesting project to allow it to work in a project centric manner

* Updating the LyTestTools copy_assets_to_project function to be able to copy assets with folders to the temporary project root
Fixed an issue in LyTestTools where the temporary log directory could have shutil.rmtree being called twice on it leading to an exception which fails an automated test

Updated the asset_procesor_gui_tests_2 AddScanFolder test to not use the
output prefix, but instead place the source asset root into a
subdirectory

* Correct the AssetProcessorPlatformConfig Scan Folders for the EngineAssets directory to point at the Assets directory

* Updated the asset procesor batch dependency test scan folder to point at the 'Assets' folder instead of 'EngineAssets'
2021-04-28 21:38:43 -05:00

264 lines
8.3 KiB
CMake

#
# 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.
#
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
Legacy::RC
)
# 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)
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
)
# 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)
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
)
# 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
)
endif()