diff options
| author | ruki <[email protected]> | 2020-11-12 22:45:23 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-11-12 22:45:23 +0800 |
| commit | 2c21924f4a970cfabaac8bf589376e16656f5d46 (patch) | |
| tree | c1116e9827d2ccb4b98e76eb70f273f29aa3685f | |
| parent | 9a845fe45e97dcb078a89e0b9f5d27885a841660 (diff) | |
fix target/toolchains
| -rw-r--r-- | xmake/actions/config/main.lua | 29 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/project/project.lua | 21 |
2 files changed, 29 insertions, 21 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index 0488d3882..30a300a42 100644 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -135,6 +135,30 @@ function _check_target(targetname) end end +-- check target toolchains +function _check_target_toolchains() + -- check toolchains configuration for all target in the current project + -- @note we must check targets after loading options + for _, target in pairs(project.targets()) do + if target:get("enabled") ~= false and (target:get("toolchains") or not target:is_plat(config.get("plat"))) then + for _, toolchain_inst in pairs(target:toolchains()) do + -- check toolchains for `target/set_toolchains()` + if target:get("toolchains") then + if not toolchain_inst:check() then + raise("toolchain(\"%s\"): not found!", toolchain_inst:name()) + end + else + -- check platform toolchains for `target/set_plat()` + local ok, errors = target:platform():check() + if not ok then + raise(errors) + end + end + end + end + end +end + -- main entry function main() @@ -284,6 +308,11 @@ force to build in current directory via run `xmake -P .`]], os.projectdir()) end end + -- check target toolchains + if recheck then + _check_target_toolchains() + end + -- dump config if option.get("verbose") then config.dump() diff --git a/xmake/core/sandbox/modules/import/core/project/project.lua b/xmake/core/sandbox/modules/import/core/project/project.lua index a6753ef09..731454fe0 100644 --- a/xmake/core/sandbox/modules/import/core/project/project.lua +++ b/xmake/core/sandbox/modules/import/core/project/project.lua @@ -118,27 +118,6 @@ function sandbox_core_project.check() -- save all options to the cache file option.save() - -- check toolchains configuration for all target in the current project - -- @note we must check targets after loading options - for _, target in pairs(table.wrap(targets)) do - if target:get("enabled") ~= false and (target:get("toolchains") or target:plat() ~= config.get("plat")) then - for _, toolchain_inst in pairs(target:toolchains()) do - -- check toolchains for `target/set_toolchains()` - if target:get("toolchains") then - if not toolchain_inst:check() then - raise("toolchain(\"%s\"): not found!", toolchain_inst:name()) - end - else - -- check platform toolchains for `target/set_plat()` - local ok, errors = target:platform():check() - if not ok then - raise(errors) - end - end - end - end - end - -- leave the project directory local ok, errors = os.cd(oldir) if not ok then |
