diff options
| author | ruki <[email protected]> | 2021-10-18 21:02:26 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-10-18 21:02:26 +0800 |
| commit | 4e3967d123432b2352b450ed892fcb1b8f3b37d2 (patch) | |
| tree | 6fbd34ee82aff8e57cb779784a44de030dfa9c3e /xmake/rules/c++/unity_build/xmake.lua | |
| parent | 69ddff2a27199172659c9c823dabde8c4b004ae3 (diff) | |
rename to unity build
Diffstat (limited to 'xmake/rules/c++/unity_build/xmake.lua')
| -rw-r--r-- | xmake/rules/c++/unity_build/xmake.lua | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/xmake/rules/c++/unity_build/xmake.lua b/xmake/rules/c++/unity_build/xmake.lua new file mode 100644 index 000000000..838f8a097 --- /dev/null +++ b/xmake/rules/c++/unity_build/xmake.lua @@ -0,0 +1,45 @@ +--!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 ruki +-- @file xmake.lua +-- + +rule("c++.unity_build") + after_load(function (target) + import("unity_build") + local sourcebatches = target:sourcebatches() + if sourcebatches then + for _, rulename in ipairs({"c.build", "c++.build"}) do + local sourcebatch = sourcebatches[rulename] + if sourcebatch then + unity_build(target, sourcebatch) + end + end + end + end) + before_build(function (target, opt) + import("unity_build") + local sourcebatches = target:sourcebatches() + if sourcebatches then + for _, rulename in ipairs({"c.build", "c++.build"}) do + local sourcebatch = sourcebatches[rulename] + if sourcebatch then + unity_build.generate_unitfiles(target, sourcebatch, opt) + end + end + end + end) |
