Skip to content
Open
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
8 changes: 7 additions & 1 deletion tools/agent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ set(AGENT_SOURCES
tools/tool-edit.cpp
tools/tool-glob.cpp
tools/tool-plan.cpp
stb-image-impl.cpp
# stb-image-impl.cpp
)

option(LLAMA_AGENT_NEEDS_STB "Build stb_image implementation locally" OFF)

if(LLAMA_AGENT_NEEDS_STB)
list(APPEND AGENT_SOURCES stb-image-impl.cpp)
endif()
Comment on lines +26 to +30

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative approach is to lean on the CMake provided WIN32 flag which felt like a possible fit as well.

Suggested change
option(LLAMA_AGENT_NEEDS_STB "Build stb_image implementation locally" OFF)
if(LLAMA_AGENT_NEEDS_STB)
list(APPEND AGENT_SOURCES stb-image-impl.cpp)
endif()
# stb-image-impl.cpp compiles STB_IMAGE_IMPLEMENTATION into the executable. On
# non-Windows static builds these stbi_* symbols are already provided by libmtmd.a
# (pulled in transitively via server-context), so compiling them here causes
# duplicate-definition link errors. Only build it on Windows, where llama-agent
# links against mtmd's shared library and needs its own copy.
if(WIN32)
target_sources(${TARGET} PRIVATE stb-image-impl.cpp)
endif()


# MCP support only available on Unix (uses fork, pipe, poll)
if(NOT WIN32)
list(APPEND AGENT_SOURCES
Expand Down