diff options
| -rw-r--r-- | xmake/actions/config/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/platforms/cross/config.lua | 53 |
2 files changed, 56 insertions, 0 deletions
diff --git a/xmake/actions/config/xmake.lua b/xmake/actions/config/xmake.lua index ace84c4b0..597f4c0aa 100644 --- a/xmake/actions/config/xmake.lua +++ b/xmake/actions/config/xmake.lua @@ -166,6 +166,9 @@ task("config") , " - sdk/bin" , " - sdk/lib" , " - sdk/include" } + , {nil, "sdkname", "kv", nil, "The Cross SDK Name" + , "e.g." + , " - llvm" } -- show language menu options , function () diff --git a/xmake/platforms/cross/config.lua b/xmake/platforms/cross/config.lua index b410ddbef..cbd54ad25 100644 --- a/xmake/platforms/cross/config.lua +++ b/xmake/platforms/cross/config.lua @@ -52,12 +52,65 @@ function _check_cross_toolchain() end end +-- get llvm toolchains +function _toolchains_llvm() + + -- init toolchains + local cc = toolchain("the c compiler") + local cxx = toolchain("the c++ compiler") + local cpp = toolchain("the c preprocessor") + local ld = toolchain("the linker") + local sh = toolchain("the shared library linker") + local ar = toolchain("the static library archiver") + local ex = toolchain("the static library extractor") + local strip = toolchain("the symbols stripper") + local ranlib = toolchain("the static library index generator") + local as = toolchain("the assember") + local toolchains = {cc = cc, cxx = cxx, cpp = cpp, as = as, ld = ld, sh = sh, ar = ar, ex = ex, ranlib = ranlib, strip = strip} + + -- init the c compiler + cc:add("$(env CC)", "clang") + + -- init the c preprocessor + cpp:add("$(env CPP)", "clang -E") + + -- init the c++ compiler + cxx:add("$(env CXX)", "clang", "clang++") + + -- init the assember + as:add("$(env AS)", "clang") + + -- init the linker + ld:add("$(env LD)", "$(env CXX)", "clang++", "clang") + + -- init the shared library linker + sh:add("$(env SH)", "$(env CXX)", "clang++", "clang") + + -- init the static library archiver + ar:add("$(env AR)", "llvm-ar") + + -- init the static library extractor + ex:add("$(env AR)", "llvm-ar") + + -- init the static library index generator + ranlib:add("$(env RANLIB)", "llvm-ranlib") + + -- init the symbols stripper + strip:add("$(env STRIP)", "llvm-strip") + return toolchains +end + -- get toolchains function _toolchains() -- get cross prefix local cross = config.get("cross") or "" + -- for llvm toolchains? + if cross == "" and config.get("sdkname") == "llvm" then + return _toolchains_llvm() + end + -- init toolchains local cc = toolchain("the c compiler") local cxx = toolchain("the c++ compiler") |
