|
|
@ -57,8 +57,14 @@ func BuildAndroid() error { |
|
|
|
func BuildIOS() error { |
|
|
|
func BuildIOS() error { |
|
|
|
fmt.Println("Building for iOS...") |
|
|
|
fmt.Println("Building for iOS...") |
|
|
|
outPath += "ios" |
|
|
|
outPath += "ios" |
|
|
|
|
|
|
|
arch := os.Getenv("GOARCH") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(arch) == 0 { |
|
|
|
|
|
|
|
arch = runtime.GOARCH |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
os.Setenv("GOOS", "darwin") |
|
|
|
os.Setenv("GOOS", "darwin") |
|
|
|
os.Setenv("GOARCH", "arm64") |
|
|
|
os.Setenv("GOARCH", arch) |
|
|
|
os.Setenv("CGO_ENABLED", "1") |
|
|
|
os.Setenv("CGO_ENABLED", "1") |
|
|
|
os.Setenv("CC", "clang") |
|
|
|
os.Setenv("CC", "clang") |
|
|
|
|
|
|
|
|
|
|
@ -81,11 +87,26 @@ func BuildLinux() error { |
|
|
|
fmt.Println("Building for Linux...") |
|
|
|
fmt.Println("Building for Linux...") |
|
|
|
|
|
|
|
|
|
|
|
outPath += "linux" |
|
|
|
outPath += "linux" |
|
|
|
|
|
|
|
arch := os.Getenv("GOARCH") |
|
|
|
|
|
|
|
cc := os.Getenv("CC") |
|
|
|
|
|
|
|
cxx := os.Getenv("CXX") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(arch) == 0 { |
|
|
|
|
|
|
|
arch = runtime.GOARCH |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(cc) == 0 { |
|
|
|
|
|
|
|
cc = "gcc" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(cxx) != 0 { |
|
|
|
|
|
|
|
os.Setenv("CXX", cxx) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
os.Setenv("GOOS", "linux") |
|
|
|
os.Setenv("GOOS", "linux") |
|
|
|
os.Setenv("GOARCH", "amd64") |
|
|
|
os.Setenv("GOARCH", arch) |
|
|
|
os.Setenv("CGO_ENABLED", "1") |
|
|
|
os.Setenv("CGO_ENABLED", "1") |
|
|
|
os.Setenv("CC", "gcc") //
|
|
|
|
os.Setenv("CC", cc) //
|
|
|
|
|
|
|
|
|
|
|
|
cmd := exec.Command("go", "build", "-buildmode=c-shared", "-trimpath", "-ldflags=-s -w", "-o", outPath+"/"+soName+".so", ".") |
|
|
|
cmd := exec.Command("go", "build", "-buildmode=c-shared", "-trimpath", "-ldflags=-s -w", "-o", outPath+"/"+soName+".so", ".") |
|
|
|
cmd.Dir = goSrc |
|
|
|
cmd.Dir = goSrc |
|
|
|