summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-18 00:52:52 +0800
committerruki <[email protected]>2022-05-18 00:52:52 +0800
commit11ba8e1356abcdd6efa9716c5e9dfd337764aeae (patch)
tree36b7db5aefcebd21e98bb16a93caa38bb496dc0d /xmake/modules
parented15fde870e6cdb8d82c55bdcc981d50752f66f4 (diff)
add build cache stub
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/core/tools/cl.lua3
-rw-r--r--xmake/modules/private/cache/build_cache.lua32
2 files changed, 34 insertions, 1 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index fc3ef5622..e4d36f9e6 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -507,7 +507,8 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
-- use vstool to compile and enable vs_unicode_output @see https://github.com/xmake-io/xmake/issues/528
if distcc_build_client.is_distccjob() and distcc_build_client.singleton():has_freejobs() then
local program, argv = compargv(self, sourcefile, objectfile, compflags, table.join(opt, {rawargs = true}))
- return distcc_build_client.singleton():compile(program, argv, {envs = self:runenvs(), preprocess = _preprocess, tool = self, target = opt.target})
+ return distcc_build_client.singleton():compile(program, argv, {envs = self:runenvs(),
+ preprocess = _preprocess, tool = self, target = opt.target})
else
local program, argv = compargv(self, sourcefile, objectfile, compflags, opt)
return vstool.iorunv(program, argv, {envs = self:runenvs()})
diff --git a/xmake/modules/private/cache/build_cache.lua b/xmake/modules/private/cache/build_cache.lua
new file mode 100644
index 000000000..6537f691b
--- /dev/null
+++ b/xmake/modules/private/cache/build_cache.lua
@@ -0,0 +1,32 @@
+--!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 build_cache.lua
+--
+
+-- imports
+import("core.project.config")
+
+-- is enabled?
+function enabled()
+ local build_cache = _g.build_cache
+ if build_cache == nil and config.get("ccache") then
+ _g.build_cache = build_cache or false
+ end
+ return build_cache or false
+end
+