Skip to content
Merged
Show file tree
Hide file tree
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
27 changes: 27 additions & 0 deletions ports/ggml/0001-fix-cmakelists.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -202,7 +202,7 @@ option(GGML_BUILD_EXAMPLES "ggml: build examples" ${GGML_STANDALONE})
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED true)

-set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED true)

set(THREADS_PREFER_PTHREAD_FLAG ON)
@@ -238,6 +238,7 @@ include(CMakePackageConfigHelpers)
# all public headers
set(GGML_PUBLIC_HEADERS
include/ggml.h
+ include/ggml-cpp.h
include/ggml-cpu.h
include/ggml-alloc.h
include/ggml-backend.h
@@ -245,6 +246,7 @@ set(GGML_PUBLIC_HEADERS
include/ggml-cann.h
include/ggml-cuda.h
include/ggml-kompute.h
+ include/ggml-opencl.h
include/ggml-opt.h
include/ggml-metal.h
include/ggml-rpc.h
100 changes: 100 additions & 0 deletions ports/ggml/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ggml-org/ggml
REF 9a4acb374565f4146b8d6eb1cffdcd7d437d1ba2
SHA512 091a794baf669616ee20dc19d0232e64456c07cd50cbe6d81aa68b98f178801be1b62da9eea417e7a563a6b73bb3136777f860c756270569676fb760f2e751ed
HEAD_REF master
PATCHES
0001-fix-cmakelists.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
cuda GGML_CUDA
vulkan GGML_VULKAN
metal GGML_METAL
opencl GGML_OPENCL
openmp GGML_OPENMP
)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" GGML_STATIC)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DGGML_STATIC=${GGML_STATIC}
-DGGML_CCACHE=OFF
-DGGML_BUILD_NUMBER=1
-DGGML_BUILD_TESTS=OFF
-DGGML_BUILD_EXAMPLES=OFF
-DGGML_HIP=OFF
-DGGML_SYCL=OFF
${FEATURE_OPTIONS}
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME ggml CONFIG_PATH "lib/cmake/ggml")
vcpkg_copy_pdbs()

if (VCPKG_LIBRARY_LINKAGE MATCHES "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/ggml/ggml-config.cmake"
"set_and_check(GGML_BIN_DIR \"\${PACKAGE_PREFIX_DIR}/bin\")"
""
)
endif()

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/ggml/ggml-config.cmake"
"add_library(ggml::ggml UNKNOWN IMPORTED)"
"if (NOT TARGET ggml::ggml)
add_library(ggml::ggml UNKNOWN IMPORTED)
endif()"
)

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/ggml/ggml-config.cmake"
"add_library(ggml::ggml-base UNKNOWN IMPORTED)"
"if (NOT TARGET ggml::ggml-base)
add_library(ggml::ggml-base UNKNOWN IMPORTED)
endif()"
)

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/ggml/ggml-config.cmake"
"add_library(ggml::\${_ggml_backend} UNKNOWN IMPORTED)"
"if (NOT TARGET ggml::\${_ggml_backend})
add_library(ggml::\${_ggml_backend} UNKNOWN IMPORTED)
endif()"
)

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/ggml/ggml-config.cmake"
"add_library(ggml::all INTERFACE IMPORTED)"
"if (NOT TARGET ggml::all)
add_library(ggml::all INTERFACE IMPORTED)
endif()"
)

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/ggml/ggml-config.cmake"
"if (NOT GGML_SHARED_LIB)"
"if (NOT GGML_SHARED_LIB)
if (GGML_OPENCL)
find_package(OpenCL REQUIRED)
list(APPEND GGML_CPU_INTERFACE_LINK_LIBRARIES OpenCL::OpenCL)
endif()"
)

if (NOT VCPKG_BUILD_TYPE)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig")
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/share/pkgconfig/ggml.pc" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/ggml.pc")
endif()
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig")
file(RENAME "${CURRENT_PACKAGES_DIR}/share/pkgconfig/ggml.pc" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/ggml.pc")
vcpkg_fixup_pkgconfig()

if ("vulkan" IN_LIST FEATURES)
vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES vulkan-shaders-gen)
endif()


