CMakeLists.txt 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. bit_cast.h
  27. bit_field.h
  28. bit_set.h
  29. bit_util.h
  30. bounded_threadsafe_queue.h
  31. cityhash.cpp
  32. cityhash.h
  33. common_funcs.h
  34. common_precompiled_headers.h
  35. common_types.h
  36. concepts.h
  37. container_hash.h
  38. demangle.cpp
  39. demangle.h
  40. detached_tasks.cpp
  41. detached_tasks.h
  42. div_ceil.h
  43. dynamic_library.cpp
  44. dynamic_library.h
  45. elf.h
  46. error.cpp
  47. error.h
  48. expected.h
  49. fiber.cpp
  50. fiber.h
  51. fixed_point.h
  52. fs/file.cpp
  53. fs/file.h
  54. fs/fs.cpp
  55. fs/fs.h
  56. fs/fs_paths.h
  57. fs/fs_types.h
  58. fs/fs_util.cpp
  59. fs/fs_util.h
  60. fs/path_util.cpp
  61. fs/path_util.h
  62. hash.h
  63. hex_util.cpp
  64. hex_util.h
  65. host_memory.cpp
  66. host_memory.h
  67. input.h
  68. intrusive_red_black_tree.h
  69. literals.h
  70. logging/backend.cpp
  71. logging/backend.h
  72. logging/filter.cpp
  73. logging/filter.h
  74. logging/formatter.h
  75. logging/log.h
  76. logging/log_entry.h
  77. logging/text_formatter.cpp
  78. logging/text_formatter.h
  79. logging/types.h
  80. lz4_compression.cpp
  81. lz4_compression.h
  82. make_unique_for_overwrite.h
  83. math_util.h
  84. memory_detect.cpp
  85. memory_detect.h
  86. microprofile.cpp
  87. microprofile.h
  88. microprofileui.h
  89. multi_level_page_table.cpp
  90. multi_level_page_table.h
  91. nvidia_flags.cpp
  92. nvidia_flags.h
  93. overflow.h
  94. page_table.cpp
  95. page_table.h
  96. param_package.cpp
  97. param_package.h
  98. parent_of_member.h
  99. point.h
  100. precompiled_headers.h
  101. quaternion.h
  102. range_map.h
  103. reader_writer_queue.h
  104. ring_buffer.h
  105. ${CMAKE_CURRENT_BINARY_DIR}/scm_rev.cpp
  106. scm_rev.h
  107. scope_exit.h
  108. scratch_buffer.h
  109. settings.cpp
  110. settings.h
  111. settings_common.cpp
  112. settings_common.h
  113. settings_enums.h
  114. settings_input.cpp
  115. settings_input.h
  116. settings_setting.h
  117. socket_types.h
  118. spin_lock.cpp
  119. spin_lock.h
  120. steady_clock.cpp
  121. steady_clock.h
  122. stream.cpp
  123. stream.h
  124. string_util.cpp
  125. string_util.h
  126. swap.h
  127. telemetry.cpp
  128. telemetry.h
  129. thread.cpp
  130. thread.h
  131. thread_queue_list.h
  132. thread_worker.h
  133. threadsafe_queue.h
  134. time_zone.cpp
  135. time_zone.h
  136. tiny_mt.h
  137. tree.h
  138. typed_address.h
  139. uint128.h
  140. unique_function.h
  141. uuid.cpp
  142. uuid.h
  143. vector_math.h
  144. virtual_buffer.cpp
  145. virtual_buffer.h
  146. wall_clock.cpp
  147. wall_clock.h
  148. zstd_compression.cpp
  149. zstd_compression.h
  150. )
  151. if (YUZU_ENABLE_PORTABLE)
  152. add_compile_definitions(YUZU_ENABLE_PORTABLE)
  153. endif()
  154. if (WIN32)
  155. target_sources(common PRIVATE
  156. windows/timer_resolution.cpp
  157. windows/timer_resolution.h
  158. )
  159. target_link_libraries(common PRIVATE ntdll)
  160. endif()
  161. if(ANDROID)
  162. target_sources(common
  163. PRIVATE
  164. fs/fs_android.cpp
  165. fs/fs_android.h
  166. )
  167. endif()
  168. if(ARCHITECTURE_x86_64)
  169. target_sources(common
  170. PRIVATE
  171. x64/cpu_detect.cpp
  172. x64/cpu_detect.h
  173. x64/cpu_wait.cpp
  174. x64/cpu_wait.h
  175. x64/native_clock.cpp
  176. x64/native_clock.h
  177. x64/rdtsc.cpp
  178. x64/rdtsc.h
  179. x64/xbyak_abi.h
  180. x64/xbyak_util.h
  181. )
  182. target_link_libraries(common PRIVATE xbyak::xbyak)
  183. endif()
  184. if (ARCHITECTURE_arm64 AND (ANDROID OR LINUX))
  185. target_sources(common
  186. PRIVATE
  187. arm64/native_clock.cpp
  188. arm64/native_clock.h
  189. )
  190. endif()
  191. if (MSVC)
  192. target_compile_definitions(common PRIVATE
  193. # The standard library doesn't provide any replacement for codecvt yet
  194. # so we can disable this deprecation warning for the time being.
  195. _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
  196. )
  197. target_compile_options(common PRIVATE
  198. /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
  199. /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
  200. /we4800 # Implicit conversion from 'type' to bool. Possible information loss
  201. )
  202. endif()
  203. if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  204. target_compile_options(common PRIVATE
  205. -fsized-deallocation
  206. -Werror=unreachable-code-aggressive
  207. )
  208. target_compile_definitions(common PRIVATE
  209. # Clang 14 and earlier have errors when explicitly instantiating Settings::Setting
  210. $<$<VERSION_LESS:$<CXX_COMPILER_VERSION>,15>:CANNOT_EXPLICITLY_INSTANTIATE>
  211. )
  212. endif()
  213. create_target_directory_groups(common)
  214. target_link_libraries(common PUBLIC Boost::context Boost::headers fmt::fmt microprofile Threads::Threads)
  215. target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle)
  216. if (ANDROID)
  217. # For ASharedMemory_create
  218. target_link_libraries(common PRIVATE android)
  219. endif()
  220. if (YUZU_USE_PRECOMPILED_HEADERS)
  221. target_precompile_headers(common PRIVATE precompiled_headers.h)
  222. endif()