CMakeLists.txt (5953B)
1 add_library(core 2 achievements.cpp 3 achievements.h 4 achievements_private.h 5 analog_controller.cpp 6 analog_controller.h 7 analog_joystick.cpp 8 analog_joystick.h 9 bios.cpp 10 bios.h 11 bus.cpp 12 bus.h 13 cdrom.cpp 14 cdrom.h 15 cdrom_async_reader.cpp 16 cdrom_async_reader.h 17 cheats.cpp 18 cheats.h 19 controller.cpp 20 controller.h 21 cpu_code_cache.cpp 22 cpu_code_cache.h 23 cpu_code_cache_private.h 24 cpu_core.cpp 25 cpu_core.h 26 cpu_core_private.h 27 cpu_disasm.cpp 28 cpu_disasm.h 29 cpu_pgxp.cpp 30 cpu_pgxp.h 31 cpu_types.cpp 32 cpu_types.h 33 digital_controller.cpp 34 digital_controller.h 35 dma.cpp 36 dma.h 37 fullscreen_ui.cpp 38 fullscreen_ui.h 39 game_database.cpp 40 game_database.h 41 game_list.cpp 42 game_list.h 43 gdb_server.cpp 44 gdb_server.h 45 gpu.cpp 46 gpu.h 47 gpu_backend.cpp 48 gpu_backend.h 49 gpu_commands.cpp 50 gpu_hw.cpp 51 gpu_hw.h 52 gpu_hw_shadergen.cpp 53 gpu_hw_shadergen.h 54 gpu_shadergen.cpp 55 gpu_shadergen.h 56 gpu_sw.cpp 57 gpu_sw.h 58 gpu_sw_backend.cpp 59 gpu_sw_backend.h 60 gpu_types.h 61 guncon.cpp 62 guncon.h 63 gte.cpp 64 gte.h 65 gte_types.h 66 host.cpp 67 host.h 68 host_interface_progress_callback.cpp 69 host_interface_progress_callback.h 70 hotkeys.cpp 71 input_types.h 72 imgui_overlays.cpp 73 imgui_overlays.h 74 interrupt_controller.cpp 75 interrupt_controller.h 76 justifier.cpp 77 justifier.h 78 mdec.cpp 79 mdec.h 80 memory_card.cpp 81 memory_card.h 82 memory_card_image.cpp 83 memory_card_image.h 84 mips_encoder.h 85 multitap.cpp 86 multitap.h 87 negcon.cpp 88 negcon.h 89 negcon_rumble.cpp 90 negcon_rumble.h 91 pad.cpp 92 pad.h 93 pcdrv.cpp 94 pcdrv.h 95 pine_server.cpp 96 pine_server.h 97 playstation_mouse.cpp 98 playstation_mouse.h 99 psf_loader.cpp 100 psf_loader.h 101 save_state_version.h 102 settings.cpp 103 settings.h 104 shader_cache_version.h 105 sio.cpp 106 sio.h 107 spu.cpp 108 spu.h 109 system.cpp 110 system.h 111 texture_replacements.cpp 112 texture_replacements.h 113 timers.cpp 114 timers.h 115 timing_event.cpp 116 timing_event.h 117 types.h 118 ) 119 120 set(RECOMPILER_SRCS 121 cpu_recompiler_code_generator.cpp 122 cpu_recompiler_code_generator.h 123 cpu_recompiler_code_generator_generic.cpp 124 cpu_recompiler_register_cache.cpp 125 cpu_recompiler_register_cache.h 126 cpu_recompiler_thunks.h 127 cpu_recompiler_types.h 128 ) 129 130 set(NEWREC_SOURCES 131 cpu_newrec_compiler.cpp 132 cpu_newrec_compiler.h 133 ) 134 135 target_precompile_headers(core PRIVATE "pch.h") 136 target_include_directories(core PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..") 137 target_include_directories(core PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..") 138 target_link_libraries(core PUBLIC Threads::Threads common util) 139 target_link_libraries(core PRIVATE xxhash imgui rapidyaml rcheevos cpuinfo::cpuinfo ZLIB::ZLIB Zstd::Zstd) 140 141 if(CPU_ARCH_X64) 142 target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1" "ENABLE_NEWREC=1" "ENABLE_MMAP_FASTMEM=1") 143 target_sources(core PRIVATE ${RECOMPILER_SRCS} ${NEWREC_SOURCES} 144 cpu_recompiler_code_generator_x64.cpp 145 cpu_newrec_compiler_x64.cpp 146 cpu_newrec_compiler_x64.h 147 ) 148 target_link_libraries(core PRIVATE xbyak) 149 if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") 150 target_link_libraries(core PRIVATE zydis) 151 endif() 152 message(STATUS "Building x64 recompiler.") 153 endif() 154 if(CPU_ARCH_ARM32) 155 target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1" "ENABLE_NEWREC=1") 156 target_sources(core PRIVATE ${RECOMPILER_SRCS} ${NEWREC_SOURCES} 157 cpu_recompiler_code_generator_aarch32.cpp 158 cpu_newrec_compiler_aarch32.cpp 159 cpu_newrec_compiler_aarch32.h 160 ) 161 target_link_libraries(core PUBLIC vixl) 162 message(STATUS "Building AArch32 recompiler.") 163 endif() 164 if(CPU_ARCH_ARM64) 165 target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1" "ENABLE_NEWREC=1" "ENABLE_MMAP_FASTMEM=1") 166 target_sources(core PRIVATE ${RECOMPILER_SRCS} ${NEWREC_SOURCES} 167 cpu_recompiler_code_generator_aarch64.cpp 168 cpu_newrec_compiler_aarch64.cpp 169 cpu_newrec_compiler_aarch64.h 170 ) 171 target_link_libraries(core PUBLIC vixl) 172 message(STATUS "Building AArch64 recompiler.") 173 endif() 174 if(CPU_ARCH_RISCV64) 175 target_compile_definitions(core PUBLIC "ENABLE_NEWREC=1" "ENABLE_MMAP_FASTMEM=1") 176 target_sources(core PRIVATE ${NEWREC_SOURCES} 177 cpu_newrec_compiler_riscv64.cpp 178 cpu_newrec_compiler_riscv64.h 179 ) 180 target_link_libraries(core PUBLIC biscuit::biscuit riscv-disas) 181 message(STATUS "Building RISC-V 64-bit recompiler.") 182 endif() 183 184 # Copy the provided data directory to the output directory. Borrowed from PCSX2. 185 function(add_resources target path basedir) 186 get_filename_component(dir ${path} DIRECTORY) 187 file(RELATIVE_PATH subdir ${basedir} ${dir}) 188 if(APPLE) 189 target_sources(${target} PRIVATE ${path}) 190 set_source_files_properties(${path} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/${subdir}) 191 else() 192 add_custom_command(TARGET ${target} POST_BUILD 193 COMMAND "${CMAKE_COMMAND}" -E make_directory "$<TARGET_FILE_DIR:${target}>/resources/${subdir}" 194 COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${path}" "$<TARGET_FILE_DIR:${target}>/resources/${subdir}") 195 endif() 196 source_group(Resources/${subdir} FILES ${path}) 197 endfunction() 198 199 function(add_core_resources target) 200 add_util_resources(${target}) 201 202 if(APPLE) 203 # Copy discord-rpc into the bundle 204 get_target_property(DISCORD_RPC_LIBRARY DiscordRPC::discord-rpc IMPORTED_LOCATION_RELEASE) 205 target_sources(${target} PRIVATE "${DISCORD_RPC_LIBRARY}") 206 set_source_files_properties("${DISCORD_RPC_LIBRARY}" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks) 207 endif() 208 209 file(GLOB_RECURSE RESOURCE_FILES ${CMAKE_SOURCE_DIR}/data/resources/*) 210 foreach(path IN LISTS RESOURCE_FILES) 211 get_filename_component(file ${path} NAME) 212 if("${file}" MATCHES "^\\.") # Don't copy macOS garbage (mainly Finder's .DS_Store files) into application 213 continue() 214 endif() 215 add_resources(${target} ${path} ${CMAKE_SOURCE_DIR}/data/resources/) 216 endforeach() 217 if(ALLOW_INSTALL) 218 install_imported_dep_library(cpuinfo::cpuinfo) 219 install(DIRECTORY "$<TARGET_FILE_DIR:${target}>/resources" DESTINATION "${CMAKE_INSTALL_PREFIX}") 220 endif() 221 endfunction()