From e180c6ad99df696ff2f28b19c704089e29430a34 Mon Sep 17 00:00:00 2001 From: hzcortex Date: Sun, 28 Jan 2018 20:08:48 +0800 Subject: [PATCH] add cross-platform-compilation explanation --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index f5ff239..abe894c 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,31 @@ Fanfou backup tools via golang # deprecated delayed 饭否无法模拟登陆,问题暂时不想解决......以后有时间再做...... + +# 交叉编译 + + +``` +Windows 下编译 Mac 和 Linux 64位可执行程序 + +SET CGO_ENABLED=0 +SET GOOS=darwin +SET GOARCH=amd64 +go build main.go + +SET CGO_ENABLED=0 +SET GOOS=linux +SET GOARCH=amd64 +go build main.go +``` + + +Mac 下编译 Linux 和 Windows 64位可执行程序 + +CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go +CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go + +Linux 下编译 Mac 和 Windows 64位可执行程序 + +CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build main.go +CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go