Skip to content

Add conditional build option for stb-image implementation - #33

Open
magicse wants to merge 1 commit into
gary149:masterfrom
magicse:patch-6
Open

Add conditional build option for stb-image implementation#33
magicse wants to merge 1 commit into
gary149:masterfrom
magicse:patch-6

Conversation

@magicse

@magicse magicse commented Apr 18, 2026

Copy link
Copy Markdown

Added option to conditionally include stb-image implementation in build. To avoide multiple definition of `stbi_load' and e.t.c....

Overview

Additional information

Requirements

Added option to conditionally include stb-image implementation in build.
To avoide multiple definition of `stbi_load' and e.t.c....

@GencoreOperative GencoreOperative left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I've provided a comment to consider. Thanks for looking into this.

Comment on lines +26 to +30
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()

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants