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

Specify CC flags for the armv6k target #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Meziu
Copy link
Member

@Meziu Meziu commented Mar 17, 2025

Closes #41
CC: @adryzz @ian-h-chamberlain

Bad first implementation i cooked up 2 months ago. Is there any project i could try this on? Extremely simple and portable C code doesn't have much problems regardless, and I can't find a reasonably sized test to use this on.

@Meziu Meziu requested a review from a team as a code owner March 17, 2025 18:45
@AzureMarker
Copy link
Member

AzureMarker commented Mar 17, 2025

You could try https://github.com/AzureMarker/n3ds-remote-play
Edit: nvm, you probably want something that has C in the build.

Copy link
Member

@ian-h-chamberlain ian-h-chamberlain left a comment

Choose a reason for hiding this comment

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

I think this looks reasonable at first glance and probably won't cause any issues although it might be useful to warn if any of these flags are detected in the environment.

As for testing it out, did you try the project the issue was originally filed about? https://github.com/adryzz/imgui-ctru-rs (edit: or any random sys crate maybe, e.g. https://lib.rs/crates/libz-sys)

);

command.env("CFLAGS_armv6k-nintendo-3ds", &cflags);
command.env("CXXFLAGS_armv6k-nintendo-3ds", &cflags);
Copy link
Member

@ian-h-chamberlain ian-h-chamberlain Mar 20, 2025

Choose a reason for hiding this comment

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

For most of these, I would probably suggest not overriding them (or at least emitting a warning of some sort) if they are already set in cargo-3ds's environment, to allow users to override this default behavior with more specific flags if they want.

For CFLAGS/CXXFLAGS we could do something like we have for RUSTFLAGS and just append all of these builtin flags, so the user could do something like CFLAGS_armv6k_nintendo_3ds=-Wall cargo 3ds build easily enough if they wanted to.

The downside is that to be "truly correct" you'd need to parse all the different ones that cc does.

Edit: one other thing, you could set these as e.g. TARGET_CFLAGS or TARGET_CC since we know the target here should always be armv6k-nintendo-3ds, and this would allow users to override with the more specific CC_armv6k_nintendo_3ds if they want to.

There is a function try_flags_from_environment but I'm not sure it works the way this is intended to... perhaps users would just need to override flags in their own build.rs if they really wanted

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.

Set environment variables for CC and CXX to allow building C/C++ wrapper crates
3 participants