Add Linux Vulkan support for local inference (#9038)
Signed-off-by: jh-block <jhugo@block.xyz>
This commit is contained in:
@@ -92,6 +92,7 @@ module.exports = {
|
||||
categories: ['Development'],
|
||||
desktopTemplate: './forge.deb.desktop',
|
||||
options: {
|
||||
depends: ['libvulkan1'],
|
||||
icon: 'src/images/icon.png',
|
||||
prefix: '/opt',
|
||||
},
|
||||
@@ -107,6 +108,7 @@ module.exports = {
|
||||
categories: ['Development'],
|
||||
desktopTemplate: './forge.rpm.desktop',
|
||||
options: {
|
||||
requires: ['vulkan-loader'],
|
||||
icon: 'src/images/icon.png',
|
||||
prefix: '/opt',
|
||||
fpm: ['--rpm-rpmbuild-define', '_build_id_links none'],
|
||||
|
||||
@@ -32,6 +32,11 @@ npx tsx scripts/build-native.ts darwin-arm64 linux-x64
|
||||
The built binaries are placed into `ui/goose-binary/goose-binary-{platform}/bin/`.
|
||||
These directories are git-ignored.
|
||||
|
||||
Linux native binaries are built with local inference Vulkan support. Linux build
|
||||
hosts need Vulkan headers and `glslc`; Linux runtime hosts need the Vulkan loader
|
||||
package, such as `libvulkan1` on Debian/Ubuntu or `vulkan-loader` on RPM-based
|
||||
distributions.
|
||||
|
||||
## Publishing
|
||||
|
||||
Publishing is handled by GitHub Actions. See `.github/workflows/publish-npm.yml`.
|
||||
|
||||
@@ -50,6 +50,14 @@
|
||||
"../distro": "distro"
|
||||
},
|
||||
"externalBin": ["../../../target/release/goose"],
|
||||
"linux": {
|
||||
"deb": {
|
||||
"depends": ["libvulkan1"]
|
||||
},
|
||||
"rpm": {
|
||||
"depends": ["vulkan-loader"]
|
||||
}
|
||||
},
|
||||
"macOS": {
|
||||
"entitlements": "entitlements.plist",
|
||||
"hardenedRuntime": true
|
||||
|
||||
@@ -75,9 +75,10 @@ set -euo pipefail
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq --no-install-recommends \
|
||||
build-essential cmake pkg-config libssl-dev libdbus-1-dev \
|
||||
libclang-dev protobuf-compiler libprotobuf-dev ca-certificates >/dev/null 2>&1
|
||||
libclang-dev protobuf-compiler libprotobuf-dev ca-certificates \
|
||||
libvulkan-dev libvulkan1 glslc >/dev/null 2>&1
|
||||
echo "==> Compiling goose (this takes a while)..."
|
||||
cargo build --release --bin goose
|
||||
cargo build --release --bin goose --features vulkan
|
||||
cp /build/target/release/goose /output/goose
|
||||
echo "==> Done"
|
||||
'
|
||||
@@ -116,12 +117,13 @@ FROM rust:1.92-bookworm
|
||||
RUN apt-get update -qq && \
|
||||
apt-get install -y -qq --no-install-recommends \
|
||||
build-essential cmake pkg-config libssl-dev libdbus-1-dev \
|
||||
libclang-dev protobuf-compiler libprotobuf-dev ca-certificates >/dev/null 2>&1 && \
|
||||
libclang-dev protobuf-compiler libprotobuf-dev ca-certificates \
|
||||
libvulkan-dev libvulkan1 glslc >/dev/null 2>&1 && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /build
|
||||
COPY . .
|
||||
RUN mkdir -p /output && \
|
||||
cargo build --release --bin goose && \
|
||||
cargo build --release --bin goose --features vulkan && \
|
||||
cp target/release/goose /output/goose
|
||||
DEOF
|
||||
|
||||
|
||||
@@ -57,10 +57,16 @@ function buildTarget(platform: string): void {
|
||||
console.log(`==> Building goose for ${platform} (${rustTarget})`);
|
||||
|
||||
try {
|
||||
execSync(`cargo build --release --target ${rustTarget} --bin goose`, {
|
||||
cwd: ROOT,
|
||||
stdio: "inherit",
|
||||
});
|
||||
const featureArgs = platform.startsWith("linux-")
|
||||
? " --features vulkan"
|
||||
: "";
|
||||
execSync(
|
||||
`cargo build --release --target ${rustTarget} --bin goose${featureArgs}`,
|
||||
{
|
||||
cwd: ROOT,
|
||||
stdio: "inherit",
|
||||
},
|
||||
);
|
||||
} catch (err) {
|
||||
console.error(`Failed to build for ${platform}`);
|
||||
throw err;
|
||||
|
||||
Reference in New Issue
Block a user