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
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)

option(S2_VULKAN "Build with Vulkan backend" OFF)
option(S2_CUDA "Build with CUDA backend" OFF)
option(S2_HIP "Build with HIP backend" OFF)
option(S2_METAL "Build with Metal backend" OFF)
option(S2_BUILD_SHARED_LIBRARIES "Build S2 shared and static library targets" OFF)
option(S2_AUTO_APPLY_LOCAL_PATCHES "Automatically apply local patches from patches/*.patch during build" ON)
Expand Down Expand Up @@ -66,11 +67,16 @@ if(S2_METAL)
else()
set(GGML_METAL OFF CACHE BOOL "" FORCE)
endif()
if(S2_HIP)
set(GGML_HIP ON CACHE BOOL "" FORCE)
else()
set(GGML_HIP OFF CACHE BOOL "" FORCE)
endif()

add_subdirectory(ggml)

if(TARGET s2_apply_local_patches)
foreach(_target ggml ggml-base ggml-cpu ggml-cuda ggml-vulkan ggml-metal)
foreach(_target ggml ggml-base ggml-cpu ggml-cuda ggml-hip ggml-vulkan ggml-metal)
if(TARGET ${_target})
add_dependencies(${_target} s2_apply_local_patches)
endif()
Expand Down Expand Up @@ -110,6 +116,9 @@ endif()
if(S2_METAL)
target_compile_definitions(${target_name} PRIVATE GGML_USE_METAL)
endif()
if(S2_HIP)
target_compile_definitions(${target_name} PRIVATE GGML_USE_CUDA)
endif()

if(UNIX AND NOT APPLE)
target_link_libraries(${target_name} PRIVATE pthread m)
Expand Down