# libvoicecat — the shared C++ core (docs/architecture.md).
# Sources are globbed so adding a stub under src/<subsystem>/ needs no CMake edit.
file(GLOB_RECURSE VOICECAT_SOURCES CONFIGURE_DEPENDS
     "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")

if(VOICECAT_BUILD_SHARED)
    add_library(voicecat SHARED ${VOICECAT_SOURCES})
else()
    add_library(voicecat STATIC ${VOICECAT_SOURCES})
    # Static consumers must see VC_API as empty (no dllimport).
    target_compile_definitions(voicecat PUBLIC VOICECAT_STATIC)
endif()
add_library(voicecat::voicecat ALIAS voicecat)

target_include_directories(voicecat
    PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR}/include
    PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)

target_compile_definitions(voicecat PRIVATE VOICECAT_BUILDING)
target_compile_features(voicecat PUBLIC cxx_std_20)

set_target_properties(voicecat PROPERTIES
    C_VISIBILITY_PRESET hidden
    CXX_VISIBILITY_PRESET hidden
    VISIBILITY_INLINES_HIDDEN ON)

if(VOICECAT_USE_VCPKG_DEPS)
    # Wire real dependencies here as each subsystem is implemented. Example (uncomment
    # the ones a subsystem needs; see docs/tech-stack.md and core/proto for protobuf):
    #   find_package(unofficial-sodium CONFIG REQUIRED)   # crypto/  (libsodium)
    #   find_package(MbedTLS CONFIG REQUIRED)             # crypto/  (TLS 1.3)
    #   find_package(Opus CONFIG REQUIRED)                # codec/
    #   find_package(protobuf CONFIG REQUIRED)            # protocol/
    #   find_package(asio CONFIG REQUIRED)                # net/
    #   find_package(unofficial-sqlite3 CONFIG REQUIRED)  # server persistence
    #   find_package(spdlog CONFIG REQUIRED)
    #   target_link_libraries(voicecat PRIVATE Opus::opus protobuf::libprotobuf ...)
    #
    # protobuf codegen (when protocol/ is implemented):
    #   find_package(Protobuf CONFIG REQUIRED)
    #   protobuf_generate(TARGET voicecat PROTOS proto/voicecat.proto LANGUAGE cpp)
    message(STATUS "voicecat: deps ON — add find_package()/link calls here as subsystems land")
endif()
