CMakeLists.txt 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. # SPDX-FileCopyrightText: 2018 yuzu Emulator Project
  2. # SPDX-License-Identifier: GPL-2.0-or-later
  3. if (DEFINED ENV{AZURECIREPO})
  4. set(BUILD_REPOSITORY $ENV{AZURECIREPO})
  5. endif()
  6. if (DEFINED ENV{TITLEBARFORMATIDLE})
  7. set(TITLE_BAR_FORMAT_IDLE $ENV{TITLEBARFORMATIDLE})
  8. endif ()
  9. if (DEFINED ENV{TITLEBARFORMATRUNNING})
  10. set(TITLE_BAR_FORMAT_RUNNING $ENV{TITLEBARFORMATRUNNING})
  11. endif ()
  12. if (DEFINED ENV{DISPLAYVERSION})
  13. set(DISPLAY_VERSION $ENV{DISPLAYVERSION})
  14. endif ()
  15. include(GenerateSCMRev)
  16. add_library(common STATIC
  17. address_space.cpp
  18. address_space.h
  19. algorithm.h
  20. alignment.h
  21. announce_multiplayer_room.h
  22. assert.cpp
  23. assert.h
  24. atomic_helpers.h
  25. atomic_ops.h
  26. detached_tasks.cpp
  27. detached_tasks.h
  28. bit_cast.h
  29. bit_field.h
  30. bit_set.h
  31. bit_util.h
  32. cityhash.cpp
  33. cityhash.h
  34. common_funcs.h
  35. common_precompiled_headers.h
  36. common_types.h
  37. concepts.h
  38. container_hash.h
  39. demangle.cpp
  40. demangle.h
  41. div_ceil.h
  42. dynamic_library.cpp
  43. dynamic_library.h
  44. elf.h
  45. error.cpp
  46. error.h
  47. expected.h
  48. fiber.cpp
  49. fiber.h
  50. fixed_point.h
  51. fs/file.cpp
  52. fs/file.h
  53. fs/fs.cpp
  54. fs/fs.h
  55. fs/fs_paths.h
  56. fs/fs_types.h
  57. fs/fs_util.cpp
  58. fs/fs_util.h
  59. fs/path_util.cpp
  60. fs/path_util.h
  61. hash.h
  62. hex_util.cpp
  63. hex_util.h
  64. host_memory.cpp
  65. host_memory.h
  66. input.h
  67. intrusive_red_black_tree.h
  68. literals.h
  69. logging/backend.cpp
  70. logging/backend.h
  71. logging/filter.cpp
  72. logging/filter.h
  73. logging/formatter.h
  74. logging/log.h
  75. logging/log_entry.h
  76. logging/text_formatter.cpp
  77. logging/text_formatter.h
  78. logging/types.h
  79. lz4_compression.cpp
  80. lz4_compression.h
  81. make_unique_for_overwrite.h
  82. math_util.h
  83. memory_detect.cpp
  84. memory_detect.h
  85. microprofile.cpp
  86. microprofile.h
  87. microprofileui.h
  88. multi_level_page_table.cpp
  89. multi_level_page_table.h
  90. nvidia_flags.cpp
  91. nvidia_flags.h
  92. overflow.h
  93. page_table.cpp
  94. page_table.h
  95. param_package.cpp
  96. param_package.h
  97. parent_of_member.h
  98. point.h
  99. precompiled_headers.h
  100. quaternion.h
  101. range_map.h
  102. reader_writer_queue.h
  103. ring_buffer.h
  104. ${CMAKE_CURRENT_BINARY_DIR}/scm_rev.cpp
  105. scm_rev.h
  106. scope_exit.h
  107. scratch_buffer.h
  108. settings.cpp
  109. settings.h
  110. settings_input.cpp
  111. settings_input.h
  112. socket_types.h
  113. spin_lock.cpp
  114. spin_lock.h
  115. steady_clock.cpp
  116. steady_clock.h
  117. stream.cpp
  118. stream.h
  119. string_util.cpp
  120. string_util.h
  121. swap.h
  122. telemetry.cpp
  123. telemetry.h
  124. thread.cpp
  125. thread.h
  126. thread_queue_list.h
  127. thread_worker.h
  128. threadsafe_queue.h
  129. time_zone.cpp
  130. time_zone.h
  131. tiny_mt.h
  132. tree.h
  133. typed_address.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 (WIN32)
  147. target_sources(common PRIVATE
  148. windows/timer_resolution.cpp
  149. windows/timer_resolution.h
  150. )
  151. target_link_libraries(common PRIVATE ntdll)
  152. endif()
  153. if(ANDROID)
  154. target_sources(common
  155. PRIVATE
  156. fs/fs_android.cpp
  157. fs/fs_android.h
  158. )
  159. endif()
  160. if(ARCHITECTURE_x86_64)
  161. target_sources(common
  162. PRIVATE
  163. x64/cpu_detect.cpp
  164. x64/cpu_detect.h
  165. x64/cpu_wait.cpp
  166. x64/cpu_wait.h
  167. x64/native_clock.cpp
  168. x64/native_clock.h
  169. x64/rdtsc.cpp
  170. x64/rdtsc.h
  171. x64/xbyak_abi.h
  172. x64/xbyak_util.h
  173. )
  174. target_link_libraries(common PRIVATE xbyak::xbyak)
  175. endif()
  176. if (MSVC)
  177. target_compile_definitions(common PRIVATE
  178. # The standard library doesn't provide any replacement for codecvt yet
  179. # so we can disable this deprecation warning for the time being.
  180. _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
  181. )
  182. target_compile_options(common PRIVATE
  183. /W4
  184. /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
  185. /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
  186. /we4800 # Implicit conversion from 'type' to bool. Possible information loss
  187. )
  188. else()
  189. target_compile_options(common PRIVATE
  190. $<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation>
  191. )
  192. endif()
  193. create_target_directory_groups(common)
  194. target_link_libraries(common PUBLIC Boost::context Boost::headers fmt::fmt microprofile Threads::Threads)
  195. target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle)
  196. if (ANDROID)
  197. # For ASharedMemory_create
  198. target_link_libraries(common PRIVATE android)
  199. endif()
  200. if (YUZU_USE_PRECOMPILED_HEADERS)
  201. target_precompile_headers(common PRIVATE precompiled_headers.h)
  202. endif()