CMakeLists.txt 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. # This will set python_package_name to whatever the package 'Python' is associated with
  12. ly_get_package_association(Python python_package_name)
  13. if (NOT python_package_name)
  14. set(python_package_name "python-no-package-assocation-found")
  15. message(WARNING "Python was not found in the package assocation list. Did someone call ly_associate_package(xxxxxxx Python) ?")
  16. endif()
  17. ly_add_target(
  18. NAME EditorPythonBindings.Static STATIC
  19. NAMESPACE Gem
  20. FILES_CMAKE
  21. editorpythonbindings_common_files.cmake
  22. Source/Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
  23. PLATFORM_INCLUDE_FILES
  24. Source/Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
  25. Source/Platform/Common/${PAL_TRAIT_COMPILER_ID}/editorpythonbindings_static_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake
  26. COMPILE_DEFINITIONS
  27. PRIVATE
  28. PY_PACKAGE="${python_package_name}"
  29. INCLUDE_DIRECTORIES
  30. PRIVATE
  31. .
  32. Source
  33. PUBLIC
  34. Include
  35. BUILD_DEPENDENCIES
  36. PRIVATE
  37. AZ::AzCore
  38. PUBLIC
  39. 3rdParty::Python
  40. 3rdParty::pybind11
  41. AZ::AzToolsFramework
  42. )
  43. ly_add_target(
  44. NAME EditorPythonBindings.Editor GEM_MODULE
  45. NAMESPACE Gem
  46. FILES_CMAKE
  47. editorpythonbindings_editor_files.cmake
  48. INCLUDE_DIRECTORIES
  49. PRIVATE
  50. .
  51. Source
  52. PUBLIC
  53. Include
  54. BUILD_DEPENDENCIES
  55. PRIVATE
  56. Gem::EditorPythonBindings.Static
  57. )
  58. # builders and tools use EditorPythonBindings.Editor
  59. ly_create_alias(NAME EditorPythonBindings.Builders NAMESPACE Gem TARGETS EditorPythonBindings.Editor)
  60. ly_create_alias(NAME EditorPythonBindings.Tools NAMESPACE Gem TARGETS EditorPythonBindings.Editor)
  61. ################################################################################
  62. # Tests
  63. ################################################################################
  64. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  65. ly_add_target(
  66. NAME EditorPythonBindings.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::EditorPythonBindings.Static
  82. )
  83. ly_add_googletest(
  84. NAME Gem::EditorPythonBindings.Tests
  85. COMPONENT TestTools
  86. LABELS REQUIRES_tiaf
  87. )
  88. endif()