-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
96 lines (84 loc) · 3.27 KB
/
CMakeLists.txt
File metadata and controls
96 lines (84 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Copyright 2026 LiveKit, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.20)
project(livekit_cpp_example_collection LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Make "include(LiveKitSDK)" search in ./cmake
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(LIVEKIT_SDK_VERSION "latest" CACHE STRING "LiveKit C++ SDK version (e.g. 0.2.0 or latest)")
set(LIVEKIT_LOCAL_SDK_DIR "" CACHE PATH "Path to a local LiveKit SDK install prefix (skips download)")
if(LIVEKIT_LOCAL_SDK_DIR)
message(STATUS "Using local LiveKit SDK: ${LIVEKIT_LOCAL_SDK_DIR}")
list(PREPEND CMAKE_PREFIX_PATH "${LIVEKIT_LOCAL_SDK_DIR}")
else()
include(LiveKitSDK)
livekit_sdk_setup(
VERSION "${LIVEKIT_SDK_VERSION}"
SDK_DIR "${CMAKE_BINARY_DIR}/_deps/livekit-sdk"
GITHUB_TOKEN "$ENV{GITHUB_TOKEN}"
)
endif()
find_package(LiveKit CONFIG REQUIRED)
if(TARGET LiveKit::livekit)
set(LIVEKIT_CORE_TARGET LiveKit::livekit)
elseif(TARGET livekit)
set(LIVEKIT_CORE_TARGET livekit)
else()
message(FATAL_ERROR "Could not find a LiveKit core target (expected LiveKit::livekit or livekit).")
endif()
set(LIVEKIT_DATA_DIR "")
if(DEFINED LIVEKIT_ROOT_DIR AND EXISTS "${LIVEKIT_ROOT_DIR}/data")
set(LIVEKIT_DATA_DIR "${LIVEKIT_ROOT_DIR}/data")
endif()
function(livekit_copy_windows_runtime_dlls target_name)
if(NOT WIN32)
return()
endif()
get_filename_component(_lk_cmake_parent "${LiveKit_DIR}" DIRECTORY)
get_filename_component(_lk_lib_dir "${_lk_cmake_parent}" DIRECTORY)
get_filename_component(_lk_prefix "${_lk_lib_dir}" DIRECTORY)
set(_lk_bin_dir "${_lk_prefix}/bin")
foreach(_lk_runtime_dll IN ITEMS livekit.dll livekit_ffi.dll)
if(EXISTS "${_lk_bin_dir}/${_lk_runtime_dll}")
add_custom_command(TARGET ${target_name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${_lk_bin_dir}/${_lk_runtime_dll}"
"$<TARGET_FILE_DIR:${target_name}>"
)
endif()
endforeach()
if(TARGET SDL3::SDL3)
add_custom_command(TARGET ${target_name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_FILE:SDL3::SDL3>"
"$<TARGET_FILE_DIR:${target_name}>"
)
endif()
endfunction()
include(ExampleDeps)
add_subdirectory(basic_room)
add_subdirectory(simple_room)
add_subdirectory(simple_rpc)
add_subdirectory(simple_data_stream)
add_subdirectory(logging_levels_basic_usage)
add_subdirectory(logging_levels_custom_sinks)
add_subdirectory(hello_livekit_sender)
add_subdirectory(hello_livekit_receiver)
add_subdirectory(simple_joystick_sender)
add_subdirectory(simple_joystick_receiver)
add_subdirectory(ping_pong_ping)
add_subdirectory(ping_pong_pong)
add_subdirectory(user_timestamped_video)