Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ build/
build-debug/
build-release/
vcpkg_installed/
# Generated header
include/livekit/build.h
received_green.avif
docs/*.bak
docs/html/
Expand Down
24 changes: 10 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set(LIVEKIT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

option(LIVEKIT_BUILD_EXAMPLES "Build LiveKit examples" OFF)
option(LIVEKIT_BUILD_TESTS "Build LiveKit tests" OFF)

# vcpkg is only used on Windows; Linux/macOS use system package managers
if(WIN32)
Expand Down Expand Up @@ -131,8 +132,8 @@ add_custom_command(

target_sources(livekit_proto PRIVATE ${PROTO_SRCS} ${PROTO_HDRS})

set(GENERATED_INCLUDE_DIR "${LIVEKIT_BINARY_DIR}/generated")
file(MAKE_DIRECTORY "${GENERATED_INCLUDE_DIR}")
# Generate build.h directly into include/livekit/ for simpler include paths
set(GENERATED_BUILD_H "${LIVEKIT_ROOT_DIR}/include/livekit/build.h")

set(GIT_COMMIT "unknown")
find_package(Git QUIET)
Expand All @@ -151,7 +152,7 @@ set(GENERATED_COMMENT "This file was auto-generated by CMake on ${BUILD_DATE}. D

configure_file(
"${LIVEKIT_ROOT_DIR}/build.h.in"
"${GENERATED_INCLUDE_DIR}/build.h"
"${GENERATED_BUILD_H}"
@ONLY
)

Expand Down Expand Up @@ -321,7 +322,6 @@ target_include_directories(livekit
${LIVEKIT_ROOT_DIR}/src
${RUST_ROOT}/livekit-ffi/include
${PROTO_BINARY_DIR}
${GENERATED_INCLUDE_DIR}
)

target_link_libraries(livekit
Expand All @@ -335,15 +335,12 @@ message(STATUS "Protobuf: version=${Protobuf_VERSION}; protoc=${Protobuf_PROTOC_
add_dependencies(livekit build_rust_ffi)

if(LIVEKIT_IS_TOPLEVEL)
# Copy public headers to build/include
# Copy public headers to build/include (build.h is already in include/livekit/)
add_custom_command(
TARGET livekit POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${LIVEKIT_ROOT_DIR}/include
${CMAKE_BINARY_DIR}/include
COMMAND ${CMAKE_COMMAND} -E copy
${GENERATED_INCLUDE_DIR}/build.h
${CMAKE_BINARY_DIR}/include/livekit/build.h
COMMENT "Copying public headers to build/include"
)

Expand Down Expand Up @@ -591,17 +588,12 @@ if(APPLE)
endif()


# Install public headers
# Install public headers (includes generated build.h which is now in include/livekit/)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/include/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp"
)

# Install generated build.h if it is part of the public headers
install(FILES "${GENERATED_INCLUDE_DIR}/build.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/livekit"
)

# ---- Create Config + Version + Targets for find_package(LiveKit CONFIG) ----

# cmake/LiveKitConfig.cmake.in must exist in your repo
Expand Down Expand Up @@ -642,6 +634,10 @@ if(LIVEKIT_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

if(LIVEKIT_BUILD_TESTS)
add_subdirectory(src/tests)
endif()

add_custom_target(clean_generated
COMMAND ${CMAKE_COMMAND} -E rm -rf "${PROTO_BINARY_DIR}"
COMMENT "Clean generated protobuf files"
Expand Down
182 changes: 172 additions & 10 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
"inherits": "windows-base",
"binaryDir": "${sourceDir}/build-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
"CMAKE_BUILD_TYPE": "Release",
"LIVEKIT_BUILD_EXAMPLES": "OFF",
"LIVEKIT_BUILD_TESTS": "OFF"
}
},
{
Expand All @@ -76,7 +78,9 @@
"inherits": "windows-base",
"binaryDir": "${sourceDir}/build-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
"CMAKE_BUILD_TYPE": "Debug",
"LIVEKIT_BUILD_EXAMPLES": "OFF",
"LIVEKIT_BUILD_TESTS": "OFF"
}
},
{
Expand All @@ -88,6 +92,7 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"LIVEKIT_BUILD_EXAMPLES": "ON",
"LIVEKIT_BUILD_TESTS": "OFF",
"VCPKG_MANIFEST_FEATURES": "examples"
}
},
Expand All @@ -100,6 +105,7 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"LIVEKIT_BUILD_EXAMPLES": "ON",
"LIVEKIT_BUILD_TESTS": "OFF",
"VCPKG_MANIFEST_FEATURES": "examples"
}
},
Expand All @@ -110,7 +116,9 @@
"inherits": "linux-base",
"binaryDir": "${sourceDir}/build-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
"CMAKE_BUILD_TYPE": "Release",
"LIVEKIT_BUILD_EXAMPLES": "OFF",
"LIVEKIT_BUILD_TESTS": "OFF"
}
},
{
Expand All @@ -120,7 +128,9 @@
"inherits": "linux-base",
"binaryDir": "${sourceDir}/build-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
"CMAKE_BUILD_TYPE": "Debug",
"LIVEKIT_BUILD_EXAMPLES": "OFF",
"LIVEKIT_BUILD_TESTS": "OFF"
}
},
{
Expand All @@ -131,7 +141,8 @@
"binaryDir": "${sourceDir}/build-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"LIVEKIT_BUILD_EXAMPLES": "ON"
"LIVEKIT_BUILD_EXAMPLES": "ON",
"LIVEKIT_BUILD_TESTS": "OFF"
}
},
{
Expand All @@ -142,7 +153,8 @@
"binaryDir": "${sourceDir}/build-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"LIVEKIT_BUILD_EXAMPLES": "ON"
"LIVEKIT_BUILD_EXAMPLES": "ON",
"LIVEKIT_BUILD_TESTS": "OFF"
}
},
{
Expand All @@ -152,7 +164,9 @@
"inherits": "macos-base",
"binaryDir": "${sourceDir}/build-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
"CMAKE_BUILD_TYPE": "Release",
"LIVEKIT_BUILD_EXAMPLES": "OFF",
"LIVEKIT_BUILD_TESTS": "OFF"
}
},
{
Expand All @@ -162,7 +176,9 @@
"inherits": "macos-base",
"binaryDir": "${sourceDir}/build-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
"CMAKE_BUILD_TYPE": "Debug",
"LIVEKIT_BUILD_EXAMPLES": "OFF",
"LIVEKIT_BUILD_TESTS": "OFF"
}
},
{
Expand All @@ -173,7 +189,8 @@
"binaryDir": "${sourceDir}/build-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"LIVEKIT_BUILD_EXAMPLES": "ON"
"LIVEKIT_BUILD_EXAMPLES": "ON",
"LIVEKIT_BUILD_TESTS": "OFF"
}
},
{
Expand All @@ -184,7 +201,80 @@
"binaryDir": "${sourceDir}/build-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"LIVEKIT_BUILD_EXAMPLES": "ON"
"LIVEKIT_BUILD_EXAMPLES": "ON",
"LIVEKIT_BUILD_TESTS": "OFF"
}
},
{
"name": "windows-release-tests",
"displayName": "Windows x64 Release with Tests",
"description": "Build for Windows x64 Release with test suite",
"inherits": "windows-base",
"binaryDir": "${sourceDir}/build-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"LIVEKIT_BUILD_EXAMPLES": "OFF",
"LIVEKIT_BUILD_TESTS": "ON"
}
},
{
"name": "windows-debug-tests",
"displayName": "Windows x64 Debug with Tests",
"description": "Build for Windows x64 Debug with test suite",
"inherits": "windows-base",
"binaryDir": "${sourceDir}/build-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"LIVEKIT_BUILD_EXAMPLES": "OFF",
"LIVEKIT_BUILD_TESTS": "ON"
}
},
{
"name": "linux-release-tests",
"displayName": "Linux Release with Tests",
"description": "Build for Linux Release with test suite",
"inherits": "linux-base",
"binaryDir": "${sourceDir}/build-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"LIVEKIT_BUILD_EXAMPLES": "OFF",
"LIVEKIT_BUILD_TESTS": "ON"
}
},
{
"name": "linux-debug-tests",
"displayName": "Linux Debug with Tests",
"description": "Build for Linux Debug with test suite",
"inherits": "linux-base",
"binaryDir": "${sourceDir}/build-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"LIVEKIT_BUILD_EXAMPLES": "OFF",
"LIVEKIT_BUILD_TESTS": "ON"
}
},
{
"name": "macos-release-tests",
"displayName": "macOS Release with Tests",
"description": "Build for macOS Release with test suite",
"inherits": "macos-base",
"binaryDir": "${sourceDir}/build-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"LIVEKIT_BUILD_EXAMPLES": "OFF",
"LIVEKIT_BUILD_TESTS": "ON"
}
},
{
"name": "macos-debug-tests",
"displayName": "macOS Debug with Tests",
"description": "Build for macOS Debug with test suite",
"inherits": "macos-base",
"binaryDir": "${sourceDir}/build-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"LIVEKIT_BUILD_EXAMPLES": "OFF",
"LIVEKIT_BUILD_TESTS": "ON"
}
}
],
Expand Down Expand Up @@ -240,6 +330,78 @@
{
"name": "macos-debug-examples",
"configurePreset": "macos-debug-examples"
},
{
"name": "windows-release-tests",
"configurePreset": "windows-release-tests",
"configuration": "Release"
},
{
"name": "windows-debug-tests",
"configurePreset": "windows-debug-tests",
"configuration": "Debug"
},
{
"name": "linux-release-tests",
"configurePreset": "linux-release-tests"
},
{
"name": "linux-debug-tests",
"configurePreset": "linux-debug-tests"
},
{
"name": "macos-release-tests",
"configurePreset": "macos-release-tests"
},
{
"name": "macos-debug-tests",
"configurePreset": "macos-debug-tests"
}
],
"testPresets": [
{
"name": "windows-release-tests",
"configurePreset": "windows-release-tests",
"configuration": "Release",
"output": {
"outputOnFailure": true
}
},
{
"name": "windows-debug-tests",
"configurePreset": "windows-debug-tests",
"configuration": "Debug",
"output": {
"outputOnFailure": true
}
},
{
"name": "linux-release-tests",
"configurePreset": "linux-release-tests",
"output": {
"outputOnFailure": true
}
},
{
"name": "linux-debug-tests",
"configurePreset": "linux-debug-tests",
"output": {
"outputOnFailure": true
}
},
{
"name": "macos-release-tests",
"configurePreset": "macos-release-tests",
"output": {
"outputOnFailure": true
}
},
{
"name": "macos-debug-tests",
"configurePreset": "macos-debug-tests",
"output": {
"outputOnFailure": true
}
}
]
}
Loading
Loading