CMakeLists.txt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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_common.h
  111. settings_enums.h
  112. settings_input.cpp
  113. settings_input.h
  114. settings_setting.h
  115. socket_types.h
  116. spin_lock.cpp
  117. spin_lock.h
  118. steady_clock.cpp
  119. steady_clock.h
  120. stream.cpp
  121. stream.h
  122. string_util.cpp
  123. string_util.h
  124. swap.h
  125. telemetry.cpp
  126. telemetry.h
  127. thread.cpp
  128. thread.h
  129. thread_queue_list.h
  130. thread_worker.h
  131. threadsafe_queue.h
  132. time_zone.cpp
  133. time_zone.h
  134. tiny_mt.h
  135. tree.h
  136. typed_address.h
  137. uint128.h
  138. unique_function.h
  139. uuid.cpp
  140. uuid.h
  141. vector_math.h
  142. virtual_buffer.cpp
  143. virtual_buffer.h
  144. wall_clock.cpp
  145. wall_clock.h
  146. zstd_compression.cpp
  147. zstd_compression.h
  148. )
  149. if (WIN32)
  150. target_sources(common PRIVATE
  151. windows/timer_resolution.cpp
  152. windows/timer_resolution.h
  153. )
  154. target_link_libraries(common PRIVATE ntdll)
  155. endif()
  156. if(ANDROID)
  157. target_sources(common
  158. PRIVATE
  159. fs/fs_android.cpp
  160. fs/fs_android.h
  161. )
  162. endif()
  163. if(ARCHITECTURE_x86_64)
  164. target_sources(common
  165. PRIVATE
  166. x64/cpu_detect.cpp
  167. x64/cpu_detect.h
  168. x64/cpu_wait.cpp
  169. x64/cpu_wait.h
  170. x64/native_clock.cpp
  171. x64/native_clock.h
  172. x64/rdtsc.cpp
  173. x64/rdtsc.h
  174. x64/xbyak_abi.h
  175. x64/xbyak_util.h
  176. )
  177. target_link_libraries(common PRIVATE xbyak::xbyak)
  178. endif()
  179. if (MSVC)
  180. target_compile_definitions(common PRIVATE
  181. # The standard library doesn't provide any replacement for codecvt yet
  182. # so we can disable this deprecation warning for the time being.
  183. _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
  184. )
  185. target_compile_options(common PRIVATE
  186. /W4
  187. /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
  188. /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
  189. /we4800 # Implicit conversion from 'type' to bool. Possible information loss
  190. )
  191. else()
  192. target_compile_options(common PRIVATE
  193. $<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation>
  194. )
  195. endif()
  196. create_target_directory_groups(common)
  197. target_link_libraries(common PUBLIC Boost::context Boost::headers fmt::fmt microprofile Threads::Threads)
  198. target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle)
  199. if (ANDROID)
  200. # For ASharedMemory_create
  201. target_link_libraries(common PRIVATE android)
  202. endif()
  203. if (YUZU_USE_PRECOMPILED_HEADERS)
  204. target_precompile_headers(common PRIVATE precompiled_headers.h)
  205. endif()