CMakeLists.txt 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. fiber.cpp
  54. fiber.h
  55. fs/file.cpp
  56. fs/file.h
  57. fs/fs.cpp
  58. fs/fs.h
  59. fs/fs_paths.h
  60. fs/fs_types.h
  61. fs/fs_util.cpp
  62. fs/fs_util.h
  63. fs/path_util.cpp
  64. fs/path_util.h
  65. hash.h
  66. hex_util.cpp
  67. hex_util.h
  68. host_memory.cpp
  69. host_memory.h
  70. intrusive_red_black_tree.h
  71. literals.h
  72. logging/backend.cpp
  73. logging/backend.h
  74. logging/filter.cpp
  75. logging/filter.h
  76. logging/log.h
  77. logging/text_formatter.cpp
  78. logging/text_formatter.h
  79. logging/types.h
  80. lz4_compression.cpp
  81. lz4_compression.h
  82. math_util.h
  83. memory_detect.cpp
  84. memory_detect.h
  85. microprofile.cpp
  86. microprofile.h
  87. microprofileui.h
  88. misc.cpp
  89. nvidia_flags.cpp
  90. nvidia_flags.h
  91. page_table.cpp
  92. page_table.h
  93. param_package.cpp
  94. param_package.h
  95. parent_of_member.h
  96. point.h
  97. quaternion.h
  98. ring_buffer.h
  99. scm_rev.cpp
  100. scm_rev.h
  101. scope_exit.h
  102. settings.cpp
  103. settings.h
  104. settings_input.cpp
  105. settings_input.h
  106. spin_lock.cpp
  107. spin_lock.h
  108. stream.cpp
  109. stream.h
  110. string_util.cpp
  111. string_util.h
  112. swap.h
  113. telemetry.cpp
  114. telemetry.h
  115. thread.cpp
  116. thread.h
  117. thread_queue_list.h
  118. thread_worker.h
  119. threadsafe_queue.h
  120. time_zone.cpp
  121. time_zone.h
  122. tiny_mt.h
  123. tree.h
  124. uint128.h
  125. unique_function.h
  126. uuid.cpp
  127. uuid.h
  128. vector_math.h
  129. virtual_buffer.cpp
  130. virtual_buffer.h
  131. wall_clock.cpp
  132. wall_clock.h
  133. zstd_compression.cpp
  134. zstd_compression.h
  135. )
  136. if(ARCHITECTURE_x86_64)
  137. target_sources(common
  138. PRIVATE
  139. x64/cpu_detect.cpp
  140. x64/cpu_detect.h
  141. x64/native_clock.cpp
  142. x64/native_clock.h
  143. x64/xbyak_abi.h
  144. x64/xbyak_util.h
  145. )
  146. endif()
  147. if (MSVC)
  148. target_compile_definitions(common PRIVATE
  149. # The standard library doesn't provide any replacement for codecvt yet
  150. # so we can disable this deprecation warning for the time being.
  151. _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
  152. )
  153. target_compile_options(common PRIVATE
  154. /W4
  155. /WX
  156. )
  157. else()
  158. target_compile_options(common PRIVATE
  159. -Werror
  160. $<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation>
  161. )
  162. endif()
  163. create_target_directory_groups(common)
  164. target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads)
  165. target_link_libraries(common PRIVATE lz4::lz4 xbyak)
  166. if (MSVC)
  167. target_link_libraries(common PRIVATE zstd::zstd)
  168. else()
  169. target_link_libraries(common PRIVATE zstd)
  170. endif()
  171. if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND CMAKE_CXX_COMPILER_ID STREQUAL GNU)
  172. target_link_libraries(common PRIVATE backtrace)
  173. endif()