50 lines
1.8 KiB
CMake
50 lines
1.8 KiB
CMake
# EchoionProtocol — reverse-engineered TeamSpeak 3/6 full-client voice protocol.
|
|
#
|
|
# Deliberately dependency-isolated: it knows nothing about Echoion::Api, Void or
|
|
# reflection. It links only OpenSSL (crypto), libopus (voice) and a vendored
|
|
# QuickLZ. This keeps it independently unit-testable and reusable, and lets it
|
|
# build with a plain C++20 toolchain even though the rest of Echoion needs
|
|
# C++26/reflection.
|
|
|
|
cmake_minimum_required(VERSION 3.24)
|
|
|
|
# Allow standalone configuration (own build) as well as add_subdirectory() from
|
|
# the Echoion root.
|
|
if(NOT DEFINED PROJECT_NAME)
|
|
project(EchoionProtocol LANGUAGES CXX)
|
|
endif()
|
|
|
|
option(ECHOIONPROTOCOL_BUILD_TESTS "Build EchoionProtocol unit tests" OFF)
|
|
|
|
find_package(OpenSSL REQUIRED)
|
|
|
|
find_package(PkgConfig QUIET)
|
|
if(PkgConfig_FOUND)
|
|
pkg_check_modules(OPUS IMPORTED_TARGET opus)
|
|
# libsodium provides the raw Ed25519 point arithmetic the TS6 license chain
|
|
# (initivexpand2) needs; OpenSSL cannot do it.
|
|
pkg_check_modules(SODIUM REQUIRED IMPORTED_TARGET libsodium)
|
|
endif()
|
|
|
|
file(GLOB ECHOIONPROTOCOL_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
|
|
|
|
add_library(EchoionProtocol STATIC ${ECHOIONPROTOCOL_SOURCES})
|
|
add_library(Echoion::Protocol ALIAS EchoionProtocol)
|
|
|
|
target_include_directories(EchoionProtocol
|
|
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
|
|
|
# This target is standalone C++20 on purpose — do not inherit the tree's C++26.
|
|
target_compile_features(EchoionProtocol PUBLIC cxx_std_20)
|
|
|
|
target_link_libraries(EchoionProtocol PUBLIC OpenSSL::Crypto PkgConfig::SODIUM)
|
|
if(TARGET PkgConfig::OPUS)
|
|
target_link_libraries(EchoionProtocol PUBLIC PkgConfig::OPUS)
|
|
target_compile_definitions(EchoionProtocol PUBLIC ECHOION_HAVE_OPUS=1)
|
|
endif()
|
|
|
|
if(ECHOIONPROTOCOL_BUILD_TESTS OR BUILD_TESTS)
|
|
enable_testing()
|
|
add_subdirectory(tests)
|
|
endif()
|