Skip to content

Commit

Permalink
Fix build.zig for 0.12.1, and add running instructions to readme, det…
Browse files Browse the repository at this point in the history
…ect inkscape layer names (#7)

* Add selectors for inkscape svgs
* Fix workflow and compile with zig 0.12.1
* Add running instructions to readme

---------

Co-authored-by: Cory Alder <cory@davander.com>
  • Loading branch information
coryalder and Cory Alder authored Aug 4, 2024
1 parent 6ef5b3b commit 2ca058e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:

- name: Install Zig
run: |
wget -q https://ziglang.org/builds/zig-linux-x86_64-0.12.0-dev.1830+779b8e259.tar.xz
tar -xf zig-linux-x86_64-0.12.0-dev.1830+779b8e259.tar.xz
wget -q https://ziglang.org/download/0.12.1/zig-linux-x86_64-0.12.1.tar.xz
tar -xf zig-linux-x86_64-0.12.1.tar.xz
- uses: actions/setup-python@v4
with:
Expand All @@ -41,7 +41,7 @@ jobs:
- name: Build native
working-directory: native
run: |
../zig-linux-x86_64-0.12.0-dev.1830+779b8e259/zig build -Doptimize=ReleaseFast
../zig-linux-x86_64-0.12.1/zig build -Doptimize=ReleaseFast
- name: Build web
run: |
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ Gingerbread is a tool for converting vector artwork to KiCAD PCB files that live

See https://gingerbread.wntr.dev for more information.

## Building & Running

1. make sure you have python3 and zig (0.12.1) installed
2. build the native code in `native/` using `zig build`
3. make sure you have `jinja2` installed (`python3 -m pip install jinja2`)
4. run build.py in the root directory (`python3 build.py`)
5. this builds the site into `build/`, serve it using python `python3 -m http.server 8080 --bind 127.0.0.1 --directory ./build` and visit `http://127.0.0.1:8080/` to view the site

## License and contributing

Gingerbread is open source! Please take a chance to read the [LICENSE](LICENSE.md) file.
Expand Down
7 changes: 5 additions & 2 deletions native/build.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
const std = @import("std");

pub fn build(b: *std.Build) void {
const target: std.zig.CrossTarget = .{ .cpu_arch = .wasm32, .os_tag = .wasi };
const target = b.resolveTargetQuery(.{
.cpu_arch = .wasm32,
.os_tag = .wasi,
});
const optimize = b.standardOptimizeOption(.{});

const libpotrace = b.addStaticLibrary(.{
Expand Down Expand Up @@ -48,11 +51,11 @@ pub fn build(b: *std.Build) void {
.version = .{ .major = 1, .minor = 0, .patch = 0 },
.target = target,
.optimize = optimize,
.strip = true
});
libgingerbread.entry = .disabled;
libgingerbread.rdynamic = true;
libgingerbread.wasi_exec_model = std.builtin.WasiExecModel.reactor;
libgingerbread.strip = false;
libgingerbread.linkLibC();
libgingerbread.linkLibrary(libpotrace);
libgingerbread.linkLibrary(libclipper2);
Expand Down
16 changes: 8 additions & 8 deletions web/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,57 +23,57 @@ class Design {
{
name: "Drill",
type: "drill",
selector: "#Drill, #Drills",
selector: "#Drill, #Drills, [*|label=\"Drills\"]",
color: "Fuchsia",
},
{
name: "FSilkS",
type: "raster",
selector: "#FSilkS, #F\\.SilkS",
selector: "#FSilkS, #F\\.SilkS, [*|label=\"F\\.SilkS\"]",
color: "white",
number: 3,
},
{
name: "FMask",
type: "raster",
selector: "#FMask, #F\\.Mask",
selector: "#FMask, #F\\.Mask, [*|label=\"F\\.Mask\"]",
color: "black",
is_mask: true,
number: 5,
},
{
name: "FCu",
type: "raster",
selector: "#FCu, #F\\.Cu",
selector: "#FCu, #F\\.Cu, [*|label=\"F\\.Cu\"]",
color: "gold",
number: 1,
},
{
name: "BCu",
type: "raster",
selector: "#BCu, #B\\.Cu",
selector: "#BCu, #B\\.Cu, [*|label=\"B\\.Cu\"]",
color: "gold",
number: 2,
},
{
name: "BMask",
type: "raster",
selector: "#BMask, #B\\.Mask",
selector: "#BMask, #B\\.Mask, [*|label=\"B\\.Mask\"]",
color: "black",
is_mask: true,
number: 6,
},
{
name: "BSilkS",
type: "raster",
selector: "#BSilkS, #B\\.SilkS",
selector: "#BSilkS, #B\\.SilkS, [*|label=\"B\\.SilkS\"]",
color: "white",
number: 4,
},
{
name: "EdgeCuts",
type: "vector",
selector: "#EdgeCuts, #Edge\\.Cuts",
selector: "#EdgeCuts, #Edge\\.Cuts, [*|label=\"Edge\\.Cuts\"]",
color: "PeachPuff",
force_color: true,
number: 7,
Expand Down

0 comments on commit 2ca058e

Please # to comment.