@@ -6,6 +6,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
66set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
77
88option (AGENT_CPP_BUILD_TESTS "Build agent.cpp tests" OFF )
9+ option (AGENT_CPP_BUILD_EXAMPLES "Build agent.cpp examples" OFF )
910option (AGENT_CPP_BUNDLED_LLAMA "Bundle llama.cpp (vs. find installed)" ON )
1011
1112set (LLAMA_CPP_DIR "" CACHE PATH "Path to existing llama.cpp directory (leave empty to use submodule)" )
@@ -108,6 +109,66 @@ if(AGENT_CPP_BUILD_TESTS)
108109 message (STATUS "Tests enabled. Run with: ctest or ./test_tool" )
109110endif ()
110111
112+ if (AGENT_CPP_BUILD_EXAMPLES)
113+ # Shell example
114+ add_executable (shell-example examples/shell/shell.cpp)
115+ target_include_directories (shell-example PRIVATE
116+ ${CMAKE_CURRENT_SOURCE_DIR} /src
117+ ${CMAKE_CURRENT_SOURCE_DIR} /examples/shared
118+ ${LLAMA_SOURCE_DIR} /common
119+ ${LLAMA_SOURCE_DIR} /ggml/include
120+ ${LLAMA_SOURCE_DIR} /include
121+ ${LLAMA_SOURCE_DIR} /vendor
122+ )
123+ target_link_libraries (shell-example PRIVATE agent model common llama)
124+ target_compile_features (shell-example PRIVATE cxx_std_17)
125+
126+ # Memory example
127+ add_executable (memory-example examples/memory/memory.cpp)
128+ target_include_directories (memory-example PRIVATE
129+ ${CMAKE_CURRENT_SOURCE_DIR} /src
130+ ${CMAKE_CURRENT_SOURCE_DIR} /examples/shared
131+ ${LLAMA_SOURCE_DIR} /common
132+ ${LLAMA_SOURCE_DIR} /ggml/include
133+ ${LLAMA_SOURCE_DIR} /include
134+ ${LLAMA_SOURCE_DIR} /vendor
135+ )
136+ target_link_libraries (memory-example PRIVATE agent model common llama)
137+ target_compile_features (memory-example PRIVATE cxx_std_17)
138+
139+ # Multi-agent example
140+ add_executable (multi-agent-example examples/multi-agent/multi-agent.cpp)
141+ target_include_directories (multi-agent-example PRIVATE
142+ ${CMAKE_CURRENT_SOURCE_DIR} /src
143+ ${CMAKE_CURRENT_SOURCE_DIR} /examples/shared
144+ ${LLAMA_SOURCE_DIR} /common
145+ ${LLAMA_SOURCE_DIR} /ggml/include
146+ ${LLAMA_SOURCE_DIR} /include
147+ ${LLAMA_SOURCE_DIR} /vendor
148+ )
149+ target_link_libraries (multi-agent-example PRIVATE agent model common llama)
150+ target_compile_features (multi-agent-example PRIVATE cxx_std_17)
151+
152+ # Context engineering example
153+ add_executable (context-engineering-example examples/context-engineering/context-engineering.cpp)
154+ target_include_directories (context-engineering-example PRIVATE
155+ ${CMAKE_CURRENT_SOURCE_DIR} /src
156+ ${CMAKE_CURRENT_SOURCE_DIR} /examples/shared
157+ ${LLAMA_SOURCE_DIR} /common
158+ ${LLAMA_SOURCE_DIR} /ggml/include
159+ ${LLAMA_SOURCE_DIR} /include
160+ ${LLAMA_SOURCE_DIR} /vendor
161+ )
162+ target_link_libraries (context-engineering-example PRIVATE agent model common llama)
163+ target_compile_features (context-engineering-example PRIVATE cxx_std_17)
164+
165+ # Note: tracing-example is not included here as it requires additional
166+ # dependencies (OpenTelemetry, protobuf, curl). Build it separately from
167+ # examples/tracing/
168+
169+ message (STATUS "Examples enabled." )
170+ endif ()
171+
111172option (AGENT_CPP_INSTALL "Generate install target" OFF )
112173
113174if (AGENT_CPP_INSTALL)
0 commit comments