Commit graph

11 commits

Author SHA1 Message Date
Vivek Roy
ff0258f27d all: use std.Build.installArtifact 2023-04-25 15:06:11 -07:00
Ali Chraghi
edd2117174 all: build: update to zig version 0.11.0-dev.6883+da0509750 2023-03-24 23:22:59 -07:00
Stephen Gutekanst
6bd4d91932 all: cache module() returns to avoid duplicate modules
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-03-15 21:20:28 -07:00
Stephen Gutekanst
ae06ca541f model3d: update to latest Zig build API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-02-12 10:05:03 -07:00
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
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
Stephen Gutekanst
c96ff64958 model3d: disable alignment sanitizer for all of model3d
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-11-14 18:14:35 -07:00
Keith Chambers
d21cce37a4
model3d: set cross-target when compiling statically (#616)
This is required for building with a non-native target, otherwise library is build for the native platform and attempts to link fail
2022-11-14 17:53:48 -07:00
Stephen Gutekanst
917b0eb8be model3d: disable UBSan alignment sanitization on m3d_load
Works around: https://gitlab.com/bztsrc/model3d/-/issues/19

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-11-14 16:52:36 -07:00
Keith Chambers
731e2b1287
{mach,model3d}: link model3d as static lib instead of adding C files to build step (#613)
This allows the library to link better with projects. Otherwise you can end up with a mix of conflicts over that compiler + version to use.

Also adds .use_model3d option to mach build system. If set to true, model3d will be linked in statically to target project.
2022-11-14 15:43:53 -07:00
Ali Chraghi
3ea1dea4f7
model3d: add m3d implementation / bindings (#589) 2022-10-21 07:42:01 -07:00