Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
stenzek
GitHub Repository: stenzek/duckstation
Path: blob/master/src/common/CMakeLists.txt
7488 views
1
add_library(common
2
align.h
3
assert.cpp
4
assert.h
5
binary_reader_writer.cpp
6
binary_reader_writer.h
7
bitfield.h
8
bitutils.h
9
bcdutils.h
10
crash_handler.cpp
11
crash_handler.h
12
dimensional_array.h
13
dynamic_library.cpp
14
dynamic_library.h
15
error.cpp
16
error.h
17
fastjmp.cpp
18
fastjmp.h
19
fifo_queue.h
20
file_system.cpp
21
file_system.h
22
gsvector.cpp
23
gsvector.h
24
gsvector_formatter.h
25
gsvector_neon.h
26
gsvector_nosimd.h
27
gsvector_sse.h
28
intrin.h
29
hash_combine.h
30
heap_array.h
31
heterogeneous_containers.h
32
layered_settings_interface.cpp
33
layered_settings_interface.h
34
log.cpp
35
log.h
36
log_channels.h
37
memmap.cpp
38
memmap.h
39
md5_digest.cpp
40
md5_digest.h
41
minizip_helpers.h
42
path.h
43
perf_scope.cpp
44
perf_scope.h
45
progress_callback.cpp
46
progress_callback.h
47
ryml_helpers.h
48
scoped_guard.h
49
settings_interface.cpp
50
settings_interface.h
51
sha1_digest.cpp
52
sha1_digest.h
53
sha256_digest.cpp
54
sha256_digest.h
55
small_string.cpp
56
small_string.h
57
string_util.cpp
58
string_util.h
59
string_pool.cpp
60
string_pool.h
61
time_helpers.h
62
thirdparty/SmallVector.cpp
63
thirdparty/SmallVector.h
64
thirdparty/aes.cpp
65
thirdparty/aes.h
66
thirdparty/usb_key_code_data.h
67
thirdparty/usb_key_code_data.inl
68
task_queue.cpp
69
task_queue.h
70
threading.cpp
71
threading.h
72
timer.cpp
73
timer.h
74
types.h
75
xorshift_prng.h
76
)
77
78
target_include_directories(common PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
79
target_link_libraries(common PUBLIC fmt Threads::Threads)
80
target_link_libraries(common PRIVATE fast_float "${CMAKE_DL_LIBS}")
81
82
if(WIN32)
83
target_sources(common PRIVATE
84
thirdparty/StackWalker.cpp
85
thirdparty/StackWalker.h
86
windows_headers.h
87
)
88
target_link_libraries(common PRIVATE OneCore.lib)
89
endif()
90
91
if(MSVC)
92
if(CPU_ARCH_X64)
93
enable_language(ASM_MASM)
94
target_sources(common PRIVATE fastjmp_x86.asm)
95
set_source_files_properties(fastjmp_x86.asm PROPERTIES COMPILE_FLAGS "/D_M_X86_64")
96
elseif(CPU_ARCH_ARM32 OR CPU_ARCH_ARM64)
97
enable_language(ASM_MARMASM)
98
target_sources(common PRIVATE fastjmp_arm.asm)
99
endif()
100
endif()
101
102
if(APPLE)
103
set(MAC_SOURCES
104
cocoa_tools.h
105
cocoa_tools.mm
106
)
107
target_sources(common PRIVATE ${MAC_SOURCES})
108
set_source_files_properties(${MAC_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
109
find_library(COCOA_LIBRARY Cocoa REQUIRED)
110
find_library(QUARTZCORE_LIBRARY QuartzCore)
111
target_link_libraries(common PRIVATE ${COCOA_LIBRARY} ${QUARTZCORE_LIBRARY})
112
endif()
113
114
if(NOT WIN32 AND NOT ANDROID AND NOT APPLE)
115
target_link_libraries(common PRIVATE libbacktrace::libbacktrace)
116
endif()
117
118
if(ANDROID)
119
target_link_libraries(common PRIVATE log)
120
endif()
121
122
if(LINUX)
123
# We need -lrt for shm_unlink
124
target_link_libraries(common PRIVATE rt)
125
endif()
126
127
# If the host size was detected, we need to set it as a macro.
128
if(DEFINED HOST_MIN_PAGE_SIZE AND DEFINED HOST_MAX_PAGE_SIZE)
129
target_compile_definitions(common PUBLIC
130
"-DMIN_HOST_PAGE_SIZE=${HOST_MIN_PAGE_SIZE}"
131
"-DMAX_HOST_PAGE_SIZE=${HOST_MAX_PAGE_SIZE}"
132
)
133
elseif(DEFINED HOST_PAGE_SIZE)
134
target_compile_definitions(common PUBLIC
135
"-DOVERRIDE_HOST_PAGE_SIZE=${HOST_PAGE_SIZE}"
136
)
137
endif()
138
if(DEFINED HOST_CACHE_LINE_SIZE)
139
target_compile_definitions(common PUBLIC
140
"-DOVERRIDE_HOST_CACHE_LINE_SIZE=${HOST_CACHE_LINE_SIZE}"
141
)
142
endif()
143
144