CMakeLists.txt 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. o3de_pal_dir(pal_source_dir ${CMAKE_CURRENT_LIST_DIR}/Source/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
  12. include(${pal_source_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) # PAL_TRAIT_ATOM_MATERIAL_EDITOR_APPLICATION_SUPPORTED
  13. if(NOT PAL_TRAIT_ATOM_MATERIAL_EDITOR_APPLICATION_SUPPORTED)
  14. return()
  15. endif()
  16. ly_add_target(
  17. NAME MaterialEditor APPLICATION
  18. NAMESPACE Gem
  19. AUTOMOC
  20. AUTORCC
  21. FILES_CMAKE
  22. materialeditor_files.cmake
  23. ${pal_source_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
  24. PLATFORM_INCLUDE_FILES
  25. ${pal_source_dir}/tool_dependencies_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
  26. INCLUDE_DIRECTORIES
  27. PRIVATE
  28. .
  29. Source
  30. ${pal_source_dir}
  31. PUBLIC
  32. Include
  33. BUILD_DEPENDENCIES
  34. PRIVATE
  35. Gem::CommonFeaturesAtom.Static
  36. Gem::AtomToolsFramework.Editor
  37. Gem::AtomToolsFramework.Static
  38. RUNTIME_DEPENDENCIES
  39. Gem::AtomToolsFramework.Editor
  40. )
  41. ly_set_gem_variant_to_load(TARGETS MaterialEditor VARIANTS Tools)
  42. # Add a 'builders' alias to allow the MaterialEditor root gem path to be added to the generated
  43. # cmake_dependencies.<project>.assetprocessor.setreg to allow the asset scan folder for it to be added
  44. ly_create_alias(NAME MaterialEditor.Builders NAMESPACE Gem)
  45. # Add build dependency to Editor for the MaterialEditor application since
  46. # Editor opens up the MaterialEditor
  47. ly_add_dependencies(Editor Gem::MaterialEditor)
  48. # Inject the project path into the MaterialEditor VS debugger command arguments if the build system being invoked
  49. # in a project centric view
  50. if(NOT PROJECT_NAME STREQUAL "O3DE")
  51. set_property(TARGET MaterialEditor APPEND PROPERTY VS_DEBUGGER_COMMAND_ARGUMENTS "--project-path=\"${CMAKE_SOURCE_DIR}\"")
  52. endif()
  53. # Adds the MaterialEditor target as a C preprocessor define so that it can be used as a Settings Registry
  54. # specialization in order to look up the generated .setreg which contains the dependencies
  55. # specified for the target.
  56. if(TARGET MaterialEditor)
  57. set_source_files_properties(
  58. Source/MaterialEditorApplication.cpp
  59. PROPERTIES
  60. COMPILE_DEFINITIONS
  61. LY_CMAKE_TARGET="MaterialEditor"
  62. )
  63. else()
  64. message(FATAL_ERROR "Cannot set LY_CMAKE_TARGET define to MaterialEditor as the target doesn't exist anymore."
  65. " Perhaps it has been renamed")
  66. endif()