Skip to content

Commit 0a5104a

Browse files
committed
feat: add examples building support to build scripts
- Add debug-examples and release-examples commands - Update usage help text
1 parent 8abddba commit 0a5104a

File tree

3 files changed

+38
-17
lines changed

3 files changed

+38
-17
lines changed

build.cmd

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,24 @@ if "%1"=="debug" (
6767
goto configure_build
6868
)
6969

70+
if "%1"=="debug-examples" (
71+
set "BUILD_TYPE=Debug"
72+
set "PRESET=windows-debug-examples"
73+
goto configure_build
74+
)
75+
7076
if "%1"=="release" (
7177
set "BUILD_TYPE=Release"
7278
set "PRESET=windows-release"
7379
goto configure_build
7480
)
7581

82+
if "%1"=="release-examples" (
83+
set "BUILD_TYPE=Release"
84+
set "PRESET=windows-release-examples"
85+
goto configure_build
86+
)
87+
7688
if "%1"=="verbose" (
7789
set "VERBOSE=--verbose"
7890
goto build_only
@@ -89,7 +101,9 @@ echo Usage: build.cmd [command]
89101
echo.
90102
echo Commands:
91103
echo debug Configure + build Debug version
104+
echo debug-examples Configure + build Debug version with examples
92105
echo release Configure + build Release version
106+
echo release-examples Configure + build Release version with examples
93107
echo clean Run CMake's built-in clean target
94108
echo clean-all Run clean_all (clears C++ + Rust targets)
95109
echo verbose Build with verbose output (implies last configured type)
@@ -98,6 +112,7 @@ echo.
98112
echo Examples:
99113
echo build.cmd debug
100114
echo build.cmd release
115+
echo build.cmd release-examples
101116
echo build.cmd clean
102117
echo build.cmd clean-all
103118
echo build.cmd verbose

build.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ Usage:
2525
2626
Commands:
2727
debug Configure + build Debug version
28+
debug-examples Configure + build Debug version with examples
2829
release Configure + build Release version
29-
verbose Build with verbose output (uses last configured build)
30+
release-examples Configure + build Release version with examples
3031
clean Run CMake's built-in clean target
3132
clean-all Run full clean (C++ build + Rust targets + generated files)
3233
help Show this help message
@@ -46,21 +47,10 @@ Options (for debug / release / verbose):
4647
4748
Examples:
4849
./build.sh release
49-
./build.sh release --bundle
50-
./build.sh release --bundle --archive
51-
./build.sh release --bundle --prefix ./sdk-out/livekit-sdk-macos-arm64
52-
./build.sh debug --bundle --prefix /tmp/livekit-sdk-debug
53-
./build.sh release --version 0.1.0 --bundle --archive
54-
./build.sh release -G Ninja --macos-arch arm64 --bundle \\
55-
--archive-name livekit-sdk-0.1.0-macos-arm64
56-
57-
Notes:
58-
- '--bundle' installs a consumable SDK layout containing:
59-
* headers under include/
60-
* libraries under lib/ (and bin/ if shared)
61-
* CMake package files under lib/cmake/LiveKit/
62-
- '--archive' requires '--bundle'
63-
- CI builds should use '--version' to ensure build.h matches the release tag
50+
./build.sh release-examples
51+
./build.sh clean
52+
./build.sh clean-all
53+
./build.sh verbose
6454
EOF
6555
}
6656

@@ -252,6 +242,12 @@ case "${cmd}" in
252242
fi
253243
fi
254244
;;
245+
debug-examples)
246+
BUILD_TYPE="Debug"
247+
PRESET="${OS_TYPE}-debug-examples"
248+
configure
249+
build
250+
;;
255251
release)
256252
BUILD_TYPE="Release"
257253
PRESET="${OS_TYPE}-release"
@@ -264,6 +260,12 @@ case "${cmd}" in
264260
fi
265261
fi
266262
;;
263+
release-examples)
264+
BUILD_TYPE="Release"
265+
PRESET="${OS_TYPE}-release-examples"
266+
configure
267+
build
268+
;;
267269
verbose)
268270
VERBOSE="1"
269271
# Optional: allow --bundle with verbose builds as well, but requires configure already ran.

examples/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ include(sdl3)
1313
set(EXAMPLES_PRIVATE_INCLUDE_DIRS
1414
${LIVEKIT_ROOT_DIR}/src
1515
${LIVEKIT_BINARY_DIR}/generated
16-
${Protobuf_INCLUDE_DIRS}
1716
)
1817

1918
add_executable(SimpleRoom
@@ -32,9 +31,12 @@ add_executable(SimpleRoom
3231

3332
target_include_directories(SimpleRoom PRIVATE ${EXAMPLES_PRIVATE_INCLUDE_DIRS})
3433

34+
# Link protobuf::libprotobuf directly to get proper include directories
35+
# (livekit links it PRIVATELY so its headers aren't propagated)
3536
target_link_libraries(SimpleRoom
3637
PRIVATE
3738
livekit
39+
protobuf::libprotobuf
3840
SDL3::SDL3
3941
)
4042

@@ -64,6 +66,7 @@ target_link_libraries(SimpleRpc
6466
PRIVATE
6567
nlohmann_json::nlohmann_json
6668
livekit
69+
protobuf::libprotobuf
6770
)
6871

6972
add_executable(SimpleDataStream
@@ -75,6 +78,7 @@ target_include_directories(SimpleDataStream PRIVATE ${EXAMPLES_PRIVATE_INCLUDE_D
7578
target_link_libraries(SimpleDataStream
7679
PRIVATE
7780
livekit
81+
protobuf::libprotobuf
7882
)
7983

8084
add_custom_command(

0 commit comments

Comments
 (0)