Skip to content

Commit f7aef1c

Browse files
fix the build, and order of CMakeList sections
1 parent be36168 commit f7aef1c

File tree

2 files changed

+46
-43
lines changed

2 files changed

+46
-43
lines changed

CMakeLists.txt

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,44 @@ protobuf_generate(
4646
IMPORT_DIRS ${FFI_PROTO_DIR}
4747
)
4848

49+
########### auto-gen build.h #######################
50+
51+
# Where to place the generated header
52+
set(GENERATED_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
53+
file(MAKE_DIRECTORY "${GENERATED_INCLUDE_DIR}")
54+
55+
# Try to capture git commit; fall back to "unknown" if git isn't available or repo isn't present.
56+
set(GIT_COMMIT "unknown")
57+
find_package(Git QUIET)
58+
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
59+
execute_process(
60+
COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD
61+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
62+
OUTPUT_VARIABLE GIT_COMMIT
63+
OUTPUT_STRIP_TRAILING_WHITESPACE
64+
ERROR_QUIET
65+
)
66+
endif()
67+
68+
# Build timestamp
69+
string(TIMESTAMP BUILD_DATE "%Y-%m-%d %H:%M:%S")
70+
71+
# Comment shown at the top of the generated header
72+
set(GENERATED_COMMENT "This file was auto-generated by CMake on ${LIVEKIT_BUILD_DATE}. Do NOT edit manually. Edit build.h.in instead.")
73+
74+
# Generate the header from the template
75+
configure_file(
76+
"${CMAKE_CURRENT_SOURCE_DIR}/build.h.in"
77+
"${GENERATED_INCLUDE_DIR}/build.h"
78+
@ONLY
79+
)
80+
81+
# Include the directory for the headers
82+
include_directories("${GENERATED_INCLUDE_DIR}")
83+
84+
85+
########### Livekit Rust SDK #######################
86+
4987
# Find cargo
5088
find_program(CARGO_EXECUTABLE NAMES cargo REQUIRED)
5189

@@ -129,6 +167,7 @@ target_include_directories(livekit PUBLIC
129167
${CMAKE_SOURCE_DIR}/src
130168
${RUST_ROOT}/livekit-ffi/include
131169
${PROTO_BINARY_DIR}
170+
${GENERATED_INCLUDE_DIR}
132171
)
133172

134173
target_link_libraries(livekit
@@ -143,45 +182,6 @@ message(STATUS "Protobuf: version=${Protobuf_VERSION}; protoc=${Protobuf_PROTOC_
143182
add_dependencies(livekit build_rust_ffi)
144183

145184

146-
########### auto-gen build.h #######################
147-
148-
# Where to place the generated header
149-
set(GENERATED_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
150-
file(MAKE_DIRECTORY "${GENERATED_INCLUDE_DIR}")
151-
152-
# Try to capture git commit; fall back to "unknown" if git isn't available or repo isn't present.
153-
set(GIT_COMMIT "unknown")
154-
find_package(Git QUIET)
155-
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
156-
execute_process(
157-
COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD
158-
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
159-
OUTPUT_VARIABLE GIT_COMMIT
160-
OUTPUT_STRIP_TRAILING_WHITESPACE
161-
ERROR_QUIET
162-
)
163-
endif()
164-
165-
# Build timestamp
166-
string(TIMESTAMP BUILD_DATE "%Y-%m-%d %H:%M:%S")
167-
168-
# Comment shown at the top of the generated header
169-
set(GENERATED_COMMENT "This file was auto-generated by CMake on ${LIVEKIT_BUILD_DATE}. Do NOT edit manually. Edit build.h.in instead.")
170-
171-
# Generate the header from the template
172-
configure_file(
173-
"${CMAKE_CURRENT_SOURCE_DIR}/build.h.in"
174-
"${GENERATED_INCLUDE_DIR}/build.h"
175-
@ONLY
176-
)
177-
178-
# Make the generated header available to your targets:
179-
# (Option A) Global include dir
180-
include_directories("${GENERATED_INCLUDE_DIR}")
181-
182-
# (Option B) Or, per-target (recommended):
183-
# target_include_directories(<your_target> PRIVATE "${GENERATED_INCLUDE_DIR}")
184-
185185
########### Platform specific settings ###########
186186

187187
if(APPLE)

include/livekit/ffi_client.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@
2929
namespace livekit {
3030

3131
namespace proto {
32-
class FfiEvent
33-
}
32+
class FfiEvent;
33+
class FfiResponse;
34+
class FfiRequest;
35+
class RoomInfo;
36+
} // namespace proto
3437

3538
using FfiCallbackFn = void (*)(const uint8_t *, size_t);
3639
extern "C" void livekit_ffi_initialize(FfiCallbackFn cb, bool capture_logs,
@@ -67,8 +70,8 @@ class FfiClient {
6770
void RemoveListener(ListenerId id);
6871

6972
// Room APIs
70-
std::future<livekit::proto::RoomInfo> connectAsync(const std::string &url,
71-
const std::string &token);
73+
std::future<proto::RoomInfo> connectAsync(const std::string &url,
74+
const std::string &token);
7275

7376
// Track APIs
7477
std::future<std::vector<RtcStats>> getTrackStatsAsync(uintptr_t track_handle);

0 commit comments

Comments
 (0)