CMakeLists.txt 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. free_region_manager.h
  53. fs/file.cpp
  54. fs/file.h
  55. fs/fs.cpp
  56. fs/fs.h
  57. fs/fs_paths.h
  58. fs/fs_types.h
  59. fs/fs_util.cpp
  60. fs/fs_util.h
  61. fs/path_util.cpp
  62. fs/path_util.h
  63. hash.h
  64. heap_tracker.cpp
  65. heap_tracker.h
  66. hex_util.cpp
  67. hex_util.h
  68. host_memory.cpp
  69. host_memory.h
  70. input.h
  71. intrusive_red_black_tree.h
  72. literals.h
  73. logging/backend.cpp
  74. logging/backend.h
  75. logging/filter.cpp
  76. logging/filter.h
  77. logging/formatter.h
  78. logging/log.h
  79. logging/log_entry.h
  80. logging/text_formatter.cpp
  81. logging/text_formatter.h
  82. logging/types.h
  83. lz4_compression.cpp
  84. lz4_compression.h
  85. make_unique_for_overwrite.h
  86. math_util.h
  87. memory_detect.cpp
  88. memory_detect.h
  89. microprofile.cpp
  90. microprofile.h
  91. microprofileui.h
  92. multi_level_page_table.cpp
  93. multi_level_page_table.h
  94. nvidia_flags.cpp
  95. nvidia_flags.h
  96. overflow.h
  97. page_table.cpp
  98. page_table.h
  99. param_package.cpp
  100. param_package.h
  101. parent_of_member.h
  102. point.h
  103. precompiled_headers.h
  104. quaternion.h
  105. range_map.h
  106. range_mutex.h
  107. reader_writer_queue.h
  108. ring_buffer.h
  109. ${CMAKE_CURRENT_BINARY_DIR}/scm_rev.cpp
  110. scm_rev.h
  111. scope_exit.h
  112. scratch_buffer.h
  113. settings.cpp
  114. settings.h
  115. settings_common.cpp
  116. settings_common.h
  117. settings_enums.h
  118. settings_input.cpp
  119. settings_input.h
  120. settings_setting.h
  121. socket_types.h
  122. spin_lock.cpp
  123. spin_lock.h
  124. stb.cpp
  125. stb.h
  126. steady_clock.cpp
  127. steady_clock.h
  128. stream.cpp
  129. stream.h
  130. string_util.cpp
  131. string_util.h
  132. swap.h
  133. telemetry.cpp
  134. telemetry.h
  135. thread.cpp
  136. thread.h
  137. thread_queue_list.h
  138. thread_worker.h
  139. threadsafe_queue.h
  140. time_zone.cpp
  141. time_zone.h
  142. tiny_mt.h
  143. tree.h
  144. typed_address.h
  145. uint128.h
  146. unique_function.h
  147. uuid.cpp
  148. uuid.h
  149. vector_math.h
  150. virtual_buffer.cpp
  151. virtual_buffer.h
  152. wall_clock.cpp
  153. wall_clock.h
  154. zstd_compression.cpp
  155. zstd_compression.h
  156. )
  157. if (YUZU_ENABLE_PORTABLE)
  158. add_compile_definitions(YUZU_ENABLE_PORTABLE)
  159. endif()
  160. if (WIN32)
  161. target_sources(common PRIVATE
  162. windows/timer_resolution.cpp
  163. windows/timer_resolution.h
  164. )
  165. target_link_libraries(common PRIVATE ntdll)
  166. endif()
  167. if (NOT WIN32)
  168. target_sources(common PRIVATE
  169. signal_chain.cpp
  170. signal_chain.h
  171. )
  172. endif()
  173. if(ANDROID)
  174. target_sources(common
  175. PUBLIC
  176. fs/fs_android.cpp
  177. fs/fs_android.h
  178. android/android_common.cpp
  179. android/android_common.h
  180. android/id_cache.cpp
  181. android/id_cache.h
  182. android/applets/software_keyboard.cpp
  183. android/applets/software_keyboard.h
  184. )
  185. endif()
  186. if (UNIX AND NOT APPLE)
  187. target_sources(common PRIVATE
  188. linux/gamemode.cpp
  189. linux/gamemode.h
  190. )
  191. target_link_libraries(common PRIVATE gamemode::headers)
  192. endif()
  193. if(ARCHITECTURE_x86_64)
  194. target_sources(common
  195. PRIVATE
  196. x64/cpu_detect.cpp
  197. x64/cpu_detect.h
  198. x64/cpu_wait.cpp
  199. x64/cpu_wait.h
  200. x64/native_clock.cpp
  201. x64/native_clock.h
  202. x64/rdtsc.cpp
  203. x64/rdtsc.h
  204. x64/xbyak_abi.h
  205. x64/xbyak_util.h
  206. )
  207. target_link_libraries(common PRIVATE xbyak::xbyak)
  208. endif()
  209. if (HAS_NCE)
  210. target_sources(common
  211. PRIVATE
  212. arm64/native_clock.cpp
  213. arm64/native_clock.h
  214. )
  215. endif()
  216. if (MSVC)
  217. target_compile_definitions(common PRIVATE
  218. # The standard library doesn't provide any replacement for codecvt yet
  219. # so we can disable this deprecation warning for the time being.
  220. _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
  221. )
  222. target_compile_options(common PRIVATE
  223. /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
  224. /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
  225. /we4800 # Implicit conversion from 'type' to bool. Possible information loss
  226. )
  227. else()
  228. set_source_files_properties(stb.cpp PROPERTIES COMPILE_OPTIONS "-Wno-implicit-fallthrough;-Wno-missing-declarations;-Wno-missing-field-initializers")
  229. endif()
  230. if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  231. target_compile_options(common PRIVATE
  232. -fsized-deallocation
  233. -Werror=unreachable-code-aggressive
  234. )
  235. target_compile_definitions(common PRIVATE
  236. # Clang 14 and earlier have errors when explicitly instantiating Settings::Setting
  237. $<$<VERSION_LESS:$<CXX_COMPILER_VERSION>,15>:CANNOT_EXPLICITLY_INSTANTIATE>
  238. )
  239. endif()
  240. target_link_libraries(common PUBLIC Boost::context Boost::headers fmt::fmt microprofile stb::headers Threads::Threads)
  241. target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle)
  242. if (ANDROID)
  243. # For ASharedMemory_create
  244. target_link_libraries(common PRIVATE android)
  245. endif()
  246. if (YUZU_USE_PRECOMPILED_HEADERS)
  247. target_precompile_headers(common PRIVATE precompiled_headers.h)
  248. endif()
  249. create_target_directory_groups(common)