CMakeLists.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. # SPDX-FileCopyrightText: 2018 yuzu Emulator Project
  2. # SPDX-License-Identifier: GPL-2.0-or-later
  3. add_subdirectory(host_shaders)
  4. if(LIBVA_FOUND)
  5. set_source_files_properties(host1x/ffmpeg/ffmpeg.cpp
  6. PROPERTIES COMPILE_DEFINITIONS LIBVA_FOUND=1)
  7. list(APPEND FFmpeg_LIBRARIES ${LIBVA_LIBRARIES})
  8. endif()
  9. add_library(video_core STATIC
  10. buffer_cache/buffer_base.h
  11. buffer_cache/buffer_cache_base.h
  12. buffer_cache/buffer_cache.cpp
  13. buffer_cache/buffer_cache.h
  14. buffer_cache/memory_tracker_base.h
  15. buffer_cache/usage_tracker.h
  16. buffer_cache/word_manager.h
  17. cache_types.h
  18. cdma_pusher.cpp
  19. cdma_pusher.h
  20. compatible_formats.cpp
  21. compatible_formats.h
  22. control/channel_state.cpp
  23. control/channel_state.h
  24. control/channel_state_cache.cpp
  25. control/channel_state_cache.h
  26. control/scheduler.cpp
  27. control/scheduler.h
  28. delayed_destruction_ring.h
  29. dirty_flags.cpp
  30. dirty_flags.h
  31. dma_pusher.cpp
  32. dma_pusher.h
  33. engines/sw_blitter/blitter.cpp
  34. engines/sw_blitter/blitter.h
  35. engines/sw_blitter/converter.cpp
  36. engines/sw_blitter/converter.h
  37. engines/const_buffer_info.h
  38. engines/draw_manager.cpp
  39. engines/draw_manager.h
  40. engines/engine_interface.h
  41. engines/engine_upload.cpp
  42. engines/engine_upload.h
  43. engines/fermi_2d.cpp
  44. engines/fermi_2d.h
  45. engines/kepler_compute.cpp
  46. engines/kepler_compute.h
  47. engines/kepler_memory.cpp
  48. engines/kepler_memory.h
  49. engines/maxwell_3d.cpp
  50. engines/maxwell_3d.h
  51. engines/maxwell_dma.cpp
  52. engines/maxwell_dma.h
  53. engines/puller.cpp
  54. engines/puller.h
  55. framebuffer_config.h
  56. fsr.cpp
  57. fsr.h
  58. host1x/codecs/codec.cpp
  59. host1x/codecs/codec.h
  60. host1x/codecs/h264.cpp
  61. host1x/codecs/h264.h
  62. host1x/codecs/vp8.cpp
  63. host1x/codecs/vp8.h
  64. host1x/codecs/vp9.cpp
  65. host1x/codecs/vp9.h
  66. host1x/codecs/vp9_types.h
  67. host1x/ffmpeg/ffmpeg.cpp
  68. host1x/ffmpeg/ffmpeg.h
  69. host1x/control.cpp
  70. host1x/control.h
  71. host1x/host1x.cpp
  72. host1x/host1x.h
  73. host1x/nvdec.cpp
  74. host1x/nvdec.h
  75. host1x/nvdec_common.h
  76. host1x/sync_manager.cpp
  77. host1x/sync_manager.h
  78. host1x/syncpoint_manager.cpp
  79. host1x/syncpoint_manager.h
  80. host1x/vic.cpp
  81. host1x/vic.h
  82. macro/macro.cpp
  83. macro/macro.h
  84. macro/macro_hle.cpp
  85. macro/macro_hle.h
  86. macro/macro_interpreter.cpp
  87. macro/macro_interpreter.h
  88. fence_manager.h
  89. gpu.cpp
  90. gpu.h
  91. gpu_thread.cpp
  92. gpu_thread.h
  93. invalidation_accumulator.h
  94. memory_manager.cpp
  95. memory_manager.h
  96. precompiled_headers.h
  97. pte_kind.h
  98. query_cache/bank_base.h
  99. query_cache/query_base.h
  100. query_cache/query_cache_base.h
  101. query_cache/query_cache.h
  102. query_cache/query_stream.h
  103. query_cache/types.h
  104. query_cache.h
  105. rasterizer_accelerated.cpp
  106. rasterizer_accelerated.h
  107. rasterizer_interface.h
  108. renderer_base.cpp
  109. renderer_base.h
  110. renderer_null/null_rasterizer.cpp
  111. renderer_null/null_rasterizer.h
  112. renderer_null/renderer_null.cpp
  113. renderer_null/renderer_null.h
  114. renderer_opengl/blit_image.cpp
  115. renderer_opengl/blit_image.h
  116. renderer_opengl/gl_buffer_cache_base.cpp
  117. renderer_opengl/gl_buffer_cache.cpp
  118. renderer_opengl/gl_buffer_cache.h
  119. renderer_opengl/gl_compute_pipeline.cpp
  120. renderer_opengl/gl_compute_pipeline.h
  121. renderer_opengl/gl_device.cpp
  122. renderer_opengl/gl_device.h
  123. renderer_opengl/gl_fence_manager.cpp
  124. renderer_opengl/gl_fence_manager.h
  125. renderer_opengl/gl_fsr.cpp
  126. renderer_opengl/gl_fsr.h
  127. renderer_opengl/gl_graphics_pipeline.cpp
  128. renderer_opengl/gl_graphics_pipeline.h
  129. renderer_opengl/gl_rasterizer.cpp
  130. renderer_opengl/gl_rasterizer.h
  131. renderer_opengl/gl_resource_manager.cpp
  132. renderer_opengl/gl_resource_manager.h
  133. renderer_opengl/gl_shader_cache.cpp
  134. renderer_opengl/gl_shader_cache.h
  135. renderer_opengl/gl_shader_manager.cpp
  136. renderer_opengl/gl_shader_manager.h
  137. renderer_opengl/gl_shader_context.h
  138. renderer_opengl/gl_shader_util.cpp
  139. renderer_opengl/gl_shader_util.h
  140. renderer_opengl/gl_state_tracker.cpp
  141. renderer_opengl/gl_state_tracker.h
  142. renderer_opengl/gl_staging_buffer_pool.cpp
  143. renderer_opengl/gl_staging_buffer_pool.h
  144. renderer_opengl/gl_texture_cache.cpp
  145. renderer_opengl/gl_texture_cache.h
  146. renderer_opengl/gl_texture_cache_base.cpp
  147. renderer_opengl/gl_query_cache.cpp
  148. renderer_opengl/gl_query_cache.h
  149. renderer_opengl/maxwell_to_gl.h
  150. renderer_opengl/renderer_opengl.cpp
  151. renderer_opengl/renderer_opengl.h
  152. renderer_opengl/util_shaders.cpp
  153. renderer_opengl/util_shaders.h
  154. renderer_vulkan/blit_image.cpp
  155. renderer_vulkan/blit_image.h
  156. renderer_vulkan/fixed_pipeline_state.cpp
  157. renderer_vulkan/fixed_pipeline_state.h
  158. renderer_vulkan/maxwell_to_vk.cpp
  159. renderer_vulkan/maxwell_to_vk.h
  160. renderer_vulkan/pipeline_helper.h
  161. renderer_vulkan/pipeline_statistics.cpp
  162. renderer_vulkan/pipeline_statistics.h
  163. renderer_vulkan/renderer_vulkan.h
  164. renderer_vulkan/renderer_vulkan.cpp
  165. renderer_vulkan/vk_blit_screen.cpp
  166. renderer_vulkan/vk_blit_screen.h
  167. renderer_vulkan/vk_buffer_cache_base.cpp
  168. renderer_vulkan/vk_buffer_cache.cpp
  169. renderer_vulkan/vk_buffer_cache.h
  170. renderer_vulkan/vk_command_pool.cpp
  171. renderer_vulkan/vk_command_pool.h
  172. renderer_vulkan/vk_compute_pass.cpp
  173. renderer_vulkan/vk_compute_pass.h
  174. renderer_vulkan/vk_compute_pipeline.cpp
  175. renderer_vulkan/vk_compute_pipeline.h
  176. renderer_vulkan/vk_descriptor_pool.cpp
  177. renderer_vulkan/vk_descriptor_pool.h
  178. renderer_vulkan/vk_fence_manager.cpp
  179. renderer_vulkan/vk_fence_manager.h
  180. renderer_vulkan/vk_fsr.cpp
  181. renderer_vulkan/vk_fsr.h
  182. renderer_vulkan/vk_graphics_pipeline.cpp
  183. renderer_vulkan/vk_graphics_pipeline.h
  184. renderer_vulkan/vk_master_semaphore.cpp
  185. renderer_vulkan/vk_master_semaphore.h
  186. renderer_vulkan/vk_pipeline_cache.cpp
  187. renderer_vulkan/vk_pipeline_cache.h
  188. renderer_vulkan/vk_present_manager.cpp
  189. renderer_vulkan/vk_present_manager.h
  190. renderer_vulkan/vk_query_cache.cpp
  191. renderer_vulkan/vk_query_cache.h
  192. renderer_vulkan/vk_rasterizer.cpp
  193. renderer_vulkan/vk_rasterizer.h
  194. renderer_vulkan/vk_render_pass_cache.cpp
  195. renderer_vulkan/vk_render_pass_cache.h
  196. renderer_vulkan/vk_resource_pool.cpp
  197. renderer_vulkan/vk_resource_pool.h
  198. renderer_vulkan/vk_scheduler.cpp
  199. renderer_vulkan/vk_scheduler.h
  200. renderer_vulkan/vk_shader_util.cpp
  201. renderer_vulkan/vk_shader_util.h
  202. renderer_vulkan/vk_smaa.cpp
  203. renderer_vulkan/vk_smaa.h
  204. renderer_vulkan/vk_staging_buffer_pool.cpp
  205. renderer_vulkan/vk_staging_buffer_pool.h
  206. renderer_vulkan/vk_state_tracker.cpp
  207. renderer_vulkan/vk_state_tracker.h
  208. renderer_vulkan/vk_swapchain.cpp
  209. renderer_vulkan/vk_swapchain.h
  210. renderer_vulkan/vk_texture_cache.cpp
  211. renderer_vulkan/vk_texture_cache.h
  212. renderer_vulkan/vk_texture_cache_base.cpp
  213. renderer_vulkan/vk_turbo_mode.cpp
  214. renderer_vulkan/vk_turbo_mode.h
  215. renderer_vulkan/vk_update_descriptor.cpp
  216. renderer_vulkan/vk_update_descriptor.h
  217. shader_cache.cpp
  218. shader_cache.h
  219. shader_environment.cpp
  220. shader_environment.h
  221. shader_notify.cpp
  222. shader_notify.h
  223. smaa_area_tex.h
  224. smaa_search_tex.h
  225. surface.cpp
  226. surface.h
  227. texture_cache/accelerated_swizzle.cpp
  228. texture_cache/accelerated_swizzle.h
  229. texture_cache/decode_bc.cpp
  230. texture_cache/decode_bc.h
  231. texture_cache/descriptor_table.h
  232. texture_cache/formatter.cpp
  233. texture_cache/formatter.h
  234. texture_cache/format_lookup_table.cpp
  235. texture_cache/format_lookup_table.h
  236. texture_cache/image_base.cpp
  237. texture_cache/image_base.h
  238. texture_cache/image_info.cpp
  239. texture_cache/image_info.h
  240. texture_cache/image_view_base.cpp
  241. texture_cache/image_view_base.h
  242. texture_cache/image_view_info.cpp
  243. texture_cache/image_view_info.h
  244. texture_cache/render_targets.h
  245. texture_cache/samples_helper.h
  246. texture_cache/slot_vector.h
  247. texture_cache/texture_cache.cpp
  248. texture_cache/texture_cache.h
  249. texture_cache/texture_cache_base.h
  250. texture_cache/types.h
  251. texture_cache/util.cpp
  252. texture_cache/util.h
  253. textures/astc.h
  254. textures/astc.cpp
  255. textures/bcn.cpp
  256. textures/bcn.h
  257. textures/decoders.cpp
  258. textures/decoders.h
  259. textures/texture.cpp
  260. textures/texture.h
  261. textures/workers.cpp
  262. textures/workers.h
  263. transform_feedback.cpp
  264. transform_feedback.h
  265. video_core.cpp
  266. video_core.h
  267. vulkan_common/vulkan_debug_callback.cpp
  268. vulkan_common/vulkan_debug_callback.h
  269. vulkan_common/vulkan_device.cpp
  270. vulkan_common/vulkan_device.h
  271. vulkan_common/vulkan_instance.cpp
  272. vulkan_common/vulkan_instance.h
  273. vulkan_common/vulkan_library.cpp
  274. vulkan_common/vulkan_library.h
  275. vulkan_common/vulkan_memory_allocator.cpp
  276. vulkan_common/vulkan_memory_allocator.h
  277. vulkan_common/vulkan_surface.cpp
  278. vulkan_common/vulkan_surface.h
  279. vulkan_common/vulkan_wrapper.cpp
  280. vulkan_common/vulkan_wrapper.h
  281. vulkan_common/nsight_aftermath_tracker.cpp
  282. vulkan_common/nsight_aftermath_tracker.h
  283. vulkan_common/vma.cpp
  284. vulkan_common/vma.h
  285. vulkan_common/vulkan.h
  286. )
  287. create_target_directory_groups(video_core)
  288. target_link_libraries(video_core PUBLIC common core)
  289. target_link_libraries(video_core PUBLIC glad shader_recompiler stb bc_decoder)
  290. if (YUZU_USE_BUNDLED_FFMPEG AND NOT (WIN32 OR ANDROID))
  291. add_dependencies(video_core ffmpeg-build)
  292. endif()
  293. target_include_directories(video_core PRIVATE ${FFmpeg_INCLUDE_DIR})
  294. target_link_libraries(video_core PRIVATE ${FFmpeg_LIBRARIES})
  295. target_link_options(video_core PRIVATE ${FFmpeg_LDFLAGS})
  296. add_dependencies(video_core host_shaders)
  297. target_include_directories(video_core PRIVATE ${HOST_SHADERS_INCLUDE})
  298. target_link_libraries(video_core PRIVATE sirit Vulkan::Headers GPUOpen::VulkanMemoryAllocator)
  299. if (ENABLE_NSIGHT_AFTERMATH)
  300. if (NOT DEFINED ENV{NSIGHT_AFTERMATH_SDK})
  301. message(FATAL_ERROR "Environment variable NSIGHT_AFTERMATH_SDK has to be provided")
  302. endif()
  303. if (NOT WIN32)
  304. message(FATAL_ERROR "Nsight Aftermath doesn't support non-Windows platforms")
  305. endif()
  306. target_compile_definitions(video_core PRIVATE HAS_NSIGHT_AFTERMATH)
  307. target_include_directories(video_core PRIVATE "$ENV{NSIGHT_AFTERMATH_SDK}/include")
  308. endif()
  309. if (MSVC)
  310. target_compile_options(video_core PRIVATE
  311. /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
  312. /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data
  313. )
  314. else()
  315. if (APPLE)
  316. # error: declaration shadows a typedef in 'interval_base_set<SubType, DomainT, Compare, Interval, Alloc>'
  317. # error: implicit conversion loses integer precision: 'int' to 'boost::icl::bound_type' (aka 'unsigned char')
  318. target_compile_options(video_core PRIVATE -Wno-shadow -Wno-unused-local-typedef)
  319. else()
  320. target_compile_options(video_core PRIVATE -Werror=conversion)
  321. endif()
  322. target_compile_options(video_core PRIVATE
  323. -Wno-sign-conversion
  324. )
  325. # xbyak
  326. set_source_files_properties(macro/macro_jit_x64.cpp PROPERTIES COMPILE_OPTIONS "-Wno-conversion;-Wno-shadow")
  327. # VMA
  328. set_source_files_properties(vulkan_common/vma.cpp PROPERTIES COMPILE_OPTIONS "-Wno-conversion;-Wno-unused-variable;-Wno-unused-parameter;-Wno-missing-field-initializers")
  329. endif()
  330. if (ARCHITECTURE_x86_64)
  331. target_sources(video_core PRIVATE
  332. macro/macro_jit_x64.cpp
  333. macro/macro_jit_x64.h
  334. )
  335. target_link_libraries(video_core PUBLIC xbyak::xbyak)
  336. endif()
  337. if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
  338. target_link_libraries(video_core PRIVATE dynarmic::dynarmic)
  339. endif()
  340. if (YUZU_USE_PRECOMPILED_HEADERS)
  341. target_precompile_headers(video_core PRIVATE precompiled_headers.h)
  342. endif()
  343. if (YUZU_ENABLE_LTO)
  344. set_property(TARGET video_core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
  345. endif()
  346. if (ANDROID AND ARCHITECTURE_arm64)
  347. target_link_libraries(video_core PRIVATE adrenotools)
  348. endif()