From 63248fc3e33e6f3b579dce6a743fd6ce8939af9c Mon Sep 17 00:00:00 2001 From: Aldehir Rojas Date: Sun, 24 May 2026 03:37:28 -0400 Subject: [PATCH] cmake : fix ui build (#23592) * cmake/ui : add -fPIC to llama-ui static lib * cmake : rename host compiled embed helper --- tools/ui/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/ui/CMakeLists.txt b/tools/ui/CMakeLists.txt index d4cf35802..60d9020da 100644 --- a/tools/ui/CMakeLists.txt +++ b/tools/ui/CMakeLists.txt @@ -43,9 +43,9 @@ if(CMAKE_CROSSCOMPILING) message(STATUS "UI: building llama-ui-embed with host compiler ${HOST_CXX_COMPILER}") if(CMAKE_HOST_WIN32) - set(LLAMA_UI_EMBED_EXE "${CMAKE_CURRENT_BINARY_DIR}/llama-ui-embed.exe") + set(LLAMA_UI_EMBED_EXE "${CMAKE_CURRENT_BINARY_DIR}/llama-ui-embed-host.exe") else() - set(LLAMA_UI_EMBED_EXE "${CMAKE_CURRENT_BINARY_DIR}/llama-ui-embed") + set(LLAMA_UI_EMBED_EXE "${CMAKE_CURRENT_BINARY_DIR}/llama-ui-embed-host") endif() add_custom_command( @@ -56,6 +56,8 @@ if(CMAKE_CROSSCOMPILING) COMMENT "Building llama-ui-embed (host)" VERBATIM ) + + # phony target to tie it into the dependency graph add_custom_target(llama-ui-embed DEPENDS "${LLAMA_UI_EMBED_EXE}") else() add_executable(llama-ui-embed embed.cpp) @@ -93,6 +95,10 @@ add_library(${TARGET} STATIC ${UI_CPP} ${UI_H}) target_compile_features(${TARGET} PRIVATE cxx_std_17) add_dependencies(${TARGET} llama-ui-assets) +if (BUILD_SHARED_LIBS) + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) +endif() + target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_BINARY_DIR} )