CMakeLists.txt 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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. set(SCRIPT_CANVAS_COMMON_DEFINES
  9. SCRIPTCANVAS
  10. ENABLE_EXTENDED_MATH_SUPPORT=0
  11. )
  12. set(SCRIPT_CANVAS_EXECUTION_NOTIFICATION_DEFINES
  13. $<$<NOT:$<CONFIG:Release>>:SC_EXECUTION_TRACE_ENABLED> # this is REQUIRED for debugging/execution logging
  14. )
  15. set(SCRIPT_CANVAS_DEBUG_DEBUGGER_DEFINES
  16. $<$<NOT:$<CONFIG:Release>>:
  17. # SCRIPT_CANVAS_DEBUGGER_IS_ALWAYS_OBSERVING # for aggressive logging that ignores filtering (probably only for debug/development purposes)
  18. # SCRIPT_CANVAS_DEBUGGER_CONNECT_TO_ANYTHING_BUT_SELF # connect to the first target that is not self
  19. # SCRIPT_CANVAS_DEBUG_DEBUGGER # to debug the ${gem_name} Debugging systems themselves
  20. >
  21. )
  22. ly_add_target(
  23. NAME ${gem_name}Debugger STATIC
  24. NAMESPACE Gem
  25. FILES_CMAKE
  26. scriptcanvasgem_debugger_files.cmake
  27. INCLUDE_DIRECTORIES
  28. PRIVATE
  29. Include
  30. Include/ScriptCanvas
  31. COMPILE_DEFINITIONS
  32. PUBLIC
  33. SCRIPTCANVAS_ERRORS_ENABLED
  34. PRIVATE
  35. ${SCRIPT_CANVAS_COMMON_DEFINES}
  36. ${SCRIPT_CANVAS_DEBUG_DEBUGGER_DEFINES}
  37. ${SCRIPT_CANVAS_EXECUTION_NOTIFICATION_DEFINES}
  38. BUILD_DEPENDENCIES
  39. PRIVATE
  40. AZ::AzCore
  41. AZ::AzFramework
  42. Gem::ScriptEvents.Static
  43. )
  44. # the script canvas debugger is an optional gem module
  45. # To Enable it, associate it with a project
  46. ly_create_alias(NAME ${gem_name}Debugger.Builders NAMESPACE Gem TARGETS Gem::${gem_name}Debugger)
  47. ly_create_alias(NAME ${gem_name}Debugger.Tools NAMESPACE Gem TARGETS Gem::${gem_name}Debugger)
  48. ly_create_alias(NAME ${gem_name}Debugger.Clients NAMESPACE Gem TARGETS Gem::${gem_name}Debugger)
  49. ly_create_alias(NAME ${gem_name}Debugger.Servers NAMESPACE Gem TARGETS Gem::${gem_name}Debugger)
  50. ly_create_alias(NAME ${gem_name}Debugger.Unified NAMESPACE Gem TARGETS Gem::${gem_name}Debugger)
  51. ly_add_target(
  52. NAME ${gem_name}.Extensions STATIC
  53. NAMESPACE Gem
  54. FILES_CMAKE
  55. scriptcanvasgem_extensions_files.cmake
  56. INCLUDE_DIRECTORIES
  57. PUBLIC
  58. Include
  59. BUILD_DEPENDENCIES
  60. PUBLIC
  61. AZ::AzCore
  62. AZ::AzFramework
  63. )
  64. ly_add_target(
  65. NAME ${gem_name}.API STATIC
  66. NAMESPACE Gem
  67. FILES_CMAKE
  68. scriptcanvasgem_autogen_files.cmake
  69. scriptcanvasgem_headers.cmake
  70. scriptcanvasgem_common_files.cmake
  71. scriptcanvasgem_runtime_asset_files.cmake
  72. INCLUDE_DIRECTORIES
  73. PUBLIC
  74. .
  75. Include
  76. Include/ScriptCanvas
  77. ${SCRIPT_CANVAS_AUTOGEN_BUILD_DIR}
  78. COMPILE_DEFINITIONS
  79. PUBLIC
  80. SCRIPTCANVAS_ERRORS_ENABLED
  81. PRIVATE
  82. ${SCRIPT_CANVAS_COMMON_DEFINES}
  83. ${SCRIPT_CANVAS_DEBUG_DEBUGGER_DEFINES}
  84. ${SCRIPT_CANVAS_EXECUTION_NOTIFICATION_DEFINES}
  85. BUILD_DEPENDENCIES
  86. PUBLIC
  87. Gem::ScriptEvents.Static
  88. Gem::ExpressionEvaluation.Static
  89. Gem::${gem_name}.Extensions
  90. PRIVATE
  91. AZ::AzCore
  92. AZ::AzFramework
  93. Gem::${gem_name}Debugger
  94. AUTOGEN_RULES
  95. *.ScriptCanvasGrammar.xml,ScriptCanvasGrammar_Header.jinja,$path/$fileprefix.generated.h
  96. *.ScriptCanvasGrammar.xml,ScriptCanvasGrammar_Source.jinja,$path/$fileprefix.generated.cpp
  97. *.ScriptCanvasNodeable.xml,ScriptCanvasNodeable_Header.jinja,$path/$fileprefix.generated.h
  98. *.ScriptCanvasNodeable.xml,ScriptCanvasNodeable_Source.jinja,$path/$fileprefix.generated.cpp
  99. *.ScriptCanvasFunction.xml,ScriptCanvasFunction_Header.jinja,$path/$fileprefix.generated.h
  100. *.ScriptCanvasFunction.xml,ScriptCanvasFunction_Source.jinja,$path/$fileprefix.generated.cpp
  101. RUNTIME_DEPENDENCIES
  102. Gem::${gem_name}Debugger
  103. )
  104. ly_add_target(
  105. NAME ${gem_name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
  106. NAMESPACE Gem
  107. FILES_CMAKE
  108. scriptcanvasgem_game_files.cmake
  109. INCLUDE_DIRECTORIES
  110. PRIVATE
  111. .
  112. Include/${gem_name}
  113. COMPILE_DEFINITIONS
  114. PUBLIC
  115. SCRIPTCANVAS_ERRORS_ENABLED
  116. SCRIPTCANVAS_EDITOR
  117. PRIVATE
  118. ${SCRIPT_CANVAS_COMMON_DEFINES}
  119. BUILD_DEPENDENCIES
  120. PUBLIC
  121. Gem::${gem_name}.API
  122. PRIVATE
  123. AZ::AzCore
  124. AZ::AzFramework
  125. Gem::ScriptEvents.Static
  126. RUNTIME_DEPENDENCIES
  127. Gem::ScriptEvents
  128. Gem::ExpressionEvaluation
  129. )
  130. # Inject the gem name into the Module source file
  131. ly_add_source_properties(
  132. SOURCES
  133. Source/ScriptCanvasGem.cpp
  134. PROPERTY COMPILE_DEFINITIONS
  135. VALUES
  136. O3DE_GEM_NAME=${gem_name}
  137. O3DE_GEM_VERSION=${gem_version})
  138. # the "${gem_name}" target is active in Clients and Servers
  139. ly_create_alias(NAME ${gem_name}.Clients NAMESPACE Gem TARGETS Gem::${gem_name})
  140. ly_create_alias(NAME ${gem_name}.Servers NAMESPACE Gem TARGETS Gem::${gem_name})
  141. ly_create_alias(NAME ${gem_name}.Unified NAMESPACE Gem TARGETS Gem::${gem_name})
  142. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  143. ly_add_target(
  144. NAME ${gem_name}.Editor.Static STATIC
  145. NAMESPACE Gem
  146. AUTOMOC
  147. AUTOUIC
  148. AUTORCC
  149. FILES_CMAKE
  150. scriptcanvasgem_editor_files.cmake
  151. scriptcanvasgem_editor_asset_files.cmake
  152. scriptcanvasgem_editor_builder_files.cmake
  153. scriptcanvasgem_editor_tools_files.cmake
  154. scriptcanvasgem_game_files.cmake
  155. COMPILE_DEFINITIONS
  156. PUBLIC
  157. SCRIPTCANVAS_ERRORS_ENABLED
  158. PRIVATE
  159. ${SCRIPT_CANVAS_COMMON_DEFINES}
  160. INCLUDE_DIRECTORIES
  161. PUBLIC
  162. Editor/Include
  163. PRIVATE
  164. .
  165. Editor
  166. Tools
  167. ${SCRIPT_CANVAS_AUTOGEN_BUILD_DIR}
  168. BUILD_DEPENDENCIES
  169. PUBLIC
  170. Legacy::CryCommon
  171. AZ::AzCore
  172. AZ::AssetBuilderSDK
  173. ${additional_dependencies}
  174. Gem::${gem_name}.API
  175. Gem::ScriptEvents.Static
  176. Gem::GraphCanvasWidgets
  177. Gem::ExpressionEvaluation.Static
  178. PRIVATE
  179. Legacy::EditorCore
  180. RUNTIME_DEPENDENCIES
  181. Gem::${gem_name}
  182. )
  183. ly_add_target(
  184. NAME ${gem_name}.Editor GEM_MODULE
  185. NAMESPACE Gem
  186. FILES_CMAKE
  187. scriptcanvasgem_editor_shared_files.cmake
  188. COMPILE_DEFINITIONS
  189. PUBLIC
  190. SCRIPTCANVAS_ERRORS_ENABLED
  191. PRIVATE
  192. SCRIPTCANVAS_EDITOR
  193. ${SCRIPT_CANVAS_COMMON_DEFINES}
  194. INCLUDE_DIRECTORIES
  195. PUBLIC
  196. Editor/Include
  197. PRIVATE
  198. .
  199. Editor
  200. BUILD_DEPENDENCIES
  201. PRIVATE
  202. AZ::AzToolsFramework
  203. PUBLIC
  204. Gem::${gem_name}.Editor.Static
  205. RUNTIME_DEPENDENCIES
  206. 3rdParty::Qt::Core
  207. 3rdParty::Qt::Gui
  208. 3rdParty::Qt::Widgets
  209. Legacy::EditorCore
  210. AZ::AzQtComponents
  211. Gem::GraphCanvas.Editor
  212. Gem::ScriptEvents.Editor
  213. Gem::ExpressionEvaluation
  214. )
  215. # Inject the gem name into the Module source file
  216. ly_add_source_properties(
  217. SOURCES
  218. Editor/ScriptCanvasEditorGem.cpp
  219. PROPERTY COMPILE_DEFINITIONS
  220. VALUES
  221. O3DE_GEM_NAME=${gem_name}
  222. O3DE_GEM_VERSION=${gem_version})
  223. # the "${gem_name}.Editor" target is active in all dev tools:
  224. ly_create_alias(NAME ${gem_name}.Builders NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  225. ly_create_alias(NAME ${gem_name}.Tools NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
  226. endif()
  227. ################################################################################
  228. # Tests
  229. ################################################################################
  230. if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
  231. ly_add_target(
  232. NAME ${gem_name}.Tests MODULE
  233. NAMESPACE Gem
  234. FILES_CMAKE
  235. scriptcanvasgem_tests_files.cmake
  236. INCLUDE_DIRECTORIES
  237. PRIVATE
  238. Include
  239. Tests
  240. BUILD_DEPENDENCIES
  241. PRIVATE
  242. AZ::AzCore
  243. AZ::AzCoreTestCommon
  244. AZ::AzFramework
  245. AZ::AzTest
  246. Gem::${gem_name}.API
  247. )
  248. ly_add_googletest(
  249. NAME Gem::${gem_name}.Tests
  250. )
  251. if(PAL_TRAIT_BUILD_HOST_TOOLS)
  252. ly_add_target(
  253. NAME ${gem_name}.Editor.Tests MODULE
  254. NAMESPACE Gem
  255. FILES_CMAKE
  256. scriptcanvasgem_editor_tests_files.cmake
  257. INCLUDE_DIRECTORIES
  258. PRIVATE
  259. Builder
  260. Editor
  261. BUILD_DEPENDENCIES
  262. PRIVATE
  263. AZ::AzCoreTestCommon
  264. AZ::AzTest
  265. Gem::${gem_name}.API
  266. Gem::${gem_name}.Editor.Static
  267. )
  268. ly_add_googletest(
  269. NAME Gem::${gem_name}.Editor.Tests
  270. )
  271. endif()
  272. endif()