123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- # {BEGIN_LICENSE}
- # 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
- #
- # {END_LICENSE}
- # Currently we are in the Code folder: ${CMAKE_CURRENT_LIST_DIR}
- # Get the platform specific folder ${pal_dir} for the current folder: ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}
- # Note: o3de_pal_dir will take care of the details for us, as this may be a restricted platform
- # in which case it will see if that platform is present here or in the restricted folder.
- # i.e. It could here in our gem : Gems/${Name}/Code/Platform/<platorm_name> or
- # <restricted_folder>/<platform_name>/Gems/${Name}/Code
- o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
- # Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the
- # traits for this platform. Traits for a platform are defines for things like whether or not something in this gem
- # is supported by this platform.
- include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
- # Check to see if building the Gem Modules are supported for the current platform
- if(NOT PAL_TRAIT_${NameUpper}_SUPPORTED)
- return()
- endif()
- # If we are on a host platform, we want to add the host tools targets like the ${gem_name}.Editor target which
- # will also depend on ${gem_name}.Editor.API target
- if(PAL_TRAIT_BUILD_HOST_TOOLS)
- # The ${gem_name}.Editor.API target can be used by other gems that want to interact with the ${gem_name}.Editor module
- ly_add_target(
- NAME ${gem_name}.Editor.API INTERFACE
- NAMESPACE Gem
- FILES_CMAKE
- ${NameLower}_editor_api_files.cmake
- ${pal_dir}/${NameLower}_editor_api_files.cmake
- INCLUDE_DIRECTORIES
- INTERFACE
- Include
- BUILD_DEPENDENCIES
- INTERFACE
- AZ::AzToolsFramework
- )
- # The ${gem_name}.Editor.Private.Object target is an internal target
- # which is only to be used by this gems CMakeLists.txt and any subdirectories
- # Other gems should not use this target
- ly_add_target(
- NAME ${gem_name}.Editor.Private.Object STATIC
- NAMESPACE Gem
- AUTORCC
- FILES_CMAKE
- ${NameLower}_editor_private_files.cmake
- TARGET_PROPERTIES
- O3DE_PRIVATE_TARGET TRUE
- INCLUDE_DIRECTORIES
- PRIVATE
- Include
- Source
- BUILD_DEPENDENCIES
- PUBLIC
- AZ::AzToolsFramework
- )
- ly_add_target(
- NAME ${gem_name}.Editor GEM_MODULE
- NAMESPACE Gem
- AUTOMOC
- FILES_CMAKE
- ${NameLower}_editor_shared_files.cmake
- INCLUDE_DIRECTORIES
- PRIVATE
- Source
- PUBLIC
- Include
- BUILD_DEPENDENCIES
- PUBLIC
- Gem::${gem_name}.Editor.API
- PRIVATE
- Gem::${gem_name}.Editor.Private.Object
- RUNTIME_DEPENDENCIES
- Gem::QtForPython.Editor
- )
- # Include the gem name into the Editor Module source file
- # for use with the AZ_DECLARE_MODULE_CLASS macro
- # This is to allow renaming of the gem to also cause
- # the CreateModuleClass_Gem_<gem-name> function which
- # is used to bootstrap the gem in monolithic builds to link to the new gem name
- ly_add_source_properties(
- SOURCES
- Source/Tools/${Name}EditorModule.cpp
- PROPERTY COMPILE_DEFINITIONS
- VALUES
- O3DE_GEM_NAME=${gem_name}
- O3DE_GEM_VERSION=${gem_version})
- # By default, we will specify that the above target ${gem_name} would be used by
- # Tool and Builder type targets when this gem is enabled. If you don't want it
- # active in Tools or Builders by default, delete one of both of the following lines:
- ly_create_alias(NAME ${gem_name}.Tools NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
- ly_create_alias(NAME ${gem_name}.Builders NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
- # For the Tools and Builders variants of ${gem_name} Gem, an alias to the ${gem_name}.Editor API target will be made
- ly_create_alias(NAME ${gem_name}.Tools.API NAMESPACE Gem TARGETS Gem::${gem_name}.Editor.API)
- ly_create_alias(NAME ${gem_name}.Builders.API NAMESPACE Gem TARGETS Gem::${gem_name}.Editor.API)
- # Add in CMake dependencies for each gem dependency listed in this gem's gem.json file
- # for the Tools and Builders gem variants
- o3de_add_variant_dependencies_for_gem_dependencies(GEM_NAME ${gem_name} VARIANTS Tools Builders)
- endif()
- ################################################################################
- # Tests
- ################################################################################
- # See if globally, tests are supported
- if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
- # We globally support tests, see if we support tests on this platform for ${gem_name}.Editor.Tests
- # If we are a host platform we want to add tools test like editor tests here
- if(PAL_TRAIT_BUILD_HOST_TOOLS)
- endif()
- endif()
|