#Restricting build to target x86_64 Windows

1 messages · Page 1 of 1 (latest)

mystic gazelle
#

Hello !

I'm starting Zig, with a project to implement a sort of procfs to Windows, through WinFSP (https://github.com/winfsp/winfsp).
Obviously, since I'm targeting Windows, I would like to configure the build system to restrict it to actually only targeting Windows

I think I got a well formed std.Target, through

    const target = std.Target;
    const os = target.Os{ .tag = target.Os.Tag.windows, .version_range = target.Os.VersionRange{ .windows = target.Os.WindowsVersion.Range{
        .min = target.Os.WindowsVersion.win10_rs1,
        .max = target.Os.WindowsVersion.win10_fe,
    } } };

    const cpu = target.Cpu.Arch.x86_64;

    const mytarget = target{ .cpu = target.Cpu.baseline(cpu), .os = os, .abi = target.Abi.default(cpu, os), .ofmt = target.ObjectFormat.default(os.tag, cpu) };

But it looks like since Zig 0.10, b.setTarget() requires a std.zig.CrossTarget.
I tried to get one through std.zig.CrossTarget.fromTarget(), but the compiler complains about expected type 'zig.CrossTarget', found 'type'.

Is there a way to convert it ? Or even better, is there something like CrossTarget.fromTriplet("x86_64-windows-msvc") ?

deep star
#

Have you tried using default target and then conditionally check if it's windows

#

If it's not, throw something like @latent lichenmpileError() or @proud domenic()

#

damn, sorry for pings

latent lichen
#

Use `` next time

#

Although it's kind of funny that you managed to ping two people

deep star
#

discord doesn't highlight anything...

mystic gazelle
mystic gazelle
#

@compilerError() fails, even in an if block. Looks like if the compiler just sees it, it refuse to compile

#

Just returning from the function works tho, thanks for the help 🙂

latent lichen