forked from SirMangler/pcsx2
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
223 lines (209 loc) · 4.66 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# Check that people use the good file
if(NOT TOP_CMAKE_WAS_SOURCED)
message(FATAL_ERROR "
You did not 'cmake' the good CMakeLists.txt file. Use the one in the top dir.
It is advice to delete all wrongly generated cmake stuff => CMakeFiles & CMakeCache.txt")
endif(NOT TOP_CMAKE_WAS_SOURCED)
add_library(common)
# x86emitter sources
target_sources(common PRIVATE
AlignedMalloc.cpp
Assertions.cpp
Console.cpp
CrashHandler.cpp
DynamicLibrary.cpp
Error.cpp
FastJmp.cpp
FileSystem.cpp
HostSys.cpp
Image.cpp
HTTPDownloader.cpp
MemorySettingsInterface.cpp
MD5Digest.cpp
PrecompiledHeader.cpp
Perf.cpp
ProgressCallback.cpp
ReadbackSpinManager.cpp
Semaphore.cpp
SettingsWrapper.cpp
SmallString.cpp
StringUtil.cpp
TextureDecompress.cpp
Timer.cpp
WAVWriter.cpp
WindowInfo.cpp
)
# x86emitter headers
target_sources(common PRIVATE
AlignedMalloc.h
Assertions.h
boost_spsc_queue.hpp
BitUtils.h
ByteSwap.h
Console.h
CrashHandler.h
DynamicLibrary.h
Easing.h
EnumOps.h
Error.h
FPControl.h
FastJmp.h
FileSystem.h
HashCombine.h
HostSys.h
HeterogeneousContainers.h
Image.h
LRUCache.h
HeapArray.h
HTTPDownloader.h
MemorySettingsInterface.h
MD5Digest.h
MRCHelpers.h
Path.h
PrecompiledHeader.h
ProgressCallback.h
ReadbackSpinManager.h
RedtapeWilCom.h
RedtapeWindows.h
ScopedGuard.h
SettingsInterface.h
SettingsWrapper.h
SingleRegisterTypes.h
SmallString.h
StringUtil.h
Timer.h
TextureDecompress.h
Threading.h
VectorIntrin.h
WAVWriter.h
WindowInfo.h
WrappedMemCopy.h
)
if(_M_X86)
target_sources(common PRIVATE
emitter/avx.cpp
emitter/bmi.cpp
emitter/fpu.cpp
emitter/groups.cpp
emitter/jmp.cpp
emitter/legacy.cpp
emitter/legacy_sse.cpp
emitter/movs.cpp
emitter/simd.cpp
emitter/x86emitter.cpp
)
target_sources(common PRIVATE
emitter/implement/dwshift.h
emitter/implement/group1.h
emitter/implement/group2.h
emitter/implement/group3.h
emitter/implement/helpers.h
emitter/implement/incdec.h
emitter/implement/jmpcall.h
emitter/implement/movs.h
emitter/implement/simd_arithmetic.h
emitter/implement/simd_comparisons.h
emitter/implement/simd_helpers.h
emitter/implement/simd_moremovs.h
emitter/implement/simd_shufflepack.h
emitter/implement/simd_templated_helpers.h
emitter/implement/test.h
emitter/implement/xchg.h
emitter/instructions.h
emitter/internal.h
emitter/legacy_instructions.h
emitter/legacy_internal.h
emitter/legacy_types.h
emitter/x86emitter.h
emitter/x86types.h
)
endif()
if(WIN32)
enable_language(ASM_MASM)
target_sources(common PRIVATE
FastJmp.asm
HTTPDownloaderWinHTTP.cpp
HTTPDownloaderWinHTTP.h
StackWalker.cpp
StackWalker.h
Windows/WinThreads.cpp
Windows/WinHostSys.cpp
Windows/WinMisc.cpp
)
target_link_libraries(common PUBLIC
WIL::WIL
winmm
pathcch
)
elseif(APPLE)
target_sources(common PRIVATE
CocoaTools.mm
CocoaTools.h
Darwin/DarwinThreads.cpp
Darwin/DarwinMisc.cpp
Darwin/DarwinMisc.h
)
target_compile_options(common PRIVATE -fobjc-arc)
target_link_options(common PRIVATE -fobjc-link-runtime)
target_link_libraries(common PRIVATE
"-framework Foundation"
"-framework IOKit"
)
else()
target_sources(common PRIVATE
Linux/LnxHostSys.cpp
Linux/LnxThreads.cpp
Linux/LnxMisc.cpp
)
target_include_directories(common PRIVATE
${DBUS_INCLUDE_DIRS}
)
target_link_libraries(common PRIVATE
${DBUS_LINK_LIBRARIES}
X11::X11
X11::Xrandr
)
if(USE_BACKTRACE)
target_compile_definitions(common PRIVATE "HAS_LIBBACKTRACE=1")
target_link_libraries(common PRIVATE libbacktrace::libbacktrace)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
target_link_libraries(common PRIVATE cpuinfo)
endif()
endif()
set_source_files_properties(PrecompiledHeader.cpp PROPERTIES HEADER_FILE_ONLY TRUE)
if(USE_VTUNE)
target_link_libraries(common PUBLIC Vtune::Vtune)
endif()
if (USE_GCC AND CMAKE_INTERPROCEDURAL_OPTIMIZATION)
# GCC LTO doesn't work with asm statements
set_source_files_properties(FastJmp.cpp PROPERTIES COMPILE_FLAGS -fno-lto)
endif()
if(NOT WIN32)
# libcurl-based HTTPDownloader
target_sources(common PRIVATE
HTTPDownloaderCurl.cpp
HTTPDownloaderCurl.h
)
target_link_libraries(common PRIVATE
CURL::libcurl
)
endif()
target_link_libraries(common PRIVATE
${LIBC_LIBRARIES}
JPEG::JPEG
PNG::PNG
WebP::libwebp
)
target_link_libraries(common PUBLIC
fmt::fmt
fast_float
)
fixup_file_properties(common)
target_compile_features(common PUBLIC cxx_std_17)
target_include_directories(common PUBLIC ../3rdparty/include ../)
target_compile_definitions(common PUBLIC "${PCSX2_DEFS}")
target_compile_options(common PRIVATE "${PCSX2_WARNINGS}")
if(COMMAND target_precompile_headers)
target_precompile_headers(common PRIVATE PrecompiledHeader.h)
endif()