diff options
| author | ruki <[email protected]> | 2021-03-23 18:27:59 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-03-23 18:27:59 +0800 |
| commit | 8936f11d510960caacf1fa8bcead1bedbef6a964 (patch) | |
| tree | 39573ba922bad0dbf19c2dbaee29f789b6d3e731 | |
| parent | 5a05a357b8d12669d315fbb2a0e074fb2160e62c (diff) | |
| parent | 04e0731ab41a10940a267979b728e77a815459cf (diff) | |
Merge pull request #1303 from PucklaMotzer09/scons
Add scons buildsystem to package.tools
| -rw-r--r-- | xmake/modules/package/tools/scons.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/xmake/modules/package/tools/scons.lua b/xmake/modules/package/tools/scons.lua new file mode 100644 index 000000000..d9468666c --- /dev/null +++ b/xmake/modules/package/tools/scons.lua @@ -0,0 +1,36 @@ +--!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-present, TBOOX Open Source Group. +-- +-- @author PucklaMotzer09 +-- @file scons.lua +-- + +-- imports +import("core.base.option") +import("lib.detect.find_tool") + +-- build package +function build(package, configs, opt) + opt = opt or {} + local buildir = opt.buildir or os.curdir() + local njob = opt.jobs or option.get("jobs") or tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2)) + local scons = assert(find_tool("scons"), "scons not found!") + local argv = {"-C", buildir, "-j", njob} + if configs then + table.join2(argv, configs) + end + os.vrunv(scons.program, argv, {envs = opt.envs}) +end |
