cmake_minimum_required(VERSION 3.15)
project(llmlog_engine CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Fetch nlohmann-json (header-only library)
include(FetchContent)
FetchContent_Declare(
    nlohmann_json
    GIT_REPOSITORY https://github.com/nlohmann/json.git
    GIT_TAG v3.11.3
)
FetchContent_MakeAvailable(nlohmann_json)

# Find pybind11
find_package(pybind11 CONFIG REQUIRED)

# Create the pybind11 module
pybind11_add_module(
    _llmlog_engine
    src_cpp/_core.cpp
    src_cpp/llmlog_engine.cpp
)

target_include_directories(_llmlog_engine PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src_cpp)
target_link_libraries(_llmlog_engine PRIVATE nlohmann_json::nlohmann_json)

# Install to the proper Python package location
install(TARGETS _llmlog_engine DESTINATION llmlog_engine)
