summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-02-18 00:49:42 +0800
committerruki <[email protected]>2021-02-18 00:49:42 +0800
commit46e0f6a1adda408052ba5b87c244cedaae5f1d00 (patch)
treebe3ff982685afc14e7dab6f57d3801d2477ca629
parent6417f5b6b8aa784dc5a734511365597d707ce8dc (diff)
rename targetkind to kind
-rw-r--r--xmake/actions/build/build.lua4
-rw-r--r--xmake/actions/build/kinds/binary.lua4
-rw-r--r--xmake/actions/build/kinds/shared.lua4
-rw-r--r--xmake/actions/build/kinds/static.lua4
-rw-r--r--xmake/actions/config/scangen.lua2
-rw-r--r--xmake/actions/package/main.lua4
-rw-r--r--xmake/actions/run/main.lua6
-rw-r--r--xmake/core/language/language.lua6
-rw-r--r--xmake/core/project/target.lua23
-rw-r--r--xmake/core/tool/compiler.lua6
-rw-r--r--xmake/core/tool/linker.lua2
-rw-r--r--xmake/modules/private/action/run/make_runenvs.lua2
-rw-r--r--xmake/modules/private/diagnosis/dump_targets.lua2
-rw-r--r--xmake/modules/target/action/install/main.lua2
-rw-r--r--xmake/modules/target/action/install/windows.lua2
-rw-r--r--xmake/modules/target/action/uninstall/main.lua2
-rw-r--r--xmake/modules/target/action/uninstall/windows.lua2
-rw-r--r--xmake/plugins/project/cmake/cmakelists.lua4
-rw-r--r--xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua6
-rw-r--r--xmake/plugins/project/vstudio/impl/vs201x.lua8
-rw-r--r--xmake/plugins/project/vsxmake/getinfo.lua4
-rw-r--r--xmake/plugins/show/info/target.lua2
-rw-r--r--xmake/rules/cuda/devlink/xmake.lua2
-rw-r--r--xmake/rules/mode/xmake.lua2
-rw-r--r--xmake/rules/utils/inherit_links/inherit_links.lua4
-rw-r--r--xmake/rules/utils/symbols/export_all/export_all.lua30
-rw-r--r--xmake/rules/utils/symbols/export_all/xmake.lua24
-rw-r--r--xmake/rules/utils/symbols/extract/xmake.lua (renamed from xmake/rules/utils/extract_symbols/xmake.lua)2
-rw-r--r--xmake/rules/xcode/application/build.lua2
-rw-r--r--xmake/rules/xcode/framework/xmake.lua2
30 files changed, 114 insertions, 55 deletions
diff --git a/xmake/actions/build/build.lua b/xmake/actions/build/build.lua
index ea828c8d1..79e6ad40e 100644
--- a/xmake/actions/build/build.lua
+++ b/xmake/actions/build/build.lua
@@ -28,7 +28,7 @@ import("core.base.hashset")
-- clean target for rebuilding
function _clean_target(target)
- local targetkind = target:targetkind()
+ local targetkind = target:kind()
if targetkind ~= "phony" and targetkind ~= "object" then
os.tryrm(target:symbolfile())
os.tryrm(target:targetfile())
@@ -55,7 +55,7 @@ function _add_batchjobs_builtin(batchjobs, rootjob, target)
-- uses the builtin target script
if not job and not target:isphony() then
- job, job_leaf = import("kinds." .. target:targetkind(), {anonymous = true})(batchjobs, rootjob, target)
+ job, job_leaf = import("kinds." .. target:kind(), {anonymous = true})(batchjobs, rootjob, target)
end
job = job or rootjob
return job, job_leaf or job
diff --git a/xmake/actions/build/kinds/binary.lua b/xmake/actions/build/kinds/binary.lua
index 45b97a706..bc4763fd6 100644
--- a/xmake/actions/build/kinds/binary.lua
+++ b/xmake/actions/build/kinds/binary.lua
@@ -31,7 +31,7 @@ import("object", {alias = "add_batchjobs_for_object"})
function _do_link_target(target, opt)
-- load linker instance
- local linkinst = linker.load(target:targetkind(), target:sourcekinds(), {target = target})
+ local linkinst = linker.load(target:kind(), target:sourcekinds(), {target = target})
-- get link flags
local linkflags = linkinst:linkflags({target = target})
@@ -42,7 +42,7 @@ function _do_link_target(target, opt)
-- need build this target?
local depfiles = objectfiles
for _, dep in ipairs(target:orderdeps()) do
- if dep:targetkind() == "static" then
+ if dep:kind() == "static" then
if depfiles == objectfiles then
depfiles = table.copy(objectfiles)
end
diff --git a/xmake/actions/build/kinds/shared.lua b/xmake/actions/build/kinds/shared.lua
index 821e775ce..2c95bd95b 100644
--- a/xmake/actions/build/kinds/shared.lua
+++ b/xmake/actions/build/kinds/shared.lua
@@ -31,7 +31,7 @@ import("object", {alias = "add_batchjobs_for_object"})
function _do_link_target(target, opt)
-- load linker instance
- local linkinst = linker.load(target:targetkind(), target:sourcekinds(), {target = target})
+ local linkinst = linker.load(target:kind(), target:sourcekinds(), {target = target})
-- get link flags
local linkflags = linkinst:linkflags({target = target})
@@ -42,7 +42,7 @@ function _do_link_target(target, opt)
-- need build this target?
local depfiles = objectfiles
for _, dep in ipairs(target:orderdeps()) do
- if dep:targetkind() == "static" then
+ if dep:kind() == "static" then
if depfiles == objectfiles then
depfiles = table.copy(objectfiles)
end
diff --git a/xmake/actions/build/kinds/static.lua b/xmake/actions/build/kinds/static.lua
index b058ba875..63bc50304 100644
--- a/xmake/actions/build/kinds/static.lua
+++ b/xmake/actions/build/kinds/static.lua
@@ -31,7 +31,7 @@ import("object", {alias = "add_batchjobs_for_object"})
function _do_link_target(target, opt)
-- load linker instance
- local linkinst = linker.load(target:targetkind(), target:sourcekinds(), {target = target})
+ local linkinst = linker.load(target:kind(), target:sourcekinds(), {target = target})
-- get link flags
local linkflags = linkinst:linkflags({target = target})
@@ -42,7 +42,7 @@ function _do_link_target(target, opt)
-- need build this target?
local depfiles = objectfiles
for _, dep in ipairs(target:orderdeps()) do
- if dep:targetkind() == "static" then
+ if dep:kind() == "static" then
if depfiles == objectfiles then
depfiles = table.copy(objectfiles)
end
diff --git a/xmake/actions/config/scangen.lua b/xmake/actions/config/scangen.lua
index a249b73c0..6e955b7c1 100644
--- a/xmake/actions/config/scangen.lua
+++ b/xmake/actions/config/scangen.lua
@@ -54,7 +54,7 @@ function main()
-- add targetkinds
if filecount > 0 then
- for targetkind, _ in pairs(instance:targetkinds()) do
+ for targetkind, _ in pairs(instance:kinds()) do
targetkinds[targetkind] = true
end
end
diff --git a/xmake/actions/package/main.lua b/xmake/actions/package/main.lua
index 7977d3b23..6f93562bc 100644
--- a/xmake/actions/package/main.lua
+++ b/xmake/actions/package/main.lua
@@ -47,7 +47,7 @@ function _package_library(target)
-- copy *.lib for shared/windows (*.dll) target
-- @see https://github.com/xmake-io/xmake/issues/787
- if target:targetkind() == "shared" and is_plat("windows", "mingw") then
+ if target:kind() == "shared" and is_plat("windows", "mingw") then
local targetfile = target:targetfile()
local targetfile_lib = path.join(path.directory(targetfile), path.basename(targetfile) .. ".lib")
if os.isfile(targetfile_lib) then
@@ -100,7 +100,7 @@ function _do_package_target(target)
end
-- get kind
- local kind = target:targetkind()
+ local kind = target:kind()
-- get script
local scripts =
diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua
index 7690ea331..0974b2f68 100644
--- a/xmake/actions/run/main.lua
+++ b/xmake/actions/run/main.lua
@@ -32,7 +32,7 @@ import("private.action.run.make_runenvs")
function _do_run_target(target)
-- only for binary program
- if target:targetkind() ~= "binary" then
+ if target:kind() ~= "binary" then
return
end
@@ -175,7 +175,7 @@ function _check_targets(targetname)
-- install default or all targets
for _, target in ipairs(project.ordertargets()) do
local default = target:get("default")
- if (default == nil or default == true or option.get("all")) and target:targetkind() == "binary" then
+ if (default == nil or default == true or option.get("all")) and target:kind() == "binary" then
table.insert(targets, target)
end
end
@@ -220,7 +220,7 @@ function main()
-- run default or all binary targets
for _, target in ipairs(project.ordertargets()) do
local default = target:get("default")
- if (default == nil or default == true or option.get("all")) and target:targetkind() == "binary" then
+ if (default == nil or default == true or option.get("all")) and target:kind() == "binary" then
_run(target)
end
end
diff --git a/xmake/core/language/language.lua b/xmake/core/language/language.lua
index 0626e18e0..2b3e9d813 100644
--- a/xmake/core/language/language.lua
+++ b/xmake/core/language/language.lua
@@ -123,7 +123,7 @@ end
-- e.g.
-- {binary = "ld", static = "ar", shared = "sh"}
--
-function _instance:targetkinds()
+function _instance:kinds()
return self._INFO:get("targetkinds")
end
@@ -594,7 +594,7 @@ function language.linkerinfos_of(targetkind, sourcekinds)
for name, instance in pairs(languages) do
for _, mixingkind in ipairs(table.wrap(instance:mixingkinds())) do
local targetflags = instance:targetflags()
- for _targetkind, linkerkind in pairs(table.wrap(instance:targetkinds())) do
+ for _targetkind, linkerkind in pairs(table.wrap(instance:kinds())) do
-- init linker info
linkerinfos[_targetkind] = linkerinfos[_targetkind] or {}
@@ -667,7 +667,7 @@ function language.targetkinds()
-- merge all for each language
local targetkinds = {}
for name, instance in pairs(languages) do
- for targetkind, linkerkind in pairs(table.wrap(instance:targetkinds())) do
+ for targetkind, linkerkind in pairs(table.wrap(instance:kinds())) do
targetkinds[targetkind] = targetkinds[targetkind] or {}
table.insert(targetkinds[targetkind], linkerkind)
end
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index c0a643434..6f6a38494 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -447,6 +447,16 @@ function _instance:name()
return self._NAME
end
+-- get the target kind
+function _instance:kind()
+ return self:get("kind") or "phony"
+end
+
+-- get the target kind (deprecated)
+function _instance:targetkind()
+ return self:kind()
+end
+
-- get the platform of this target
function _instance:plat()
return self:get("plat") or config.get("plat") or os.host()
@@ -558,7 +568,7 @@ function _instance:linker()
end
-- get the linker instance
- local instance, errors = linker.load(self:targetkind(), self:sourcekinds(), self)
+ local instance, errors = linker.load(self:kind(), self:sourcekinds(), self)
if not instance then
os.raise(errors)
end
@@ -620,7 +630,7 @@ end
function _instance:isphony()
-- get target kind
- local targetkind = self:targetkind()
+ local targetkind = self:kind()
-- is phony?
return not targetkind or targetkind == "phony"
@@ -891,11 +901,6 @@ function _instance:autogenfile(sourcefile, opt)
return path.join(rootdir, (opt and opt.filename) and opt.filename or path.filename(sourcefile))
end
--- get the target kind
-function _instance:targetkind()
- return self:get("kind") or "phony"
-end
-
-- get the target directory
function _instance:targetdir()
@@ -934,7 +939,7 @@ function _instance:targetfile()
local targetdir = self:targetdir()
-- get target kind
- local targetkind = self:targetkind()
+ local targetkind = self:kind()
-- only compile objects? no target file
if targetkind == "object" then
@@ -1217,7 +1222,7 @@ function _instance:objectfiles()
-- get object files from all dependent targets (object kind)
if self:orderdeps() then
for _, dep in ipairs(self:orderdeps()) do
- if dep:targetkind() == "object" then
+ if dep:kind() == "object" then
table.join2(objectfiles, dep:objectfiles())
remove_repeat = true
end
diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua
index 22a4233df..b896d04b6 100644
--- a/xmake/core/tool/compiler.lua
+++ b/xmake/core/tool/compiler.lua
@@ -175,7 +175,7 @@ function compiler:build(sourcefiles, targetfile, opt)
-- get target kind
local targetkind = opt.targetkind
if not targetkind and opt.target and opt.target.targetkind then
- targetkind = opt.target:targetkind()
+ targetkind = opt.target:kind()
end
-- get it
@@ -207,7 +207,7 @@ function compiler:buildargv(sourcefiles, targetfile, opt)
-- get target kind
local targetkind = opt.targetkind
if not targetkind and opt.target and opt.target.targetkind then
- targetkind = opt.target:targetkind()
+ targetkind = opt.target:kind()
end
-- get it
@@ -297,7 +297,7 @@ function compiler:compflags(opt)
-- get target kind
local targetkind = opt.targetkind
if not targetkind and target and target.targetkind then
- targetkind = target:targetkind()
+ targetkind = target:kind()
end
-- add flags from compiler/toolchains
diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua
index 17eafe7dc..a90dba8c1 100644
--- a/xmake/core/tool/linker.lua
+++ b/xmake/core/tool/linker.lua
@@ -231,7 +231,7 @@ function linker:linkflags(opt)
-- get target kind
local targetkind = opt.targetkind
if not targetkind and target and target.targetkind then
- targetkind = target:targetkind()
+ targetkind = target:kind()
end
-- add flags from linker/toolchains
diff --git a/xmake/modules/private/action/run/make_runenvs.lua b/xmake/modules/private/action/run/make_runenvs.lua
index bb40e57f3..2ca69c033 100644
--- a/xmake/modules/private/action/run/make_runenvs.lua
+++ b/xmake/modules/private/action/run/make_runenvs.lua
@@ -49,7 +49,7 @@ function _make_runpath_on_windows(target)
end
end
for _, dep in ipairs(target:orderdeps()) do
- if dep:targetkind() == "shared" then
+ if dep:kind() == "shared" then
insert(dep:targetdir())
end
end
diff --git a/xmake/modules/private/diagnosis/dump_targets.lua b/xmake/modules/private/diagnosis/dump_targets.lua
index b9cc4be5f..c992a28f0 100644
--- a/xmake/modules/private/diagnosis/dump_targets.lua
+++ b/xmake/modules/private/diagnosis/dump_targets.lua
@@ -42,7 +42,7 @@ end
function main(targetname)
config.load()
for _, target in ipairs(_get_targets(targetname)) do
- cprint("${bright}target(%s):${clear} %s", target:name(), target:targetkind())
+ cprint("${bright}target(%s):${clear} %s", target:name(), target:kind())
local deps = target:get("deps")
if deps then
cprint(" ${color.dump.string}deps:")
diff --git a/xmake/modules/target/action/install/main.lua b/xmake/modules/target/action/install/main.lua
index 5d385ec49..64dec9f18 100644
--- a/xmake/modules/target/action/install/main.lua
+++ b/xmake/modules/target/action/install/main.lua
@@ -49,7 +49,7 @@ function main(target, opt)
-- call script
if not target:isphony() then
local install_style = target:is_plat("windows", "mingw") and "windows" or "unix"
- local script = import(install_style, {anonymous = true})["install_" .. target:targetkind()]
+ local script = import(install_style, {anonymous = true})["install_" .. target:kind()]
if script then
script(target, opt)
end
diff --git a/xmake/modules/target/action/install/windows.lua b/xmake/modules/target/action/install/windows.lua
index 548b4dfe4..73e8f5ee3 100644
--- a/xmake/modules/target/action/install/windows.lua
+++ b/xmake/modules/target/action/install/windows.lua
@@ -74,7 +74,7 @@ function install_binary(target, opt)
-- install the dependent shared/windows (*.dll) target
-- @see https://github.com/xmake-io/xmake/issues/961
for _, dep in ipairs(target:orderdeps()) do
- if dep:targetkind() == "shared" then
+ if dep:kind() == "shared" then
local depfile = dep:targetfile()
if os.isfile(depfile) then
os.vcp(depfile, binarydir)
diff --git a/xmake/modules/target/action/uninstall/main.lua b/xmake/modules/target/action/uninstall/main.lua
index bb84d811c..5e7e26a9b 100644
--- a/xmake/modules/target/action/uninstall/main.lua
+++ b/xmake/modules/target/action/uninstall/main.lua
@@ -41,7 +41,7 @@ function main(target, opt)
-- call script
if not target:isphony() then
local install_style = target:is_plat("windows", "mingw") and "windows" or "unix"
- local script = import(install_style, {anonymous = true})["uninstall_" .. target:targetkind()]
+ local script = import(install_style, {anonymous = true})["uninstall_" .. target:kind()]
if script then
script(target, opt)
end
diff --git a/xmake/modules/target/action/uninstall/windows.lua b/xmake/modules/target/action/uninstall/windows.lua
index a9b09c43c..f45028303 100644
--- a/xmake/modules/target/action/uninstall/windows.lua
+++ b/xmake/modules/target/action/uninstall/windows.lua
@@ -59,7 +59,7 @@ function uninstall_binary(target, opt)
-- remove the dependent shared/windows (*.dll) target
-- @see https://github.com/xmake-io/xmake/issues/961
for _, dep in ipairs(target:orderdeps()) do
- if dep:targetkind() == "shared" then
+ if dep:kind() == "shared" then
os.vrm(path.join(binarydir, path.filename(dep:targetfile())))
end
_uninstall_shared_for_packages(dep, binarydir)
diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua
index c207863b2..502b5bc51 100644
--- a/xmake/plugins/project/cmake/cmakelists.lua
+++ b/xmake/plugins/project/cmake/cmakelists.lua
@@ -476,7 +476,7 @@ function _add_target(cmakelists, target)
cmakelists:print("# target")
-- is phony target?
- local targetkind = target:targetkind()
+ local targetkind = target:kind()
if target:isphony() then
return _add_target_phony(cmakelists, target)
elseif targetkind == "binary" then
@@ -486,7 +486,7 @@ function _add_target(cmakelists, target)
elseif targetkind == "shared" then
_add_target_shared(cmakelists, target)
else
- raise("unknown target kind %s", target:targetkind())
+ raise("unknown target kind %s", target:kind())
end
-- TODO export target headers (deprecated)
diff --git a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua
index a9e541bb3..5ddeeb7b0 100644
--- a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua
+++ b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua
@@ -70,7 +70,7 @@ end
function _make_linkflags(target, vcprojdir)
-- make the linking flags
- local linkflags = linker.linkflags(target:targetkind(), target:sourcekinds(), {target = target})
+ local linkflags = linker.linkflags(target:kind(), target:sourcekinds(), {target = target})
-- replace -libpath:dir or /libpath:dir, -pdb:symbol.pdb or /pdb:symbol.pdb
local flags = {}
@@ -201,7 +201,7 @@ end
function _make_VCLinkerTool(vcprojfile, vsinfo, target, vcprojdir)
-- need not linker?
- local kind = target:targetkind()
+ local kind = target:kind()
if kind ~= "binary" and kind ~= "shared" then
vcprojfile:enter("<Tool")
vcprojfile:print("Name=\"VCLinkerTool\"")
@@ -292,7 +292,7 @@ function _make_configurations(vcprojfile, vsinfo, target, vcprojdir)
vcprojfile:print("Name=\"$(mode)|Win32\"")
vcprojfile:print("OutputDirectory=\"%s\"", path.relative(path.absolute(target:targetdir()), vcprojdir))
vcprojfile:print("IntermediateDirectory=\"%s\"", path.relative(path.absolute(target:objectdir()), vcprojdir))
- vcprojfile:print("ConfigurationType=\"%d\"", assert(configuration_types[target:targetkind()]))
+ vcprojfile:print("ConfigurationType=\"%d\"", assert(configuration_types[target:kind()]))
vcprojfile:print("CharacterSet=\"%d\"", unicode and 1 or 2) -- mbc: 2, wcs: 1
vcprojfile:print("UseOfMFC=\"%d\"", usemfc)
vcprojfile:print(">")
diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua
index 268383919..cbc93e2c9 100644
--- a/xmake/plugins/project/vstudio/impl/vs201x.lua
+++ b/xmake/plugins/project/vstudio/impl/vs201x.lua
@@ -72,7 +72,7 @@ function _make_targetinfo(mode, arch, target)
targetinfo.symbols = target:get("symbols")
-- save target kind
- targetinfo.targetkind = target:targetkind()
+ targetinfo.targetkind = target:kind()
-- save target file
targetinfo.targetfile = target:targetfile()
@@ -108,7 +108,7 @@ function _make_targetinfo(mode, arch, target)
end
-- save linker flags
- local linkflags = linker.linkflags(target:targetkind(), target:sourcekinds(), {target = target})
+ local linkflags = linker.linkflags(target:kind(), target:sourcekinds(), {target = target})
targetinfo.linkflags = linkflags
-- use mfc? save the mfc runtime kind
@@ -134,7 +134,7 @@ end
function _make_targetheaders(mode, arch, target, last)
-- only for static and shared target
- local kind = target:targetkind()
+ local kind = target:kind()
if kind == "static" or kind == "shared" then
-- TODO make headers, (deprecated)
@@ -295,7 +295,7 @@ function make(outputdir, vsinfo)
-- init target info
_target.name = targetname
- _target.kind = target:targetkind()
+ _target.kind = target:kind()
_target.scriptdir = target:scriptdir()
_target.info = _target.info or {}
table.insert(_target.info, _make_targetinfo(mode, arch, target))
diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua
index 75bb65aa9..b770152b8 100644
--- a/xmake/plugins/project/vsxmake/getinfo.lua
+++ b/xmake/plugins/project/vsxmake/getinfo.lua
@@ -162,7 +162,7 @@ function _make_targetinfo(mode, arch, target)
end
-- save subsystem
- local linkflags = linker.linkflags(target:targetkind(), target:sourcekinds(), {target = target})
+ local linkflags = linker.linkflags(target:kind(), target:sourcekinds(), {target = target})
for _, linkflag in ipairs(linkflags) do
if linkflag:lower():find("[%-/]subsystem:windows") then
targetinfo.subsystem = "windows"
@@ -385,7 +385,7 @@ function main(outputdir, vsinfo)
_target.target = targetname
_target.vcxprojdir = path.join(vsinfo.solution_dir, targetname)
_target.target_id = hash.uuid4(targetname)
- _target.kind = target:targetkind()
+ _target.kind = target:kind()
_target.scriptdir = path.relative(target:scriptdir(), _target.vcxprojdir)
_target.projectdir = path.relative(project.directory(), _target.vcxprojdir)
local targetdir = target:get("targetdir")
diff --git a/xmake/plugins/show/info/target.lua b/xmake/plugins/show/info/target.lua
index 30462848a..fb99b31e4 100644
--- a/xmake/plugins/show/info/target.lua
+++ b/xmake/plugins/show/info/target.lua
@@ -33,7 +33,7 @@ function main(name)
-- show target information
print("The information of target(%s):", name)
- cprint(" ${color.dump.string}kind${clear}: %s", target:targetkind())
+ cprint(" ${color.dump.string}kind${clear}: %s", target:kind())
cprint(" ${color.dump.string}targetfile${clear}: %s", target:targetfile())
local deps = target:get("deps")
if deps then
diff --git a/xmake/rules/cuda/devlink/xmake.lua b/xmake/rules/cuda/devlink/xmake.lua
index d44686b50..e92a0b779 100644
--- a/xmake/rules/cuda/devlink/xmake.lua
+++ b/xmake/rules/cuda/devlink/xmake.lua
@@ -42,7 +42,7 @@ rule("cuda.build.devlink")
end
-- only for binary/shared
- local targetkind = target:targetkind()
+ local targetkind = target:kind()
if targetkind ~= "binary" and targetkind ~= "shared" then
return
end
diff --git a/xmake/rules/mode/xmake.lua b/xmake/rules/mode/xmake.lua
index 2bdb9f689..932e47ae2 100644
--- a/xmake/rules/mode/xmake.lua
+++ b/xmake/rules/mode/xmake.lua
@@ -45,7 +45,7 @@ rule("mode.release")
if is_mode("release") then
-- set the symbols visibility: hidden
- if not target:get("symbols") and target:targetkind() ~= "shared" then
+ if not target:get("symbols") and target:kind() ~= "shared" then
target:set("symbols", "hidden")
end
diff --git a/xmake/rules/utils/inherit_links/inherit_links.lua b/xmake/rules/utils/inherit_links/inherit_links.lua
index 52d64fd4c..83d36d1d2 100644
--- a/xmake/rules/utils/inherit_links/inherit_links.lua
+++ b/xmake/rules/utils/inherit_links/inherit_links.lua
@@ -35,7 +35,7 @@ function main(target)
end
-- export links and linkdirs
- local targetkind = target:targetkind()
+ local targetkind = target:kind()
if targetkind == "shared" or targetkind == "static" then
local targetfile = target:targetfile()
@@ -64,7 +64,7 @@ function main(target)
local targetdir = target:targetdir()
for _, dep in ipairs(target:orderdeps()) do
local depinherit = target:extraconf("deps", dep:name(), "inherit")
- if dep:targetkind() == "shared" and (depinherit == nil or depinherit) then
+ if dep:kind() == "shared" and (depinherit == nil or depinherit) then
local rpathdir = "@loader_path"
local subdir = path.relative(path.directory(dep:targetfile()), targetdir)
if subdir and subdir ~= '.' then
diff --git a/xmake/rules/utils/symbols/export_all/export_all.lua b/xmake/rules/utils/symbols/export_all/export_all.lua
new file mode 100644
index 000000000..9d815090c
--- /dev/null
+++ b/xmake/rules/utils/symbols/export_all/export_all.lua
@@ -0,0 +1,30 @@
+--!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 export_all.lua
+--
+
+-- imports
+import("lib.detect.find_tool")
+import("core.tool.toolchain")
+
+-- export all symbols for dynamic library
+function main (target)
+ -- @note it only supports windows/dll now
+ assert(target:is_plat("windows") and target:kind() == "shared", 'rule("utils.symbols.export_all"): only support windows/dll now')
+
+end
diff --git a/xmake/rules/utils/symbols/export_all/xmake.lua b/xmake/rules/utils/symbols/export_all/xmake.lua
new file mode 100644
index 000000000..5f8a63519
--- /dev/null
+++ b/xmake/rules/utils/symbols/export_all/xmake.lua
@@ -0,0 +1,24 @@
+--!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
+--
+
+-- define rule: utils.symbols.export_all
+rule("utils.symbols.export_all")
+ before_link("export_all")
+
diff --git a/xmake/rules/utils/extract_symbols/xmake.lua b/xmake/rules/utils/symbols/extract/xmake.lua
index eba3f2a24..278935eae 100644
--- a/xmake/rules/utils/extract_symbols/xmake.lua
+++ b/xmake/rules/utils/symbols/extract/xmake.lua
@@ -27,7 +27,7 @@ rule("utils.symbols.extract")
-- need generate symbols?
local strip = target:get("strip")
- local targetkind = target:targetkind()
+ local targetkind = target:kind()
if target:get("symbols") == "debug" and (strip == "all" or strip == "debug")
and (targetkind == "binary" or targetkind == "shared") and platform.tool("strip") then -- only for strip command
target:data_set("utils.symbols.extract", true)
diff --git a/xmake/rules/xcode/application/build.lua b/xmake/rules/xcode/application/build.lua
index 0ba319bfa..786f5da89 100644
--- a/xmake/rules/xcode/application/build.lua
+++ b/xmake/rules/xcode/application/build.lua
@@ -48,7 +48,7 @@ function main (target, opt)
-- copy dependent dynamic libraries, TODO copy frameworks
for _, dep in ipairs(target:orderdeps()) do
- if dep:targetkind() == "shared" then
+ if dep:kind() == "shared" then
os.vcp(dep:targetfile(), binarydir)
end
end
diff --git a/xmake/rules/xcode/framework/xmake.lua b/xmake/rules/xcode/framework/xmake.lua
index ed3e4b6ec..b112dcaf1 100644
--- a/xmake/rules/xcode/framework/xmake.lua
+++ b/xmake/rules/xcode/framework/xmake.lua
@@ -147,7 +147,7 @@ rule("xcode.framework")
os.cd(oldir)
-- do codesign, only for dynamic library
- if target:targetkind() == "shared" then
+ if target:kind() == "shared" then
local codesign_identity = target:values("xcode.codesign_identity") or get_config("xcode_codesign_identity")
if target:is_plat("macosx") or (target:is_plat("iphoneos") and target:is_arch("x86_64", "i386")) then
codesign_identity = nil