Hi - first - _loving nim, it is such a breath of fresh air!
I want to automate cross-compiling and building a Linux and Windows deployable (from a Linux docker). I have managed to do this with nim and mingw thanks to https://stackoverflow.com/a/37817061.
I don't quite understand the relationship between nimble and nim though. I can't figure out how to use nimble to compile and link against multiple CPUs and OSes?
What is the use case for nimble and should it support cross-compilation?
FWIW, I was hugely attracted to go because of its ludicrously simple cross-compilation. If nim could match its ease of use (for cross-building) then it would be awesome ;-).
Thanks!
Nimble is a package manager. I don't know where you got cross compilation and Nimble from but Nimble just makes installing packages easier and it has nothing to do with cross compiling.
The stackoverflow answer says you can change the --cpu and --os flags with whatever to cross compile with anything. There's more on these flags in the nim compiler documentation which you can change the C/C++ compiler with too
Thanks @Hlaaftana.
I think I assumed Nimble was more than just that, and I didn't realise I could install packages with Nimble and still use nim to compile. The fact Nimble has capabilities to build, clean and install the project threw me a little.
I will experiment, but my assumption then is that I can install packages with Nimble and still compile with nim.
Thanks again.
Actually Nimble isn't just a package manager. You can use Nim to compile Nimble packages but it's better to use Nimble itself, this is because Nim cannot read your .nimble file whereas Nimble can.
Nimble supports the same compilation commands as Nim: nimble c --cpu:amd64 --os:windows file.nim should work.