CMakeLists.txt 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. # Currently we are in the Code folder: ${CMAKE_CURRENT_LIST_DIR}
  9. # Get the platform specific folder ${pal_dir} for the current folder: ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}
  10. # Note: o3de_pal_dir will take care of the details for us, as this may be a restricted platform
  11. # in which case it will see if that platform is present here or in the restricted folder.
  12. # i.e. It could here in our gem : Gems/${gem_name}/Code/Platform/<platorm_name> or
  13. # <restricted_folder>/<platform_name>/Gems/${gem_name}/Code
  14. o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
  15. # Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the
  16. # traits for this platform. Traits for a platform are defines for things like whether or not something in this gem
  17. # is supported by this platform.
  18. include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
  19. # The ${gem_name}.Private.Object target is an internal target
  20. # It should not be used outside of this Gems CMakeLists.txt
  21. ly_add_target(
  22. NAME ${gem_name}.Private.Object STATIC
  23. NAMESPACE Gem
  24. FILES_CMAKE
  25. streamerprofiler_private_files.cmake
  26. ${pal_dir}/streamerprofiler_private_files.cmake
  27. TARGET_PROPERTIES
  28. O3DE_PRIVATE_TARGET TRUE
  29. INCLUDE_DIRECTORIES
  30. PRIVATE
  31. Source
  32. BUILD_DEPENDENCIES
  33. PUBLIC
  34. AZ::AzCore
  35. Gem::ImGui.imguilib
  36. )
  37. # Here add ${gem_name} target, it depends on the Private Object library and Public API interface
  38. ly_add_target(
  39. NAME ${gem_name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
  40. NAMESPACE Gem
  41. FILES_CMAKE
  42. streamerprofiler_shared_files.cmake
  43. ${pal_dir}/streamerprofiler_shared_files.cmake
  44. INCLUDE_DIRECTORIES
  45. PRIVATE
  46. Source
  47. BUILD_DEPENDENCIES
  48. PRIVATE
  49. Gem::${gem_name}.Private.Object
  50. )
  51. # Inject the gem name into the Module source file
  52. ly_add_source_properties(
  53. SOURCES
  54. Source/StreamerProfilerModule.cpp
  55. PROPERTY COMPILE_DEFINITIONS
  56. VALUES
  57. O3DE_GEM_NAME=${gem_name}
  58. O3DE_GEM_VERSION=${gem_version})
  59. # By default, we will specify that the above target ${gem_name} would be used by
  60. # Client and Server type targets when this gem is enabled. If you don't want it
  61. # active in Clients or Servers by default, delete one of both of the following lines:
  62. ly_create_alias(NAME ${gem_name}.Clients NAMESPACE Gem TARGETS Gem::${gem_name})
  63. ly_create_alias(NAME ${gem_name}.Servers NAMESPACE Gem TARGETS Gem::${gem_name})
  64. ly_create_alias(NAME ${gem_name}.Unified NAMESPACE Gem TARGETS Gem::${gem_name})
  65. ################################################################################
  66. # Tests
  67. ################################################################################
  68. # See if globally, tests are supported
  69. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  70. # We globally support tests, see if we support tests on this platform for ${gem_name}.Tests
  71. if(PAL_TRAIT_STREAMERPROFILER_TEST_SUPPORTED)
  72. # We support ${gem_name}.Tests on this platform, add dependency on the Private Object target
  73. ly_add_target(
  74. NAME ${gem_name}.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  75. NAMESPACE Gem
  76. FILES_CMAKE
  77. streamerprofiler_tests_files.cmake
  78. INCLUDE_DIRECTORIES
  79. PRIVATE
  80. Tests
  81. Source
  82. BUILD_DEPENDENCIES
  83. PRIVATE
  84. AZ::AzTest
  85. AZ::AzFramework
  86. Gem::${gem_name}.Private.Object
  87. )
  88. # Add ${gem_name}.Tests to googletest
  89. # Commented out as currently there are no ${gem_name} tests
  90. # ly_add_googletest(
  91. # NAME Gem::${gem_name}.Tests
  92. # )
  93. endif()
  94. endif()