Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
stenzek
GitHub Repository: stenzek/duckstation
Path: blob/master/src/common/CMakeLists.txt
4208 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
thirdparty/SmallVector.cpp
60
thirdparty/SmallVector.h
61
thirdparty/aes.cpp
62
thirdparty/aes.h
63
thirdparty/usb_key_code_data.h
64
thirdparty/usb_key_code_data.inl
65
task_queue.cpp
66
task_queue.h
67
threading.cpp
68
threading.h
69
timer.cpp
70
timer.h
71
types.h
72
xorshift_prng.h
73
)
74
75
target_include_directories(common PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
76
target_include_directories(common PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
77
target_link_libraries(common PUBLIC fmt Threads::Threads fast_float)
78
target_link_libraries(common PRIVATE "${CMAKE_DL_LIBS}")
79
80
if(WIN32)
81
target_sources(common PRIVATE
82
thirdparty/StackWalker.cpp
83
thirdparty/StackWalker.h
84
windows_headers.h
85
)
86
target_link_libraries(common PRIVATE OneCore.lib)
87
endif()
88
89
if(MSVC)
90
if(CPU_ARCH_X64)
91
enable_language(ASM_MASM)
92
target_sources(common PRIVATE fastjmp_x86.asm)
93
set_source_files_properties(fastjmp_x86.asm PROPERTIES COMPILE_FLAGS "/D_M_X86_64")
94
elseif(CPU_ARCH_ARM32 OR CPU_ARCH_ARM64)
95
enable_language(ASM_MARMASM)
96
target_sources(common PRIVATE fastjmp_arm.asm)
97
endif()
98
endif()
99
100
if(APPLE)
101
set(MAC_SOURCES
102
cocoa_tools.h
103
cocoa_tools.mm
104
)
105
target_sources(common PRIVATE ${MAC_SOURCES})
106
set_source_files_properties(${MAC_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
107
find_library(COCOA_LIBRARY Cocoa REQUIRED)
108
target_link_libraries(common PRIVATE ${COCOA_LIBRARY})
109
endif()
110
111
if(NOT WIN32 AND NOT ANDROID AND NOT APPLE)
112
target_link_libraries(common PRIVATE libbacktrace::libbacktrace)
113
endif()
114
115
if(ANDROID)
116
target_link_libraries(common PRIVATE log)
117
endif()
118
119
if(LINUX)
120
# We need -lrt for shm_unlink
121
target_link_libraries(common PRIVATE rt)
122
endif()
123
124
# If the host size was detected, we need to set it as a macro.
125
if(DEFINED HOST_MIN_PAGE_SIZE AND DEFINED HOST_MAX_PAGE_SIZE)
126
target_compile_definitions(common PUBLIC
127
"-DMIN_HOST_PAGE_SIZE=${HOST_MIN_PAGE_SIZE}"
128
"-DMAX_HOST_PAGE_SIZE=${HOST_MAX_PAGE_SIZE}"
129
)
130
elseif(DEFINED HOST_PAGE_SIZE)
131
target_compile_definitions(common PUBLIC
132
"-DOVERRIDE_HOST_PAGE_SIZE=${HOST_PAGE_SIZE}"
133
)
134
endif()
135
if(DEFINED HOST_CACHE_LINE_SIZE)
136
target_compile_definitions(common PUBLIC
137
"-DOVERRIDE_HOST_CACHE_LINE_SIZE=${HOST_CACHE_LINE_SIZE}"
138
)
139
endif()
140
141