diff options
| author | ruki <[email protected]> | 2020-07-19 12:58:57 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-07-19 12:58:57 +0800 |
| commit | 4ef022737b74da6e2c2e2a351424dd281ea7cf0c (patch) | |
| tree | 29771c2bc94454ef8707c86aba350bf592120654 /xmake/toolchains/go | |
| parent | 5bcf2414231f41c96be8ba8403a17b679c18af59 (diff) | |
add goos and goarch
Diffstat (limited to 'xmake/toolchains/go')
| -rw-r--r-- | xmake/toolchains/go/xmake.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/xmake/toolchains/go/xmake.lua b/xmake/toolchains/go/xmake.lua index 39c253b57..60fed9041 100644 --- a/xmake/toolchains/go/xmake.lua +++ b/xmake/toolchains/go/xmake.lua @@ -32,6 +32,25 @@ toolchain("go") -- on load on_load(function (toolchain) + if not toolchain:is_plat(os.host()) or not toolchain:is_arch(os.arch()) then + local goos, goarch + if toolchain:is_plat("windows", "mingw", "msys", "cygwin") then + goos = "windows" + goarch = toolchain:is_arch("x64", "x86_64") and "amd64" or "386" + elseif toolchain:is_plat("linux") then + goos = "linux" + goarch = toolchain:is_arch("x86_64") and "amd64" or "386" + elseif toolchain:is_plat("macosx") then + goos = "darwin" + goarch = toolchain:is_arch("x86_64") and "amd64" or "386" + end + if goos then + toolchain:add("runenvs", "GOOS", goos) + end + if goarch then + toolchain:add("runenvs", "GOARCH", goarch) + end + end toolchain:set("gcldflags", "") end) |
