Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
stenzek
GitHub Repository: stenzek/duckstation
Path: blob/master/src/core/CMakeLists.txt
4208 views
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
cdrom_subq_replacement.cpp
18
cdrom_subq_replacement.h
19
cheats.cpp
20
cheats.h
21
controller.cpp
22
controller.h
23
cpu_code_cache.cpp
24
cpu_code_cache.h
25
cpu_code_cache_private.h
26
cpu_core.cpp
27
cpu_core.h
28
cpu_core_private.h
29
cpu_disasm.cpp
30
cpu_disasm.h
31
cpu_pgxp.cpp
32
cpu_pgxp.h
33
cpu_types.cpp
34
cpu_types.h
35
ddgo_controller.cpp
36
ddgo_controller.h
37
digital_controller.cpp
38
digital_controller.h
39
dma.cpp
40
dma.h
41
fullscreen_ui.cpp
42
fullscreen_ui.h
43
game_database.cpp
44
game_database.h
45
game_list.cpp
46
game_list.h
47
gdb_server.cpp
48
gdb_server.h
49
gpu.cpp
50
gpu.h
51
gpu_backend.cpp
52
gpu_backend.h
53
gpu_commands.cpp
54
gpu_dump.cpp
55
gpu_dump.h
56
gpu_hw.cpp
57
gpu_hw.h
58
gpu_hw_shadergen.cpp
59
gpu_hw_shadergen.h
60
gpu_hw_texture_cache.cpp
61
gpu_hw_texture_cache.h
62
gpu_presenter.cpp
63
gpu_presenter.h
64
gpu_shadergen.cpp
65
gpu_shadergen.h
66
gpu_sw.cpp
67
gpu_sw.h
68
gpu_sw_rasterizer.cpp
69
gpu_sw_rasterizer.h
70
gpu_thread.cpp
71
gpu_thread.h
72
gpu_thread_commands.h
73
gpu_types.h
74
guncon.cpp
75
guncon.h
76
gte.cpp
77
gte.h
78
gte_types.h
79
host.cpp
80
host.h
81
hotkeys.cpp
82
input_types.h
83
imgui_overlays.cpp
84
imgui_overlays.h
85
interrupt_controller.cpp
86
interrupt_controller.h
87
jogcon.cpp
88
jogcon.h
89
justifier.cpp
90
justifier.h
91
mdec.cpp
92
mdec.h
93
memory_card.cpp
94
memory_card.h
95
memory_card_image.cpp
96
memory_card_image.h
97
memory_scanner.cpp
98
memory_scanner.h
99
mips_encoder.h
100
multitap.cpp
101
multitap.h
102
negcon.cpp
103
negcon.h
104
negcon_rumble.cpp
105
negcon_rumble.h
106
pad.cpp
107
pad.h
108
pcdrv.cpp
109
pcdrv.h
110
performance_counters.cpp
111
performance_counters.h
112
pio.cpp
113
pio.h
114
playstation_mouse.cpp
115
playstation_mouse.h
116
psf_loader.cpp
117
psf_loader.h
118
save_state_version.h
119
settings.cpp
120
settings.h
121
shader_cache_version.h
122
sio.cpp
123
sio.h
124
spu.cpp
125
spu.h
126
system.cpp
127
system.h
128
system_private.h
129
timers.cpp
130
timers.h
131
timing_event.cpp
132
timing_event.h
133
types.h
134
)
135
136
set(RECOMPILER_SRCS
137
cpu_recompiler.cpp
138
cpu_recompiler.h
139
)
140
141
target_precompile_headers(core PRIVATE "pch.h")
142
target_include_directories(core PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
143
target_include_directories(core PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
144
target_link_libraries(core PUBLIC Threads::Threads common util)
145
target_link_libraries(core PRIVATE xxhash imgui rapidyaml rcheevos cpuinfo::cpuinfo ZLIB::ZLIB zstd::libzstd_shared libzip::zip)
146
147
if(CPU_ARCH_X64)
148
target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1" "ENABLE_MMAP_FASTMEM=1")
149
target_sources(core PRIVATE
150
${RECOMPILER_SRCS}
151
cpu_recompiler_x64.cpp
152
cpu_recompiler_x64.h
153
)
154
target_link_libraries(core PRIVATE xbyak)
155
if(CMAKE_BUILD_TYPE MATCHES "Debug|Devel")
156
target_link_libraries(core PRIVATE zydis)
157
endif()
158
message(STATUS "Building x64 recompiler.")
159
endif()
160
if(CPU_ARCH_ARM32)
161
target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1")
162
target_sources(core PRIVATE
163
${RECOMPILER_SRCS}
164
cpu_recompiler_arm32.cpp
165
cpu_recompiler_arm32.h
166
)
167
target_link_libraries(core PUBLIC vixl)
168
message(STATUS "Building ARM32 recompiler.")
169
endif()
170
if(CPU_ARCH_ARM64)
171
target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1" "ENABLE_MMAP_FASTMEM=1")
172
target_sources(core PRIVATE
173
${RECOMPILER_SRCS}
174
cpu_recompiler_arm64.cpp
175
cpu_recompiler_arm64.h
176
)
177
target_link_libraries(core PUBLIC vixl)
178
message(STATUS "Building ARM64 recompiler.")
179
endif()
180
if(CPU_ARCH_RISCV64)
181
target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1" "ENABLE_MMAP_FASTMEM=1")
182
target_sources(core PRIVATE
183
${RECOMPILER_SRCS}
184
cpu_recompiler_riscv64.cpp
185
cpu_recompiler_riscv64.h
186
)
187
target_link_libraries(core PUBLIC biscuit::biscuit riscv-disas)
188
message(STATUS "Building RISC-V-64 recompiler.")
189
endif()
190
191
# Copy the provided data directory to the output directory. Borrowed from PCSX2.
192
function(add_resources target path basedir)
193
get_filename_component(dir ${path} DIRECTORY)
194
file(RELATIVE_PATH subdir ${basedir} ${dir})
195
if(APPLE)
196
target_sources(${target} PRIVATE ${path})
197
set_source_files_properties(${path} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/${subdir})
198
else()
199
add_custom_command(TARGET ${target} POST_BUILD
200
COMMAND "${CMAKE_COMMAND}" -E make_directory "$<TARGET_FILE_DIR:${target}>/resources/${subdir}"
201
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${path}" "$<TARGET_FILE_DIR:${target}>/resources/${subdir}")
202
endif()
203
source_group(Resources/${subdir} FILES ${path})
204
endfunction()
205
206
function(add_core_resources target)
207
add_util_resources(${target})
208
209
if(APPLE)
210
# Copy discord-rpc into the bundle
211
get_target_property(DISCORD_RPC_LIBRARY DiscordRPC::discord-rpc IMPORTED_LOCATION_RELEASE)
212
target_sources(${target} PRIVATE "${DISCORD_RPC_LIBRARY}")
213
set_source_files_properties("${DISCORD_RPC_LIBRARY}" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
214
endif()
215
216
file(GLOB_RECURSE RESOURCE_FILES ${CMAKE_SOURCE_DIR}/data/resources/*)
217
foreach(path IN LISTS RESOURCE_FILES)
218
get_filename_component(file ${path} NAME)
219
if("${file}" MATCHES "^\\.") # Don't copy macOS garbage (mainly Finder's .DS_Store files) into application
220
continue()
221
endif()
222
add_resources(${target} ${path} ${CMAKE_SOURCE_DIR}/data/resources/)
223
endforeach()
224
if(ALLOW_INSTALL)
225
install_imported_dep_library(cpuinfo::cpuinfo)
226
install_imported_dep_library(DiscordRPC::discord-rpc)
227
install_imported_dep_library(libzip::zip)
228
install(DIRECTORY "$<TARGET_FILE_DIR:${target}>/resources" DESTINATION "${CMAKE_INSTALL_BINDIR}")
229
endif()
230
231
# Linux platforms need a copy of the .desktop and icon file because Wayland stupidity.
232
# See QtHost::EarlyProcessStartup() for where this is used and why. We still need to set it when running
233
# as a Flatpak, but thankfully we don't need the extra copy.
234
if((LINUX OR BSD) AND (NOT DEFINED ENV{container}))
235
message(STATUS "Copying desktop file to resources directory.")
236
set(PACKAGING_SOURCE_DIR "${CMAKE_SOURCE_DIR}/scripts/packaging")
237
foreach(path "org.duckstation.DuckStation.desktop" "org.duckstation.DuckStation.png")
238
add_resources(${target} "${PACKAGING_SOURCE_DIR}/${path}" "${PACKAGING_SOURCE_DIR}")
239
endforeach()
240
endif()
241
endfunction()
242
243