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

Save target.json and linker script to target directory #1

Open
parasyte opened this issue Jun 23, 2019 · 5 comments
Open

Save target.json and linker script to target directory #1

parasyte opened this issue Jun 23, 2019 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@parasyte
Copy link
Collaborator

The target.json and linker script files are currently written to a temporary directory. These should be written to the target directory instead. It should use a sub-directory like ./target/cargo-n64 to keep the target directory clean. The directory tree will have to be created if it does not exist.

@Lokathor
Copy link
Member

Lokathor commented Jun 23, 2019

In the gba crate we keep the target description json in the project root so that it's more visible to others that are just browsing the code. You might want to do that here too. Then you can copy it to wherever during the build or alter the command line argument appropriately.

@parasyte
Copy link
Collaborator Author

I wasn't happy with duplicating these build files in each bin crate. And there's a dependency issue with the runtime rrt0 requiring specific symbols defined by the linker script.

The best case is that these are built into the compiler, but I'm no where near ready to support that kind of effort. So I ended up with this cargo wrapper to manage compiling, linking, and the minimal runtime.

You can see from other tickets that rls needs paths to at least the sysroot and target.json so I guess cargo-n64 will handle that, too. 🤷‍♀

@Lokathor
Copy link
Member

you can still have the build.rs copy the data to the OUT_DIR, and then place an environment value in the build for where other crates can find that file.

This is all necessary because, by the rules of build.rs files, a build.rs that writes to anywhere in the project directory other than the OUT_DIR is a "failed" build when checking for a build pass during a cargo publish.

@parasyte
Copy link
Collaborator Author

I'm not planning to require a build.rs for the various bin crates (e.g. N64 games). For the same reason I don't want to require copying the target.json and linker script around.

... Unless you had another idea with build.rs that I don't quite grasp.

@parasyte
Copy link
Collaborator Author

Now that I've come back to this, it probably does make sense to include a "common" build script somewhere. I'm still not convinced that it should be copy-pasta into every N64 Rust project, but for sure in some common dependency. And it will dramatically improve many of the difficulties that we have now with building N64 ROMs. Things like, running an RSP assembler to build microcode, or build-time asset format conversions, etc.

@parasyte parasyte added enhancement New feature or request help wanted Extra attention is needed labels Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants