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