#Substitute for `main_mod_path`

1 messages · Page 1 of 1 (latest)

past forge
#

I have a project where the file with the entry point is not at the root of the src directory, where I have everything else. Previously, on addExecutable I could pass the main_mod_path argument to be src/ and that would allow me to @import a file src/foo/bar.zig from src/baz/main.zig, for instance (as ../foo/bar.zig). However, the main_mod_path option, was removed in c20ad5. Reading through the diff, I can see the deletion but no similar option added.

And no, it's not an option to put main.zig directly on src/ (or something to avoid, rather), as it's a low-level project that needs different entry points depending on the architecture.

heavy heron
past forge
#

Oh, okay... Pretty disappointing to know that there is no other way to accomplish this... I'll try to create a main.zig file on src/ with a comptime switch that imports the corresponding main.zig file...

#

Thanks for the answer anyway, I guess I'll close this post now

heavy heron
#

yeah i know what you mean. i wished there was a replacement for a bit. but found that it was pretty easy for my use case to create a similar tests.zig file to what you described next to my build.zig

#

and import tests from there