Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
cj1128 committed Jul 7, 2020
1 parent 9db10c0 commit 6a5bdd3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
SHELL := /bin/bash

flags := -X main.appVersion=`git tag --points-at HEAD`
build_flags := $(flags) -s -w

install:
go install -ldflags "$(flags)"
Expand All @@ -13,7 +12,9 @@ build:
exit 1 ; \
fi

go-bindata -prefix static static
# windows
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -v -tags static -ldflags "-s -w" -o "tmp/codeposter_windows_amd64.exe"

gox -arch="386 amd64" -os="darwin linux windows" -ldflags="$(build_flags)" -output="tmp/{{.Dir}}_{{.OS}}_{{.Arch}}"
# mac
go build -v -tags static -ldflags "-s -w" -o "tmp/codeposter_darwin_amd64"
.PHONY: build
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,23 @@

## 安装

因为 [go-sdl2](https://github.com/veandco/go-sdl2) 使用了 CGO,编译比较复杂,建议在 [Releases](https://github.com/cj1128/codeposter/releases) 中下载编译好的二进制程序。

### 编译

主机为 Mac,静态编译到 Mac:

```bash
$ go build -v -tags static -ldflags "-s -w"
```

交叉编译到 Windows:

```bash
$ go get -v github.com/cj1128/codeposter
$ CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -v -tags static -ldflags "-s -w"
```

或者去 [Releases](https://github.com/cj1128/codeposter/releases) 中下载编译好的二进制程序
Linux 无法在 Mac 上进行交叉编译,在 Linux 进行编译可以参考 [go-sdl2](https://github.com/veandco/go-sdl2) 的文档说明

## 使用

Expand Down

0 comments on commit 6a5bdd3

Please sign in to comment.