Skip to content

Commit 5e51bc4

Browse files
committed
cmake: targets against legacy-option-headers when appropriate
legacy-option-headers provides the headers included by `src/common/options/legacy_config_opts.h`. these headers are generated from corresponding .yaml.in file. because these headers file are generated at build time, we need to construct the file-level dependencies between the targets using them and these headers, otherwise the compiler could fail to compile the tree if any of the headers are not generated yet, when compiling .cc file which (indirectly) includes it. in order to address this, in this change, we 1. search for all .cc files which have `#include "common/config.h"` in it 2. and find out the targets building the .cc file, then 3. add `legacy-option-headers` to its linkage using CMake this should partially address the above race condition we've been running into on slow build hosts. because we have not audited the .h files including `common/config.h`, this change should be considered a partial fix. Signed-off-by: Kefu Chai <[email protected]>
1 parent c24a6ff commit 5e51bc4

File tree

17 files changed

+50
-13
lines changed

17 files changed

+50
-13
lines changed

src/client/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ set(libclient_srcs
1010
posix_acl.cc
1111
Delegation.cc)
1212
add_library(client STATIC ${libclient_srcs})
13-
target_link_libraries(client osdc)
13+
target_link_libraries(client
14+
legacy-option-headers
15+
osdc)

src/compressor/lz4/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ set(lz4_sources
77

88
add_library(ceph_lz4 SHARED ${lz4_sources})
99
target_link_libraries(ceph_lz4
10-
PRIVATE LZ4::LZ4 compressor $<$<PLATFORM_ID:Windows>:ceph-common>)
10+
PRIVATE
11+
legacy-option-headers
12+
LZ4::LZ4 compressor $<$<PLATFORM_ID:Windows>:ceph-common>)
1113
if(HAVE_QATZIP AND HAVE_QAT)
1214
target_link_libraries(ceph_lz4 PRIVATE qat_compressor)
1315
endif()

src/compressor/snappy/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ set(snappy_sources
66

77
add_library(ceph_snappy SHARED ${snappy_sources})
88
target_link_libraries(ceph_snappy
9-
PRIVATE snappy::snappy compressor $<$<PLATFORM_ID:Windows>:ceph-common>)
9+
PRIVATE
10+
legacy-option-headers
11+
snappy::snappy compressor $<$<PLATFORM_ID:Windows>:ceph-common>)
1012
set_target_properties(ceph_snappy PROPERTIES
1113
VERSION 2.0.0
1214
SOVERSION 2

src/crimson/osd/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ if(HAS_VTA)
6363
PROPERTIES COMPILE_FLAGS -fno-var-tracking-assignments)
6464
endif()
6565
target_link_libraries(crimson-osd
66+
legacy-option-headers
6667
crimson-admin
6768
crimson-common
6869
crimson-os

src/dokan/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set(ceph_dokan_srcs
77
add_executable(ceph-dokan ${ceph_dokan_srcs})
88
target_link_libraries(ceph-dokan ${DOKAN_LIBRARIES}
99
${GSSAPI_LIBRARIES}
10+
legacy-option-headers
1011
cephfs ceph-common global ${EXTRALIBS})
1112
set_target_properties(ceph-dokan PROPERTIES
1213
COMPILE_FLAGS "-I${DOKAN_INCLUDE_DIRS}")

src/librados/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ add_library(librados_impl STATIC
44
RadosClient.cc
55
librados_util.cc
66
librados_tp.cc)
7-
7+
target_link_libraries(librados_impl
8+
PRIVATE legacy-option-headers)
89
# C/C++ API
910
add_library(librados ${CEPH_SHARED}
1011
librados_c.cc

src/mds/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,6 @@ set(mds_srcs
5252
${CMAKE_SOURCE_DIR}/src/mgr/MDSPerfMetricTypes.cc)
5353
add_library(mds STATIC ${mds_srcs})
5454
target_link_libraries(mds PRIVATE
55+
legacy-option-headers
5556
heap_profiler cpu_profiler osdc ${LUA_LIBRARIES})
5657
target_include_directories(mds PRIVATE "${LUA_INCLUDE_DIR}")

src/mon/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ endif()
3838
add_library(mon STATIC
3939
${lib_mon_srcs})
4040
target_link_libraries(mon
41+
legacy-option-headers
4142
kv
4243
heap_profiler
4344
${FMT_LIB})

src/msg/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ add_library(common-msg-objs OBJECT ${msg_srcs})
4848
target_compile_definitions(common-msg-objs PRIVATE
4949
$<TARGET_PROPERTY:${FMT_LIB},INTERFACE_COMPILE_DEFINITIONS>)
5050
target_include_directories(common-msg-objs PRIVATE ${OPENSSL_INCLUDE_DIR})
51+
target_link_libraries(common-msg-objs
52+
PUBLIC
53+
legacy-option-headers)
5154

5255
if(WITH_DPDK)
5356
set(async_dpdk_srcs

src/os/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ if(HAVE_LIBZFS)
4747
endif()
4848

4949
add_library(os STATIC ${libos_srcs})
50-
target_link_libraries(os blk)
50+
target_link_libraries(os
51+
legacy-option-headers
52+
blk)
5153

5254
target_link_libraries(os heap_profiler kv)
5355

0 commit comments

Comments
 (0)