CMakeLists.txt 4.1 KB

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