The most troublesome thing was to put mingw .....
It's good to put it in yay, but I'm a student or you who asks questions every time and thinks it's troublesome if there are many packages. There was an option at last. answer Put none in the Nanchara series. Could you make this the default?
mingw.sh
yay --answerdiff none --answerclean none --answeredit none mingw-w64-binutils-bin
yay --answerdiff none --answerclean none --answeredit none mingw-w64-crt-bin
yay --answerdiff none --answerclean none --answeredit none mingw-w64-gcc-bin
yay --answerdiff none --answerclean none --answeredit none mingw-w64-headers-bin
yay --answerdiff none --answerclean none --answeredit none mingw-w64-winpthreads-bin
*.nim.cfg
The cross-compilation itself with nim is the nth brew, so you can write it almost exactly as it is.
Nim cross-compilation method -Qiita Nim cross-compilation method \ (Linux -> Windows version ) -Qiita
In archlinux, there is enough description in /etc/nim.cfg, so you only need to write the difference.
Since some GNU-linker options do not work with mingw-linker, it is necessary to crush the contents of the original option.
sh:*.nim.cfg
amd64.windows.gcc.path = "/usr/bin/"
amd64.windows.gcc.exe = "x86_64-w64-mingw32-gcc"
amd64.windows.gcc.linkerexe = "x86_64-w64-mingw32-gcc"
#amd64.windows.gcc.options.linker = ""
gcc.options.linker = ""
nim c --os:windows *.nim
After that, if you enter --os: windows, the output file name will also be * .exe. I haven't tried it on windows, but it worked on: P wine, so it's probably fine.
For example, if you build a certain script with os: windows, it will be like this
$ nim c --os:windows modini.nim
Hint: used config file '/etc/nim/nim.cfg' [Conf]
Hint: used config file '/etc/nim/config.nims' [Conf]
Hint: used config file '.../modini.nim.cfg' [Conf]
...
Hint: [Link]
Hint: 42996 LOC; 0.794 sec; 47.617MiB peakmem; Debug build; proj: .../modini.nim; out: .../modini.exe [SuccessX]
$ file modini.exe
modini.exe: PE32+ executable (console) x86-64, for MS Windows
$ wine ./modini.exe
Recommended Posts