CMakeLists.txt 5.6 KB

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