-
Notifications
You must be signed in to change notification settings - Fork 26
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
First stab at cross-compilation support #113
Conversation
I just want to note that the However, I cannot find any information on the deprecation of the |
By the way, the approach looks good. Let me know when you are ready to merge. I agree with implementing a workaround until target-spec-json is stabilized. Let's just create an issue after this is merged to remind us to refactor when appropriate. |
7327a56
to
eab74f8
Compare
6364a2e
to
c27d989
Compare
This took longer than expected to finish, sorry about the delay 😅. This is now ready for review. I mainly fixed all the tests and added a test to make sure cross-compilation actually worked, and added back Big caveat: I have no clue about the good practices in WiX. Notably the whole CargoTargetExplicit ifdef thing feels gross to me. You can't exactly pass booleans to the preprocessor, so that was the next closest thing I could find, but if there's a better way, I'd love to know :). |
No worries. It might take me some time to review, too.
Without any in-depth review or extensive thought to this, I am actually okay with breaking compatibility here. If the usage should be avoided, then we just need eliminate it. I was going to make a v0.4 release after this was complete. The tick up in the minor version, pre-1.0.0, would indicate some things have changed and I would make note in the release notes. I will play around with it a little bit to see if my initial thoughts are constant. |
My thought process is, since there's no (easy) way to tell cargo install "Please install this version or any semver-compatible version", I tend to avoid breaking changes in tools installable via So removing the |
I just looked at the |
The template doesn't use it anymore, but it's still defined in |
Got it! The platform is now just an alias for the architecture. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, thank you for implementing this feature and the effort. I saw that the --build-plan
option might be removed and I got really confused by the CargoTargetExplicit
implementation. I think it might be possible to move that logic back into Rust and avoid using the preprocessor. Please see my comment/rambling about it.
Once the comments are acknowledged, I am happy to merge/continue refining this implementation.
c27d989
to
a5921ac
Compare
My first stab at fixing #110. Not fully complete yet (need to integrate it into the CLI, write some tests, fix some others).
This PR works by adding a new optional target flag to the Create step, which contains the rust target to build for. This flag is passed as-is to the cargo invocation.
When invoking wix, we use the target to find which
-arch
to pass to wix. This is currently implemented by looking at the first component of the target name, and transforming it to something wix-compatible (e.g. "x86_64" => "x64", etc...). Note that this is somewhat wrong: Ideally we should extract the target spec fromrustc -Z unstable-options --print target-spec-json | jq .llvm-target
, but the target spec json isn't stable, so we can't easily rely on it. Using the target name is an OK approximation that should get us most of the way there.We then pass the target name to Wix as a variable, so we can find where the resulting binaries go.
I took the opportunity to remove use of Win64 and Platform in the wxs: those attributes are deprecated according to the wix documentation, passing -arch on the command line should be prefered (which this PR now does).
var.Platform
is replaced bysys.BUILDARCH
.