CMakeLists.txt 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. ly_add_target(
  12. NAME ${gem_name}.Static STATIC
  13. NAMESPACE Gem
  14. FILES_CMAKE
  15. editorpythonbindings_common_files.cmake
  16. PLATFORM_INCLUDE_FILES
  17. Source/Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
  18. Source/Platform/Common/${PAL_TRAIT_COMPILER_ID}/editorpythonbindings_static_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake
  19. INCLUDE_DIRECTORIES
  20. PRIVATE
  21. .
  22. Source
  23. PUBLIC
  24. Include
  25. BUILD_DEPENDENCIES
  26. PRIVATE
  27. AZ::AzCore
  28. PUBLIC
  29. 3rdParty::Python
  30. 3rdParty::pybind11
  31. AZ::AzToolsFramework
  32. )
  33. ly_add_target(
  34. NAME ${gem_name}.Editor GEM_MODULE
  35. NAMESPACE Gem
  36. FILES_CMAKE
  37. editorpythonbindings_editor_files.cmake
  38. INCLUDE_DIRECTORIES
  39. PRIVATE
  40. ${CMAKE_CURRENT_SOURCE_DIR}/Source/Platform/${PAL_PLATFORM_NAME}
  41. PRIVATE
  42. .
  43. Source
  44. PUBLIC
  45. Include
  46. BUILD_DEPENDENCIES
  47. PRIVATE
  48. Gem::${gem_name}.Static
  49. )
  50. # Inject the gem name into the Module source file
  51. ly_add_source_properties(
  52. SOURCES
  53. Source/EditorPythonBindingsModule.cpp
  54. PROPERTY COMPILE_DEFINITIONS
  55. VALUES
  56. O3DE_GEM_NAME=${gem_name}
  57. O3DE_GEM_VERSION=${gem_version})
  58. # builders and tools use EditorPythonBindings.Editor
  59. ly_create_alias(NAME ${gem_name}.Builders NAMESPACE Gem TARGETS ${gem_name}.Editor)
  60. ly_create_alias(NAME ${gem_name}.Tools NAMESPACE Gem TARGETS ${gem_name}.Editor)
  61. ################################################################################
  62. # Tests
  63. ################################################################################
  64. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  65. ly_add_target(
  66. NAME ${gem_name}.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  67. NAMESPACE Gem
  68. FILES_CMAKE
  69. editorpythonbindings_tests_files.cmake
  70. PLATFORM_INCLUDE_FILES
  71. Source/Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
  72. Source/Platform/Common/${PAL_TRAIT_COMPILER_ID}/editorpythonbindings_tests_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake
  73. INCLUDE_DIRECTORIES
  74. PRIVATE
  75. .
  76. Tests
  77. Include
  78. BUILD_DEPENDENCIES
  79. PRIVATE
  80. AZ::AzTest
  81. Gem::${gem_name}.Static
  82. )
  83. ly_add_googletest(
  84. NAME Gem::${gem_name}.Tests
  85. COMPONENT TestTools
  86. LABELS REQUIRES_tiaf
  87. )
  88. endif()