CMakeLists.txt 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. # Add a custom command to generate a new shader_cache_version hash when any of the following files change
  2. # NOTE: This is an approximation of what files affect shader generation, its possible something else
  3. # could affect the result, but much more unlikely than the following files. Keeping a list of files
  4. # like this allows for much better caching since it doesn't force the user to recompile binary shaders every update
  5. set(VIDEO_CORE "${CMAKE_SOURCE_DIR}/src/video_core")
  6. if (DEFINED ENV{AZURECIREPO})
  7. set(BUILD_REPOSITORY $ENV{AZURECIREPO})
  8. endif()
  9. if (DEFINED ENV{TITLEBARFORMATIDLE})
  10. set(TITLE_BAR_FORMAT_IDLE $ENV{TITLEBARFORMATIDLE})
  11. endif ()
  12. if (DEFINED ENV{TITLEBARFORMATRUNNING})
  13. set(TITLE_BAR_FORMAT_RUNNING $ENV{TITLEBARFORMATRUNNING})
  14. endif ()
  15. if (DEFINED ENV{DISPLAYVERSION})
  16. set(DISPLAY_VERSION $ENV{DISPLAYVERSION})
  17. endif ()
  18. # Pass the path to git to the GenerateSCMRev.cmake as well
  19. find_package(Git QUIET)
  20. add_custom_command(OUTPUT scm_rev.cpp
  21. COMMAND ${CMAKE_COMMAND}
  22. -DSRC_DIR=${CMAKE_SOURCE_DIR}
  23. -DBUILD_REPOSITORY=${BUILD_REPOSITORY}
  24. -DTITLE_BAR_FORMAT_IDLE=${TITLE_BAR_FORMAT_IDLE}
  25. -DTITLE_BAR_FORMAT_RUNNING=${TITLE_BAR_FORMAT_RUNNING}
  26. -DBUILD_TAG=${BUILD_TAG}
  27. -DBUILD_ID=${DISPLAY_VERSION}
  28. -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
  29. -P ${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake
  30. DEPENDS
  31. # WARNING! It was too much work to try and make a common location for this list,
  32. # so if you need to change it, please update CMakeModules/GenerateSCMRev.cmake as well
  33. "${VIDEO_CORE}/renderer_opengl/gl_arb_decompiler.cpp"
  34. "${VIDEO_CORE}/renderer_opengl/gl_arb_decompiler.h"
  35. "${VIDEO_CORE}/renderer_opengl/gl_shader_cache.cpp"
  36. "${VIDEO_CORE}/renderer_opengl/gl_shader_cache.h"
  37. "${VIDEO_CORE}/renderer_opengl/gl_shader_decompiler.cpp"
  38. "${VIDEO_CORE}/renderer_opengl/gl_shader_decompiler.h"
  39. "${VIDEO_CORE}/renderer_opengl/gl_shader_disk_cache.cpp"
  40. "${VIDEO_CORE}/renderer_opengl/gl_shader_disk_cache.h"
  41. "${VIDEO_CORE}/shader/decode/arithmetic.cpp"
  42. "${VIDEO_CORE}/shader/decode/arithmetic_half.cpp"
  43. "${VIDEO_CORE}/shader/decode/arithmetic_half_immediate.cpp"
  44. "${VIDEO_CORE}/shader/decode/arithmetic_immediate.cpp"
  45. "${VIDEO_CORE}/shader/decode/arithmetic_integer.cpp"
  46. "${VIDEO_CORE}/shader/decode/arithmetic_integer_immediate.cpp"
  47. "${VIDEO_CORE}/shader/decode/bfe.cpp"
  48. "${VIDEO_CORE}/shader/decode/bfi.cpp"
  49. "${VIDEO_CORE}/shader/decode/conversion.cpp"
  50. "${VIDEO_CORE}/shader/decode/ffma.cpp"
  51. "${VIDEO_CORE}/shader/decode/float_set.cpp"
  52. "${VIDEO_CORE}/shader/decode/float_set_predicate.cpp"
  53. "${VIDEO_CORE}/shader/decode/half_set.cpp"
  54. "${VIDEO_CORE}/shader/decode/half_set_predicate.cpp"
  55. "${VIDEO_CORE}/shader/decode/hfma2.cpp"
  56. "${VIDEO_CORE}/shader/decode/image.cpp"
  57. "${VIDEO_CORE}/shader/decode/integer_set.cpp"
  58. "${VIDEO_CORE}/shader/decode/integer_set_predicate.cpp"
  59. "${VIDEO_CORE}/shader/decode/memory.cpp"
  60. "${VIDEO_CORE}/shader/decode/texture.cpp"
  61. "${VIDEO_CORE}/shader/decode/other.cpp"
  62. "${VIDEO_CORE}/shader/decode/predicate_set_predicate.cpp"
  63. "${VIDEO_CORE}/shader/decode/predicate_set_register.cpp"
  64. "${VIDEO_CORE}/shader/decode/register_set_predicate.cpp"
  65. "${VIDEO_CORE}/shader/decode/shift.cpp"
  66. "${VIDEO_CORE}/shader/decode/video.cpp"
  67. "${VIDEO_CORE}/shader/decode/warp.cpp"
  68. "${VIDEO_CORE}/shader/decode/xmad.cpp"
  69. "${VIDEO_CORE}/shader/ast.cpp"
  70. "${VIDEO_CORE}/shader/ast.h"
  71. "${VIDEO_CORE}/shader/compiler_settings.cpp"
  72. "${VIDEO_CORE}/shader/compiler_settings.h"
  73. "${VIDEO_CORE}/shader/control_flow.cpp"
  74. "${VIDEO_CORE}/shader/control_flow.h"
  75. "${VIDEO_CORE}/shader/decode.cpp"
  76. "${VIDEO_CORE}/shader/expr.cpp"
  77. "${VIDEO_CORE}/shader/expr.h"
  78. "${VIDEO_CORE}/shader/node.h"
  79. "${VIDEO_CORE}/shader/node_helper.cpp"
  80. "${VIDEO_CORE}/shader/node_helper.h"
  81. "${VIDEO_CORE}/shader/registry.cpp"
  82. "${VIDEO_CORE}/shader/registry.h"
  83. "${VIDEO_CORE}/shader/shader_ir.cpp"
  84. "${VIDEO_CORE}/shader/shader_ir.h"
  85. "${VIDEO_CORE}/shader/track.cpp"
  86. "${VIDEO_CORE}/shader/transform_feedback.cpp"
  87. "${VIDEO_CORE}/shader/transform_feedback.h"
  88. # and also check that the scm_rev files haven't changed
  89. "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in"
  90. "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.h"
  91. # technically we should regenerate if the git version changed, but its not worth the effort imo
  92. "${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake"
  93. VERBATIM
  94. )
  95. add_library(common STATIC
  96. algorithm.h
  97. alignment.h
  98. assert.cpp
  99. assert.h
  100. atomic_ops.h
  101. detached_tasks.cpp
  102. detached_tasks.h
  103. bit_cast.h
  104. bit_field.h
  105. bit_set.h
  106. bit_util.h
  107. cityhash.cpp
  108. cityhash.h
  109. common_funcs.h
  110. common_sizes.h
  111. common_types.h
  112. concepts.h
  113. div_ceil.h
  114. dynamic_library.cpp
  115. dynamic_library.h
  116. fiber.cpp
  117. fiber.h
  118. fs/file.cpp
  119. fs/file.h
  120. fs/fs.cpp
  121. fs/fs.h
  122. fs/fs_paths.h
  123. fs/fs_types.h
  124. fs/fs_util.cpp
  125. fs/fs_util.h
  126. fs/path_util.cpp
  127. fs/path_util.h
  128. hash.h
  129. hex_util.cpp
  130. hex_util.h
  131. intrusive_red_black_tree.h
  132. logging/backend.cpp
  133. logging/backend.h
  134. logging/filter.cpp
  135. logging/filter.h
  136. logging/log.h
  137. logging/text_formatter.cpp
  138. logging/text_formatter.h
  139. lz4_compression.cpp
  140. lz4_compression.h
  141. math_util.h
  142. memory_detect.cpp
  143. memory_detect.h
  144. microprofile.cpp
  145. microprofile.h
  146. microprofileui.h
  147. misc.cpp
  148. nvidia_flags.cpp
  149. nvidia_flags.h
  150. page_table.cpp
  151. page_table.h
  152. param_package.cpp
  153. param_package.h
  154. parent_of_member.h
  155. point.h
  156. quaternion.h
  157. ring_buffer.h
  158. scm_rev.cpp
  159. scm_rev.h
  160. scope_exit.h
  161. settings.cpp
  162. settings.h
  163. settings_input.cpp
  164. settings_input.h
  165. spin_lock.cpp
  166. spin_lock.h
  167. stream.cpp
  168. stream.h
  169. string_util.cpp
  170. string_util.h
  171. swap.h
  172. telemetry.cpp
  173. telemetry.h
  174. thread.cpp
  175. thread.h
  176. thread_queue_list.h
  177. thread_worker.cpp
  178. thread_worker.h
  179. threadsafe_queue.h
  180. time_zone.cpp
  181. time_zone.h
  182. tiny_mt.h
  183. tree.h
  184. uint128.h
  185. uuid.cpp
  186. uuid.h
  187. vector_math.h
  188. virtual_buffer.cpp
  189. virtual_buffer.h
  190. wall_clock.cpp
  191. wall_clock.h
  192. zstd_compression.cpp
  193. zstd_compression.h
  194. )
  195. if(ARCHITECTURE_x86_64)
  196. target_sources(common
  197. PRIVATE
  198. x64/cpu_detect.cpp
  199. x64/cpu_detect.h
  200. x64/native_clock.cpp
  201. x64/native_clock.h
  202. x64/xbyak_abi.h
  203. x64/xbyak_util.h
  204. )
  205. endif()
  206. if (MSVC)
  207. target_compile_definitions(common PRIVATE
  208. # The standard library doesn't provide any replacement for codecvt yet
  209. # so we can disable this deprecation warning for the time being.
  210. _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
  211. )
  212. target_compile_options(common PRIVATE
  213. /W4
  214. /WX
  215. )
  216. else()
  217. target_compile_options(common PRIVATE
  218. -Werror
  219. $<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation>
  220. )
  221. endif()
  222. create_target_directory_groups(common)
  223. target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile)
  224. target_link_libraries(common PRIVATE lz4::lz4 xbyak)
  225. if (MSVC)
  226. target_link_libraries(common PRIVATE zstd::zstd)
  227. else()
  228. target_link_libraries(common PRIVATE zstd)
  229. endif()