DMD is self-contained, and all the source is there to generate code for all targets.
Can the target selection please be a runtime option?
It would be super handy even when *developing* DMD if it could cross-compile.
I'm working in windows, iterating on DMD, and every few minutes I run some test compiles and see the windows output, but I'd love to also see the linux output looks right.
Rather, I have to commit, push somewhere, sync on linux, build it there, and run my tests.
That's a slow and pointless turnaround, when I'm sure it wouldn't be too hard for DMD to just accept a --target option, then I could verify both outputs at the same time from the same place. Save me hours of stuffing about!
So, any takers? :)
Comment #1 by turkeyman — 2018-05-26T03:54:39Z
I should also add, this would be very useful for developing, but not JUST for developing.
I have a couple of projects where we generate our windows builds from linux CI infrastructure. We cross-compile our windows builds from linux, and DMD can't currently participate in that workflow.
I have used wine to build for windows using DMD from linux in the past, and that is... definitely less than ideal.
Comment #2 by doob — 2018-05-26T18:20:10Z
(In reply to Manu from comment #0)
> Rather, I have to commit, push somewhere, sync on linux, build it there, and
> run my tests.
In the meantime there's Windows subsystem for Linux and Docker.
Comment #3 by turkeyman — 2018-05-26T20:47:34Z
I've been using WSL. It has taken a couple of steps out of the turn-around, it's still not ideal though.
I'd like to just run the same binary, and I can debug it using the same debugger I use.
Comment #4 by trikkuz — 2018-05-29T13:00:04Z
I always hoped this. And I hope someone will patch dmd.
Comment #5 by turkeyman — 2019-08-02T03:49:37Z
This would really make iterating on DMD under windows SOOO MUCH EASIER!
Comment #6 by dlang-bot — 2021-05-20T11:02:32Z
@thewilsonator updated dlang/dmd pull request #12508 "Implement -target" fixing this issue:
- Fix issue 18907: enable cross-compilation with `-target=<triple>`
https://github.com/dlang/dmd/pull/12508
Comment #7 by dlang-bot — 2021-05-30T09:03:23Z
dlang/dmd pull request #12508 "Implement -target" was merged into master:
- 10688c92e469abf8a8e0951398c1f2e7b32eeaf9 by Nicholas Wilson:
Fix issue 18907: enable cross-compilation with `-target=<triple>`
https://github.com/dlang/dmd/pull/12508