# introduce std.Build.Module and extract some logic into it · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/c20ad51c621ba18d2c90cc96d1b550831dc5d7a3)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: c20ad51c621ba18d2c90cc96d1b550831dc5d7a3

Requested commit: c20ad51c621ba18d2c90cc96d1b550831dc5d7a3

Commit: c20ad51c621ba18d2c90cc96d1b550831dc5d7a3

Tree: 41786dd2be23e90fb13c3c867ad3881117b09b0f

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
introduce std.Build.Module and extract some logic into it

This moves many settings from `std.Build.Step.Compile` and into
`std.Build.Module`, and then makes them transitive.

In other words, it adds support for exposing Zig modules in packages,
which are configured in various ways, such as depending on other link
objects, include paths, or even a different optimization mode.

Now, transitive dependencies will be included in the compilation, so you
can, for example, make a Zig module depend on some C source code, and
expose that Zig module in a package.

Currently, the compiler frontend autogenerates only one
`@import("builtin")` module for the entire compilation, however, a
future enhancement will be to make it honor the differences in modules,
so that modules can be compiled with different optimization modes, code
model, valgrind integration, or even target CPU feature set.

closes #14719

```

## Parents

- [134e8cf76a6664ebd028fbcbfbd7a1b85ad031f5](https://git.cafe/gitcafe/zig/commit/134e8cf76a6664ebd028fbcbfbd7a1b85ad031f5?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/c20ad51c621ba18d2c90cc96d1b550831dc5d7a3?format=markdown)
