Skip to content

Commit bdf5f05

Browse files
pass clang for macro
1 parent 0c3d438 commit bdf5f05

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

‎build.h.in‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,23 @@
66

77
// Version injected by CMake (CI should set it). Defaults to 0.0.0 for dev builds.
88
#define LIVEKIT_BUILD_VERSION "@LIVEKIT_VERSION@"
9-
#define LIVEKIT_BUILD_FLAVOR "cpp"
10-
#define LIVEKIT_CAPTURE_ENABLED @LIVEKIT_CAPTURE_ENABLED@
9+
#define LIVEKIT_BUILD_FLAVOR "cpp"
10+
11+
namespace livekit {
12+
13+
/// @brief Whether the Rust FFI was built with capture-source support.
14+
inline constexpr bool kCaptureEnabled = "@LIVEKIT_CAPTURE_ENABLED@"[0] == '1';
15+
16+
} // namespace livekit
1117

1218
#ifdef DEBUG
13-
#define LIVEKIT_BUILD_SUFFIX "-debug"
19+
#define LIVEKIT_BUILD_SUFFIX "-debug"
1420
#else
15-
#define LIVEKIT_BUILD_SUFFIX "-release"
21+
#define LIVEKIT_BUILD_SUFFIX "-release"
1622
#endif
1723

1824
// Follow params are auto generated by CMakeLists.txt
19-
#define LIVEKIT_BUILD_DATE "@BUILD_DATE@"
25+
#define LIVEKIT_BUILD_DATE "@BUILD_DATE@"
2026
#define LIVEKIT_BUILD_COMMIT "@GIT_COMMIT@"
2127

2228
#define LIVEKIT_BUILD_VERSION_FULL LIVEKIT_BUILD_VERSION LIVEKIT_BUILD_SUFFIX

‎src/tests/integration/test_capture_source.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ constexpr std::uint32_t kCaptureFramerateFps = 30;
5151
/// Skips the calling test when the FFI library was built without the capture
5252
/// feature. A feature-less FFI reports only a generic invalid handle, so this
5353
/// has to be decided at compile time rather than sniffed from an error string.
54-
#if LIVEKIT_CAPTURE_ENABLED
55-
#define SKIP_WITHOUT_CAPTURE_FEATURE() ((void)0)
56-
#else
57-
#define SKIP_WITHOUT_CAPTURE_FEATURE() \
58-
GTEST_SKIP() << "livekit-ffi built without the 'capture' feature; configure with -DLIVEKIT_ENABLE_CAPTURE=ON"
59-
#endif
54+
#define SKIP_WITHOUT_CAPTURE_FEATURE() \
55+
do { \
56+
if constexpr (!kCaptureEnabled) { \
57+
GTEST_SKIP() << "livekit-ffi built without the 'capture' feature; configure with -DLIVEKIT_ENABLE_CAPTURE=ON"; \
58+
} \
59+
} while (false)
6060

6161
std::shared_ptr<CaptureSource> createPatternCapture() {
6262
PatternVideoSourceConfig config;

0 commit comments

Comments
 (0)