Skip to content

Commit

Permalink
ci: linux gui compiles?
Browse files Browse the repository at this point in the history
  • Loading branch information
cztomsik committed Oct 8, 2024
1 parent 1d50173 commit fb94d81
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ jobs:
strategy:
fail-fast: false
matrix:
target:
[
target: [
# { headless: false, os: "windows-latest" },
{ headless: false, os: "ubuntu-latest" },
# { headless: false, os: "macos-14" },
{ headless: true, os: "windows-latest" },
{ headless: true, os: "ubuntu-latest" },
{ headless: true, os: "macos-14" },
Expand All @@ -30,12 +32,18 @@ jobs:
with:
version: master

- if: runner.os == 'macOS'
run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

- if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libwebkit2gtk-4.1-dev

- run: npm ci && npm run build

- run: zig build -Doptimize=ReleaseFast -Dheadless=${{ matrix.target.headless }}
- run: zig build -Doptimize=ReleaseSafe -Dheadless=${{ matrix.target.headless }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ava-${{ matrix.target.headless && 'headless-' }}${{ matrix.target.os }}
name: ava-${{ matrix.target.headless && 'headless-' || '' }}${{ matrix.target.os }}
path: zig-out/bin/*
26 changes: 17 additions & 9 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,7 @@ pub fn build(b: *std.Build) !void {
exe.root_module.addOptions("options", options);

if (!headless) {
const webview = b.dependency("webview", .{});
exe.linkLibCpp();
exe.addIncludePath(webview.path(""));
exe.addCSourceFile(.{ .file = webview.path("webview.cc"), .flags = &.{ "-std=c++14", "-DWEBVIEW_STATIC" } });

switch (target.result.os.tag) {
.macos => exe.linkFramework("WebKit"),
else => {},
}
try addWebview(b, exe);
}

try addLlama(b, exe);
Expand All @@ -53,6 +45,22 @@ pub fn build(b: *std.Build) !void {
run_step.dependOn(&run_cmd.step);
}

fn addWebview(b: *std.Build, exe: anytype) !void {
const webview = b.dependency("webview", .{});
exe.linkLibCpp();
exe.addIncludePath(webview.path(""));
exe.addCSourceFile(.{ .file = webview.path("webview.cc"), .flags = &.{ "-std=c++14", "-DWEBVIEW_STATIC" } });

switch (exe.rootModuleTarget().os.tag) {
.macos => exe.linkFramework("WebKit"),
.linux => {
exe.linkSystemLibrary("gtk+-3.0");
exe.linkSystemLibrary("webkit2gtk-4.1");
},
else => {},
}
}

fn addLlama(b: *std.Build, exe: anytype) !void {
exe.addIncludePath(b.path("llama.cpp/ggml/include"));
exe.addIncludePath(b.path("llama.cpp/include"));
Expand Down

0 comments on commit fb94d81

Please sign in to comment.