summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools
diff options
context:
space:
mode:
authorruki <[email protected]>2025-01-24 22:45:58 +0800
committerruki <[email protected]>2025-01-24 22:45:58 +0800
commit1f59ab2428339916eafc2bdc1350641cc1c4f6d3 (patch)
tree27c03e7f47ba77018516d91e0d63421b1fdf4f7d /xmake/modules/core/tools
parentdbaf52568f4bb1152ad7123917a98b52f60adaa6 (diff)
support static libs
Diffstat (limited to 'xmake/modules/core/tools')
-rw-r--r--xmake/modules/core/tools/ar6x.lua27
-rw-r--r--xmake/modules/core/tools/cl6x.lua29
2 files changed, 56 insertions, 0 deletions
diff --git a/xmake/modules/core/tools/ar6x.lua b/xmake/modules/core/tools/ar6x.lua
new file mode 100644
index 000000000..455b7dd1e
--- /dev/null
+++ b/xmake/modules/core/tools/ar6x.lua
@@ -0,0 +1,27 @@
+--!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 ar6x.lua
+--
+
+inherit("ar")
+
+-- init it
+function init(self)
+ self:set("arflags", "-r")
+end
+
diff --git a/xmake/modules/core/tools/cl6x.lua b/xmake/modules/core/tools/cl6x.lua
index 0485d2b9c..c2d272bb7 100644
--- a/xmake/modules/core/tools/cl6x.lua
+++ b/xmake/modules/core/tools/cl6x.lua
@@ -80,6 +80,35 @@ function nf_sysincludedir(self, dir)
return nf_includedir(self, dir)
end
+-- make the link flag
+function nf_link(self, lib)
+ if not lib:endswith(".a") and not lib:endswith(".so") then
+ lib = "lib" .. lib .. ".a"
+ end
+ return "-l" .. lib
+end
+
+-- make the syslink flag
+function nf_syslink(self, lib)
+ return nf_link(self, lib)
+end
+
+-- make the linkdir flag
+function nf_linkdir(self, dir)
+ return {"-i" .. path.translate(dir)}
+end
+
+-- make the rpathdir flag
+function nf_rpathdir(self, dir, opt)
+ opt = opt or {}
+ local extra = opt.extra
+ if extra and extra.installonly then
+ return
+ end
+ dir = path.translate(dir)
+ return {"-rpath=" .. dir}
+end
+
-- make the link arguments list
function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
local argv = table.join("-z", "--output_file=" .. targetfile, objectfiles, flags)