file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/pkgconfig")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
48 changes: 48 additions & 0 deletions ports/ggml/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "ggml",
"version-date": "2025-02-12",
"description": "Tensor library for machine learning",
"homepage": "https://github.com/ggml-org/ggml",
"license": "MIT",
"supports": "!(windows & arm) & !uwp & !android",
"dependencies": [
"blas",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"cuda": {
"description": "Enable CUDA support",
"dependencies": [
"cuda"
]
},
"metal": {
"description": "Enable Metal support",
"supports": "osx"
},
"opencl": {
"description": "Enable OpenCL support",
"dependencies": [
"opencl"
]
},
"openmp": {
"description": "Enable OpenMP support",
"supports": "!osx"
},
"vulkan": {
"description": "Enable Vulkan support",
"supports": "!x86",
"dependencies": [
"vulkan-sdk-components"
]
}
}
}
15 changes: 15 additions & 0 deletions ports/llama-cpp/0001-external-ggml.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -145,10 +145,8 @@ endif()
# 3rd-party
#

-if (NOT TARGET ggml)
- add_subdirectory(ggml)
- # ... otherwise assume ggml is added by a parent CMakeLists.txt
-endif()
+find_package(ggml CONFIG REQUIRED)
+add_library(ggml ALIAS ggml::all)

#
# build the library
59 changes: 59 additions & 0 deletions ports/llama-cpp/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ggml-org/llama.cpp
REF b${VERSION}
SHA512 e093f4c7d4b2de425932bb4960683527a8a3bba242132c2f5e5bfed8480f0e336a06f97baf2d20ee591c6deee7535e159d40884a5e3f7caf0ae0967b8a046850
HEAD_REF master
PATCHES
0001-external-ggml.patch
)

file(REMOVE_RECURSE "${SOURCE_PATH}/ggml")

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DGGML_CCACHE=OFF
-DLLAMA_BUILD_TESTS=OFF
-DLLAMA_BUILD_EXAMPLES=OFF
-DLLAMA_ALL_WARNINGS=OFF
${FEATURE_OPTIONS}
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME llama CONFIG_PATH "lib/cmake/llama")
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()

if (VCPKG_LIBRARY_LINKAGE MATCHES "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/llama/llama-config.cmake"
"set_and_check(LLAMA_BIN_DIR \"${PACKAGE_PREFIX_DIR}/bin\")"
""
IGNORE_UNCHANGED
)
endif()

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/llama/llama-config.cmake"
"add_library(llama UNKNOWN IMPORTED)"
"if (NOT TARGET llama)
add_library(llama UNKNOWN IMPORTED)
endif()
"
)

file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
file(RENAME "${CURRENT_PACKAGES_DIR}/bin/convert_hf_to_gguf.py" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/convert-hf-to-gguf.py")
file(INSTALL "${SOURCE_PATH}/gguf-py" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
if (NOT VCPKG_BUILD_TYPE)
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/convert_hf_to_gguf.py")
endif()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

if (VCPKG_LIBRARY_LINKAGE MATCHES "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
19 changes: 19 additions & 0 deletions ports/llama-cpp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "llama-cpp",
"version": "4743",
"description": "LLM inference in C/C++",
"homepage": "https://github.com/ggml-org/llama.cpp",
"license": "MIT",
"supports": "!android",
"dependencies": [
"ggml",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
8 changes: 8 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3108,6 +3108,10 @@
"baseline": "2.2.2",
"port-version": 9
},
"ggml": {
"baseline": "2025-02-12",
"port-version": 0
},
"ghc-filesystem": {
"baseline": "1.5.14",
"port-version": 0
Expand Down Expand Up @@ -5540,6 +5544,10 @@
"baseline": "2024-11-28",
"port-version": 0
},
"llama-cpp": {
"baseline": "4743",
"port-version": 0
},
"llfio": {
"baseline": "2025-01-13",
"port-version": 0
Expand Down
9 changes: 9 additions & 0 deletions versions/g-/ggml.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "d741b07274976f46443096ab695beb6314dbb8d7",
"version-date": "2025-02-12",
"port-version": 0
}
]
}
9 changes: 9 additions & 0 deletions versions/l-/llama-cpp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "a626675dd61bb60eb67e115b5a23e0ecc378685f",
"version": "4743",
"port-version": 0
}
]
}