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

book: Set driver link-arg in build.rs #1502

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

crawfxrd
Copy link
Contributor

config.toml is a project-level configuration. Cargo will only read the configuration from the current directory and up, and not in:

  • package directories in a workspace
  • package directories when --manifest-path is used

Use build.rs instead, which will be executed before the package is built and only apply the flags for the specific package. This allows mixing drivers and applications in a workspace while still invoking Cargo from the workspace root.

Ref: https://doc.rust-lang.org/cargo/reference/config.html#hierarchical-structure
Ref: https://doc.rust-lang.org/cargo/reference/build-scripts.html

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

@crawfxrd crawfxrd force-pushed the driver-link-arg branch 2 times, most recently from 64db3cb to ba305ce Compare December 17, 2024 01:42
@crawfxrd crawfxrd changed the title book: Set driver link-arg in build.rs book: Set driver link-arg in build.rs Dec 17, 2024
Copy link
Contributor

@phip1611 phip1611 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. What do you think, @nicholasbishop?

`config.toml` is a project-level configuration. Cargo will only read the
configuration from the current directory and up, and not in:

- package directories in a workspace
- package directories when `--manifest-path` is used

Use `build.rs` instead, which will be executed before the package is
built and only apply the flags for the specific package. This allows mixing
drivers and applications in a workspace while still invoking Cargo from the
workspace root.

Ref: https://doc.rust-lang.org/cargo/reference/config.html#hierarchical-structure
Ref: https://doc.rust-lang.org/cargo/reference/build-scripts.html
Signed-off-by: Tim Crawford <tcrawford@system76.com>
@nicholasbishop nicholasbishop added this pull request to the merge queue Dec 18, 2024
Merged via the queue into rust-osdev:main with commit 1e5380e Dec 18, 2024
15 checks passed
@crawfxrd crawfxrd deleted the driver-link-arg branch December 18, 2024 01:25
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

Successfully merging this pull request may close these issues.

3 participants