CMakeLists.txt 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. add_subdirectory(Plugins)
  12. ly_add_target(
  13. NAME EditorCore SHARED
  14. NAMESPACE Legacy
  15. AUTOMOC
  16. AUTOUIC
  17. FILES_CMAKE
  18. editor_core_files.cmake
  19. Platform/${PAL_PLATFORM_NAME}/editor_core_files_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
  20. INCLUDE_DIRECTORIES
  21. PUBLIC
  22. Include
  23. .
  24. ..
  25. COMPILE_DEFINITIONS
  26. PRIVATE
  27. EDITOR_CORE
  28. PUBLIC
  29. EDITOR
  30. BUILD_DEPENDENCIES
  31. PRIVATE
  32. Legacy::CryCommon
  33. PUBLIC
  34. 3rdParty::Qt::Core
  35. 3rdParty::Qt::Gui
  36. 3rdParty::Qt::Widgets
  37. AZ::AzToolsFramework
  38. )
  39. # Header only target to prevent linkage against editor libraries when is not needed. Eventually the targets that depend
  40. # on editor headers should cleanup dependencies and interact with the editor through buses or other mechanisms
  41. ly_add_target(
  42. NAME Editor.Headers HEADERONLY
  43. NAMESPACE Legacy
  44. FILES_CMAKE
  45. editor_headers_files.cmake
  46. INCLUDE_DIRECTORIES
  47. INTERFACE
  48. Include
  49. .
  50. ..
  51. BUILD_DEPENDENCIES
  52. INTERFACE
  53. Legacy::EditorCommon.Headers
  54. )
  55. ################################################################################
  56. # EditorLib
  57. ################################################################################
  58. set(pal_cmake_files "")
  59. foreach(enabled_platform ${LY_PAL_TOOLS_ENABLED})
  60. string(TOLOWER ${enabled_platform} enabled_platform_lowercase)
  61. o3de_pal_dir(pal_cmake_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${enabled_platform} ${O3DE_ENGINE_RESTRICTED_PATH} ${LY_ROOT_FOLDER})
  62. list(APPEND pal_cmake_files ${pal_cmake_dir}/editor_lib_${enabled_platform_lowercase}_files.cmake)
  63. endforeach()
  64. ly_get_pal_tool_dirs(pal_tool_dirs ${CMAKE_CURRENT_LIST_DIR}/Platform)
  65. ly_add_target(
  66. NAME EditorLib SHARED
  67. NAMESPACE Legacy
  68. AUTOMOC
  69. AUTOUIC
  70. AUTORCC
  71. FILES_CMAKE
  72. editor_lib_files.cmake
  73. Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
  74. PLATFORM_INCLUDE_FILES
  75. Platform/${PAL_PLATFORM_NAME}/editor_lib_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
  76. Platform/Common/${PAL_TRAIT_COMPILER_ID}/editor_lib_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake
  77. ${pal_cmake_files}
  78. INCLUDE_DIRECTORIES
  79. PUBLIC
  80. Include
  81. PRIVATE
  82. .
  83. ..
  84. AssetBrowser/AssetTypes/Character
  85. ${pal_tool_dirs}
  86. COMPILE_DEFINITIONS
  87. PRIVATE
  88. SANDBOX_EXPORTS
  89. ${LY_LEGACY_TERRAIN_EDITOR_DEFINES}
  90. INTERFACE
  91. SANDBOX_IMPORTS
  92. BUILD_DEPENDENCIES
  93. PRIVATE
  94. 3rdParty::Qt::Core
  95. 3rdParty::Qt::Gui
  96. 3rdParty::Qt::Widgets
  97. 3rdParty::Qt::Concurrent
  98. 3rdParty::TIFF
  99. Legacy::CryCommon
  100. Legacy::EditorCommon
  101. AZ::AzCore
  102. AZ::AzToolsFramework
  103. Gem::LmbrCentral.Static
  104. AZ::AtomCore
  105. Gem::Atom_RPI.Edit
  106. Gem::Atom_RPI.Public
  107. Gem::Atom_Feature_Common.Public
  108. Gem::AtomToolsFramework.Static
  109. Gem::AtomViewportDisplayInfo
  110. Gem::EditorModeFeedback.Editor.Static
  111. ${additional_dependencies}
  112. PUBLIC
  113. 3rdParty::Qt::Network
  114. Legacy::EditorCore
  115. RUNTIME_DEPENDENCIES
  116. Legacy::EditorCommon
  117. )
  118. ly_add_source_properties(
  119. SOURCES CryEdit.cpp
  120. PROPERTY COMPILE_DEFINITIONS
  121. VALUES
  122. O3DE_COPYRIGHT_YEAR=${O3DE_COPYRIGHT_YEAR}
  123. O3DE_BUILD_VERSION=${O3DE_INSTALL_BUILD_VERSION}
  124. ${LY_PAL_TOOLS_DEFINES}
  125. )
  126. ly_add_source_properties(
  127. SOURCES
  128. MainWindow.cpp
  129. PROPERTY COMPILE_DEFINITIONS
  130. VALUES ${LY_PAL_TOOLS_DEFINES}
  131. )
  132. get_property(editor_plugins GLOBAL PROPERTY LY_EDITOR_PLUGINS)
  133. string (REPLACE ";" "," editor_plugins "${editor_plugins}")
  134. ly_add_source_properties(
  135. SOURCES PluginManager.cpp
  136. PROPERTY COMPILE_DEFINITIONS
  137. VALUES LY_EDITOR_PLUGINS="${editor_plugins}"
  138. )
  139. ################################################################################
  140. # Editor
  141. ################################################################################
  142. ly_add_target(
  143. NAME Editor APPLICATION
  144. NAMESPACE Legacy
  145. AUTORCC
  146. FILES_CMAKE
  147. editor_files.cmake
  148. PLATFORM_INCLUDE_FILES
  149. Platform/${PAL_PLATFORM_NAME}/editor_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
  150. TARGET_PROPERTIES
  151. LY_INSTALL_GENERATE_RUN_TARGET TRUE
  152. BUILD_DEPENDENCIES
  153. PRIVATE
  154. 3rdParty::Qt::Core
  155. Legacy::CryCommon
  156. RUNTIME_DEPENDENCIES
  157. Legacy::CrySystem
  158. Legacy::EditorLib
  159. ProjectManager
  160. )
  161. ly_set_gem_variant_to_load(TARGETS Editor VARIANTS Tools)
  162. set_property(SOURCE
  163. CryEdit.cpp
  164. APPEND PROPERTY
  165. COMPILE_DEFINITIONS LY_CMAKE_TARGET="Editor"
  166. )
  167. ly_add_translations(
  168. TARGETS Editor
  169. PREFIX Translations
  170. FILES
  171. Translations/editor_en-us.ts
  172. Translations/assetbrowser_en-us.ts
  173. )
  174. ly_add_dependencies(Editor AssetProcessor)
  175. if(LY_DEFAULT_PROJECT_PATH)
  176. set_property(TARGET Editor APPEND PROPERTY VS_DEBUGGER_COMMAND_ARGUMENTS "--project-path=\"${LY_DEFAULT_PROJECT_PATH}\"")
  177. endif()
  178. ################################################################################
  179. # Tests
  180. ################################################################################
  181. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  182. ly_add_target(
  183. NAME EditorCore.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  184. NAMESPACE Legacy
  185. AUTOMOC
  186. FILES_CMAKE
  187. editor_core_test_files.cmake
  188. INCLUDE_DIRECTORIES
  189. PRIVATE
  190. .
  191. BUILD_DEPENDENCIES
  192. PRIVATE
  193. AZ::AzTest
  194. 3rdParty::Qt::Gui
  195. 3rdParty::Qt::Widgets
  196. Legacy::EditorCore
  197. Legacy::CryCommon
  198. AZ::AzCore
  199. )
  200. ly_add_googletest(
  201. NAME Legacy::EditorCore.Tests
  202. LABELS REQUIRES_tiaf
  203. )
  204. ly_add_target(
  205. NAME EditorLib.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
  206. NAMESPACE Legacy
  207. AUTOMOC
  208. FILES_CMAKE
  209. editor_lib_test_files.cmake
  210. INCLUDE_DIRECTORIES
  211. PRIVATE
  212. Include
  213. .
  214. COMPILE_DEFINITIONS
  215. PRIVATE
  216. ${LY_LEGACY_TERRAIN_EDITOR_DEFINES}
  217. BUILD_DEPENDENCIES
  218. PRIVATE
  219. AZ::AzTest
  220. AZ::AzCoreTestCommon
  221. 3rdParty::Qt::Core
  222. 3rdParty::Qt::Gui
  223. 3rdParty::Qt::Widgets
  224. 3rdParty::Qt::Test
  225. Legacy::CryCommon
  226. AZ::AzToolsFramework
  227. AZ::AzToolsFramework.Tests
  228. AZ::AzFrameworkTestShared
  229. AZ::AzToolsFrameworkTestCommon
  230. Legacy::EditorLib
  231. Gem::AtomToolsFramework.Static
  232. RUNTIME_DEPENDENCIES
  233. Gem::LmbrCentral
  234. )
  235. ly_add_googletest(
  236. NAME Legacy::EditorLib.Tests
  237. LABELS REQUIRES_tiaf
  238. )
  239. endif()