summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-03-04 22:41:14 +0800
committerruki <[email protected]>2019-03-04 10:07:28 +0800
commit81222c3b9d2aec685ae0869adf58130d707af9b0 (patch)
tree59ec095bf88219c474e4f80fa276eb6245a3f9e6
parentee633ec6733376854fa8ea8a38da5b83fb47f5e4 (diff)
support yasm for vs201x plugin
-rw-r--r--xmake/plugins/project/vstudio/impl/vs201x.lua8
-rw-r--r--xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua9
2 files changed, 11 insertions, 6 deletions
diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua
index 0fd80605a..f4337392b 100644
--- a/xmake/plugins/project/vstudio/impl/vs201x.lua
+++ b/xmake/plugins/project/vstudio/impl/vs201x.lua
@@ -74,17 +74,19 @@ function _make_targetinfo(mode, arch, target)
-- save object dir
targetinfo.objectdir = target:objectdir()
- -- save compiler flags
- local firstcompflags=nil
+ -- save compiler flags and cmds
+ local firstcompflags = nil
targetinfo.compflags = {}
+ targetinfo.compcmds = {}
for sourcekind, sourcebatch in pairs(target:sourcebatches()) do
if not sourcebatch.rulename then
- for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
+ for idx, sourcefile in ipairs(sourcebatch.sourcefiles) do
local compflags = compiler.compflags(sourcefile, {target = target})
if not firstcompflags and (sourcekind == "cc" or sourcekind == "cxx") then
firstcompflags = compflags
end
targetinfo.compflags[sourcefile] = compflags
+ targetinfo.compcmds[sourcefile] = compiler.compcmd("__sourcefile__", "__objectfile__", {sourcekind = sourcekind, target = target})
end
end
end
diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
index 384a2ded5..6ed72b75e 100644
--- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
+++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
@@ -24,6 +24,7 @@
-- imports
import("core.project.config")
+import("core.tool.compiler")
import("core.language.language")
import("vsfile")
@@ -540,8 +541,9 @@ function _make_source_file_forall(vcxprojfile, vsinfo, target, sourcefile, sourc
vcxprojfile:print("<FileType>Document</FileType>")
for _, info in ipairs(sourceinfo) do
local objectfile = path.relative(path.absolute(info.objectfile), vcxprojdir)
+ local compcmd = info.compcmd:gsub("__objectfile__", objectfile):gsub("__sourcefile__", sourcefile)
vcxprojfile:print("<Outputs Condition=\"\'%$(Configuration)|%$(Platform)\'==\'%s\'\">%s</Outputs>", info.mode .. '|' .. info.arch, objectfile)
- vcxprojfile:print("<Command Condition=\"\'%$(Configuration)|%$(Platform)\'==\'%s\'\">%s /nologo /c %s -Fo%s %s</Command>", info.mode .. '|' .. info.arch, ifelse(info.arch == "x64", "ml64", "ml"), os.args(info.flags), objectfile, sourcefile)
+ vcxprojfile:print("<Command Condition=\"\'%$(Configuration)|%$(Platform)\'==\'%s\'\">%s</Command>", info.mode .. '|' .. info.arch, compcmd)
end
-- for *.rc files
@@ -652,10 +654,11 @@ function _make_source_file_forspec(vcxprojfile, vsinfo, target, sourcefile, sour
-- for *.asm files
local objectfile = path.relative(path.absolute(info.objectfile), vcxprojdir)
if info.sourcekind == "as" then
+ local compcmd = info.compcmd:gsub("__objectfile__", objectfile):gsub("__sourcefile__", sourcefile)
vcxprojfile:print("<ExcludedFromBuild>false</ExcludedFromBuild>")
vcxprojfile:print("<FileType>Document</FileType>")
vcxprojfile:print("<Outputs>%s</Outputs>", objectfile)
- vcxprojfile:print("<Command>%s /nologo /c %s -Fo%s %s</Command>", ifelse(info.arch == "x64", "ml64", "ml"), os.args(info.flags), objectfile, sourcefile)
+ vcxprojfile:print("<Command>%s</Command>", compcmd)
-- for *.rc files
elseif sourcekind == "mrc" then
@@ -722,7 +725,7 @@ function _make_source_files(vcxprojfile, vsinfo, target, vcxprojdir)
local objectfile = objectfiles[idx]
local flags = targetinfo.sourceflags[sourcefile]
sourceinfos[sourcefile] = sourceinfos[sourcefile] or {}
- table.insert(sourceinfos[sourcefile], {mode = targetinfo.mode, arch = targetinfo.arch, sourcekind = sourcekind, objectfile = objectfile, flags = flags})
+ table.insert(sourceinfos[sourcefile], {mode = targetinfo.mode, arch = targetinfo.arch, sourcekind = sourcekind, objectfile = objectfile, flags = flags, compcmd = targetinfo.compcmds[sourcefile]})
end
end
end