Initial release
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
ggml-build-install
|
||||
ggml-build-install-dl
|
||||
|
||||
install
|
||||
install-dl
|
||||
|
||||
build
|
||||
build-dl
|
||||
@@ -0,0 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project(ggml-simple)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
find_package(ggml 0.19.0 REQUIRED)
|
||||
|
||||
set(TEST_TARGET test-cmake)
|
||||
add_executable(test-cmake test-cmake.cpp)
|
||||
target_link_libraries(test-cmake PRIVATE ggml::ggml)
|
||||
@@ -0,0 +1,21 @@
|
||||
## cmake-test
|
||||
|
||||
This directory can be built as a separate project to test/verify a ggml
|
||||
installation.
|
||||
|
||||
### Usage
|
||||
The following will configure, build, and install ggml using two different
|
||||
configurations. One will use dynamically linked backends (GGML_BACKEND_DL=ON)
|
||||
and one without.
|
||||
|
||||
Configuring, build, and install ggml:
|
||||
```console
|
||||
./build-install.sh
|
||||
```
|
||||
|
||||
Build this project twice using the installations created above:
|
||||
```console
|
||||
./build.sh
|
||||
```
|
||||
|
||||
_wip_
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Remove installation target directory
|
||||
rm -rf install-dl install ggml-build-install-dl ggml-build-install
|
||||
|
||||
### Build standard installation
|
||||
build_dir=ggml-build-install
|
||||
install_dir=install
|
||||
|
||||
cmake --fresh -S ../../. -B $build_dir -DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DCMAKE_INSTALL_PREFIX="${PWD}/${install_dir}"
|
||||
|
||||
cmake --build $build_dir --parallel 12
|
||||
cmake --install $build_dir
|
||||
|
||||
### Build dynamic backend
|
||||
build_dir=ggml-build-install-dl
|
||||
install_dir=install-dl
|
||||
|
||||
# Build dynamic backend modules and install them in libexec, mirroring a package
|
||||
# manager's private plugin directory. GGML_BACKEND_DIR is compiled into ggml as
|
||||
# its plugin search path, and cmake --install copies the backend modules there.
|
||||
cmake --fresh -S ../../. -B $build_dir -DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DGGML_BACKEND_DL=ON \
|
||||
-DGGML_CPU_ALL_VARIANTS=ON \
|
||||
-DCMAKE_INSTALL_PREFIX="${PWD}/${install_dir}" \
|
||||
-DGGML_BACKEND_DIR="${PWD}/${install_dir}/libexec"
|
||||
|
||||
cmake --build $build_dir --parallel 12
|
||||
cmake --install $build_dir
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "ggml-backend.h"
|
||||
#include "ggml.h"
|
||||
#include <cstdio>
|
||||
|
||||
int main(void) {
|
||||
printf("[test-cmake] Using ggml version %s\n", ggml_version());
|
||||
printf("[test-cmake] Loading all backends...\n");
|
||||
ggml_backend_load_all();
|
||||
printf("[test-cmake] Succesfully loaded all backend.\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user