summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-11-13 22:48:36 +0800
committerruki <[email protected]>2018-11-13 10:51:40 +0800
commit7d234801498d6e272d780407695ebff89a64d675 (patch)
tree28313737e1c44c3d639fbf49ab05ed0bc68ec1d4
parentbcfe7b269dc8ccca180099c8ce62f333a405ed11 (diff)
improve compiler tools
-rw-r--r--xmake/core/base/table.lua12
-rw-r--r--xmake/core/platform/platform.lua4
-rw-r--r--xmake/core/tool/compiler.lua10
-rw-r--r--xmake/core/tool/linker.lua7
-rw-r--r--xmake/core/tool/tool.lua23
-rw-r--r--xmake/modules/core/tools/ar.lua7
-rw-r--r--xmake/modules/core/tools/cl.lua15
-rw-r--r--xmake/modules/core/tools/clang.lua6
-rw-r--r--xmake/modules/core/tools/cparser.lua32
-rw-r--r--xmake/modules/core/tools/dmd.lua16
-rw-r--r--xmake/modules/core/tools/fasm.lua15
-rw-r--r--xmake/modules/core/tools/gcc.lua49
-rw-r--r--xmake/modules/core/tools/go.lua13
-rw-r--r--xmake/modules/core/tools/ldc.lua4
-rw-r--r--xmake/modules/core/tools/lib.lua5
-rw-r--r--xmake/modules/core/tools/link.lua12
-rw-r--r--xmake/modules/core/tools/llvm_rc.lua9
-rw-r--r--xmake/modules/core/tools/ml.lua19
-rw-r--r--xmake/modules/core/tools/nvcc.lua20
-rw-r--r--xmake/modules/core/tools/rc.lua9
-rw-r--r--xmake/modules/core/tools/rustc.lua17
-rw-r--r--xmake/modules/core/tools/swiftc.lua15
-rw-r--r--xmake/modules/core/tools/tcc.lua32
-rw-r--r--xmake/modules/core/tools/windres.lua9
-rw-r--r--xmake/modules/core/tools/yasm.lua13
25 files changed, 151 insertions, 222 deletions
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua
index f6e34c628..dde5fa23c 100644
--- a/xmake/core/base/table.lua
+++ b/xmake/core/base/table.lua
@@ -119,9 +119,15 @@ function table.inherit(...)
for k, v in pairs(clasz) do
if type(v) == "function" then
if k:startswith("__") then
- metainfo[k] = v
+ if metainfo[k] == nil then
+ metainfo[k] = v
+ end
else
- instance[k] = v
+ if instance[k] == nil then
+ instance[k] = v
+ else
+ instance["_super_" .. k] = v
+ end
end
end
end
@@ -151,6 +157,8 @@ function table.inherit2(self, ...)
else
if self[k] == nil then
self[k] = v
+ else
+ self["_super_" .. k] = v
end
end
end
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua
index 325935a38..b5886dd42 100644
--- a/xmake/core/platform/platform.lua
+++ b/xmake/core/platform/platform.lua
@@ -58,13 +58,13 @@ end
-- set the value to the platform info
function _instance:set(name, ...)
- self._INFO[name] = table.unwrap(table.unique({...}))
+ self._INFO[name] = table.unwrap({...})
end
-- add the value to the platform info
function _instance:add(name, ...)
local info = table.wrap(self._INFO[name])
- self._INFO[name] = table.unwrap(table.unique(table.join(info, ...)))
+ self._INFO[name] = table.unwrap(table.join(info, ...))
end
-- get the platform configure
diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua
index 99f965a0a..9c622ba33 100644
--- a/xmake/core/tool/compiler.lua
+++ b/xmake/core/tool/compiler.lua
@@ -65,16 +65,14 @@ end
-- add flags from the compiler
function compiler:_addflags_from_compiler(flags, targetkind)
-
- -- done
for _, flagkind in ipairs(self:_flagkinds()) do
- -- add compiler.xxflags
+ -- add compiler, e.g. cxflags
table.join2(flags, self:get(flagkind))
- -- add compiler.targetkind.xxflags
- if targetkind ~= nil and self:get(targetkind) ~= nil then
- table.join2(flags, self:get(targetkind)[flagkind])
+ -- add compiler, e.g. targetkind.cxflags
+ if targetkind then
+ table.join2(flags, self:get(targetkind .. '.' .. flagkind))
end
end
end
diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua
index 363e7ad30..16bcbfe27 100644
--- a/xmake/core/tool/linker.lua
+++ b/xmake/core/tool/linker.lua
@@ -73,12 +73,11 @@ function linker:_addflags_from_compiler(flags, target, targetkind)
if instance then
for _, flagkind in ipairs(self:_flagkinds()) do
- -- attempt to add special lanugage flags first, .e.g gc-ldflags, dc-arflags
+ -- attempt to add special lanugage flags first, e.g. gc-ldflags, dc-arflags
table.join2(flags_of_compiler, instance:get(toolkind .. 'flags') or instance:get(flagkind))
- -- attempt to add special lanugage flags first for target kind, .e.g gc-ldflags, dc-arflags
- local targetflags = instance:get(targetkind) or {}
- table.join2(flags_of_compiler, targetflags[toolkind .. 'flags'] or targetflags[flagkind])
+ -- attempt to add special lanugage flags first for target kind, e.g. targetkind.gc-ldflags, targetkind.dc-arflags
+ table.join2(flags_of_compiler, instance:get(targetkind .. '.' .. toolkind .. 'flags') or instance:get(targetkind .. '.' .. flagkind))
end
end
end
diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua
index 80c53cb67..d4380bec9 100644
--- a/xmake/core/tool/tool.lua
+++ b/xmake/core/tool/tool.lua
@@ -57,6 +57,7 @@ function _instance.new(kind, name, program)
instance._NAME = name
instance._KIND = kind
instance._PROGRAM = program
+ instance._INFO = {}
-- init instance
if instance.init then
@@ -85,6 +86,28 @@ function _instance:program()
return self._PROGRAM
end
+-- set the value to the platform info
+function _instance:set(name, ...)
+ self._INFO[name] = table.unwrap({...})
+end
+
+-- add the value to the platform info
+function _instance:add(name, ...)
+ local info = table.wrap(self._INFO[name])
+ self._INFO[name] = table.unwrap(table.join(info, ...))
+end
+
+-- get the platform configure
+function _instance:get(name)
+ if self._super_get then
+ local value = self:_super_get(name)
+ if value ~= nil then
+ return value
+ end
+ end
+ return self._INFO[name]
+end
+
-- has the given flag?
function _instance:has_flags(flag)
diff --git a/xmake/modules/core/tools/ar.lua b/xmake/modules/core/tools/ar.lua
index 2834e111c..9ade87e08 100644
--- a/xmake/modules/core/tools/ar.lua
+++ b/xmake/modules/core/tools/ar.lua
@@ -27,12 +27,7 @@ import("core.tool.compiler")
-- init it
function init(self)
- _g.arflags = { "-cr" }
-end
-
--- get the property
-function get(self, name)
- return _g[name]
+ self:set("arflags", "-cr")
end
-- make the strip flag
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index cc6b0c680..e2434d0ec 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -30,10 +30,10 @@ import("core.language.language")
function init(self)
-- init cxflags
- _g.cxflags = { "-nologo" }
+ self:set("cxflags", "-nologo")
-- init flags map
- _g.mapflags =
+ self:set("mapflags",
{
-- optimize
["-O0"] = "-Od"
@@ -76,18 +76,13 @@ function init(self)
-- others
, ["-ftrapv"] = ""
, ["-fsanitize=address"] = ""
- }
+ })
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
["object:sources"] = false
- }
-end
-
--- get the property
-function get(self, name)
- return _g[name]
+ })
end
-- make the symbol flag
diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua
index 67b271da6..c778c28c2 100644
--- a/xmake/modules/core/tools/clang.lua
+++ b/xmake/modules/core/tools/clang.lua
@@ -32,9 +32,9 @@ function init(self)
_super.init(self)
-- suppress warning
- _super._g.cxflags = {"-Qunused-arguments"}
- _super._g.mxflags = {"-Qunused-arguments"}
- _super._g.asflags = {"-Qunused-arguments"}
+ self:add("cxflags", "-Qunused-arguments")
+ self:add("mxflags", "-Qunused-arguments")
+ self:add("asflags", "-Qunused-arguments")
end
-- make the optimize flag
diff --git a/xmake/modules/core/tools/cparser.lua b/xmake/modules/core/tools/cparser.lua
index c993b8317..ee8864b7f 100644
--- a/xmake/modules/core/tools/cparser.lua
+++ b/xmake/modules/core/tools/cparser.lua
@@ -33,22 +33,21 @@ import("detect.tools.find_ccache")
function init(self)
-- init mxflags
- _g.mxflags = { "-fmessage-length=0"
- , "-pipe"
- , "-fpascal-strings"
- , "-DIBOutlet=__attribute__((iboutlet))"
- , "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))"
- , "-DIBAction=void)__attribute__((ibaction)"}
+ self:set("mxflags", "-fmessage-length=0"
+ , "-pipe"
+ , "-fpascal-strings"
+ , "-DIBOutlet=__attribute__((iboutlet))"
+ , "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))"
+ , "-DIBAction=void)__attribute__((ibaction)")
-- init shflags
- _g.shflags = { "-shared", "-fPIC" }
+ self:set("shflags", "-shared", "-fPIC")
-- init cxflags for the kind: shared
- _g.shared = {}
- _g.shared.cxflags = {"-fPIC"}
+ self:set("shared.cxflags", "-fPIC")
-- init flags map
- _g.mapflags =
+ self:set("mapflags",
{
-- warnings
["-W1"] = "-Wall"
@@ -58,20 +57,13 @@ function init(self)
-- strip
, ["-s"] = "-s"
, ["-S"] = "-S"
- }
+ })
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
["object:sources"] = false
- }
-end
-
--- get the property
-function get(self, name)
-
- -- get it
- return _g[name]
+ })
end
-- make the strip flag
diff --git a/xmake/modules/core/tools/dmd.lua b/xmake/modules/core/tools/dmd.lua
index d02044803..9866740a1 100644
--- a/xmake/modules/core/tools/dmd.lua
+++ b/xmake/modules/core/tools/dmd.lua
@@ -31,25 +31,19 @@ import("core.project.project")
function init(self)
-- init arflags
- _g.arflags = { "-lib" }
+ self:set("arflags", "-lib")
-- init shflags
- _g.shflags = { "-shared", "-fPIC" }
+ self:set("shflags", "-shared", "-fPIC")
-- init dcflags for the kind: shared
- _g.shared = {}
- _g.shared.dcflags = {"-fPIC"}
+ self:set("shared.dcflags", "-fPIC")
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
["object:sources"] = false
- }
-end
-
--- get the property
-function get(self, name)
- return _g[name]
+ })
end
-- make the optimize flag
diff --git a/xmake/modules/core/tools/fasm.lua b/xmake/modules/core/tools/fasm.lua
index 934b2c69d..30b43e7ea 100644
--- a/xmake/modules/core/tools/fasm.lua
+++ b/xmake/modules/core/tools/fasm.lua
@@ -26,7 +26,7 @@
function init(self)
-- init flags map
- _g.mapflags =
+ self:set("mapflags",
{
-- symbols
["-g"] = ""
@@ -43,18 +43,13 @@ function init(self)
-- others
, ["-ftrapv"] = ""
, ["-fsanitize=address"] = ""
- }
+ })
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
- ["object:sources"] = false
- }
-end
-
--- get the property
-function get(self, name)
- return _g[name]
+ ["object:sources"] = false
+ })
end
-- make the define flag
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 91e4396bf..3a9fab612 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -33,28 +33,24 @@ import("detect.tools.find_ccache")
function init(self)
-- init mxflags
- _g.mxflags = { "-fmessage-length=0"
- , "-pipe"
- , "-fpascal-strings"
- , "-DIBOutlet=__attribute__((iboutlet))"
- , "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))"
- , "-DIBAction=void)__attribute__((ibaction)"}
+ self:set("mxflags", "-fmessage-length=0"
+ , "-pipe"
+ , "-fpascal-strings"
+ , "-DIBOutlet=__attribute__((iboutlet))"
+ , "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))"
+ , "-DIBAction=void)__attribute__((ibaction)")
-- init shflags
- _g.shflags = { "-shared"}
+ self:set("shflags", "-shared")
- -- init cxflags for the kind: shared
- _g.shared = {}
- _g.shared.cxflags = {}
-
- -- add -fPIC
+ -- add -fPIC for shared
if not is_plat("windows", "mingw") then
- table.insert(_g.shflags, "-fPIC")
- table.insert(_g.shared.cxflags, "-fPIC")
+ self:add("shflags", "-fPIC")
+ self:add("shared.cxflags", "-fPIC")
end
-- init flags map
- _g.mapflags =
+ self:set("mapflags",
{
-- warnings
["-W1"] = "-Wall"
@@ -64,27 +60,22 @@ function init(self)
-- strip
, ["-s"] = "-s"
, ["-S"] = "-S"
- }
+ })
-- for macho target
- local plat = config.plat()
- if plat == "macosx" or plat == "iphoneos" then
- _g.mapflags["-s"] = "-Wl,-x"
- _g.mapflags["-S"] = "-Wl,-S"
+ if is_plat("macosx") or is_plat("iphoneos") then
+ self:add("mapflags",
+ {
+ ["-s"] = "-Wl,-x"
+ , ["-S"] = "-Wl,-S"
+ })
end
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
["object:sources"] = false
- }
-end
-
--- get the property
-function get(self, name)
-
- -- get it
- return _g[name]
+ })
end
-- make the strip flag
diff --git a/xmake/modules/core/tools/go.lua b/xmake/modules/core/tools/go.lua
index f0f15ab2e..23c3eedbc 100644
--- a/xmake/modules/core/tools/go.lua
+++ b/xmake/modules/core/tools/go.lua
@@ -31,21 +31,16 @@ import("core.project.project")
function init(self)
-- init arflags
- _g.arflags = { "grc" }
+ self:set("arflags", "grc")
-- init the file formats
- _g.formats = { static = "$(name).a" }
+ self:set("formats", { static = "$(name).a" })
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
["object:sources"] = true
- }
-end
-
--- get the property
-function get(self, name)
- return _g[name]
+ })
end
-- make the optimize flag
diff --git a/xmake/modules/core/tools/ldc.lua b/xmake/modules/core/tools/ldc.lua
index f49d3509c..9dbd5b565 100644
--- a/xmake/modules/core/tools/ldc.lua
+++ b/xmake/modules/core/tools/ldc.lua
@@ -32,10 +32,10 @@ function init(self)
_super.init(self)
-- init shflags
- _super._g.shflags = { "-shared" }
+ self:set("shflags", "-shared")
-- init cxflags for the kind: shared
- _super._g.shared = {}
+ self:set("shared.dcflags", "")
end
diff --git a/xmake/modules/core/tools/lib.lua b/xmake/modules/core/tools/lib.lua
index 16370496e..e5b411c44 100644
--- a/xmake/modules/core/tools/lib.lua
+++ b/xmake/modules/core/tools/lib.lua
@@ -22,11 +22,6 @@
-- @file lib.lua
--
--- get the property
-function get(self, name)
- return _g[name]
-end
-
-- extract the static library to object directory
function extract(self, libraryfile, objectdir)
diff --git a/xmake/modules/core/tools/link.lua b/xmake/modules/core/tools/link.lua
index baf300ff2..6a73844ab 100644
--- a/xmake/modules/core/tools/link.lua
+++ b/xmake/modules/core/tools/link.lua
@@ -29,16 +29,16 @@ import("core.project.config")
function init(self)
-- init ldflags
- _g.ldflags = { "-nologo", "-dynamicbase", "-nxcompat"}
+ self:set("ldflags", "-nologo", "-dynamicbase", "-nxcompat")
-- init arflags
- _g.arflags = {"-nologo"}
+ self:set("arflags", "-nologo")
-- init shflags
- _g.shflags = {"-nologo"}
+ self:set("shflags", "-nologo")
-- init flags map
- _g.mapflags =
+ self:set("mapflags",
{
-- strip
["-s"] = ""
@@ -47,12 +47,12 @@ function init(self)
-- others
, ["-ftrapv"] = ""
, ["-fsanitize=address"] = ""
- }
+ })
end
-- get the property
function get(self, name)
- local values = _g[name]
+ local values = self._INFO[name]
if name == "ldflags" or name == "arflags" or name == "shflags" then
-- switch architecture, @note does cache it in init() for generating vs201x project
values = table.join(values, "-machine:" .. (config.arch() or "x86"))
diff --git a/xmake/modules/core/tools/llvm_rc.lua b/xmake/modules/core/tools/llvm_rc.lua
index 51d27bf62..30cb5e06b 100644
--- a/xmake/modules/core/tools/llvm_rc.lua
+++ b/xmake/modules/core/tools/llvm_rc.lua
@@ -30,15 +30,10 @@ import("core.project.project")
function init(self)
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
["object:sources"] = false
- }
-end
-
--- get the property
-function get(self, name)
- return _g[name]
+ })
end
-- make the define flag
diff --git a/xmake/modules/core/tools/ml.lua b/xmake/modules/core/tools/ml.lua
index e706d242d..67791dbb7 100644
--- a/xmake/modules/core/tools/ml.lua
+++ b/xmake/modules/core/tools/ml.lua
@@ -27,13 +27,13 @@ function init(self)
-- init asflags
if self:program():find("64") then
- _g.asflags = { "-nologo"}
+ self:set("asflags", "-nologo")
else
- _g.asflags = { "-nologo", "-Gd"}
+ self:set("asflags", "-nologo", "-Gd")
end
-- init flags map
- _g.mapflags =
+ self:set("mapflags",
{
-- symbols
["-g"] = "-Z7"
@@ -50,18 +50,13 @@ function init(self)
-- others
, ["-ftrapv"] = ""
, ["-fsanitize=address"] = ""
- }
+ })
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
- ["object:sources"] = false
- }
-end
-
--- get the property
-function get(self, name)
- return _g[name]
+ ["object:sources"] = false
+ })
end
-- make the warning flag
diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua
index 366328f5b..e653629f4 100644
--- a/xmake/modules/core/tools/nvcc.lua
+++ b/xmake/modules/core/tools/nvcc.lua
@@ -33,33 +33,25 @@ import("detect.tools.find_ccache")
function init(self)
-- init flags
- _g.cuflags = {}
- _g.ldflags = {}
if not is_plat("windows") then
- _g.shflags = { "-shared", "-fPIC" }
- _g.shared = {}
- _g.shared.cuflags = {"-fPIC"}
+ self:set("shflags", "-shared", "-fPIC")
+ self:set("shared.cuflags", "-fPIC")
end
-- init flags map
- _g.mapflags =
+ self:set("mapflags",
{
-- warnings
["-W1"] = "-Wall"
, ["-W2"] = "-Wall"
, ["-W3"] = "-Wall"
- }
+ })
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
["object:sources"] = false
- }
-end
-
--- get the property
-function get(self, name)
- return _g[name]
+ })
end
-- make the symbol flag
diff --git a/xmake/modules/core/tools/rc.lua b/xmake/modules/core/tools/rc.lua
index 1ffcf2294..45bdc47bc 100644
--- a/xmake/modules/core/tools/rc.lua
+++ b/xmake/modules/core/tools/rc.lua
@@ -30,15 +30,10 @@ import("core.project.project")
function init(self)
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
["object:sources"] = false
- }
-end
-
--- get the property
-function get(self, name)
- return _g[name]
+ })
end
-- make the define flag
diff --git a/xmake/modules/core/tools/rustc.lua b/xmake/modules/core/tools/rustc.lua
index 8df967401..f4ef43b0b 100644
--- a/xmake/modules/core/tools/rustc.lua
+++ b/xmake/modules/core/tools/rustc.lua
@@ -31,30 +31,25 @@ import("core.project.project")
function init(self)
-- init arflags
- _g.arflags = { "--crate-type=lib" }
+ self:set("arflags", "--crate-type=lib")
-- init shflags
- _g.shflags = { "--crate-type=dylib" }
+ self:set("shflags", "--crate-type=dylib")
-- init ldflags
- _g.ldflags = { "--crate-type=bin" }
+ self:set("ldflags", "--crate-type=bin")
-- init the file formats
- _g.formats = { static = "lib$(name).rlib" }
+ self:set("formats", { static = "lib$(name).rlib" })
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
["object:sources"] = false -- compile multiple source filess to the single object
, ["binary:sources"] = true -- build multiple source files to the binary target file
, ["static:sources"] = true -- build multiple source files to the static target file
, ["shared:sources"] = true -- build multiple source files to the shared target file
- }
-end
-
--- get the property
-function get(self, name)
- return _g[name]
+ })
end
-- make the optimize flag
diff --git a/xmake/modules/core/tools/swiftc.lua b/xmake/modules/core/tools/swiftc.lua
index 9701e08d6..28e9dafe4 100644
--- a/xmake/modules/core/tools/swiftc.lua
+++ b/xmake/modules/core/tools/swiftc.lua
@@ -30,7 +30,7 @@ import("detect.tools.find_ccache")
function init(self)
-- init flags map
- _g.mapflags =
+ self:set("mapflags",
{
-- symbols
["-fvisibility=hidden"] = ""
@@ -56,18 +56,13 @@ function init(self)
-- others
, ["-ftrapv"] = ""
, ["-fsanitize=address"] = ""
- }
+ })
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
- ["object:sources"] = false
- }
-end
-
--- get the property
-function get(self, name)
- return _g[name]
+ ["object:sources"] = false
+ })
end
-- make the strip flag
diff --git a/xmake/modules/core/tools/tcc.lua b/xmake/modules/core/tools/tcc.lua
index dd2bb594a..d322f4dd4 100644
--- a/xmake/modules/core/tools/tcc.lua
+++ b/xmake/modules/core/tools/tcc.lua
@@ -33,22 +33,21 @@ import("detect.tools.find_ccache")
function init(self)
-- init mxflags
- _g.mxflags = { "-fmessage-length=0"
- , "-pipe"
- , "-fpascal-strings"
- , "-DIBOutlet=__attribute__((iboutlet))"
- , "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))"
- , "-DIBAction=void)__attribute__((ibaction)"}
+ self:set("mxflags", "-fmessage-length=0"
+ , "-pipe"
+ , "-fpascal-strings"
+ , "-DIBOutlet=__attribute__((iboutlet))"
+ , "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))"
+ , "-DIBAction=void)__attribute__((ibaction)")
-- init shflags
- _g.shflags = { "-shared", "-fPIC" }
+ self:set("shflags", "-shared")
-- init cxflags for the kind: shared
- _g.shared = {}
- _g.shared.cxflags = {"-fPIC"}
+ self:set("shared.cxflags", "-fPIC")
-- init flags map
- _g.mapflags =
+ self:set("mapflags",
{
-- warnings
["-W1"] = "-Wall"
@@ -58,20 +57,13 @@ function init(self)
-- strip
, ["-s"] = "-s"
, ["-S"] = "-S"
- }
+ })
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
["object:sources"] = false
- }
-end
-
--- get the property
-function get(self, name)
-
- -- get it
- return _g[name]
+ })
end
-- make the strip flag
diff --git a/xmake/modules/core/tools/windres.lua b/xmake/modules/core/tools/windres.lua
index e7eced31f..e15f75924 100644
--- a/xmake/modules/core/tools/windres.lua
+++ b/xmake/modules/core/tools/windres.lua
@@ -30,15 +30,10 @@ import("core.project.project")
function init(self)
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
["object:sources"] = false
- }
-end
-
--- get the property
-function get(self, name)
- return _g[name]
+ })
end
-- make the define flag
diff --git a/xmake/modules/core/tools/yasm.lua b/xmake/modules/core/tools/yasm.lua
index aaa0c647c..a846ba58c 100644
--- a/xmake/modules/core/tools/yasm.lua
+++ b/xmake/modules/core/tools/yasm.lua
@@ -26,7 +26,7 @@
function init(self)
-- init flags map
- _g.mapflags =
+ self:set("mapflags",
{
-- symbols
["-g"] = ""
@@ -43,18 +43,13 @@ function init(self)
-- others
, ["-ftrapv"] = ""
, ["-fsanitize=address"] = ""
- }
+ })
-- init buildmodes
- _g.buildmodes =
+ self:set("buildmodes",
{
["object:sources"] = false
- }
-end
-
--- get the property
-function get(self, name)
- return _g[name]
+ })
end
-- make the warning flag