Commit graph

12 commits

Author SHA1 Message Date
Stephen Gutekanst
a750e31d11 Revert "all: build: fix sdkPath for relative @src.file / fix autocompletion with ZLS / IDEs (#661)"
This reverts commit a1fe671db8.

Lue suggested reverting #661 because ZLS worked around the issue of @src
being relative in that environment: https://github.com/zigtools/zls/pull/898

This is not a perfect solution (what zls did seems to be a workaround), but
is good enough for us until Zig gets an official package manager.
2023-01-10 01:57:52 -07:00
Wrench[bot]
7d246e76b3 all: update Zig to version 0.11.0-dev.1247+87b223428
Signed-off-by: Wrench[bot] <wrench@hexops.com>
2023-01-08 18:21:50 -07:00
Lue
a1fe671db8
all: build: fix sdkPath for relative @src.file / fix autocompletion with ZLS / IDEs (#661)
* all: build: fix sdkPath for relative @src.file

Prior to this commit, the build system heavily assumed that the result
`@src.file` would always be absolute, but this is no longer
guaranteed, likely due to there being no such thing as an "absolute
path" in WASI.

It appears that for normal invocations of `zig build`, it is safe to
assume that `@src.file` is absolute. However, when ZLS uses a custom
`build_runner.zig` to collect build configuration, `@src.file` is
actually relative to the current working directory, at least on my
system. For a while, this led to ZLS completions breaking entirely,
but presently it actually causes ZLS to crash!

The solution is not as simple as using relative `sdkPath` results
as-is, because the build system may attempt to resolve these paths
relative to build root, when the paths are actually relative to the
current working directory.

This leads to a sticky situation: the current working directory is a
runtime concept, but `@src.file` is resolved at compile time. However,
it appears that the build runner does not change current working
directory in between compilation and execution, so it is probably safe
to calculate `sdkPath` using runtime current working directory.

Still, this requires major changes with how `sdkPath` works, since
runtime computation and allocations are required. So pretty much
anything that relied on `sdkPath` being comptime-known has been
refactored in this commit.

The most severe result of this is that, for example, `gpu.pkg` can no
longer be a comptime-known constant: it has to be a runtime function
that takes a `*Builder` and returns a `Pkg`.

This commit deals with usages of `*.pkg` and `sdkPath` within Mach
itself, but projects that depend on Mach such as `mach-examples` will
almost certainly require changes as well.

* all: update README to reflect change in pkg usage

For details on updating your code to use this version, see: 88b1106953

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-02 01:23:46 -07:00
Wrench[bot]
d5f37257c5 all: update Zig to version 0.11.0-dev.1023+1c711b0a6
Signed-off-by: Wrench[bot] <wrench@hexops.com>
2023-01-01 02:40:57 -07:00
Wrench[bot]
a3a0417c21 all: update Zig to version 0.11.0-dev.1000+94780f7cd
Signed-off-by: Wrench[bot] <wrench@hexops.com>
2022-12-30 12:52:31 -07:00
Ali Chraghi
5849304fba all: update zig version 2022-12-25 13:36:03 -07:00
Ali Chraghi
3b162fdd7c all: update zig version 2022-12-18 18:02:31 -07:00
Stephen Gutekanst
2d705a8c3e earcut: fix inverted conditional in z-order index curve hashing
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-11-06 13:42:59 -07:00
Stephen Gutekanst
8b44cfe49b earcut: fix integer overflow in z-order curve hash codepath
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-11-06 13:36:22 -07:00
Stephen Gutekanst
f59860cea5 earcut: fix potential integer underflow
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-11-05 13:30:39 -07:00
Stephen Gutekanst
8638ec246e earcut: switch from pointer linked-list to index linked-list
* Means we can use a MultiArrayList as the backing array, which solves the lifetime
  issue and enables reuse of the buffer for multiple polygon tesselations.
* Improves performance.
* Simplifies accesses, removes optionality except in necessary cases.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-10-31 12:12:01 -07:00
Stephen Gutekanst
09fa494359 earcut: new industrial-strength polygon triangulation library
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-10-31 12:12:01 -07:00