Skip to content

Commit 7c27da8

Browse files
Sxian/clt 2400/add cmake files to release skip examples executables (#30)
* Don't ship the examples executables, and ship the Livekit cmake files * fix the cmake to require protobuf and absl * fix macos build
1 parent fbb48a4 commit 7c27da8

File tree

4 files changed

+72
-21
lines changed

4 files changed

+72
-21
lines changed

.github/workflows/make-release.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,21 @@ jobs:
131131
bundleDir="sdk-out/livekit-sdk-${{ matrix.name }}-${{ steps.version.outputs.version }}"
132132
mkdir -p "$bundleDir/lib"
133133
mkdir -p "$bundleDir/include"
134-
mkdir -p "$bundleDir/bin"
134+
mkdir -p "$bundleDir/lib/cmake/LiveKit"
135135
136-
# Copy files
136+
# Copy libs + headers (SDK)
137137
cp -r build-release/lib/* "$bundleDir/lib/" 2>/dev/null || true
138138
cp -r build-release/include/* "$bundleDir/include/" 2>/dev/null || true
139-
cp -r build-release/bin/* "$bundleDir/bin/" 2>/dev/null || true
140-
139+
140+
# Copy generated CMake package files
141+
cp -f build-release/LiveKitConfig.cmake "$bundleDir/lib/cmake/LiveKit/" || true
142+
cp -f build-release/LiveKitConfigVersion.cmake "$bundleDir/lib/cmake/LiveKit/" || true
143+
cp -f build-release/LiveKitTargets.cmake "$bundleDir/lib/cmake/LiveKit/" || true
144+
cp -f build-release/LiveKitTargets-*.cmake "$bundleDir/lib/cmake/LiveKit/" 2>/dev/null || true
145+
141146
# List bundle contents
142147
echo "Bundle contents:"
143-
find "$bundleDir" -type f | head -50
148+
find "$bundleDir" -type f | head -80
144149
145150
# ---------- Build + Bundle (Windows) ----------
146151
- name: Build and Bundle (Windows)
@@ -152,15 +157,20 @@ jobs:
152157
153158
# Create bundle directory with version in name
154159
$bundleDir = "sdk-out/livekit-sdk-${{ matrix.name }}-${{ steps.version.outputs.version }}"
155-
New-Item -ItemType Directory -Force -Path $bundleDir
156-
New-Item -ItemType Directory -Force -Path "$bundleDir/lib"
157-
New-Item -ItemType Directory -Force -Path "$bundleDir/include"
158-
New-Item -ItemType Directory -Force -Path "$bundleDir/bin"
160+
New-Item -ItemType Directory -Force -Path $bundleDir | Out-Null
161+
New-Item -ItemType Directory -Force -Path "$bundleDir/lib" | Out-Null
162+
New-Item -ItemType Directory -Force -Path "$bundleDir/include" | Out-Null
163+
New-Item -ItemType Directory -Force -Path "$bundleDir/lib/cmake/LiveKit" | Out-Null
159164
160-
# Copy files
165+
# Copy libs + headers (SDK)
161166
Copy-Item -Recurse -Force "build-release/lib/*" "$bundleDir/lib/"
162167
Copy-Item -Recurse -Force "build-release/include/*" "$bundleDir/include/"
163-
Copy-Item -Recurse -Force "build-release/bin/*" "$bundleDir/bin/"
168+
169+
# Copy generated CMake package files (best-effort)
170+
Copy-Item -Force "build-release/LiveKitConfig.cmake" "$bundleDir/lib/cmake/LiveKit/" -ErrorAction SilentlyContinue
171+
Copy-Item -Force "build-release/LiveKitConfigVersion.cmake" "$bundleDir/lib/cmake/LiveKit/" -ErrorAction SilentlyContinue
172+
Copy-Item -Force "build-release/LiveKitTargets.cmake" "$bundleDir/lib/cmake/LiveKit/" -ErrorAction SilentlyContinue
173+
Copy-Item -Force "build-release/LiveKitTargets-*.cmake" "$bundleDir/lib/cmake/LiveKit/" -ErrorAction SilentlyContinue
164174
165175
# ---------- Upload artifact (raw directory, no pre-compression) ----------
166176
- name: Upload build artifact

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ target_include_directories(livekit
318318
target_link_libraries(livekit
319319
PRIVATE
320320
livekit_ffi
321+
PUBLIC
321322
protobuf::libprotobuf
322323
)
323324

@@ -494,14 +495,14 @@ if(Protobuf_VERSION VERSION_GREATER_EQUAL 6.0)
494495
endif()
495496

496497
if(absl_FOUND)
497-
target_link_libraries(livekit PRIVATE
498+
target_link_libraries(livekit PUBLIC
498499
absl::log
499500
absl::check
500501
absl::strings
501502
absl::base
502503
)
503504
elseif(Abseil_FOUND)
504-
target_link_libraries(livekit PRIVATE
505+
target_link_libraries(livekit PUBLIC
505506
Abseil::log
506507
Abseil::check
507508
Abseil::strings

build.sh

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,21 +158,52 @@ install_bundle() {
158158
rm -rf "${PREFIX}"
159159
mkdir -p "${PREFIX}"
160160

161-
# Use --config for safety (works for multi-config too)
162-
cmake --install "${BUILD_DIR}" --config "${BUILD_TYPE}" --prefix "${PREFIX}"
161+
# Detect whether generator is multi-config (VS/Xcode) or single-config (Ninja/Unix Makefiles)
162+
local is_multi_config=0
163+
if [[ -f "${BUILD_DIR}/CMakeCache.txt" ]]; then
164+
if grep -q '^CMAKE_CONFIGURATION_TYPES:STRING=' "${BUILD_DIR}/CMakeCache.txt"; then
165+
is_multi_config=1
166+
fi
167+
fi
163168

164-
# Sanity checks (non-fatal, but helpful)
165-
if [[ ! -d "${PREFIX}/include" ]]; then
166-
echo "WARN: ${PREFIX}/include not found. Did you add install(DIRECTORY include/ ...) rules?"
169+
# Run install
170+
if [[ "${is_multi_config}" -eq 1 ]]; then
171+
echo "==> cmake --install (multi-config) config=${BUILD_TYPE}"
172+
cmake --install "${BUILD_DIR}" --config "${BUILD_TYPE}" --prefix "${PREFIX}"
173+
else
174+
echo "==> cmake --install (single-config)"
175+
cmake --install "${BUILD_DIR}" --prefix "${PREFIX}"
167176
fi
168-
if [[ ! -d "${PREFIX}/lib" && ! -d "${PREFIX}/lib64" ]]; then
177+
178+
local libdir=""
179+
if [[ -d "${PREFIX}/lib" ]]; then
180+
libdir="${PREFIX}/lib"
181+
elif [[ -d "${PREFIX}/lib64" ]]; then
182+
libdir="${PREFIX}/lib64"
183+
else
169184
echo "WARN: ${PREFIX}/lib or lib64 not found. Did you add install(TARGETS ...) rules?"
170185
fi
171-
if [[ ! -d "${PREFIX}/lib/cmake/LiveKit" && ! -d "${PREFIX}/lib64/cmake/LiveKit" ]]; then
172-
echo "WARN: CMake package files not found under lib/cmake/LiveKit. Did you add install(EXPORT ...) + LiveKitConfig.cmake?"
186+
187+
if [[ -n "${libdir}" ]]; then
188+
if [[ ! -d "${libdir}/cmake/LiveKit" ]]; then
189+
echo "WARN: CMake package files not found under ${libdir}/cmake/LiveKit."
190+
echo " Did you add install(EXPORT ...) + install(FILES LiveKitConfig*.cmake ...)?"
191+
else
192+
# Optional: verify that key files exist
193+
if [[ ! -f "${libdir}/cmake/LiveKit/LiveKitConfig.cmake" ]]; then
194+
echo "WARN: Missing ${libdir}/cmake/LiveKit/LiveKitConfig.cmake"
195+
fi
196+
if [[ ! -f "${libdir}/cmake/LiveKit/LiveKitTargets.cmake" ]]; then
197+
echo "WARN: Missing ${libdir}/cmake/LiveKit/LiveKitTargets.cmake (install(EXPORT ...) didn’t run?)"
198+
fi
199+
if [[ ! -f "${libdir}/cmake/LiveKit/LiveKitConfigVersion.cmake" ]]; then
200+
echo "WARN: Missing ${libdir}/cmake/LiveKit/LiveKitConfigVersion.cmake"
201+
fi
202+
fi
173203
fi
174204
}
175205

206+
176207
archive_bundle() {
177208
if [[ "${DO_BUNDLE}" != "1" ]]; then
178209
echo "ERROR: --archive requires --bundle"

cmake/LiveKitConfig.cmake.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
@PACKAGE_INIT@
22

3+
include(CMakeFindDependencyMacro)
4+
5+
find_dependency(Protobuf CONFIG REQUIRED)
6+
find_dependency(absl CONFIG QUIET)
7+
if(NOT absl_FOUND)
8+
find_dependency(Abseil REQUIRED)
9+
endif()
10+
311
include("${CMAKE_CURRENT_LIST_DIR}/LiveKitTargets.cmake")
12+

0 commit comments

Comments
 (0)