42 lines
1.4 KiB
CMake
42 lines
1.4 KiB
CMake
cmake_minimum_required(VERSION 3.14)
|
|
|
|
project(elevenlabs_convai_cpp LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# Find dependencies
|
|
find_package(Boost REQUIRED COMPONENTS system thread)
|
|
find_package(OpenSSL REQUIRED)
|
|
# PortAudio via vcpkg CMake config
|
|
find_package(portaudio CONFIG REQUIRED)
|
|
|
|
# Find nlohmann_json
|
|
find_package(nlohmann_json 3.11 QUIET)
|
|
|
|
if(NOT nlohmann_json_FOUND)
|
|
include(FetchContent)
|
|
# Fallback: header-only fetch to avoid old CMake policies in upstream CMakeLists
|
|
FetchContent_Declare(
|
|
nlohmann_json_src
|
|
URL https://raw.githubusercontent.com/nlohmann/json/v3.11.2/single_include/nlohmann/json.hpp
|
|
)
|
|
FetchContent_MakeAvailable(nlohmann_json_src)
|
|
add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED)
|
|
target_include_directories(nlohmann_json::nlohmann_json INTERFACE ${nlohmann_json_src_SOURCE_DIR}/single_include)
|
|
endif()
|
|
|
|
add_executable(convai_cpp
|
|
src/main.cpp
|
|
src/Conversation.cpp
|
|
src/DefaultAudioInterface.cpp
|
|
)
|
|
|
|
target_include_directories(convai_cpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
|
|
# MSVC: set Windows target version and suppress getenv deprecation warning
|
|
if(MSVC)
|
|
target_compile_definitions(convai_cpp PRIVATE _WIN32_WINNT=0x0A00 _CRT_SECURE_NO_WARNINGS)
|
|
endif()
|
|
|
|
target_link_libraries(convai_cpp PRIVATE Boost::system Boost::thread OpenSSL::SSL OpenSSL::Crypto portaudio nlohmann_json::nlohmann_json) |