mirror of
https://github.com/hanzo-cpp/sdk.git
synced 2026-11-20 19:55:32 +00:00
This client read hanzoai/openapi's hanzo.yaml at branch `main` and carried no lock, so it named its document by something that moves and could not say which bytes it was a projection of. It now reads what hanzoai/cloud emits, at the commit .spec-lock names, digest-checked on every fetch — the same document and the same four-line receipt every other Hanzo client carries. This repo's own hanzo.yml had already declared that move; the script had not made it, so the lane and the script named two different documents. Nothing is lost, measured route by route: cloud's document is a strict SUPERSET of the projection — 2479 operations against 2456, with 0 routes only in hanzo.yaml and 23 only in cloud. The projection's one addition for this language, a `default` response injected into every operation that declares none, buys nothing here: a `default` with no content produces the same void return that no `responses` does, so both documents yield the identical 834 void-returning methods. Generated, that is 2502 methods against 2455 committed. The 7.24.0 generator floor is gone, and it was not wrong when written — both defects it named lived in schemas the document no longer carries (vector_NamedVectors under additionalProperties, framework_Document.docstatus). Re-measured at the locked commit, 7.14.0 and 7.24.0 emit the same library apart from the version string in each file's header and one doc comment on ConsoleSettings::getOidcConfig. So this repo is on the fleet's 7.14.0 pin and is no longer an exception on version. It stays out of sdks.yaml for one reason only, and that one is measured too: without templates/cpp-restsdk the library fails with 8 errors in ModelBase.h, and a template is a file that has to sit beside the invocation. One flag joins the invocation, and it is the fleet's own. o11y.GettableAgentCheckIn publishes integration_config beside integrationConfig and removed_at beside removedAt so older agents keep working; C++ camel-cases a property into its accessor, so each pair declared one method twice and the library did not compile. Renaming the accessor keeps both wire keys — all four are present in the emitted model, each under its own name — which is what the python, go, java, kotlin, ruby and php rows already do for the same two schemas. Four flows changed route, none of them because of this move: their old operations are untyped or absent in hanzo.yaml too, measured by regenerating from it, so the committed tree simply predated the change. hello, chat, money and tools move to the typed route for the same job; agent keeps its route and reads the run from the typed list, because the run POST declares no body and no response. Each says so in its own header, and the rule they follow is that an example has to demonstrate a call the document types. packageVersion leaves the invocation as inert: measured with a sentinel it reaches the generator's own README and no file under include/ or src/, so the library version in CMakeLists.txt is this repo's to choose and is coupled to nothing. Measured on aarch64 Ubuntu 24.04, g++ 13.3, generator 7.14.0, document 49389cf9: 2663 sources, library 0 errors, six examples 0 errors.
85 lines
3.2 KiB
CMake
85 lines
3.2 KiB
CMake
# The Hanzo C++ SDK — one static library over the whole /v1 surface.
|
|
#
|
|
# The client under include/ and src/ is generated (scripts/generate.sh); this
|
|
# file is not, and the generator's own CMakeLists.txt is dropped before the tree
|
|
# lands. The target name, the export set and the examples switch are this repo's
|
|
# contract with a consumer, so the repo owns them.
|
|
cmake_minimum_required(VERSION 3.20)
|
|
|
|
# THE LIBRARY'S version, which is this repo's to choose and nothing else's. It
|
|
# used to be described as kept in step with the API document's info.version, and
|
|
# that coupling was inert: measured with a sentinel, `packageVersion` reaches the
|
|
# generator's own README and no file under include/ or src/, so no generated line
|
|
# ever carried it. The document names itself in the generated headers already
|
|
# ("The version of the OpenAPI document"), which is the honest place for it.
|
|
# hanzo.yml's client lane reads the number below, so a release bumps this line.
|
|
project(hanzo VERSION 8.0.0 LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
|
|
option(HANZO_BUILD_EXAMPLES "Build the six canonical example flows" OFF)
|
|
|
|
find_package(cpprestsdk REQUIRED)
|
|
find_package(Boost REQUIRED)
|
|
find_package(OpenSSL REQUIRED)
|
|
find_package(Threads REQUIRED)
|
|
|
|
# GLOB, deliberately: the file list IS the generated tree, and a hand-kept copy
|
|
# of ~2400 names would be a second source of truth that goes stale the first time
|
|
# an operation is added upstream. CONFIGURE_DEPENDS makes cmake re-check it on
|
|
# every build.
|
|
file(GLOB_RECURSE HANZO_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
|
|
if(NOT HANZO_SOURCES)
|
|
message(FATAL_ERROR
|
|
"no sources under src/. The client is generated: run ./scripts/generate.sh")
|
|
endif()
|
|
|
|
add_library(hanzo STATIC ${HANZO_SOURCES})
|
|
add_library(hanzo::hanzo ALIAS hanzo)
|
|
|
|
target_include_directories(hanzo PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<INSTALL_INTERFACE:include>)
|
|
|
|
target_link_libraries(hanzo PUBLIC
|
|
cpprestsdk::cpprest
|
|
Boost::boost
|
|
OpenSSL::SSL
|
|
OpenSSL::Crypto
|
|
Threads::Threads)
|
|
|
|
# The generated sources are what the document projects, not code anyone reviews
|
|
# line by line. Warnings on them are noise that would bury a real warning in the
|
|
# examples.
|
|
target_compile_options(hanzo PRIVATE -w)
|
|
|
|
if(HANZO_BUILD_EXAMPLES)
|
|
add_subdirectory(examples)
|
|
endif()
|
|
|
|
include(GNUInstallDirs)
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
install(TARGETS hanzo EXPORT hanzoTargets
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
install(EXPORT hanzoTargets
|
|
FILE hanzoTargets.cmake
|
|
NAMESPACE hanzo::
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hanzo)
|
|
|
|
configure_package_config_file(
|
|
cmake/hanzoConfig.cmake.in
|
|
"${CMAKE_CURRENT_BINARY_DIR}/hanzoConfig.cmake"
|
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hanzo)
|
|
write_basic_package_version_file(
|
|
"${CMAKE_CURRENT_BINARY_DIR}/hanzoConfigVersion.cmake"
|
|
COMPATIBILITY SameMajorVersion)
|
|
install(FILES
|
|
"${CMAKE_CURRENT_BINARY_DIR}/hanzoConfig.cmake"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/hanzoConfigVersion.cmake"
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hanzo)
|