Skip to content

Commit 63248fc

Browse files
authored
cmake : fix ui build (ggml-org#23592)
* cmake/ui : add -fPIC to llama-ui static lib * cmake : rename host compiled embed helper
1 parent 83eebe9 commit 63248fc

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

tools/ui/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ if(CMAKE_CROSSCOMPILING)
4343
message(STATUS "UI: building llama-ui-embed with host compiler ${HOST_CXX_COMPILER}")
4444

4545
if(CMAKE_HOST_WIN32)
46-
set(LLAMA_UI_EMBED_EXE "${CMAKE_CURRENT_BINARY_DIR}/llama-ui-embed.exe")
46+
set(LLAMA_UI_EMBED_EXE "${CMAKE_CURRENT_BINARY_DIR}/llama-ui-embed-host.exe")
4747
else()
48-
set(LLAMA_UI_EMBED_EXE "${CMAKE_CURRENT_BINARY_DIR}/llama-ui-embed")
48+
set(LLAMA_UI_EMBED_EXE "${CMAKE_CURRENT_BINARY_DIR}/llama-ui-embed-host")
4949
endif()
5050

5151
add_custom_command(
@@ -56,6 +56,8 @@ if(CMAKE_CROSSCOMPILING)
5656
COMMENT "Building llama-ui-embed (host)"
5757
VERBATIM
5858
)
59+
60+
# phony target to tie it into the dependency graph
5961
add_custom_target(llama-ui-embed DEPENDS "${LLAMA_UI_EMBED_EXE}")
6062
else()
6163
add_executable(llama-ui-embed embed.cpp)
@@ -93,6 +95,10 @@ add_library(${TARGET} STATIC ${UI_CPP} ${UI_H})
9395
target_compile_features(${TARGET} PRIVATE cxx_std_17)
9496
add_dependencies(${TARGET} llama-ui-assets)
9597

98+
if (BUILD_SHARED_LIBS)
99+
set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
100+
endif()
101+
96102
target_include_directories(${TARGET} PUBLIC
97103
${CMAKE_CURRENT_BINARY_DIR}
98104
)

0 commit comments

Comments
 (0)