cmake : fix ui build (#23592)

* cmake/ui : add -fPIC to llama-ui static lib

* cmake : rename host compiled embed helper
This commit is contained in:
Aldehir Rojas
2026-05-24 02:37:28 -05:00
committed by GitHub
parent 83eebe9d08
commit 63248fc3e3
+8 -2
View File
@@ -43,9 +43,9 @@ if(CMAKE_CROSSCOMPILING)
message(STATUS "UI: building llama-ui-embed with host compiler ${HOST_CXX_COMPILER}") message(STATUS "UI: building llama-ui-embed with host compiler ${HOST_CXX_COMPILER}")
if(CMAKE_HOST_WIN32) 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() 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() endif()
add_custom_command( add_custom_command(
@@ -56,6 +56,8 @@ if(CMAKE_CROSSCOMPILING)
COMMENT "Building llama-ui-embed (host)" COMMENT "Building llama-ui-embed (host)"
VERBATIM VERBATIM
) )
# phony target to tie it into the dependency graph
add_custom_target(llama-ui-embed DEPENDS "${LLAMA_UI_EMBED_EXE}") add_custom_target(llama-ui-embed DEPENDS "${LLAMA_UI_EMBED_EXE}")
else() else()
add_executable(llama-ui-embed embed.cpp) 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) target_compile_features(${TARGET} PRIVATE cxx_std_17)
add_dependencies(${TARGET} llama-ui-assets) 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 target_include_directories(${TARGET} PUBLIC
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
) )