Skip to content

Commit a07e5f6

Browse files
committed
add cross compile scripts and config
1 parent 81b5dc9 commit a07e5f6

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

cross-compile.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -euxo pipefail
4+
5+
build_commands=('
6+
choosenim stable \
7+
; nim c -d:release -o:bin/linux-amd64/nimclog src/nimclog.nim \
8+
; nim c -d:release --cpu:arm64 --os:linux -o:bin/linux-arm64/nimclog src/nimclog.nim \
9+
; nim c -d:release --os:macosx --cpu:amd64 -o:bin/darwin-amd64/nimclog src/nimclog.nim \
10+
; nim c -d:release -d:mingw --cpu:i386 -o:bin/windows-386/nimclog.exe src/nimclog.nim \
11+
; nim c -d:release -d:mingw --cpu:amd64 -o:bin/windows-amd64/nimclog.exe src/nimclog.nim
12+
')
13+
14+
docker run -it --rm -v `pwd`:/usr/local/src \
15+
chrishellerappsian/docker-nim-cross:latest \
16+
/bin/bash -c "choosenim stable; $build_commands"

src/nimclog.nim.cfg

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# mingw
2+
amd64.windows.gcc.path = "/usr/bin/"
3+
amd64.windows.gcc.exe = "x86_64-w64-mingw32-gcc"
4+
amd64.windows.gcc.cpp.exe = "x86_64-w64-mingw32-g++"
5+
amd64.windows.gcc.linkerexe = "x86_64-w64-mingw32-gcc"
6+
# non-zero length string to override default -ldl
7+
amd64.windows.gcc.options.linker = " "
8+
9+
i386.windows.gcc.path = "/usr/bin/"
10+
i386.windows.gcc.exe = "i686-w64-mingw32-gcc"
11+
i386.windows.gcc.cpp.exe = "i686-w64-mingw32-g++"
12+
i386.windows.gcc.linkerexe = "i686-w64-mingw32-gcc"
13+
# non-zero length string to override default -ldl
14+
i386.windows.gcc.options.linker = " "
15+
16+
# macos
17+
amd64.macosx.clang.path = "/opt/osxcross/target/bin/"
18+
amd64.macosx.clang.exe = "o64-clang"
19+
amd64.macosx.clang.linkerexe = "o64-clang"
20+
21+
i386.macosx.clang.path = "/opt/osxcross/target/bin/"
22+
i386.macosx.clang.exe = "o32-clang"
23+
i386.macosx.clang.linkerexe = "o32-clang"
24+
25+
# linux (32 bit)
26+
@if unix and i386:
27+
passC = "-m32"
28+
passL = "-m32"
29+
@end
30+
31+
# linux (musl)
32+
@if musl:
33+
passL = "-static"
34+
gcc.exe = "/usr/bin/musl-gcc"
35+
gcc.linkerexe = "/usr/bin/musl-gcc"
36+
@end

0 commit comments

Comments
 (0)