]> git.proxmox.com Git - ceph.git/blame - ceph/src/common/CMakeLists.txt
import ceph 16.2.7
[ceph.git] / ceph / src / common / CMakeLists.txt
CommitLineData
11fdf7f2
TL
1add_library(common_buffer_obj OBJECT
2 buffer.cc)
3
4add_library(common_texttable_obj OBJECT
5 TextTable.cc)
6
eafe8130
TL
7add_library(common_prioritycache_obj OBJECT
8 PriorityCache.cc)
9
f67539c2
TL
10if(WIN32)
11 add_library(dlfcn_win32 STATIC win32/dlfcn.cc win32/errno.cc)
12endif()
13
11fdf7f2
TL
14set(common_srcs
15 AsyncOpTracker.cc
16 BackTrace.cc
17 ConfUtils.cc
18 Cycles.cc
f67539c2 19 CDC.cc
11fdf7f2 20 DecayCounter.cc
f67539c2 21 FastCDC.cc
11fdf7f2 22 Finisher.cc
f67539c2 23 FixedCDC.cc
11fdf7f2
TL
24 Formatter.cc
25 Graylog.cc
26 HTMLFormatter.cc
27 HeartbeatMap.cc
28 LogClient.cc
29 LogEntry.cc
9f95a23c 30 ostream_temp.cc
11fdf7f2
TL
31 OutputDataSocket.cc
32 PluginRegistry.cc
11fdf7f2 33 Readahead.cc
9f95a23c 34 RefCountedObj.cc
11fdf7f2 35 SloppyCRCMap.cc
11fdf7f2
TL
36 Thread.cc
37 Throttle.cc
38 Timer.cc
39 TracepointProvider.cc
40 TrackedOp.cc
41 WorkQueue.cc
11fdf7f2
TL
42 admin_socket.cc
43 admin_socket_client.cc
44 assert.cc
45 bit_str.cc
11fdf7f2
TL
46 bloom_filter.cc
47 ceph_argparse.cc
48 ceph_context.cc
49 ceph_crypto.cc
11fdf7f2
TL
50 ceph_frag.cc
51 ceph_fs.cc
52 ceph_hash.cc
53 ceph_json.cc
54 ceph_strings.cc
9f95a23c 55 ceph_releases.cc
11fdf7f2
TL
56 ceph_time.cc
57 cmdparse.cc
58 code_environment.cc
59 common_init.cc
60 compat.cc
61 condition_variable_debug.cc
62 config.cc
63 config_values.cc
11fdf7f2
TL
64 dout.cc
65 entity_name.cc
66 environment.cc
67 errno.cc
68 escape.cc
69 fd.cc
70 fs_types.cc
71 hex.cc
72 histogram.cc
73 hobject.cc
74 hostname.cc
75 ipaddr.cc
76 iso_8601.cc
11fdf7f2
TL
77 lockdep.cc
78 mempool.cc
79 mime.c
80 mutex_debug.cc
81 numa.cc
f67539c2 82 openssl_opts_handler.cc
11fdf7f2
TL
83 options.cc
84 page.cc
85 perf_counters.cc
86 perf_counters_collection.cc
87 perf_histogram.cc
88 pick_address.cc
9f95a23c 89 random_string.cc
11fdf7f2
TL
90 reverse.c
91 run_cmd.cc
92 scrub_types.cc
93 shared_mutex_debug.cc
94 signal.cc
95 snap_types.cc
96 str_list.cc
97 str_map.cc
98 strtol.cc
99 types.cc
100 url_escape.cc
f67539c2 101 pretty_binary.cc
11fdf7f2
TL
102 utf8.c
103 util.cc
9f95a23c 104 version.cc)
11fdf7f2 105
f67539c2
TL
106if(WIN32)
107 if(MINGW)
108 set(CMAKE_MC_COMPILER x86_64-w64-mingw32-windmc)
109 set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
110 endif()
111
112 add_custom_command(
113 OUTPUT ${CMAKE_BINARY_DIR}/src/common/event_logging.h
114 COMMAND ${CMAKE_MC_COMPILER} -b -e h -h ${CMAKE_BINARY_DIR}/src/common/
115 -r ${CMAKE_BINARY_DIR}/src/common ${CMAKE_SOURCE_DIR}/src/common/win32/event_logging.mc
116 COMMAND ${CMAKE_RC_COMPILER} ${CMAKE_BINARY_DIR}/src/common/event_logging.rc
117 -o ${CMAKE_BINARY_DIR}/src/common/event_logging.o
118 COMMAND ${CMAKE_CXX_COMPILER} -o ${CMAKE_BINARY_DIR}/bin/event_logging.dll -shared
119 ${CMAKE_BINARY_DIR}/src/common/event_logging.o
120 DEPENDS ${CMAKE_SOURCE_DIR}/src/common/win32/event_logging.mc)
121
122 set_source_files_properties(${CMAKE_SOURCE_DIR}/src/common/win32/syslog.cc
123 APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/src/common/event_logging.h)
124
125 include_directories(SYSTEM "${CMAKE_BINARY_DIR}/src/common/")
126
127 list(APPEND common_srcs
128 win32/blkdev.cc
129 win32/dns_resolve.cc
130 win32/ifaddrs.cc
131 win32/registry.cc
132 win32/service.cc
133 win32/SubProcess.cc
134 win32/syslog.cc)
135else()
136 list(APPEND common_srcs
137 blkdev.cc
138 dns_resolve.cc
139 linux_version.c
140 SubProcess.cc)
141endif()
142
11fdf7f2
TL
143set_source_files_properties(${CMAKE_SOURCE_DIR}/src/common/version.cc
144 APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h)
145
146if(HAS_VTA)
147 set_source_files_properties(
148 config.cc
149 options.cc
150 PROPERTIES COMPILE_FLAGS -fno-var-tracking-assignments)
151endif()
152
153if(FREEBSD)
154 list(APPEND common_srcs freebsd_errno.cc)
155elseif(APPLE)
156 list(APPEND common_srcs darwin_errno.cc)
157elseif(SUN)
158 list(APPEND common_srcs solaris_errno.cc)
159elseif(AIX)
160 list(APPEND common_srcs aix_errno.cc)
f67539c2
TL
161elseif(WIN32)
162 list(APPEND common_srcs win32/errno.cc)
11fdf7f2
TL
163endif()
164
9f95a23c 165if(WITH_EVENTTRACE)
11fdf7f2
TL
166 list(APPEND common_srcs EventTrace.cc)
167endif()
168
169add_library(common-common-objs OBJECT
170 ${common_srcs})
9f95a23c
TL
171# Let's not rely on the default system headers and point Cmake to the
172# retrieved OpenSSL location. This is especially important when cross
173# compiling (e.g. targeting Windows).
174target_include_directories(common-common-objs PRIVATE ${OPENSSL_INCLUDE_DIR})
11fdf7f2
TL
175# for options.cc
176target_compile_definitions(common-common-objs PRIVATE
177 "CEPH_LIBDIR=\"${CMAKE_INSTALL_FULL_LIBDIR}\""
178 "CEPH_PKGLIBDIR=\"${CEPH_INSTALL_FULL_PKGLIBDIR}\""
179 "CEPH_DATADIR=\"${CEPH_INSTALL_DATADIR}\"")
522d829b 180compile_with_fmt(common-common-objs)
11fdf7f2
TL
181
182set(common_mountcephfs_srcs
183 armor.c
184 safe_io.c
185 module.c
186 addr_parsing.c)
187add_library(common_mountcephfs_objs OBJECT
188 ${common_mountcephfs_srcs})
189
190
191set(crc32_srcs
192 crc32c.cc
193 crc32c_intel_baseline.c
194 sctp_crc32.c)
11fdf7f2
TL
195if(HAVE_INTEL)
196 list(APPEND crc32_srcs
197 crc32c_intel_fast.c)
f67539c2
TL
198 if(HAVE_NASM_X64)
199 set(CMAKE_ASM_FLAGS "-i ${PROJECT_SOURCE_DIR}/src/isa-l/include/ ${CMAKE_ASM_FLAGS}")
11fdf7f2 200 list(APPEND crc32_srcs
f67539c2 201 ${PROJECT_SOURCE_DIR}/src/isa-l/crc/crc32_iscsi_00.asm
11fdf7f2 202 crc32c_intel_fast_zero_asm.s)
f67539c2 203 endif(HAVE_NASM_X64)
11fdf7f2
TL
204elseif(HAVE_POWER8)
205 list(APPEND crc32_srcs
206 crc32c_ppc.c)
207 if(HAVE_PPC64LE)
208 list(APPEND crc32_srcs
209 crc32c_ppc_asm.S
210 crc32c_ppc_fast_zero_asm.S)
211 endif(HAVE_PPC64LE)
212elseif(HAVE_ARMV8_CRC)
213 list(APPEND crc32_srcs
214 crc32c_aarch64.c)
215endif(HAVE_INTEL)
216
522d829b 217add_library(crc32 STATIC ${crc32_srcs})
11fdf7f2
TL
218if(HAVE_ARMV8_CRC)
219 set_target_properties(crc32 PROPERTIES
220 COMPILE_FLAGS "${CMAKE_C_FLAGS} ${ARMV8_CRC_COMPILE_FLAGS}")
221endif()
222target_link_libraries(crc32
223 arch)
224
225add_library(common_utf8 STATIC utf8.c)
226
eafe8130 227if(HAVE_KEYUTILS)
11fdf7f2
TL
228 set(parse_secret_srcs
229 secret.c)
230 add_library(parse_secret_objs OBJECT ${parse_secret_srcs})
231endif()