diff options
| author | ruki <[email protected]> | 2016-07-04 09:15:14 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-07-04 09:15:14 +0800 |
| commit | 4f352825fa293e1dd5a81c1ce986ecd76b71a9f9 (patch) | |
| tree | d4f693b65be01e22ee69667b62976d8982e0f4a8 | |
| parent | 0dc9e08fe6f74a9b98a37e00bcdeb50ed317b3df (diff) | |
fix get ar failed after checking ar
| -rw-r--r-- | xmake/core/platform/platform.lua | 10 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/tool/tool.lua | 3 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/type.lua | 25 | ||||
| -rw-r--r-- | xmake/core/tool/tool.lua | 3 | ||||
| -rw-r--r-- | xmake/platforms/android/checker.lua | 1 | ||||
| -rwxr-xr-x | xmake/platforms/android/xmake.lua | 14 | ||||
| -rw-r--r-- | xmake/platforms/checker.lua | 6 | ||||
| -rw-r--r-- | xmake/platforms/iphoneos/checker.lua | 2 | ||||
| -rwxr-xr-x | xmake/platforms/iphoneos/xmake.lua | 14 | ||||
| -rw-r--r-- | xmake/platforms/linux/checker.lua | 1 | ||||
| -rwxr-xr-x | xmake/platforms/linux/xmake.lua | 14 | ||||
| -rw-r--r-- | xmake/platforms/macosx/checker.lua | 1 | ||||
| -rwxr-xr-x | xmake/platforms/macosx/xmake.lua | 14 | ||||
| -rw-r--r-- | xmake/platforms/mingw/checker.lua | 1 | ||||
| -rwxr-xr-x | xmake/platforms/mingw/xmake.lua | 14 | ||||
| -rw-r--r-- | xmake/platforms/watchos/checker.lua | 2 | ||||
| -rwxr-xr-x | xmake/platforms/watchos/xmake.lua | 14 | ||||
| -rwxr-xr-x | xmake/platforms/windows/xmake.lua | 10 |
18 files changed, 41 insertions, 108 deletions
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua index 3c6d35e6e..5f431d671 100644 --- a/xmake/core/platform/platform.lua +++ b/xmake/core/platform/platform.lua @@ -370,16 +370,6 @@ function platform.tooldirs(plat) end end --- get the given tool -function platform.tool(name) - - -- get tools - local tools = platform.get("tools") - if tools then - return tools[name] - end -end - -- get the given format function platform.format(kind) diff --git a/xmake/core/sandbox/modules/import/core/tool/tool.lua b/xmake/core/sandbox/modules/import/core/tool/tool.lua index 883789c2c..f8df0fcbf 100644 --- a/xmake/core/sandbox/modules/import/core/tool/tool.lua +++ b/xmake/core/sandbox/modules/import/core/tool/tool.lua @@ -25,6 +25,7 @@ local sandbox_core_tool = sandbox_core_tool or {} -- load modules local tool = require("tool/tool") +local config = require("project/config") local platform = require("platform/platform") local raise = require("sandbox/modules/raise") @@ -32,7 +33,7 @@ local raise = require("sandbox/modules/raise") function sandbox_core_tool.shellname(name) -- get it - return platform.tool(name) + return config.get(name) end -- run the tool diff --git a/xmake/core/sandbox/modules/type.lua b/xmake/core/sandbox/modules/type.lua new file mode 100644 index 000000000..3dca38f99 --- /dev/null +++ b/xmake/core/sandbox/modules/type.lua @@ -0,0 +1,25 @@ +--!The Automatic Cross-platform Build Tool +-- +-- XMake is free software; you can redistribute it and/or modify +-- it under the terms of the GNU Lesser General Public License as published by +-- the Free Software Foundation; either version 2.1 of the License, or +-- (at your option) any later version. +-- +-- XMake is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public License +-- along with XMake; +-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> +-- +-- Copyright (C) 2015 - 2016, ruki All rights reserved. +-- +-- @author ruki +-- @file type.lua +-- + +-- load module +return type + diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua index 8bd41d498..ffdf748f4 100644 --- a/xmake/core/tool/tool.lua +++ b/xmake/core/tool/tool.lua @@ -33,7 +33,6 @@ local filter = require("base/filter") local config = require("project/config") local global = require("project/global") local sandbox = require("sandbox/sandbox") -local platform = require("platform/platform") -- the directories of tools function tool._directories(name) @@ -229,7 +228,7 @@ end function tool.load(kind) -- get the shell name - local shellname = platform.tool(kind) + local shellname = config.get(kind) if not shellname then return nil, string.format("cannot get tool for %s", kind) end diff --git a/xmake/platforms/android/checker.lua b/xmake/platforms/android/checker.lua index 78f2fd72f..ae77bab8d 100644 --- a/xmake/platforms/android/checker.lua +++ b/xmake/platforms/android/checker.lua @@ -113,6 +113,7 @@ function _check_toolchains(config) checker.check_toolchain(config, "as", cross, "gcc", "the assember") checker.check_toolchain(config, "ld", cross, "g++", "the linker") checker.check_toolchain(config, "ar", cross, "ar", "the static library linker") + checker.check_toolchain(config, "ex", cross, "ar", "the static library extractor") checker.check_toolchain(config, "sh", cross, "g++", "the shared library linker") end diff --git a/xmake/platforms/android/xmake.lua b/xmake/platforms/android/xmake.lua index 2bb1eb55d..34cc717c5 100755 --- a/xmake/platforms/android/xmake.lua +++ b/xmake/platforms/android/xmake.lua @@ -49,19 +49,7 @@ platform("android") _g.formats.static = {"lib", ".a"} _g.formats.object = {"", ".o"} _g.formats.shared = {"lib", ".so"} - - -- init the toolchains - _g.tools = {} - _g.tools.ccache = config.get("__ccache") - _g.tools.cc = config.get("cc") - _g.tools.cxx = config.get("cxx") - _g.tools.as = config.get("as") - _g.tools.ld = config.get("ld") - _g.tools.ar = config.get("ar") - _g.tools.sh = config.get("sh") - _g.tools.ex = config.get("ar") - _g.tools.sc = config.get("sc") - + -- init flags local arch = config.get("arch") if arch:startswith("arm64") then diff --git a/xmake/platforms/checker.lua b/xmake/platforms/checker.lua index 158156dbc..73848aa13 100644 --- a/xmake/platforms/checker.lua +++ b/xmake/platforms/checker.lua @@ -158,22 +158,20 @@ function check_ccache(config) -- get the ccache local ccache = config.get("ccache") - if ccache == nil then + if ccache == nil or (type(ccache) == "boolean" and ccache) then -- check the ccache path local ccache_path = tool.check("ccache") -- check ok? update it if ccache_path then - config.set("ccache", true) - config.set("__ccache", ccache_path) + config.set("ccache", ccache_path) else config.set("ccache", false) end -- trace print("checking for the ccache ... %s", ifelse(ccache_path, ccache_path, "no")) - end end diff --git a/xmake/platforms/iphoneos/checker.lua b/xmake/platforms/iphoneos/checker.lua index 6c2c42c73..09e033d62 100644 --- a/xmake/platforms/iphoneos/checker.lua +++ b/xmake/platforms/iphoneos/checker.lua @@ -54,6 +54,7 @@ function _check_toolchains(config) checker.check_toolchain(config, "ld", "xcrun -sdk iphonesimulator ", "clang++", "the linker") checker.check_toolchain(config, "ld", "xcrun -sdk iphonesimulator ", "clang", "the linker") checker.check_toolchain(config, "ar", "xcrun -sdk iphonesimulator ", "ar", "the static library linker") + checker.check_toolchain(config, "ex", "xcrun -sdk iphonesimulator ", "ar", "the static library extractor") checker.check_toolchain(config, "sh", "xcrun -sdk iphonesimulator ", "clang++", "the shared library linker") checker.check_toolchain(config, "sh", "xcrun -sdk iphonesimulator ", "clang", "the shared library linker") checker.check_toolchain(config, "sc", "xcrun -sdk iphonesimulator ", "swiftc", "the swift compiler") @@ -69,6 +70,7 @@ function _check_toolchains(config) checker.check_toolchain(config, "ld", "xcrun -sdk iphoneos ", "clang++", "the linker") checker.check_toolchain(config, "ld", "xcrun -sdk iphoneos ", "clang", "the linker") checker.check_toolchain(config, "ar", "xcrun -sdk iphoneos ", "ar", "the static library linker") + checker.check_toolchain(config, "ex", "xcrun -sdk iphoneos ", "ar", "the static library extractor") checker.check_toolchain(config, "sh", "xcrun -sdk iphoneos ", "clang++", "the shared library linker") checker.check_toolchain(config, "sh", "xcrun -sdk iphoneos ", "clang", "the shared library linker") checker.check_toolchain(config, "sc", "xcrun -sdk iphoneos ", "swiftc", "the swift compiler") diff --git a/xmake/platforms/iphoneos/xmake.lua b/xmake/platforms/iphoneos/xmake.lua index 26a88678c..d7dd5b3ff 100755 --- a/xmake/platforms/iphoneos/xmake.lua +++ b/xmake/platforms/iphoneos/xmake.lua @@ -50,20 +50,6 @@ platform("iphoneos") _g.formats.object = {"", ".o"} _g.formats.shared = {"lib", ".dylib"} - -- init the tools - _g.tools = {} - _g.tools.ccache = config.get("__ccache") - _g.tools.cc = config.get("cc") - _g.tools.cxx = config.get("cxx") - _g.tools.mm = config.get("mm") - _g.tools.mxx = config.get("mxx") - _g.tools.ld = config.get("ld") - _g.tools.as = config.get("as") - _g.tools.ar = config.get("ar") - _g.tools.sh = config.get("sh") - _g.tools.ex = config.get("ar") - _g.tools.sc = config.get("sc") - -- iphoneos or iphonesimulator? local arch = config.get("arch") if arch == "i386" or arch == "x86_64" then diff --git a/xmake/platforms/linux/checker.lua b/xmake/platforms/linux/checker.lua index 324f52f72..b7e24f1a5 100644 --- a/xmake/platforms/linux/checker.lua +++ b/xmake/platforms/linux/checker.lua @@ -69,6 +69,7 @@ function _check_toolchains(config) checker.check_toolchain(config, "as", cross, "gcc", "the assember") checker.check_toolchain(config, "ld", cross, "g++", "the linker") checker.check_toolchain(config, "ar", cross, "ar", "the static library linker") + checker.check_toolchain(config, "ex", cross, "ar", "the static library extractor") checker.check_toolchain(config, "sh", cross, "g++", "the shared library linker") end diff --git a/xmake/platforms/linux/xmake.lua b/xmake/platforms/linux/xmake.lua index f2c4552ca..142a5f2c6 100755 --- a/xmake/platforms/linux/xmake.lua +++ b/xmake/platforms/linux/xmake.lua @@ -52,19 +52,7 @@ platform("linux") _g.formats.static = {"lib", ".a"} _g.formats.object = {"", ".o"} _g.formats.shared = {"lib", ".so"} - - -- init the toolchains - _g.tools = {} - _g.tools.ccache = config.get("__ccache") - _g.tools.cc = config.get("cc") - _g.tools.cxx = config.get("cxx") - _g.tools.as = config.get("as") - _g.tools.ld = config.get("ld") - _g.tools.ar = config.get("ar") - _g.tools.sh = config.get("sh") - _g.tools.ex = config.get("ar") - _g.tools.sc = config.get("sc") - + -- cross toolchains? if config.get("cross") then diff --git a/xmake/platforms/macosx/checker.lua b/xmake/platforms/macosx/checker.lua index 3da2b35a6..777f45d96 100644 --- a/xmake/platforms/macosx/checker.lua +++ b/xmake/platforms/macosx/checker.lua @@ -38,6 +38,7 @@ function _check_toolchains(config) checker.check_toolchain(config, "ld", "xcrun -sdk macosx ", "clang++", "the linker") checker.check_toolchain(config, "ld", "xcrun -sdk macosx ", "clang", "the linker") checker.check_toolchain(config, "ar", "xcrun -sdk macosx ", "ar", "the static library linker") + checker.check_toolchain(config, "ex", "xcrun -sdk macosx ", "ar", "the static library extractor") checker.check_toolchain(config, "sh", "xcrun -sdk macosx ", "clang++", "the shared library linker") checker.check_toolchain(config, "sh", "xcrun -sdk macosx ", "clang", "the shared library linker") checker.check_toolchain(config, "sc", "xcrun -sdk macosx ", "swiftc", "the swift compiler") diff --git a/xmake/platforms/macosx/xmake.lua b/xmake/platforms/macosx/xmake.lua index 22e79387e..33b60b1e8 100755 --- a/xmake/platforms/macosx/xmake.lua +++ b/xmake/platforms/macosx/xmake.lua @@ -53,20 +53,6 @@ platform("macosx") _g.formats.object = {"", ".o"} _g.formats.shared = {"lib", ".dylib"} - -- init the tools - _g.tools = {} - _g.tools.ccache = config.get("__ccache") - _g.tools.cc = config.get("cc") - _g.tools.cxx = config.get("cxx") - _g.tools.mm = config.get("mm") - _g.tools.mxx = config.get("mxx") - _g.tools.as = config.get("as") - _g.tools.ld = config.get("ld") - _g.tools.ar = config.get("ar") - _g.tools.sh = config.get("sh") - _g.tools.ex = config.get("ar") - _g.tools.sc = config.get("sc") - -- init flags for architecture local arch = config.get("arch") local target_minver = config.get("target_minver") diff --git a/xmake/platforms/mingw/checker.lua b/xmake/platforms/mingw/checker.lua index d2f50b884..d45057e54 100644 --- a/xmake/platforms/mingw/checker.lua +++ b/xmake/platforms/mingw/checker.lua @@ -56,6 +56,7 @@ function _check_toolchains(config) checker.check_toolchain(config, "ld", cross, "g++", "the linker") checker.check_toolchain(config, "ld", cross, "gcc", "the linker") checker.check_toolchain(config, "ar", cross, "ar", "the static library linker") + checker.check_toolchain(config, "ex", cross, "ar", "the static library extractor") checker.check_toolchain(config, "sh", cross, "g++", "the shared library linker") checker.check_toolchain(config, "sh", cross, "gcc", "the shared library linker") checker.check_toolchain(config, "sc", cross, "swiftc", "the swift compiler") diff --git a/xmake/platforms/mingw/xmake.lua b/xmake/platforms/mingw/xmake.lua index 10602eaf4..3fb63fc8e 100755 --- a/xmake/platforms/mingw/xmake.lua +++ b/xmake/platforms/mingw/xmake.lua @@ -47,19 +47,7 @@ platform("mingw") _g.formats.object = {"", ".obj"} _g.formats.shared = {"", ".dll"} _g.formats.binary = {"", ".exe"} - - -- init the toolchains - _g.tools = {} - _g.tools.ccache = config.get("__ccache") - _g.tools.cc = config.get("cc") - _g.tools.cxx = config.get("cxx") - _g.tools.as = config.get("as") - _g.tools.ld = config.get("ld") - _g.tools.ar = config.get("ar") - _g.tools.sh = config.get("sh") - _g.tools.ex = config.get("ar") - _g.tools.sc = config.get("sc") - + -- init flags for architecture local archflags = nil local arch = config.get("arch") diff --git a/xmake/platforms/watchos/checker.lua b/xmake/platforms/watchos/checker.lua index 89ab5f1ee..2a76ac1f3 100644 --- a/xmake/platforms/watchos/checker.lua +++ b/xmake/platforms/watchos/checker.lua @@ -54,6 +54,7 @@ function _check_toolchains(config) checker.check_toolchain(config, "ld", "xcrun -sdk watchsimulator ", "clang++", "the linker") checker.check_toolchain(config, "ld", "xcrun -sdk watchsimulator ", "clang", "the linker") checker.check_toolchain(config, "ar", "xcrun -sdk watchsimulator ", "ar", "the static library linker") + checker.check_toolchain(config, "ex", "xcrun -sdk watchsimulator ", "ar", "the static library extractor") checker.check_toolchain(config, "sh", "xcrun -sdk watchsimulator ", "clang++", "the shared library linker") checker.check_toolchain(config, "sh", "xcrun -sdk watchsimulator ", "clang", "the shared library linker") checker.check_toolchain(config, "sc", "xcrun -sdk watchsimulator ", "swiftc", "the swift compiler") @@ -69,6 +70,7 @@ function _check_toolchains(config) checker.check_toolchain(config, "ld", "xcrun -sdk watchos ", "clang++", "the linker") checker.check_toolchain(config, "ld", "xcrun -sdk watchos ", "clang", "the linker") checker.check_toolchain(config, "ar", "xcrun -sdk watchos ", "ar", "the static library linker") + checker.check_toolchain(config, "ex", "xcrun -sdk watchos ", "ar", "the static library extractor") checker.check_toolchain(config, "sh", "xcrun -sdk watchos ", "clang++", "the shared library linker") checker.check_toolchain(config, "sh", "xcrun -sdk watchos ", "clang", "the shared library linker") checker.check_toolchain(config, "sc", "xcrun -sdk watchos ", "swiftc", "the swift compiler") diff --git a/xmake/platforms/watchos/xmake.lua b/xmake/platforms/watchos/xmake.lua index 1296ec712..406174b24 100755 --- a/xmake/platforms/watchos/xmake.lua +++ b/xmake/platforms/watchos/xmake.lua @@ -50,20 +50,6 @@ platform("watchos") _g.formats.object = {"", ".o"} _g.formats.shared = {"lib", ".dylib"} - -- init the tools - _g.tools = {} - _g.tools.ccache = config.get("__ccache") - _g.tools.cc = config.get("cc") - _g.tools.cxx = config.get("cxx") - _g.tools.mm = config.get("mm") - _g.tools.mxx = config.get("mxx") - _g.tools.ld = config.get("ld") - _g.tools.as = config.get("as") - _g.tools.ar = config.get("ar") - _g.tools.sh = config.get("sh") - _g.tools.ex = config.get("ar") - _g.tools.sc = config.get("sc") - -- watchos or watchsimulator? local arch = config.get("arch") if arch == "i386" then diff --git a/xmake/platforms/windows/xmake.lua b/xmake/platforms/windows/xmake.lua index a2529e2ad..c817e5e32 100755 --- a/xmake/platforms/windows/xmake.lua +++ b/xmake/platforms/windows/xmake.lua @@ -51,16 +51,6 @@ platform("windows") _g.formats.shared = {"", ".dll"} _g.formats.binary = {"", ".exe"} - -- init the toolchains - _g.tools = {} - _g.tools.cc = config.get("cc") - _g.tools.cxx = config.get("cxx") - _g.tools.ld = config.get("ld") - _g.tools.ar = config.get("ar") - _g.tools.sh = config.get("sh") - _g.tools.as = config.get("as") - _g.tools.ex = config.get("ex") - end) -- set menu |
