CMakeLists.txt 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. # ...
  34. # and also check that the scm_rev files haven't changed
  35. "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in"
  36. "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.h"
  37. # technically we should regenerate if the git version changed, but its not worth the effort imo
  38. "${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake"
  39. VERBATIM
  40. )
  41. add_library(common STATIC
  42. algorithm.h
  43. alignment.h
  44. assert.cpp
  45. assert.h
  46. atomic_ops.h
  47. detached_tasks.cpp
  48. detached_tasks.h
  49. bit_cast.h
  50. bit_field.h
  51. bit_set.h
  52. bit_util.h
  53. cityhash.cpp
  54. cityhash.h
  55. common_funcs.h
  56. common_types.h
  57. concepts.h
  58. div_ceil.h
  59. dynamic_library.cpp
  60. dynamic_library.h
  61. fiber.cpp
  62. fiber.h
  63. fs/file.cpp
  64. fs/file.h
  65. fs/fs.cpp
  66. fs/fs.h
  67. fs/fs_paths.h
  68. fs/fs_types.h
  69. fs/fs_util.cpp
  70. fs/fs_util.h
  71. fs/path_util.cpp
  72. fs/path_util.h
  73. hash.h
  74. hex_util.cpp
  75. hex_util.h
  76. host_memory.cpp
  77. host_memory.h
  78. intrusive_red_black_tree.h
  79. literals.h
  80. logging/backend.cpp
  81. logging/backend.h
  82. logging/filter.cpp
  83. logging/filter.h
  84. logging/log.h
  85. logging/text_formatter.cpp
  86. logging/text_formatter.h
  87. logging/types.h
  88. lz4_compression.cpp
  89. lz4_compression.h
  90. math_util.h
  91. memory_detect.cpp
  92. memory_detect.h
  93. microprofile.cpp
  94. microprofile.h
  95. microprofileui.h
  96. misc.cpp
  97. nvidia_flags.cpp
  98. nvidia_flags.h
  99. page_table.cpp
  100. page_table.h
  101. param_package.cpp
  102. param_package.h
  103. parent_of_member.h
  104. point.h
  105. quaternion.h
  106. ring_buffer.h
  107. scm_rev.cpp
  108. scm_rev.h
  109. scope_exit.h
  110. settings.cpp
  111. settings.h
  112. settings_input.cpp
  113. settings_input.h
  114. spin_lock.cpp
  115. spin_lock.h
  116. stream.cpp
  117. stream.h
  118. string_util.cpp
  119. string_util.h
  120. swap.h
  121. telemetry.cpp
  122. telemetry.h
  123. thread.cpp
  124. thread.h
  125. thread_queue_list.h
  126. thread_worker.h
  127. threadsafe_queue.h
  128. time_zone.cpp
  129. time_zone.h
  130. tiny_mt.h
  131. tree.h
  132. uint128.h
  133. unique_function.h
  134. uuid.cpp
  135. uuid.h
  136. vector_math.h
  137. virtual_buffer.cpp
  138. virtual_buffer.h
  139. wall_clock.cpp
  140. wall_clock.h
  141. zstd_compression.cpp
  142. zstd_compression.h
  143. )
  144. if(ARCHITECTURE_x86_64)
  145. target_sources(common
  146. PRIVATE
  147. x64/cpu_detect.cpp
  148. x64/cpu_detect.h
  149. x64/native_clock.cpp
  150. x64/native_clock.h
  151. x64/xbyak_abi.h
  152. x64/xbyak_util.h
  153. )
  154. endif()
  155. if (MSVC)
  156. target_compile_definitions(common PRIVATE
  157. # The standard library doesn't provide any replacement for codecvt yet
  158. # so we can disable this deprecation warning for the time being.
  159. _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
  160. )
  161. target_compile_options(common PRIVATE
  162. /W4
  163. /WX
  164. )
  165. else()
  166. target_compile_options(common PRIVATE
  167. -Werror
  168. $<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation>
  169. )
  170. endif()
  171. create_target_directory_groups(common)
  172. target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile)
  173. target_link_libraries(common PRIVATE lz4::lz4 xbyak)
  174. if (MSVC)
  175. target_link_libraries(common PRIVATE zstd::zstd)
  176. else()
  177. target_link_libraries(common PRIVATE zstd)
  178. endif()