CMakeLists.txt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #
  2. # Copyright (c) Contributors to the Open 3D Engine Project.
  3. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. #
  8. if(NOT PAL_TRAIT_BUILD_HOST_TOOLS)
  9. return()
  10. endif()
  11. # Currently we are in the Code folder: ${CMAKE_CURRENT_LIST_DIR}
  12. # Get the platform specific folder ${pal_dir} for the current folder: ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}
  13. # Note: o3de_pal_dir will take care of the details for us, as this may be a restricted platform
  14. # in which case it will see if that platform is present here or in the restricted folder.
  15. # i.e. It could here in our gem : Gems/DccScriptingInterface/Code/Platform/<platorm_name> or
  16. # <restricted_folder>/<platform_name>/Gems/DccScriptingInterface/Code
  17. o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
  18. # Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the
  19. # traits for this platform. Traits for a platform are defines for things like whether or not something in this gem
  20. # is supported by this platform.
  21. include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
  22. # If we are on a host platform, we want to add the host tools targets like the ${gem_name}.Editor target which
  23. # will also depend on ${gem_name}.Editor.API target
  24. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  25. # The ${gem_name}.Editor.API target can be used by other gems that want to interact with the ${gem_name}.Editor module
  26. ly_add_target(
  27. NAME ${gem_name}.Editor.API INTERFACE
  28. NAMESPACE Gem
  29. FILES_CMAKE
  30. dccscriptinginterface_editor_api_files.cmake
  31. ${pal_dir}/dccscriptinginterface_editor_api_files.cmake
  32. INCLUDE_DIRECTORIES
  33. INTERFACE
  34. Include
  35. BUILD_DEPENDENCIES
  36. INTERFACE
  37. AZ::AzToolsFramework
  38. )
  39. # The ${gem_name}.Editor.Private.Object target is an internal target
  40. # which is only to be used by this gems CMakeLists.txt and any subdirectories
  41. # Other gems should not use this target
  42. ly_add_target(
  43. NAME ${gem_name}.Editor.Private.Object STATIC
  44. NAMESPACE Gem
  45. AUTORCC
  46. FILES_CMAKE
  47. dccscriptinginterface_editor_private_files.cmake
  48. TARGET_PROPERTIES
  49. O3DE_PRIVATE_TARGET TRUE
  50. INCLUDE_DIRECTORIES
  51. PRIVATE
  52. Include
  53. Source
  54. BUILD_DEPENDENCIES
  55. PUBLIC
  56. AZ::AzToolsFramework
  57. )
  58. if (PAL_TRAIT_HAS_QTFORPYTHON)
  59. ly_add_target(
  60. NAME ${gem_name}.Editor GEM_MODULE
  61. NAMESPACE Gem
  62. AUTOMOC
  63. FILES_CMAKE
  64. dccscriptinginterface_editor_shared_files.cmake
  65. INCLUDE_DIRECTORIES
  66. PRIVATE
  67. Source
  68. PUBLIC
  69. Include
  70. BUILD_DEPENDENCIES
  71. PUBLIC
  72. Gem::${gem_name}.Editor.API
  73. PRIVATE
  74. Gem::${gem_name}.Editor.Private.Object
  75. RUNTIME_DEPENDENCIES
  76. Gem::QtForPython.Editor
  77. )
  78. # Inject the gem name into the Module source file
  79. ly_add_source_properties(
  80. SOURCES
  81. Source/Tools/DccScriptingInterfaceEditorModule.cpp
  82. PROPERTY COMPILE_DEFINITIONS
  83. VALUES
  84. O3DE_GEM_NAME=${gem_name}
  85. O3DE_GEM_VERSION=${gem_version})
  86. # By default, we will specify that the above target ${gem_name} would be used by
  87. # Tool and Builder type targets when this gem is enabled. If you don't want it
  88. # active in Tools or Builders by default, delete one of both of the following lines:
  89. ly_create_alias(NAME ${gem_name}.Tools NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  90. ly_create_alias(NAME ${gem_name}.Builders NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  91. endif()
  92. # For the Tools and Builders variants of ${gem_name} Gem, an alias to the ${gem_name}.Editor API target will be made
  93. ly_create_alias(NAME ${gem_name}.Tools.API NAMESPACE Gem TARGETS Gem::${gem_name}.Editor.API)
  94. ly_create_alias(NAME ${gem_name}.Builders.API NAMESPACE Gem TARGETS Gem::${gem_name}.Editor.API)
  95. endif()
  96. ################################################################################
  97. # Tests
  98. ################################################################################
  99. # See if globally, tests are supported
  100. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  101. # We globally support tests, see if we support tests on this platform for ${gem_name}.Editor.Tests
  102. # If we are a host platform we want to add tools test like editor tests here
  103. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  104. endif()
  105. endif()