Skip to content

Commit

Permalink
change gdk's name
Browse files Browse the repository at this point in the history
  • Loading branch information
wdsgyj committed Oct 25, 2023
1 parent 9c35dea commit 8daa860
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ FAIL

### 加入 NDK 头文件和库文件的定位方法

我们经常需要使用 NDK 的一些头文件,比如 `jni.h``EGL/egl.h``GLES3/gl3.h` 等等。而它们的定位并不是一件容易的事,通过 `gdk` 工具的加入可以帮助我们简化这一过程。我们以调用 NDK 函数输出日志到 logcat 中为例:
我们经常需要使用 NDK 的一些头文件,比如 `jni.h``EGL/egl.h``GLES3/gl3.h` 等等。而它们的定位并不是一件容易的事,通过 `pos` 工具的加入可以帮助我们简化这一过程。我们以调用 NDK 函数输出日志到 logcat 中为例:

```go
package main
Expand Down Expand Up @@ -214,7 +214,7 @@ func main() {
然后再打开另一个 terminal 编译我们的程序并运行:

```shell
> arm64 gdk go run -exec=arun .
> arm64 pos go run -exec=arun .
============================
[exit status:(0)]
0m00.04s real 0m00.01s user 0m00.03s system
Expand All @@ -232,10 +232,10 @@ func main() {

我们只需要添加连接选项 `#cgo LDFLAGS: -llog` 而无须考虑头文件和库文件在文件系统中的具体位置在哪里。

> gdk 具体使用方法:
> pos 具体使用方法:
>
> `[386|amd64|arm|arm64] [gdk [-level <android API level>]] go ...`
> `[386|amd64|arm|arm64] [pos [-level <android API level>]] go ...`
>
> - 其中 `gdk` 必须出现在 `386|amd64|arm|arm64` 它们任一个之后,其他 `go` 命令之前
> - 其中 `pos` 必须出现在 `386|amd64|arm|arm64` 它们任一个之后,其他 `go` 命令之前
> - 可以使用 `-level <android API level>` 指定具体的 API level,默认为 21
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

go install ./386 ./amd64 ./arm ./arm64 ./gdk
go install ./386 ./amd64 ./arm ./arm64 ./pos
2 changes: 1 addition & 1 deletion gdk/main.go → pos/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func main() {
flag.Parse()

if len(flag.Args()) == 0 {
fmt.Fprintf(os.Stderr, "缺少参数,gdk 不能自己运行\n")
fmt.Fprintf(os.Stderr, "缺少参数,pos 不能自己运行\n")
os.Exit(1)
}

Expand Down

0 comments on commit 8daa860

Please sign in to comment.