Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding include and library paths when using zig build #2536

Closed
kavika13 opened this issue May 22, 2019 · 1 comment
Closed

Adding include and library paths when using zig build #2536

kavika13 opened this issue May 22, 2019 · 1 comment

Comments

@kavika13
Copy link
Contributor

kavika13 commented May 22, 2019

I'm trying to build the Tetris example on Windows. The dependencies (libpng, libepoxy, glfw, etc) are not installed globally on my box, nor do I want them to be.

Should I be modifying build.zig to include the library and header paths? That doesn't seem optimal (unless the tetris project gets modified to include the headers/libs for those inside the project dir, in which case that should be an upstream modification).

Normally you can add additional compiler flags in a build system, but I'm not seeing anything like that in Zig Build. I see -isystem on the compiler itself, but not a way to pass that flag on to it from zig build.

This seems like something that could also be "solved" by a package manager, but we're talking about generic C toolchain compatibility here, so I still think it would be important to support this mode, too.

Sorry if this is an existing ticket. Couldn't find one after like 15 minutes of looking :)

Edit: Seems like there's a lot of related conversation here: #2041

@andrewrk
Copy link
Member

I'm trying to build the Tetris example on Windows. The dependencies (libpng, libepoxy, glfw, etc) are not installed globally on my box, nor do I want them to be.

The honest answer here is to sit tight until the package manager (#943) is available.

I see that you mentioned this:

This seems like something that could also be "solved" by a package manager, but we're talking about generic C toolchain compatibility here, so I still think it would be important to support this mode, too.

You can expose options to zig build like this:

zig/build.zig

Line 86 in 2c0280b

const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter");

This could be an include path for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants