CMakeLists.txt 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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_shader_cache.cpp"
  34. "${VIDEO_CORE}/renderer_opengl/gl_shader_cache.h"
  35. "${VIDEO_CORE}/renderer_opengl/gl_shader_decompiler.cpp"
  36. "${VIDEO_CORE}/renderer_opengl/gl_shader_decompiler.h"
  37. "${VIDEO_CORE}/renderer_opengl/gl_shader_disk_cache.cpp"
  38. "${VIDEO_CORE}/renderer_opengl/gl_shader_disk_cache.h"
  39. "${VIDEO_CORE}/renderer_opengl/gl_shader_gen.cpp"
  40. "${VIDEO_CORE}/renderer_opengl/gl_shader_gen.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/const_buffer_locker.cpp"
  74. "${VIDEO_CORE}/shader/const_buffer_locker.h"
  75. "${VIDEO_CORE}/shader/control_flow.cpp"
  76. "${VIDEO_CORE}/shader/control_flow.h"
  77. "${VIDEO_CORE}/shader/decode.cpp"
  78. "${VIDEO_CORE}/shader/expr.cpp"
  79. "${VIDEO_CORE}/shader/expr.h"
  80. "${VIDEO_CORE}/shader/node.h"
  81. "${VIDEO_CORE}/shader/node_helper.cpp"
  82. "${VIDEO_CORE}/shader/node_helper.h"
  83. "${VIDEO_CORE}/shader/shader_ir.cpp"
  84. "${VIDEO_CORE}/shader/shader_ir.h"
  85. "${VIDEO_CORE}/shader/track.cpp"
  86. # and also check that the scm_rev files haven't changed
  87. "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in"
  88. "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.h"
  89. # technically we should regenerate if the git version changed, but its not worth the effort imo
  90. "${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake"
  91. )
  92. add_library(common STATIC
  93. algorithm.h
  94. alignment.h
  95. assert.h
  96. detached_tasks.cpp
  97. detached_tasks.h
  98. bit_field.h
  99. bit_util.h
  100. cityhash.cpp
  101. cityhash.h
  102. color.h
  103. common_funcs.h
  104. common_paths.h
  105. common_types.h
  106. file_util.cpp
  107. file_util.h
  108. hash.h
  109. hex_util.cpp
  110. hex_util.h
  111. logging/backend.cpp
  112. logging/backend.h
  113. logging/filter.cpp
  114. logging/filter.h
  115. logging/log.h
  116. logging/text_formatter.cpp
  117. logging/text_formatter.h
  118. lz4_compression.cpp
  119. lz4_compression.h
  120. math_util.h
  121. memory_hook.cpp
  122. memory_hook.h
  123. microprofile.cpp
  124. microprofile.h
  125. microprofileui.h
  126. misc.cpp
  127. multi_level_queue.h
  128. page_table.cpp
  129. page_table.h
  130. param_package.cpp
  131. param_package.h
  132. quaternion.h
  133. ring_buffer.h
  134. scm_rev.cpp
  135. scm_rev.h
  136. scope_exit.h
  137. string_util.cpp
  138. string_util.h
  139. swap.h
  140. telemetry.cpp
  141. telemetry.h
  142. thread.cpp
  143. thread.h
  144. thread_queue_list.h
  145. threadsafe_queue.h
  146. timer.cpp
  147. timer.h
  148. uint128.cpp
  149. uint128.h
  150. uuid.cpp
  151. uuid.h
  152. vector_math.h
  153. web_result.h
  154. zstd_compression.cpp
  155. zstd_compression.h
  156. )
  157. if(ARCHITECTURE_x86_64)
  158. target_sources(common
  159. PRIVATE
  160. x64/cpu_detect.cpp
  161. x64/cpu_detect.h
  162. )
  163. endif()
  164. create_target_directory_groups(common)
  165. target_link_libraries(common PUBLIC Boost::boost fmt microprofile)
  166. target_link_libraries(common PRIVATE lz4_static libzstd_static)