summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-08-12 10:17:48 +0800
committerruki <[email protected]>2016-08-12 10:17:48 +0800
commit708236460a71b712317a5d2e6f834e705e7681a7 (patch)
tree37e0ce713a76803cf30c31c996528b71c4e0f793
parent9953fbf3c0eb8fb0b3c88a2693d312d5950dda0b (diff)
attempt to check env first
-rw-r--r--xmake/platforms/checker.lua11
-rw-r--r--xmake/platforms/linux/checker.lua16
-rw-r--r--xmake/platforms/macosx/checker.lua19
3 files changed, 46 insertions, 0 deletions
diff --git a/xmake/platforms/checker.lua b/xmake/platforms/checker.lua
index 24516944e..8b30f7dd5 100644
--- a/xmake/platforms/checker.lua
+++ b/xmake/platforms/checker.lua
@@ -240,3 +240,14 @@ function check_toolchain(config, kind, cross, name, description, check)
end
end
end
+
+-- check the toolchain from env
+function check_toolchain_from_env(config, kind, envname, description, check)
+
+ -- get shell name from the env
+ local shellname = os.getenv(envname)
+ if shellname and shellname:trim() ~= "" then
+ check_toolchain(config, kind, "", shellname, description, check)
+ end
+end
+
diff --git a/xmake/platforms/linux/checker.lua b/xmake/platforms/linux/checker.lua
index c8b9e11a8..b295db26a 100644
--- a/xmake/platforms/linux/checker.lua
+++ b/xmake/platforms/linux/checker.lua
@@ -63,6 +63,22 @@ function _check_toolchains(config)
end
end
+ -- no cross toolchains?
+ if cross and cross:trim() == "" then
+ -- check from env
+ checker.check_toolchain_from_env(config, "cc", "CC", "the c compiler")
+ checker.check_toolchain_from_env(config, "cxx", "CXX", "the c++ compiler")
+ checker.check_toolchain_from_env(config, "mm", "MM", "the objc compiler")
+ checker.check_toolchain_from_env(config, "mxx", "MXX", "the objc++ compiler")
+ checker.check_toolchain_from_env(config, "as", "AS", "the assember")
+ checker.check_toolchain_from_env(config, "ld", "LD", "the linker")
+ checker.check_toolchain_from_env(config, "ar", "AR", "the static library archiver")
+ checker.check_toolchain_from_env(config, "ex", "AR", "the static library extractor")
+ checker.check_toolchain_from_env(config, "sh", "SH", "the shared library linker")
+ checker.check_toolchain_from_env(config, "sc", "SC", "the swift compiler")
+ checker.check_toolchain_from_env(config, "dd", "DD", "the debugger")
+ end
+
-- check for gcc
checker.check_toolchain(config, "cc", cross, "gcc", "the c compiler")
checker.check_toolchain(config, "cxx", cross, "gcc", "the c++ compiler")
diff --git a/xmake/platforms/macosx/checker.lua b/xmake/platforms/macosx/checker.lua
index 9c58bfc4f..9dcbe040e 100644
--- a/xmake/platforms/macosx/checker.lua
+++ b/xmake/platforms/macosx/checker.lua
@@ -24,9 +24,28 @@
import("core.tool.tool")
import("platforms.checker", {rootdir = os.programdir()})
+-- check from envar
+function _check_toolchain_from_env(config, env)
+
+ checker.check_toolchain(config, "cc", "xcrun -sdk macosx ", "clang", "the c compiler")
+end
+
-- check the toolchains
function _check_toolchains(config)
+ -- check from env
+ checker.check_toolchain_from_env(config, "cc", "CC", "the c compiler")
+ checker.check_toolchain_from_env(config, "cxx", "CXX", "the c++ compiler")
+ checker.check_toolchain_from_env(config, "mm", "MM", "the objc compiler")
+ checker.check_toolchain_from_env(config, "mxx", "MXX", "the objc++ compiler")
+ checker.check_toolchain_from_env(config, "as", "AS", "the assember")
+ checker.check_toolchain_from_env(config, "ld", "LD", "the linker")
+ checker.check_toolchain_from_env(config, "ar", "AR", "the static library archiver")
+ checker.check_toolchain_from_env(config, "ex", "AR", "the static library extractor")
+ checker.check_toolchain_from_env(config, "sh", "SH", "the shared library linker")
+ checker.check_toolchain_from_env(config, "sc", "SC", "the swift compiler")
+ checker.check_toolchain_from_env(config, "dd", "DD", "the debugger")
+
-- check with xcrun
checker.check_toolchain(config, "cc", "xcrun -sdk macosx ", "clang", "the c compiler")
checker.check_toolchain(config, "cxx", "xcrun -sdk macosx ", "clang", "the c++ compiler")