Skip to content
Merged
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
15 changes: 3 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
pull_request:
branches: [ main ]

env:
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'

jobs:
ci:
name: CI Pipeline
Expand All @@ -26,20 +23,14 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Install clang-format, clang-tidy, and ninja
run: sudo apt-get update && sudo apt-get install -y clang-format clang-tidy ninja-build
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y clang-format clang-tidy ninja-build openssl libssl-dev

- name: Check code formatting
run: uv run scripts/format.py --check

- uses: lukka/get-cmake@latest

- name: Setup vcpkg
uses: lukka/run-vcpkg@v11

- name: Install dependencies with vcpkg
run: vcpkg install --triplet=x64-linux --x-feature=tests

- name: Build
run: uv run scripts/build.py --mode ${{ matrix.build_type }} --tests --export-compile-commands

Expand All @@ -48,4 +39,4 @@ jobs:
run: ctest --build-config ${{ matrix.build_type == 'debug' && 'Debug' || 'Release' }} --output-on-failure --parallel
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
38 changes: 17 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,14 @@ option(BUILD_TESTS "Build tests" OFF)
option(BUILD_EXAMPLES "Build example applications" ON)
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)

# Common httplib configuration definitions
set(HTTPLIB_DEFINITIONS
CPPHTTPLIB_OPENSSL_SUPPORT=1
CPPHTTPLIB_BROTLI_SUPPORT=1
CPPHTTPLIB_THREAD_POOL_COUNT=8
)
# Include CPM package manager
include(cmake/CPM.cmake)

# Find required packages through vcpkg
find_package(nlohmann_json CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(httplib CONFIG REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(unofficial-concurrentqueue CONFIG REQUIRED)
# Include all dependencies
include(cmake/dependencies/nlohmann_json.cmake)
include(cmake/dependencies/openssl.cmake)
include(cmake/dependencies/httplib.cmake) # This will include zlib and brotli
include(cmake/dependencies/concurrentqueue.cmake)

# Core library target (always built)
add_library(ai-sdk-cpp-core)
Expand Down Expand Up @@ -125,22 +120,23 @@ target_sources(ai-sdk-cpp-anthropic

# Link dependencies for core component
target_link_libraries(ai-sdk-cpp-core
PRIVATE
PUBLIC
nlohmann_json::nlohmann_json
spdlog::spdlog
PRIVATE
httplib::httplib
OpenSSL::SSL
OpenSSL::Crypto
unofficial::concurrentqueue::concurrentqueue
concurrentqueue
)

# Link dependencies for OpenAI component
target_link_libraries(ai-sdk-cpp-openai
PUBLIC
ai::core
PRIVATE
nlohmann_json::nlohmann_json
spdlog::spdlog
PRIVATE
httplib::httplib
concurrentqueue
)

# Define component availability for OpenAI
Expand All @@ -155,9 +151,10 @@ target_compile_definitions(ai-sdk-cpp-openai
target_link_libraries(ai-sdk-cpp-anthropic
PUBLIC
ai::core
PRIVATE
nlohmann_json::nlohmann_json
spdlog::spdlog
PRIVATE
httplib::httplib
concurrentqueue
)

# Define component availability for Anthropic
Expand Down Expand Up @@ -233,8 +230,7 @@ endif()

# Tests
if(BUILD_TESTS)
find_package(GTest CONFIG REQUIRED)
enable_testing()
include(cmake/dependencies/googletest.cmake)
add_subdirectory(tests)
endif()

Expand Down
Loading
Loading