CMakeLists.txt 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. if (DEFINED ENV{AZURECIREPO})
  2. set(BUILD_REPOSITORY $ENV{AZURECIREPO})
  3. endif()
  4. if (DEFINED ENV{TITLEBARFORMATIDLE})
  5. set(TITLE_BAR_FORMAT_IDLE $ENV{TITLEBARFORMATIDLE})
  6. endif ()
  7. if (DEFINED ENV{TITLEBARFORMATRUNNING})
  8. set(TITLE_BAR_FORMAT_RUNNING $ENV{TITLEBARFORMATRUNNING})
  9. endif ()
  10. if (DEFINED ENV{DISPLAYVERSION})
  11. set(DISPLAY_VERSION $ENV{DISPLAYVERSION})
  12. endif ()
  13. # Pass the path to git to the GenerateSCMRev.cmake as well
  14. find_package(Git QUIET)
  15. add_custom_command(OUTPUT scm_rev.cpp
  16. COMMAND ${CMAKE_COMMAND}
  17. -DSRC_DIR=${CMAKE_SOURCE_DIR}
  18. -DBUILD_REPOSITORY=${BUILD_REPOSITORY}
  19. -DTITLE_BAR_FORMAT_IDLE=${TITLE_BAR_FORMAT_IDLE}
  20. -DTITLE_BAR_FORMAT_RUNNING=${TITLE_BAR_FORMAT_RUNNING}
  21. -DBUILD_TAG=${BUILD_TAG}
  22. -DBUILD_ID=${DISPLAY_VERSION}
  23. -DGIT_REF_SPEC=${GIT_REF_SPEC}
  24. -DGIT_REV=${GIT_REV}
  25. -DGIT_DESC=${GIT_DESC}
  26. -DGIT_BRANCH=${GIT_BRANCH}
  27. -DBUILD_FULLNAME=${BUILD_FULLNAME}
  28. -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
  29. -P ${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake
  30. DEPENDS
  31. # Check that the scm_rev files haven't changed
  32. "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in"
  33. "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.h"
  34. # technically we should regenerate if the git version changed, but its not worth the effort imo
  35. "${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake"
  36. VERBATIM
  37. )
  38. add_library(common STATIC
  39. algorithm.h
  40. alignment.h
  41. assert.cpp
  42. assert.h
  43. atomic_ops.h
  44. detached_tasks.cpp
  45. detached_tasks.h
  46. bit_cast.h
  47. bit_field.h
  48. bit_set.h
  49. bit_util.h
  50. cityhash.cpp
  51. cityhash.h
  52. common_funcs.h
  53. common_types.h
  54. concepts.h
  55. div_ceil.h
  56. dynamic_library.cpp
  57. dynamic_library.h
  58. error.cpp
  59. error.h
  60. expected.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. input.h
  79. intrusive_red_black_tree.h
  80. literals.h
  81. logging/backend.cpp
  82. logging/backend.h
  83. logging/filter.cpp
  84. logging/filter.h
  85. logging/formatter.h
  86. logging/log.h
  87. logging/log_entry.h
  88. logging/text_formatter.cpp
  89. logging/text_formatter.h
  90. logging/types.h
  91. lz4_compression.cpp
  92. lz4_compression.h
  93. math_util.h
  94. memory_detect.cpp
  95. memory_detect.h
  96. microprofile.cpp
  97. microprofile.h
  98. microprofileui.h
  99. nvidia_flags.cpp
  100. nvidia_flags.h
  101. page_table.cpp
  102. page_table.h
  103. param_package.cpp
  104. param_package.h
  105. parent_of_member.h
  106. point.h
  107. quaternion.h
  108. ring_buffer.h
  109. scm_rev.cpp
  110. scm_rev.h
  111. scope_exit.h
  112. settings.cpp
  113. settings.h
  114. settings_input.cpp
  115. settings_input.h
  116. spin_lock.cpp
  117. spin_lock.h
  118. stream.cpp
  119. stream.h
  120. string_util.cpp
  121. string_util.h
  122. swap.h
  123. telemetry.cpp
  124. telemetry.h
  125. thread.cpp
  126. thread.h
  127. thread_queue_list.h
  128. thread_worker.h
  129. threadsafe_queue.h
  130. time_zone.cpp
  131. time_zone.h
  132. tiny_mt.h
  133. tree.h
  134. uint128.h
  135. unique_function.h
  136. uuid.cpp
  137. uuid.h
  138. vector_math.h
  139. virtual_buffer.cpp
  140. virtual_buffer.h
  141. wall_clock.cpp
  142. wall_clock.h
  143. zstd_compression.cpp
  144. zstd_compression.h
  145. )
  146. if(ARCHITECTURE_x86_64)
  147. target_sources(common
  148. PRIVATE
  149. x64/cpu_detect.cpp
  150. x64/cpu_detect.h
  151. x64/native_clock.cpp
  152. x64/native_clock.h
  153. x64/xbyak_abi.h
  154. x64/xbyak_util.h
  155. )
  156. endif()
  157. if (MSVC)
  158. target_compile_definitions(common PRIVATE
  159. # The standard library doesn't provide any replacement for codecvt yet
  160. # so we can disable this deprecation warning for the time being.
  161. _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
  162. )
  163. target_compile_options(common PRIVATE
  164. /W4
  165. /WX
  166. )
  167. else()
  168. target_compile_options(common PRIVATE
  169. -Werror
  170. $<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation>
  171. )
  172. endif()
  173. create_target_directory_groups(common)
  174. target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads)
  175. target_link_libraries(common PRIVATE lz4::lz4 xbyak)
  176. if (MSVC)
  177. target_link_libraries(common PRIVATE zstd::zstd)
  178. else()
  179. target_link_libraries(common PRIVATE zstd)
  180. endif()