diff options
| author | ruki <[email protected]> | 2020-06-23 22:37:44 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-06-23 22:37:44 +0800 |
| commit | c18d15eb89116a0f3ce96bd56f3ccf861849f6ec (patch) | |
| tree | 52b63db3274349f9a41872414208c7c30058cfd7 /xmake/plugins | |
| parent | 53df324acd9c7432336a5894ceef578daa1ce38d (diff) | |
| parent | 18bded45c229f5580c13fc8b4afc5edb6f18819a (diff) | |
Merge pull request #857 from xmake-io/toolchain
Improve toolchain to support host and cross toolchains at same time
Diffstat (limited to 'xmake/plugins')
| -rwxr-xr-x | xmake/plugins/project/main.lua | 7 | ||||
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs201x.lua | 10 | ||||
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua | 10 | ||||
| -rw-r--r-- | xmake/plugins/project/vsxmake/getinfo.lua | 10 | ||||
| -rw-r--r-- | xmake/plugins/show/lists/envs.lua | 42 |
5 files changed, 48 insertions, 31 deletions
diff --git a/xmake/plugins/project/main.lua b/xmake/plugins/project/main.lua index 0cb8d0d0e..7090413ed 100755 --- a/xmake/plugins/project/main.lua +++ b/xmake/plugins/project/main.lua @@ -22,7 +22,6 @@ import("core.base.option") import("core.base.task") import("core.project.config") -import("core.platform.environment") import("make.makefile") import("make.xmakefile") import("cmake.cmakelists") @@ -82,15 +81,9 @@ function main() -- config it first task.run("config") - -- enter toolchains environment - environment.enter("toolchains") - -- make project _make(option.get("kind")) - -- leave toolchains environment - environment.leave("toolchains") - -- trace cprint("${color.success}create ok!") end diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua index 1168ae3e7..01a38e670 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x.lua @@ -23,7 +23,6 @@ import("core.base.option") import("core.project.config") import("core.project.project") import("core.platform.platform") -import("core.platform.environment") import("core.tool.compiler") import("core.tool.linker") import("vs201x_solution") @@ -234,6 +233,9 @@ function make(outputdir, vsinfo) -- clear project to reload and recheck it project.clear() + -- check configure + config.check() + -- check project options project.check() @@ -247,9 +249,6 @@ function make(outputdir, vsinfo) -- ensure to enter project directory os.cd(project.directory()) - -- enter environment (maybe check flags by calling tools) - environment.enter("toolchains") - -- save targets for targetname, target in pairs(project.targets()) do if not target:isphony() then @@ -277,9 +276,6 @@ function make(outputdir, vsinfo) _make_targetheaders(mode, arch, target, mode_idx == #vsinfo.modes and arch_idx == 2) end end - - -- leave environment - environment.leave("toolchains") end end diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua index b69651f5f..3e9de321f 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua @@ -36,16 +36,6 @@ function _get_toolset_ver(targetinfo, vsinfo) if not toolset_ver then toolset_ver = vsinfo.toolset_version end - - -- for xp? - for _, flag in ipairs(targetinfo.linkflags) do - if flag:lower():find("^[%-/]subsystem:.-,5%.%d+$") then - toolset_ver = toolset_ver .. "_xp" - break - end - end - - -- done return toolset_ver end diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua index cbfbf13d9..1cd51035b 100644 --- a/xmake/plugins/project/vsxmake/getinfo.lua +++ b/xmake/plugins/project/vsxmake/getinfo.lua @@ -26,7 +26,6 @@ import("core.project.config") import("core.project.cache") import("core.project.project") import("core.platform.platform") -import("core.platform.environment") import("core.tool.compiler") import("core.tool.linker") import("lib.detect.find_tool") @@ -285,6 +284,9 @@ function main(outputdir, vsinfo) -- clear project to reload and recheck it project.clear() + -- check configure + config.check() + -- check project options project.check() @@ -300,9 +302,6 @@ function main(outputdir, vsinfo) -- ensure to enter project directory os.cd(project.directory()) - -- enter environment (maybe check flags by calling tools) - environment.enter("toolchains") - -- save targets for targetname, target in pairs(project.targets()) do if not target:isphony() then @@ -333,9 +332,6 @@ function main(outputdir, vsinfo) _target.deps = table.unique(table.join(_target.deps or {}, table.keys(target:deps()), nil)) end end - - -- leave environment - environment.leave("toolchains") end end diff --git a/xmake/plugins/show/lists/envs.lua b/xmake/plugins/show/lists/envs.lua new file mode 100644 index 000000000..18fbed14b --- /dev/null +++ b/xmake/plugins/show/lists/envs.lua @@ -0,0 +1,42 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015-2020, TBOOX Open Source Group. +-- +-- @author ruki +-- @file envs.lua +-- + +-- imports +import("core.base.text") +import("core.base.global") +import("core.project.config") + +-- show all toolchains +function main() + + local envs = { XMAKE_PROGRAM_DIR = {"Set the program scripts directory of xmake.", os.programdir()}, + XMAKE_CONFIGDIR = {"Set the local config directory of project.", config.directory()}, + XMAKE_GLOBALDIR = {"Set the global config directory of xmake.", global.directory()}, + XMAKE_COLORTERM = {"Set the color terminal environment.", os.getenv("XMAKE_COLORTERM") or os.getenv("COLORTERM")}, + XMAKE_LOGFILE = {"Set the log output file path.", os.getenv("XMAKE_LOGFILE")}, + XMAKE_ROOT = {"Allow xmake to run under root.", os.getenv("XMAKE_ROOT")}, + XMAKE_RAMDIR = {"Set the ramdisk directory.", os.getenv("XMAKE_RAMDIR")}, + XMAKE_TMPDIR = {"Set the temporary directory.", os.tmpdir()}} + local width = 24 + for name, env in pairs(envs) do + cprint("${color.dump.string}%s${clear}%s%s", name, (" "):rep(width - #name), env[1]) + cprint("%s${bright}%s", (" "):rep(width), env[2] or "<empty>") + end +end |
