summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-07-19 12:51:49 +0800
committerGitHub <[email protected]>2019-07-19 12:51:49 +0800
commit660b6f4e66b95ae87b814fdaa538924cfc0f476c (patch)
tree89a6bf45c6dc6ef52872b5d99d8b622c43ce9835
parentae533cdc5bcee78d7a24b64eac430d9197d0e043 (diff)
parentca45f8941e0b69582021d34061873c8752f76154 (diff)
Merge pull request #488 from OpportunityLiu/vsproj
Improve vsxmake
-rw-r--r--xmake/core/base/os.lua95
-rw-r--r--xmake/core/base/path.lua26
-rw-r--r--xmake/core/base/table.lua15
-rw-r--r--xmake/core/sandbox/modules/io.lua2
-rw-r--r--xmake/core/tool/builder.lua4
-rw-r--r--xmake/modules/package/tools/autoconf.lua4
-rw-r--r--xmake/modules/package/tools/cmake.lua6
-rw-r--r--xmake/modules/package/tools/make.lua4
-rw-r--r--xmake/modules/package/tools/meson.lua6
-rwxr-xr-xxmake/plugins/project/main.lua18
-rw-r--r--xmake/plugins/project/vstudio/impl/vs200x_solution.lua2
-rw-r--r--xmake/plugins/project/vstudio/impl/vs201x.lua10
-rw-r--r--xmake/plugins/project/vstudio/impl/vs201x_solution.lua2
-rw-r--r--xmake/plugins/project/vstudio/impl/vsinfo.lua2
-rw-r--r--xmake/plugins/project/vstudio/vs.lua18
-rw-r--r--xmake/plugins/project/vstudio/vsx.lua35
-rw-r--r--xmake/plugins/project/vsxmake/getinfo.lua105
-rw-r--r--xmake/plugins/project/vsxmake/render.lua6
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/Xmake.props257
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/Xmake.targets340
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/#target#.vcxproj.user12
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.items11
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.items.filters13
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.props75
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.targets44
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters70
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec)6
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cu(filecu)6
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cxx(filecxx)6
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.obj(fileobj)6
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.rc(filerc)6
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Filter(dir)6
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc)6
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj74
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.c(filec)6
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cu(filecu)2
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx)6
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.obj(fileobj)2
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.rc(filerc)2
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc)2
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectConfiguration(mode,arch)8
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectRef(dep)6
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch)26
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch)18
-rw-r--r--xmake/plugins/project/vsxmake/vsxmake.lua17
-rw-r--r--xmake/plugins/project/xmake.lua8
46 files changed, 803 insertions, 598 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index ee5979b2e..4c23ed0c4 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -11,7 +11,7 @@
-- 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 - 2019, TBOOX Open Source Group.
--
-- @author ruki
@@ -39,15 +39,15 @@ os._setenv = os._setenv or os.setenv
os._getenvs = os._getenvs or os.getenvs
os._readlink = os._readlink or os.readlink
--- copy single file or directory
+-- copy single file or directory
function os._cp(src, dst)
-
+
-- check
assert(src and dst)
-- is file?
if os.isfile(src) then
-
+
-- the destination is directory? append the filename
if os.isdir(dst) or path.islastsep(dst) then
dst = path.join(dst, path.filename(src))
@@ -59,7 +59,7 @@ function os._cp(src, dst)
end
-- is directory?
elseif os.isdir(src) then
-
+
-- the destination directory exists? append the filename
if os.isdir(dst) or path.islastsep(dst) then
dst = path.join(dst, path.filename(path.translate(src)))
@@ -74,20 +74,20 @@ function os._cp(src, dst)
else
return false, string.format("cannot copy file %s, error: not found this file", src)
end
-
+
-- ok
return true
end
-- move single file or directory
function os._mv(src, dst)
-
+
-- check
assert(src and dst)
-- exists file or directory?
if os.exists(src) then
-
+
-- the destination directory exists? append the filename
if os.isdir(dst) or path.islastsep(dst) then
dst = path.join(dst, path.filename(path.translate(src)))
@@ -101,14 +101,14 @@ function os._mv(src, dst)
else
return false, string.format("cannot move %s to %s, not found this file %s", src, dst, os.strerror())
end
-
+
-- ok
return true
end
--- remove single file or directory
+-- remove single file or directory
function os._rm(filedir)
-
+
-- check
assert(filedir)
@@ -136,7 +136,7 @@ function os.argw(argv)
-- match all arguments
local results = {}
for _, arg in ipairs(table.wrap(argv)) do
-
+
-- exists wildcards?
if arg:find("([%+%-%^%$%*%[%]%%])") then
local pathes = os.match(arg, 'a')
@@ -185,7 +185,7 @@ end
-- match files or directories
--
--- @param pattern the search pattern
+-- @param pattern the search pattern
-- uses "*" to match any part of a file or directory name,
-- uses "**" to recurse into subdirectories.
--
@@ -198,7 +198,7 @@ end
-- @code
-- local dirs, count = os.match("./src/*", true)
-- local files, count = os.match("./src/**.c")
--- local file = os.match("./src/test.c", 'f', function (filepath, isdir)
+-- local file = os.match("./src/test.c", 'f', function (filepath, isdir)
-- return true -- continue it
-- return false -- break it
-- end)
@@ -235,7 +235,7 @@ function os.match(pattern, mode, callback)
assert(mode, "invalid match mode: %s", mode)
elseif mode then
mode = 1
- else
+ else
mode = 0
end
@@ -314,7 +314,7 @@ end
-- copy files or directories
function os.cp(...)
-
+
-- check arguments
local args = {...}
if #args < 2 then
@@ -341,7 +341,7 @@ end
-- move files or directories
function os.mv(...)
-
+
-- check arguments
local args = {...}
if #args < 2 then
@@ -368,7 +368,7 @@ end
-- remove files or directories
function os.rm(...)
-
+
-- check arguments
local args = {...}
if #args < 1 then
@@ -433,14 +433,14 @@ function os.cd(dir)
else
return nil, string.format("cannot change directory %s, not found this directory %s", dir, os.strerror())
end
-
+
-- ok
return oldir
end
-- create directories
function os.mkdir(...)
-
+
-- check arguments
local args = {...}
if #args < 1 then
@@ -460,7 +460,7 @@ end
-- remove directories
function os.rmdir(...)
-
+
-- check arguments
local args = {...}
if #args < 1 then
@@ -534,14 +534,14 @@ function os.runv(program, argv, opt)
opt = opt or {}
-- make temporary log file
- local log = os.tmpfile()
+ local logfile = os.tmpfile()
-- execute it
- local ok = os.execv(program, argv, table.join(opt, {stdout = log, stderr = log}))
+ local ok = os.execv(program, argv, table.join(opt, {stdout = logfile, stderr = logfile}))
if ok ~= 0 then
-- make errors
- local errors = io.readfile(log)
+ local errors = io.readfile(logfile)
if not errors or #errors == 0 then
if argv ~= nil then
errors = string.format("runv(%s %s) failed(%d)!", program, table.concat(argv, ' '), ok)
@@ -551,20 +551,20 @@ function os.runv(program, argv, opt)
end
-- remove the temporary log file
- os.rm(log)
+ os.rm(logfile)
-- failed
return false, errors
end
-- remove the temporary log file
- os.rm(log)
+ os.rm(logfile)
-- ok
return true
end
--- execute command
+-- execute command
function os.exec(cmd, outfile, errfile)
-- parse arguments
@@ -581,8 +581,8 @@ end
--
-- @param program "clang", "xcrun -sdk macosx clang", "~/dir/test\ xxx/clang"
-- filename "clang", "xcrun"", "~/dir/test\ xxx/clang"
--- @param argv the arguments
--- @param opt the options, .e.g {wildcards = false, stdout = outfile, stderr = errfile,
+-- @param argv the arguments
+-- @param opt the options, .e.g {wildcards = false, stdout = outfile, stderr = errfile,
-- envs = {PATH = "xxx;xx", CFLAGS = "xx"}}
--
function os.execv(program, argv, opt)
@@ -631,7 +631,7 @@ function os.execv(program, argv, opt)
-- wait process
local waitok = -1
- local status = -1
+ local status = -1
if coroutine.running() then
-- save the current directory
@@ -688,7 +688,7 @@ function os.iorunv(program, argv, opt)
local errfile = os.tmpfile()
-- run command
- local ok = os.execv(program, argv, table.join(opt, {stdout = outfile, stderr = errfile}))
+ local ok = os.execv(program, argv, table.join(opt, {stdout = outfile, stderr = errfile}))
-- get output and error data
local outdata = io.readfile(outfile)
@@ -943,34 +943,51 @@ function os.getenvs()
return envs
end
--- set values to environment variable
+-- set values to environment variable
function os.setenv(name, ...)
- return os._setenv(name, table.concat({...}, path.envsep()))
+ local values = {...}
+ if #values <= 1 then
+ -- keep compatible with original implementation
+ return os._setenv(name, values[1] or "")
+ else
+ return os._setenv(name, path.joinenv(values))
+ end
end
--- add values to environment variable
+-- add values to environment variable
function os.addenv(name, ...)
- local sep = path.envsep()
local values = {...}
if #values > 0 then
- return os._setenv(name, table.concat(values, sep) .. sep .. (os.getenv(name) or ""))
+ local oldenv = os.getenv(name)
+ local appendenv = path.joinenv(values)
+ if oldenv == "" or oldenv == nil then
+ return os._setenv(name, appendenv)
+ else
+ return os._setenv(name, appendenv .. path.envsep() .. oldenv)
+ end
else
return true
end
end
--- set values to environment variable with the given seperator
+-- set values to environment variable with the given seperator
function os.setenvp(name, values, sep)
sep = sep or path.envsep()
return os._setenv(name, table.concat(table.wrap(values), sep))
end
--- add values to environment variable with the given seperator
+-- add values to environment variable with the given seperator
function os.addenvp(name, values, sep)
sep = sep or path.envsep()
values = table.wrap(values)
if #values > 0 then
- return os._setenv(name, table.concat(values, sep) .. sep .. (os.getenv(name) or ""))
+ local oldenv = os.getenv(name)
+ local appendenv = table.concat(values, sep)
+ if oldenv == "" or oldenv == nil then
+ return os._setenv(name, appendenv)
+ else
+ return os._setenv(name, appendenv .. sep .. oldenv)
+ end
else
return true
end
diff --git a/xmake/core/base/path.lua b/xmake/core/base/path.lua
index c1222ffc6..8b35a771c 100644
--- a/xmake/core/base/path.lua
+++ b/xmake/core/base/path.lua
@@ -158,6 +158,32 @@ function path.splitenv(env_path)
return result
end
+-- concat environment variable with `path.envsep()`,
+-- also handles more speical cases such as posix flags and windows quoted pathes
+function path.joinenv(env_table)
+
+ -- check
+ if not env_table or #env_table == 0 then
+ return ""
+ end
+
+ local envsep = path.envsep()
+ if xmake._HOST == "windows" then
+ local tab = {}
+ for _, v in ipairs(env_table) do
+ if v ~= "" then
+ if v:find(envsep, 1, true) then
+ v = '"' .. v .. '"'
+ end
+ table.insert(tab, v)
+ end
+ end
+ return table.concat(tab, envsep)
+ else
+ return table.concat(env_table, envsep)
+ end
+end
+
-- the last character is the path seperator?
function path.islastsep(p)
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua
index 9af47b5a8..3fc5d92c8 100644
--- a/xmake/core/base/table.lua
+++ b/xmake/core/base/table.lua
@@ -258,17 +258,10 @@ function table.unique(array, barrier)
end
-- add unique item
- if type(v) == "string" then
- if not exists[v] then
- exists[v] = true
- table.insert(unique, v)
- end
- else
- local key = "\"" .. tostring(v) .. "\""
- if not exists[key] then
- exists[key] = true
- table.insert(unique, v)
- end
+ if not exists[v] then
+ -- v will not be nil
+ exists[v] = true
+ table.insert(unique, v)
end
end
diff --git a/xmake/core/sandbox/modules/io.lua b/xmake/core/sandbox/modules/io.lua
index 69cd22b76..49cb1b509 100644
--- a/xmake/core/sandbox/modules/io.lua
+++ b/xmake/core/sandbox/modules/io.lua
@@ -53,6 +53,8 @@ if sandbox_io_file.__index ~= sandbox_io_file then
end
end
end
+ -- file:lines does not use its second return value for error
+ sandbox_io_file.lines = io.file.lines
end
-- get file size
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index 472d5be76..51e284ad5 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -380,8 +380,8 @@ function builder:_add_flags_from_language(flags, target, getters)
{
config = function (name)
local values = config.get(name)
- if values and name:endswith("dirs") then
- values = values:split(path.envsep(), {plain = true})
+ if values and name:endswith("dirs") then
+ values = path.splitenv(values)
end
return values
end
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index 7705c3bca..349b2c5b5 100644
--- a/xmake/modules/package/tools/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -106,8 +106,8 @@ function buildenvs(package)
table.insert(ACLOCAL_PATH, aclocal)
end
end
- envs.ACLOCAL_PATH = table.concat(ACLOCAL_PATH, path.envsep())
- envs.PKG_CONFIG_PATH = table.concat(PKG_CONFIG_PATH, path.envsep())
+ envs.ACLOCAL_PATH = path.joinenv(ACLOCAL_PATH)
+ envs.PKG_CONFIG_PATH = path.joinenv(PKG_CONFIG_PATH)
return envs
end
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 7c21947d1..75b38eaf1 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -71,9 +71,9 @@ function buildenvs(package)
table.join2(CMAKE_PREFIX_PATH, dep:installdir())
end
end
- envs.CMAKE_LIBRARY_PATH = table.concat(CMAKE_LIBRARY_PATH, path.envsep())
- envs.CMAKE_INCLUDE_PATH = table.concat(CMAKE_INCLUDE_PATH, path.envsep())
- envs.CMAKE_PREFIX_PATH = table.concat(CMAKE_PREFIX_PATH, path.envsep())
+ envs.CMAKE_LIBRARY_PATH = path.joinenv(CMAKE_LIBRARY_PATH)
+ envs.CMAKE_INCLUDE_PATH = path.joinenv(CMAKE_INCLUDE_PATH)
+ envs.CMAKE_PREFIX_PATH = path.joinenv(CMAKE_PREFIX_PATH)
return envs
end
diff --git a/xmake/modules/package/tools/make.lua b/xmake/modules/package/tools/make.lua
index 13e72b310..4a7850185 100644
--- a/xmake/modules/package/tools/make.lua
+++ b/xmake/modules/package/tools/make.lua
@@ -59,8 +59,8 @@ function buildenvs(package)
table.insert(ACLOCAL_PATH, aclocal)
end
end
- envs.ACLOCAL_PATH = table.concat(ACLOCAL_PATH, path.envsep())
- envs.PKG_CONFIG_PATH = table.concat(PKG_CONFIG_PATH, path.envsep())
+ envs.ACLOCAL_PATH = path.joinenv(ACLOCAL_PATH)
+ envs.PKG_CONFIG_PATH = path.joinenv(PKG_CONFIG_PATH)
return envs
end
diff --git a/xmake/modules/package/tools/meson.lua b/xmake/modules/package/tools/meson.lua
index f977475ab..dac331ac9 100644
--- a/xmake/modules/package/tools/meson.lua
+++ b/xmake/modules/package/tools/meson.lua
@@ -24,7 +24,7 @@ import("core.project.config")
-- get build directory
function _get_buildir()
- _g.buildir = _g.buildir or "build_" .. hash.uuid():split('%-')[1]
+ _g.buildir = _g.buildir or ("build_" .. hash.uuid():split('%-')[1])
return _g.buildir
end
@@ -78,8 +78,8 @@ function buildenvs(package)
table.insert(ACLOCAL_PATH, aclocal)
end
end
- envs.ACLOCAL_PATH = table.concat(ACLOCAL_PATH, path.envsep())
- envs.PKG_CONFIG_PATH = table.concat(PKG_CONFIG_PATH, path.envsep())
+ envs.ACLOCAL_PATH = path.joinenv(ACLOCAL_PATH)
+ envs.PKG_CONFIG_PATH = path.joinenv(PKG_CONFIG_PATH)
return envs
end
diff --git a/xmake/plugins/project/main.lua b/xmake/plugins/project/main.lua
index d2ce39a10..cfcf10c2b 100755
--- a/xmake/plugins/project/main.lua
+++ b/xmake/plugins/project/main.lua
@@ -21,11 +21,11 @@
-- imports
import("core.base.option")
import("core.base.task")
+import("core.project.config")
import("core.platform.environment")
import("make.makefile")
import("cmake.cmakelists")
import("vstudio.vs")
-import("vstudio.vsx")
import("vsxmake.vsxmake")
import("clang.compile_flags")
import("clang.compile_commands")
@@ -42,23 +42,25 @@ function _make(kind)
, vs2003 = vs.make(2003)
, vs2005 = vs.make(2005)
, vs2008 = vs.make(2008)
- , vs2010 = vsx.make(2010)
- , vs2012 = vsx.make(2012)
- , vs2013 = vsx.make(2013)
- , vs2015 = vsx.make(2015)
- , vs2017 = vsx.make(2017)
- , vs2019 = vsx.make(2019)
+ , vs2010 = vs.make(2010)
+ , vs2012 = vs.make(2012)
+ , vs2013 = vs.make(2013)
+ , vs2015 = vs.make(2015)
+ , vs2017 = vs.make(2017)
+ , vs2019 = vs.make(2019)
+ , vs = vs.make()
, vsxmake2010 = vsxmake.make(2010)
, vsxmake2012 = vsxmake.make(2012)
, vsxmake2013 = vsxmake.make(2013)
, vsxmake2015 = vsxmake.make(2015)
, vsxmake2017 = vsxmake.make(2017)
, vsxmake2019 = vsxmake.make(2019)
+ , vsxmake = vsxmake.make()
, compile_flags = compile_flags.make
, compile_commands = compile_commands.make
}
assert(maps[kind], "the project kind(%s) is not supported!", kind)
-
+
-- make it
maps[kind](option.get("outputdir"))
end
diff --git a/xmake/plugins/project/vstudio/impl/vs200x_solution.lua b/xmake/plugins/project/vstudio/impl/vs200x_solution.lua
index 5653059c5..1333da648 100644
--- a/xmake/plugins/project/vstudio/impl/vs200x_solution.lua
+++ b/xmake/plugins/project/vstudio/impl/vs200x_solution.lua
@@ -88,7 +88,7 @@ end
function make(vsinfo)
-- init solution name
- vsinfo.solution_name = project.name() or "vs" .. vsinfo.vstudio_version
+ vsinfo.solution_name = project.name() or ("vs" .. vsinfo.vstudio_version)
-- open solution file
local slnfile = vsfile.open(path.join(vsinfo.solution_dir, vsinfo.solution_name .. ".sln"), "w")
diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua
index d414a69a3..af0a18d0c 100644
--- a/xmake/plugins/project/vstudio/impl/vs201x.lua
+++ b/xmake/plugins/project/vstudio/impl/vs201x.lua
@@ -165,7 +165,10 @@ function _make_vsinfo_modes()
local vsinfo_modes = {}
local modes = option.get("modes")
if modes then
- for _, mode in ipairs(modes:split(',')) do
+ if not modes:find("\"") then
+ modes = modes:gsub(",", path.envsep())
+ end
+ for _, mode in ipairs(path.splitenv(modes)) do
table.insert(vsinfo_modes, mode:trim())
end
else
@@ -181,7 +184,10 @@ function _make_vsinfo_archs()
local vsinfo_archs = {}
local archs = option.get("archs")
if archs then
- for _, arch in ipairs(archs:split(',')) do
+ if not archs:find("\"") then
+ archs = archs:gsub(",", path.envsep())
+ end
+ for _, arch in ipairs(path.splitenv(archs)) do
table.insert(vsinfo_archs, arch:trim())
end
else
diff --git a/xmake/plugins/project/vstudio/impl/vs201x_solution.lua b/xmake/plugins/project/vstudio/impl/vs201x_solution.lua
index d38ac15cf..cfcc20509 100644
--- a/xmake/plugins/project/vstudio/impl/vs201x_solution.lua
+++ b/xmake/plugins/project/vstudio/impl/vs201x_solution.lua
@@ -96,7 +96,7 @@ end
function make(vsinfo)
-- init solution name
- vsinfo.solution_name = project.name() or "vs" .. vsinfo.vstudio_version
+ vsinfo.solution_name = project.name() or ("vs" .. vsinfo.vstudio_version)
-- open solution file
local slnpath = path.join(vsinfo.solution_dir, vsinfo.solution_name .. ".sln")
diff --git a/xmake/plugins/project/vstudio/impl/vsinfo.lua b/xmake/plugins/project/vstudio/impl/vsinfo.lua
index 3da30d398..bd512a775 100644
--- a/xmake/plugins/project/vstudio/impl/vsinfo.lua
+++ b/xmake/plugins/project/vstudio/impl/vsinfo.lua
@@ -89,5 +89,5 @@ local vsinfo =
function main(version)
assert(version)
- return assert(vsinfo[version]);
+ return assert(vsinfo[version], "unsupported vs version (%d)", version);
end \ No newline at end of file
diff --git a/xmake/plugins/project/vstudio/vs.lua b/xmake/plugins/project/vstudio/vs.lua
index a50180a23..1284828c6 100644
--- a/xmake/plugins/project/vstudio/vs.lua
+++ b/xmake/plugins/project/vstudio/vs.lua
@@ -20,16 +20,28 @@
-- imports
import("impl.vs200x")
+import("impl.vs201x")
import("impl.vsinfo")
+import("core.project.config")
-- make factory
function make(version)
+ if not version then
+ version = assert(tonumber(config.get("vs")), "invalid vs version, run `xmake f --vs=2015`")
+ vprint("using project kind vs%d", version)
+ end
+
-- get vs version info
local info = vsinfo(version)
- -- make
- return function(outputdir)
- vs200x.make(outputdir, info)
+ if version < 2010 then
+ return function(outputdir)
+ vs200x.make(outputdir, info)
+ end
+ else
+ return function(outputdir)
+ vs201x.make(outputdir, info)
+ end
end
end
diff --git a/xmake/plugins/project/vstudio/vsx.lua b/xmake/plugins/project/vstudio/vsx.lua
deleted file mode 100644
index ff8b83281..000000000
--- a/xmake/plugins/project/vstudio/vsx.lua
+++ /dev/null
@@ -1,35 +0,0 @@
---!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 - 2019, TBOOX Open Source Group.
---
--- @author ruki
--- @file vsx.lua
---
-
--- imports
-import("impl.vs201x")
-import("impl.vsinfo")
-
--- make factory
-function make(version)
-
- -- get vs version info
- local info = vsinfo(version)
-
- -- make
- return function(outputdir)
- vs201x.make(outputdir, info)
- end
-end
diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua
index 4567adb1e..906148fa2 100644
--- a/xmake/plugins/project/vsxmake/getinfo.lua
+++ b/xmake/plugins/project/vsxmake/getinfo.lua
@@ -31,6 +31,31 @@ import("lib.detect.find_tool")
import("actions.config.configheader", {alias = "generate_configheader", rootdir = os.programdir()})
import("actions.config.configfiles", {alias = "generate_configfiles", rootdir = os.programdir()})
+-- escape special chars in msbuild file
+function _escape(str)
+ if not str then
+ return nil
+ end
+
+ local map =
+ {
+ ["%"] = "%25" -- Referencing metadata
+ , ["$"] = "%24" -- Referencing properties
+ , ["@"] = "%40" -- Referencing item lists
+ , ["'"] = "%27" -- Conditions and other expressions
+ , [";"] = "%3B" -- List separator
+ , ["?"] = "%3F" -- Wildcard character for file names in Include and Exclude attributes
+ , ["*"] = "%2A" -- Wildcard character for use in file names in Include and Exclude attributes
+ -- html entities
+ , ["\""] = "&quot;"
+ , ["<"] = "&lt;"
+ , [">"] = "&gt;"
+ , ["&"] = "&amp;"
+ }
+
+ return (string.gsub(str, "[%%%$@';%?%*\"<>&]", function (c) return assert(map[c]) end))
+end
+
function _make_dirs(dir)
if dir == nil then
return ""
@@ -42,36 +67,78 @@ function _make_dirs(dir)
end
if path.is_absolute(dir) then
if dir:startswith(project.directory()) then
- return path.join("$(XmakeProjectDir)", path.relative(dir, project.directory()))
+ return path.join("$(XmakeProjectDir)", _escape(path.relative(dir, project.directory())))
end
- return dir
+ return _escape(dir)
end
- return path.join("$(XmakeProjectDir)", dir)
+ return path.join("$(XmakeProjectDir)", _escape(dir))
end
local r = {}
for k, v in ipairs(dir) do
r[k] = _make_dirs(v)
end
r = table.unique(r)
- return table.concat(r, path.envsep())
+ return table.concat(r, ";")
+end
+
+function _make_arrs(arr)
+ if arr == nil then
+ return ""
+ end
+ if type(arr) == "string" then
+ return _escape(arr)
+ end
+ local r = {}
+ for k, v in ipairs(arr) do
+ r[k] = _make_arrs(v)
+ end
+ r = table.unique(r)
+ return table.concat(r, ";")
end
function _get_values(target, name)
local values = table.wrap(target:get(name))
+
+ -- from deps
for _, dep in irpairs(target:orderdeps()) do
local depinherit = target:extraconf("deps", dep:name(), "inherit")
if depinherit == nil or depinherit then
table.join2(values, dep:get(name, {interface = true}))
end
end
- return values
+
+ -- from opts
+ for _, opt in ipairs(target:orderopts()) do
+ table.join2(values, table.wrap(opt:get(name)))
+ end
+
+ -- from packages
+ for _, pkg in ipairs(target:orderpkgs()) do
+ -- uses them instead of the builtin configs if exists extra package config
+ -- e.g. `add_packages("xxx", {links = "xxx"})`
+ local configinfo = target:pkgconfig(pkg:name())
+ if configinfo and configinfo[name] then
+ table.join2(values, configinfo[name])
+ else
+ -- uses the builtin package configs
+ table.join2(values, pkg:get(name))
+ end
+ end
+
+ return table.unique(values)
end
-- make target info
function _make_targetinfo(mode, arch, target)
-- init target info
- local targetinfo = { mode = mode, arch = arch, plat = config.get("plat"), vsarch = (arch == "x86" and "Win32" or arch) }
+ local targetinfo =
+ {
+ mode = mode
+ , arch = arch
+ , plat = config.get("plat")
+ , vsarch = (arch == "x86" and "Win32" or arch)
+ }
-- write only if not default
-- use target:get("xxx") rather than target:xxx()
@@ -80,8 +147,8 @@ function _make_targetinfo(mode, arch, target)
targetinfo.kind = target:get("kind")
-- save target file
- targetinfo.basename = target:get("basename")
- targetinfo.filename = target:get("filename")
+ targetinfo.basename = _escape(target:get("basename"))
+ targetinfo.filename = _escape(target:get("filename"))
-- save dirs
targetinfo.targetdir = _make_dirs(target:get("targetdir"))
@@ -93,8 +160,8 @@ function _make_targetinfo(mode, arch, target)
targetinfo.linkdirs = _make_dirs(_get_values(target, "linkdirs"))
-- save defines
- targetinfo.defines = table.concat(_get_values(target, "defines"), ";")
- targetinfo.languages = table.concat(_get_values(target, "languages"), ";")
+ targetinfo.defines = _make_arrs(_get_values(target, "defines"))
+ targetinfo.languages = _make_arrs(_get_values(target, "languages"))
-- save runenvs
local runenvs = {}
@@ -103,7 +170,7 @@ function _make_targetinfo(mode, arch, target)
for _, d in ipairs(v) do
table.insert(defs, vformat(d))
end
- table.insert(runenvs, format("%s=%s", k, table.concat(defs, path.envsep())))
+ table.insert(runenvs, format("%s=%s", k, path.joinenv(defs)))
end
targetinfo.runenvs = table.concat(runenvs, "\n")
@@ -129,7 +196,10 @@ function _make_vsinfo_modes()
local vsinfo_modes = {}
local modes = option.get("modes")
if modes then
- for _, mode in ipairs(modes:split(',')) do
+ if not modes:find("\"") then
+ modes = modes:gsub(",", path.envsep())
+ end
+ for _, mode in ipairs(path.splitenv(modes)) do
table.insert(vsinfo_modes, mode:trim())
end
else
@@ -145,7 +215,10 @@ function _make_vsinfo_archs()
local vsinfo_archs = {}
local archs = option.get("archs")
if archs then
- for _, arch in ipairs(archs:split(',')) do
+ if not archs:find("\"") then
+ archs = archs:gsub(",", path.envsep())
+ end
+ for _, arch in ipairs(path.splitenv(archs)) do
table.insert(vsinfo_archs, arch:trim())
end
else
@@ -266,14 +339,14 @@ function main(outputdir, vsinfo)
local dir = path.directory(f)
target._sub2[f] =
{
- path = path.join("$(XmakeProjectDir)", f),
- dir = dir
+ path = _escape(f),
+ dir = _escape(dir)
}
while dir ~= "." do
if not dirs[dir] then
dirs[dir] =
{
- dir = dir,
+ dir = _escape(dir),
dir_id = hash.uuid(dir)
}
end
diff --git a/xmake/plugins/project/vsxmake/render.lua b/xmake/plugins/project/vsxmake/render.lua
index c672b30cd..99f635d04 100644
--- a/xmake/plugins/project/vsxmake/render.lua
+++ b/xmake/plugins/project/vsxmake/render.lua
@@ -37,14 +37,14 @@ function _expand(params)
for _, v in ipairs(params) do
if type(v) == "string" then
for i, p in ipairs(r) do
- r[i] = p .. ";" .. v
+ r[i] = p .. "\0" .. v
end
else
local newr = {}
for _, c in ipairs(v) do
local rcopy = {}
for i, p in ipairs(r) do
- rcopy[i] = p .. ";" .. c
+ rcopy[i] = p .. "\0" .. c
end
newr= table.join(newr, rcopy)
end
@@ -52,7 +52,7 @@ function _expand(params)
end
end
for i, p in ipairs(r) do
- r[i] = p:split(";")
+ r[i] = p:split("\0")
end
return r
end
diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.props b/xmake/plugins/project/vsxmake/vsproj/Xmake.props
index 20432fec3..e954a435b 100644
--- a/xmake/plugins/project/vsxmake/vsproj/Xmake.props
+++ b/xmake/plugins/project/vsxmake/vsproj/Xmake.props
@@ -1,141 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup Label="XmakePropsInit">
- <!-- initialize this first to allow `Condition="'$(XmakeMode)|$(XmakeArch)' == 'release|x86'"` in custom props file -->
- <XmakeMode Condition="'$(XmakeMode)' == ''">$(Configuration)</XmakeMode>
- <XmakeMode Condition="'$(XmakeMode)' == ''">release</XmakeMode>
+ <PropertyGroup Label="XmakePropsInit">
+ <!-- initialize this first to allow `Condition="'$(XmakeMode)|$(XmakeArch)' == 'release|x86'"` in custom props file -->
+ <XmakeMode Condition="'$(XmakeMode)' == ''">$(Configuration)</XmakeMode>
+ <XmakeMode Condition="'$(XmakeMode)' == ''">release</XmakeMode>
- <XmakeArch Condition="'$(XmakeArch)' == '' And '$(Platform.ToLower())' == 'win32'">x86</XmakeArch>
- <XmakeArch Condition="'$(XmakeArch)' == '' And '$(Platform.ToLower())' != 'win32'">$(Platform)</XmakeArch>
- <XmakeArch Condition="'$(XmakeArch)' == ''">x86</XmakeArch>
- </PropertyGroup>
+ <XmakeArch Condition="'$(XmakeArch)' == '' And '$(Platform.ToLower())' == 'win32'">x86</XmakeArch>
+ <XmakeArch Condition="'$(XmakeArch)' == '' And '$(Platform.ToLower())' != 'win32'">$(Platform)</XmakeArch>
+ <XmakeArch Condition="'$(XmakeArch)' == ''">x86</XmakeArch>
+ </PropertyGroup>
- <ImportGroup Label="CustomSettings">
- <!--only search 2 levels to avoid accidentally import-->
- <Import Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.props')"
- Project="$(MSBuildProjectDirectory)\Xmake.Custom.props" />
- <Import Condition="!Exists('$(MSBuildProjectDirectory)\Xmake.Custom.props') And Exists('$(MSBuildProjectDirectory)\..\Xmake.Custom.props')"
- Project="$(MSBuildProjectDirectory)\..\Xmake.Custom.props" />
- </ImportGroup>
+ <ImportGroup Label="CustomSettings">
+ <!--only search 2 levels to avoid accidentally import-->
+ <Import Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.props')"
+ Project="$(MSBuildProjectDirectory)\Xmake.Custom.props" />
+ <Import Condition="!Exists('$(MSBuildProjectDirectory)\Xmake.Custom.props') And Exists('$(MSBuildProjectDirectory)\..\Xmake.Custom.props')"
+ Project="$(MSBuildProjectDirectory)\..\Xmake.Custom.props" />
+ </ImportGroup>
- <PropertyGroup Label="XmakePropsFallback">
- <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(XmakeTarget)</XmakeBasename>
- <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(TargetName)</XmakeBasename>
- <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(MSBuildProjectName)</XmakeBasename>
+ <PropertyGroup Label="XmakePropsFallback">
+ <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(XmakeTarget)</XmakeBasename>
+ <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(TargetName)</XmakeBasename>
+ <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(MSBuildProjectName)</XmakeBasename>
- <XmakeKind Condition="'$(XmakeKind)' == ''">binary</XmakeKind>
- <XmakePlat Condition="'$(XmakePlat)' == ''">windows</XmakePlat>
- </PropertyGroup>
+ <XmakeKind Condition="'$(XmakeKind)' == ''">binary</XmakeKind>
+ <XmakePlat Condition="'$(XmakePlat)' == ''">windows</XmakePlat>
+ </PropertyGroup>
- <PropertyGroup Label="XmakePathsFallback">
- <XmakeBuilDir Condition="'$(XmakeBuilDir)' == ''">$(XmakeProjectDir)\build</XmakeBuilDir>
- <XmakeTargetDir Condition="'$(XmakeTargetDir)' == ''">$(XmakeBuilDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeTargetDir>
- <XmakeConfigFileDir Condition="'$(XmakeConfigFileDir)' == ''">$(XmakeBuilDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeConfigFileDir>
+ <PropertyGroup Label="XmakePathsFallback">
+ <XmakeBuilDir Condition="'$(XmakeBuilDir)' == ''">$(XmakeProjectDir)\build</XmakeBuilDir>
+ <XmakeTargetDir Condition="'$(XmakeTargetDir)' == ''">$(XmakeBuilDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeTargetDir>
+ <XmakeConfigFileDir Condition="'$(XmakeConfigFileDir)' == ''">$(XmakeBuilDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeConfigFileDir>
- <XmakeConfigDir Condition="'$(XmakeConfigDir)' == ''">$(XMAKE_CONFIGDIR)</XmakeConfigDir>
- <XmakeConfigDir Condition="'$(XmakeConfigDir)' == ''">$(XmakeProjectDir)\.xmake</XmakeConfigDir>
+ <XmakeConfigDir Condition="'$(XmakeConfigDir)' == ''">$(XMAKE_CONFIGDIR)</XmakeConfigDir>
+ <XmakeConfigDir Condition="'$(XmakeConfigDir)' == ''">$(XmakeProjectDir)\.xmake</XmakeConfigDir>
- <XmakeRunDir Condition="'$(XmakeRunDir)' == ''">$(XmakeTargetDir)</XmakeRunDir>
- </PropertyGroup>
+ <XmakeRunDir Condition="'$(XmakeRunDir)' == ''">$(XmakeTargetDir)</XmakeRunDir>
+ </PropertyGroup>
- <PropertyGroup Label="XmakePathsResolve">
- <!-- resolve if they are relative paths -->
- <XmakeProjectDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeProjectDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeProjectDir)'))</XmakeProjectDir>
- <XmakeScriptDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeScriptDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeScriptDir)'))</XmakeScriptDir>
- <XmakeBuilDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeBuilDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuilDir)'))</XmakeBuilDir>
- <XmakeTargetDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeTargetDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeTargetDir)'))</XmakeTargetDir>
- <XmakeConfigDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeConfigDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigDir)'))</XmakeConfigDir>
- <XmakeConfigFileDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeConfigFileDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigFileDir)'))</XmakeConfigFileDir>
- <XmakeRunDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeRunDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeRunDir)'))</XmakeRunDir>
+ <PropertyGroup Label="XmakePathsResolve">
+ <!-- resolve if they are relative paths -->
+ <XmakeProjectDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeProjectDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeProjectDir)'))</XmakeProjectDir>
+ <XmakeScriptDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeScriptDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeScriptDir)'))</XmakeScriptDir>
+ <XmakeBuilDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeBuilDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuilDir)'))</XmakeBuilDir>
+ <XmakeTargetDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeTargetDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeTargetDir)'))</XmakeTargetDir>
+ <XmakeConfigDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeConfigDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigDir)'))</XmakeConfigDir>
+ <XmakeConfigFileDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeConfigFileDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigFileDir)'))</XmakeConfigFileDir>
+ <XmakeRunDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeRunDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeRunDir)'))</XmakeRunDir>
- <!-- normalize paths -->
- <XmakeProgramDir>$([System.IO.Path]::GetFullPath('$(XmakeProgramDir)/'))</XmakeProgramDir>
- <XmakeProjectDir>$([System.IO.Path]::GetFullPath('$(XmakeProjectDir)/'))</XmakeProjectDir>
- <XmakeScriptDir>$([System.IO.Path]::GetFullPath('$(XmakeScriptDir)/'))</XmakeScriptDir>
- <XmakeBuilDir>$([System.IO.Path]::GetFullPath('$(XmakeBuilDir)/'))</XmakeBuilDir>
- <XmakeTargetDir>$([System.IO.Path]::GetFullPath('$(XmakeTargetDir)/'))</XmakeTargetDir>
- <XmakeConfigDir>$([System.IO.Path]::GetFullPath('$(XmakeConfigDir)/'))</XmakeConfigDir>
- <XmakeConfigFileDir>$([System.IO.Path]::GetFullPath('$(XmakeConfigFileDir)/'))</XmakeConfigFileDir>
- <XmakeRunDir>$([System.IO.Path]::GetFullPath('$(XmakeRunDir)/'))</XmakeRunDir>
- </PropertyGroup>
+ <!-- normalize paths -->
+ <XmakeProgramDir>$([System.IO.Path]::GetFullPath('$(XmakeProgramDir)/'))</XmakeProgramDir>
+ <XmakeProjectDir>$([System.IO.Path]::GetFullPath('$(XmakeProjectDir)/'))</XmakeProjectDir>
+ <XmakeScriptDir>$([System.IO.Path]::GetFullPath('$(XmakeScriptDir)/'))</XmakeScriptDir>
+ <XmakeBuilDir>$([System.IO.Path]::GetFullPath('$(XmakeBuilDir)/'))</XmakeBuilDir>
+ <XmakeTargetDir>$([System.IO.Path]::GetFullPath('$(XmakeTargetDir)/'))</XmakeTargetDir>
+ <XmakeConfigDir>$([System.IO.Path]::GetFullPath('$(XmakeConfigDir)/'))</XmakeConfigDir>
+ <XmakeConfigFileDir>$([System.IO.Path]::GetFullPath('$(XmakeConfigFileDir)/'))</XmakeConfigFileDir>
+ <XmakeRunDir>$([System.IO.Path]::GetFullPath('$(XmakeRunDir)/'))</XmakeRunDir>
+ </PropertyGroup>
- <PropertyGroup Label="XmakeFlagsFallback">
- <XmakeWarning Condition="'$(XmakeWarning)' == ''">true</XmakeWarning>
- <XmakeVerbose Condition="'$(XmakeVerbose)' == ''">false</XmakeVerbose>
- <XmakeDiagnosis Condition="'$(XmakeDiagnosis)' == ''">false</XmakeDiagnosis>
- </PropertyGroup>
+ <PropertyGroup Label="XmakeFlagsFallback">
+ <XmakeWarning Condition="'$(XmakeWarning)' == ''">true</XmakeWarning>
+ <XmakeVerbose Condition="'$(XmakeVerbose)' == ''">false</XmakeVerbose>
+ <XmakeDiagnosis Condition="'$(XmakeDiagnosis)' == ''">false</XmakeDiagnosis>
+ </PropertyGroup>
- <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)' == ''">
- <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '14.0'">10.0.10240.0</WindowsTargetPlatformVersion>
- <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '15.0'">10.0.14393.0</WindowsTargetPlatformVersion>
- <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '16.0'">10.0.17763.0</WindowsTargetPlatformVersion>
- <WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">10.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <PropertyGroup Condition="'$(PlatformToolset)' == ''">
- <PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
- <PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
- <PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
- <PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
- <PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
- <PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
- </PropertyGroup>
+ <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)' == ''">
+ <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '14.0'">10.0.10240.0</WindowsTargetPlatformVersion>
+ <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '15.0'">10.0.14393.0</WindowsTargetPlatformVersion>
+ <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '16.0'">10.0.17763.0</WindowsTargetPlatformVersion>
+ <WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">10.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(PlatformToolset)' == ''">
+ <PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
+ </PropertyGroup>
- <PropertyGroup Label="AdditionalProps">
- <UseOfMfc Condition="'$(XmakeMfcKind)' != ''">$(XmakeMfcKind)</UseOfMfc>
- <CharacterSet Condition="'$(CharacterSet)' == '' And ($(XmakeDefines.Contains(';UNICODE;')) Or $(XmakeDefines.EndsWith(';UNICODE')) Or $(XmakeDefines.StartsWith('UNICODE;')) Or $(XmakeDefines.Equals('UNICODE')))">Unicode</CharacterSet>
- <CharacterSet Condition="'$(CharacterSet)' == ''">MultiByte</CharacterSet>
- </PropertyGroup>
+ <PropertyGroup Label="AdditionalProps">
+ <UseOfMfc Condition="'$(XmakeMfcKind)' != ''">$(XmakeMfcKind)</UseOfMfc>
+ <CharacterSet Condition="'$(CharacterSet)' == '' And ($(XmakeDefines.Contains(';UNICODE;')) Or $(XmakeDefines.EndsWith(';UNICODE')) Or $(XmakeDefines.StartsWith('UNICODE;')) Or $(XmakeDefines.Equals('UNICODE')))">Unicode</CharacterSet>
+ <CharacterSet Condition="'$(CharacterSet)' == ''">MultiByte</CharacterSet>
+ </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <Choose>
- <When Condition="'$(XmakeKind)' == 'binary'">
- <PropertyGroup>
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- </When>
- <When Condition="'$(XmakeKind)' == 'shared'">
- <PropertyGroup>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- </When>
- <When Condition="'$(XmakeKind)' == 'static'">
- <PropertyGroup>
- <ConfigurationType>StaticLibrary</ConfigurationType>
- </PropertyGroup>
- </When>
- </Choose>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <Choose>
+ <When Condition="'$(XmakeKind)' == 'binary'">
+ <PropertyGroup>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ </When>
+ <When Condition="'$(XmakeKind)' == 'shared'">
+ <PropertyGroup>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ </PropertyGroup>
+ </When>
+ <When Condition="'$(XmakeKind)' == 'static'">
+ <PropertyGroup>
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ </PropertyGroup>
+ </When>
+ </Choose>
- <ItemDefinitionGroup>
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);$(XmakeDefines)</PreprocessorDefinitions>
- <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx17'))">stdcpp17</LanguageStandard>
- <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx14'))">stdcpp14</LanguageStandard>
- <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx11'))">stdcpp11</LanguageStandard>
- </ClCompile>
- </ItemDefinitionGroup>
+ <ItemDefinitionGroup>
+ <ClCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);$(XmakeDefines)</PreprocessorDefinitions>
+ <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx17'))">stdcpp17</LanguageStandard>
+ <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx14'))">stdcpp14</LanguageStandard>
+ <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx11'))">stdcpp11</LanguageStandard>
+ </ClCompile>
+ </ItemDefinitionGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- <Import Condition="'$(XmakeCudaVersion)' != '' And Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props')"
- Project="$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props" />
- </ImportGroup>
+ <ImportGroup Label="ExtensionSettings">
+ <Import Condition="'$(XmakeCudaVersion)' != '' And Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props')"
+ Project="$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props" />
+ </ImportGroup>
- <ImportGroup Label="PropertySheets">
- <Import Condition="Exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
- Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
- </ImportGroup>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="Exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
+ </ImportGroup>
- <PropertyGroup Label="GlobalsFallback">
- <TargetName Condition="'$(XmakeFilename)' == ''">$(XmakeBasename)</TargetName>
- <TargetName Condition="'$(XmakeFilename)' != ''">$([System.IO.Path]::GetFileNameWithoutExtension('$(XmakeFilename)'))</TargetName>
- <TargetExt Condition="'$(XmakeFilename)' != ''">$([System.IO.Path]::GetExtension('$(XmakeFilename)'))</TargetExt>
- </PropertyGroup>
-
- <PropertyGroup Label="Path">
- <IncludePath>$(XmakeIncludeDir);$(IncludePath)</IncludePath>
- <LibraryPath>$(XmakeLinkDir);$(LibraryPath)</LibraryPath>
- <OutDir>$(XmakeTargetDir)</OutDir>
- <IntDir>$(XmakeBuilDir).vs\$(TargetName)\$(XmakeArch)\$(XmakeMode)\</IntDir>
- </PropertyGroup>
+ <PropertyGroup Label="GlobalsFallback">
+ <TargetName Condition="'$(XmakeFilename)' == ''">$(XmakeBasename)</TargetName>
+ <TargetName Condition="'$(XmakeFilename)' != ''">$([System.IO.Path]::GetFileNameWithoutExtension('$(XmakeFilename)'))</TargetName>
+ <TargetExt Condition="'$(XmakeFilename)' != ''">$([System.IO.Path]::GetExtension('$(XmakeFilename)'))</TargetExt>
+ </PropertyGroup>
+
+ <PropertyGroup Label="Path">
+ <IncludePath>$(XmakeIncludeDir);$(IncludePath)</IncludePath>
+ <LibraryPath>$(XmakeLinkDir);$(LibraryPath)</LibraryPath>
+ <OutDir>$(XmakeTargetDir)</OutDir>
+ <IntDir>$(XmakeBuilDir).vs\$(TargetName)\$(XmakeArch)\$(XmakeMode)\</IntDir>
+ </PropertyGroup>
+
+ <!-- Common files -->
+ <ItemGroup>
+ <None Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.props')"
+ Include="$(MSBuildProjectDirectory)\Xmake.Custom.props" />
+ <None Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.targets')"
+ Include="$(MSBuildProjectDirectory)\Xmake.Custom.targets" />
+ <None Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.items')"
+ Include="$(MSBuildProjectDirectory)\Xmake.Custom.items" />
+ <None Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.items.filters')"
+ Include="$(MSBuildProjectDirectory)\Xmake.Custom.items.filters" />
+ <None Condition="'$(XmakeScriptDir)' != '$(XmakeProjectDir)' And Exists('$(XmakeScriptDir)\xmake.lua')"
+ Include="$(XmakeScriptDir)\xmake.lua" />
+ </ItemGroup>
+
+ <Import Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.items')"
+ Project="$(MSBuildProjectDirectory)\Xmake.Custom.items" />
</Project>
diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets
index 05102ab40..55a698927 100644
--- a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets
+++ b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets
@@ -1,169 +1,205 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- <Import Condition="'$(XmakeCudaVersion)' != '' And Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets')"
- Project="$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets" />
- </ImportGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ <Import Condition="'$(XmakeCudaVersion)' != '' And Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets')"
+ Project="$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets" />
+ </ImportGroup>
- <PropertyGroup Label="XmakeInternal">
- <_XmakeProjectFlag Condition="'$(XmakeProjectFile)' != ''">-F "$(XmakeProjectFile)"</_XmakeProjectFlag>
- <_XmakeProjectFlag Condition="'$(XmakeProjectFile)' == ''">-P .</_XmakeProjectFlag>
-
- <_XmakeCommonFlags>$(XmakeCommonFlags.Trim())</_XmakeCommonFlags>
- <_XmakeCommonFlags Condition="$(XmakeVerbose)">$(_XmakeCommonFlags) -v</_XmakeCommonFlags>
- <_XmakeCommonFlags Condition="$(XmakeDiagnosis)">$(_XmakeCommonFlags) -D</_XmakeCommonFlags>
- <_XmakeCommonFlags>$(_XmakeCommonFlags) $(_XmakeProjectFlag)</_XmakeCommonFlags>
+ <PropertyGroup Label="XmakeInternal">
+ <_XmakeProjectFlag Condition="'$(XmakeProjectFile)' != ''">-F "$(XmakeProjectFile)"</_XmakeProjectFlag>
+ <_XmakeProjectFlag Condition="'$(XmakeProjectFile)' == ''">-P .</_XmakeProjectFlag>
+
+ <_XmakeCommonFlags>$(XmakeCommonFlags.Trim())</_XmakeCommonFlags>
+ <_XmakeCommonFlags Condition="$(XmakeVerbose)">-v $(_XmakeCommonFlags)</_XmakeCommonFlags>
+ <_XmakeCommonFlags Condition="$(XmakeDiagnosis)">-D $(_XmakeCommonFlags)</_XmakeCommonFlags>
+ <_XmakeCommonFlags>$(XmakeCommonFlags.Trim())</_XmakeCommonFlags>
+ <_XmakeCommonFlags>$(_XmakeCommonFlags) $(_XmakeProjectFlag)</_XmakeCommonFlags>
- <_XmakeBuilDir>$([MSBuild]::MakeRelative('$(XmakeProjectDir)', '$(XmakeBuilDir)').TrimEnd('/\'.ToCharArray()))</_XmakeBuilDir>
+ <_XmakeBuilDir>$([MSBuild]::MakeRelative('$(XmakeProjectDir)', '$(XmakeBuilDir)').TrimEnd('/\'.ToCharArray()))</_XmakeBuilDir>
- <_XmakeConfigFlags>$(XmakeConfigFlags.Trim())</_XmakeConfigFlags>
- <_XmakeConfigFlags>-p $(XmakePlat) -m $(XmakeMode) -a $(XmakeArch) -o "$(_XmakeBuilDir)" $(_XmakeConfigFlags)</_XmakeConfigFlags>
+ <_XmakeConfigFlags>$(XmakeConfigFlags.Trim())</_XmakeConfigFlags>
+ <_XmakeConfigFlags>-p $(XmakePlat) -m $(XmakeMode) -a $(XmakeArch) -o "$(_XmakeBuilDir)" $(_XmakeConfigFlags)</_XmakeConfigFlags>
- <_XmakeBuildFlags>$(XmakeBuildFlags.Trim())</_XmakeBuildFlags>
- <_XmakeBuildFlags Condition="$(XmakeWarning)">$(_XmakeBuildFlags) -w</_XmakeBuildFlags>
-
- <_XmakeCleanFlags>$(XmakeCleanFlags.Trim())</_XmakeCleanFlags>
+ <_XmakeBuildFlags>$(XmakeBuildFlags.Trim())</_XmakeBuildFlags>
+ <_XmakeBuildFlags Condition="$(XmakeWarning)">-w $(_XmakeBuildFlags)</_XmakeBuildFlags>
+
+ <_XmakeCleanFlags>$(XmakeCleanFlags.Trim())</_XmakeCleanFlags>
- <_XmakeBuildFlags>$(_XmakeBuildFlags.Trim())</_XmakeBuildFlags>
- <_XmakeCleanFlags>$(_XmakeCleanFlags.Trim())</_XmakeCleanFlags>
- <_XmakeConfigFlags>$(_XmakeConfigFlags.Trim())</_XmakeConfigFlags>
- <_XmakeCommonFlags>$(_XmakeCommonFlags.Trim())</_XmakeCommonFlags>
+ <_XmakeBuildFlags>$(_XmakeBuildFlags.Trim())</_XmakeBuildFlags>
+ <_XmakeCleanFlags>$(_XmakeCleanFlags.Trim())</_XmakeCleanFlags>
+ <_XmakeConfigFlags>$(_XmakeConfigFlags.Trim())</_XmakeConfigFlags>
+ <_XmakeCommonFlags>$(_XmakeCommonFlags.Trim())</_XmakeCommonFlags>
- <_XmakeExecutable>"$([System.IO.Path]::GetFullPath('$(XmakeProgramDir)xmake.exe'))"</_XmakeExecutable>
- <_XmakeEnv>
- pushd "$(XmakeProjectDir)"
- set XMAKE_CONFIGDIR=$(XmakeConfigDir)
- set XMAKE_PROGRAM_DIR=$(XmakeProgramDir)
- </_XmakeEnv>
- </PropertyGroup>
+ <_XmakeExecutable>"$([System.IO.Path]::GetFullPath('$(XmakeProgramDir)xmake.exe'))"</_XmakeExecutable>
+ <_XmakeEnv>
+ chcp 65001 &gt; NUL
+ set XMAKE_CONFIGDIR=$(XmakeConfigDir.TrimEnd('/\'.ToCharArray()))
+ set XMAKE_PROGRAM_DIR=$(XmakeProgramDir.TrimEnd('/\'.ToCharArray()))
+ </_XmakeEnv>
+ </PropertyGroup>
- <Target Name="_XmakeProjCheck">
- <Warning Condition="'$(XmakeCudaVersion)' != '' And !Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets')"
- Text="File '$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets' not found" />
- <Warning Condition="'$(XmakeCudaVersion)' != '' And !Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props')"
- Text="File '$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props' not found" />
- <Error Condition="!Exists('$(XmakeProgramDir)\xmake.exe')"
- Text="xmake.exe not found at '$(XmakeProgramDir)', please set XMAKE_PROGRAM_DIR in environments or XmakeProgramDir in vcxproj file" />
- <Error Condition="'$(XmakeProjectFile)' == '' And !Exists('$(XmakeProjectDir)\xmake.lua')"
- Text="xmake.lua not found at '$(XmakeProjectDir)', please set XmakeProjectDir in vcxproj file" />
- <Error Condition="'$(XmakeProjectFile)' != '' And !Exists('$(XmakeProjectDir)\$(XmakeProjectFile)')"
- Text="$(XmakeProjectFile) not found at '$(XmakeProjectDir)', please set XmakeProjectDir in vcxproj file" />
- </Target>
- <Target Name="_XmakeConfig" DependsOnTargets="_XmakeProjCheck">
- <Message Text="$xmake config $(_XmakeCommonFlags) $(_XmakeConfigFlags) $(XmakeTarget)" Importance="High" />
- <Exec Command="$(_XmakeEnv)
-$(_XmakeExecutable) config $(_XmakeCommonFlags) $(_XmakeConfigFlags) $(XmakeTarget)" EchoOff="true"/>
- </Target>
- <Target Name="_XmakeReconfig" DependsOnTargets="_XmakeProjCheck">
- <Message Text="$xmake config $(_XmakeCommonFlags) -c $(_XmakeConfigFlags) $(XmakeTarget)" Importance="High" />
- <Exec Command="$(_XmakeEnv)
-$(_XmakeExecutable) config $(_XmakeCommonFlags) -c $(_XmakeConfigFlags) $(XmakeTarget)" EchoOff="true"/>
- </Target>
- <Target Name="_XmakeBuild" DependsOnTargets="_XmakeProjCheck">
- <Message Text="$xmake build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(XmakeTarget)" Importance="High" />
- <Exec Command="$(_XmakeEnv)
-$(_XmakeExecutable) build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(XmakeTarget)" EchoOff="true"/>
- </Target>
- <Target Name="_XmakeClean" DependsOnTargets="_XmakeProjCheck">
- <Message Text="$xmake clean $(_XmakeCommonFlags) -a $(_XmakeCleanFlags) $(XmakeTarget)" Importance="High" />
- <Exec Command="$(_XmakeEnv)
-$(_XmakeExecutable) clean $(_XmakeCommonFlags) -a $(_XmakeCleanFlags) $(XmakeTarget)" EchoOff="true"/>
- </Target>
+ <Target Name="_XmakeProjCheck">
+ <Warning Condition="'$(XmakeCudaVersion)' != '' And !Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets')"
+ Text="File '$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets' not found" />
+ <Warning Condition="'$(XmakeCudaVersion)' != '' And !Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props')"
+ Text="File '$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props' not found" />
+ <Error Condition="!Exists('$(XmakeProgramDir)\xmake.exe')"
+ Text="xmake.exe not found at '$(XmakeProgramDir)', please set XMAKE_PROGRAM_DIR in environments or XmakeProgramDir in vcxproj file" />
+ <Error Condition="'$(XmakeProjectFile)' == '' And !Exists('$(XmakeProjectDir)\xmake.lua')"
+ Text="xmake.lua not found at '$(XmakeProjectDir)', please set XmakeProjectDir in vcxproj file" />
+ <Error Condition="'$(XmakeProjectFile)' != '' And !Exists('$(XmakeProjectDir)\$(XmakeProjectFile)')"
+ Text="$(XmakeProjectFile) not found at '$(XmakeProjectDir)', please set XmakeProjectDir in vcxproj file" />
+ </Target>
+ <Target Name="_XmakeConfig" DependsOnTargets="_XmakeProjCheck">
+ <Message Text="$xmake config $(_XmakeCommonFlags) $(_XmakeConfigFlags) $(XmakeTarget)" Importance="High" />
+ <Exec WorkingDirectory="$(XmakeProjectDir)" StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="$(_XmakeEnv)
+ $(_XmakeExecutable) config $(_XmakeCommonFlags) $(_XmakeConfigFlags) $(XmakeTarget)" EchoOff="true" />
+ </Target>
+ <Target Name="_XmakeReconfig" DependsOnTargets="_XmakeProjCheck">
+ <Message Text="$xmake config $(_XmakeCommonFlags) -c $(_XmakeConfigFlags) $(XmakeTarget)" Importance="High" />
+ <Exec WorkingDirectory="$(XmakeProjectDir)" StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="$(_XmakeEnv)
+ $(_XmakeExecutable) config $(_XmakeCommonFlags) -c $(_XmakeConfigFlags) $(XmakeTarget)" EchoOff="true" />
+ </Target>
+ <Target Name="_XmakeBuild" DependsOnTargets="_XmakeProjCheck">
+ <Message Text="$xmake build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(XmakeTarget)" Importance="High" />
+ <Exec WorkingDirectory="$(XmakeProjectDir)" StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="$(_XmakeEnv)
+ $(_XmakeExecutable) build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(XmakeTarget)" EchoOff="true" />
+ </Target>
+ <Target Name="_XmakeBuildFile" DependsOnTargets="_XmakeProjCheck">
+ <ItemGroup>
+ <SelectedFile Include="$(SelectedFiles)" />
+ <File Include="$([MSBuild]::MakeRelative('$(XmakeProjectDir)', $([System.IO.Path]::GetFullPath('%(SelectedFile.Identity)'))))" />
+ </ItemGroup>
+ <PropertyGroup>
+ <FileList>@(File)</FileList>
+ <FileFlag>--files="$(FileList)"</FileFlag>
+ </PropertyGroup>
+ <Message Text="$xmake build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(FileFlag) $(XmakeTarget)" Importance="High" />
+ <Exec WorkingDirectory="$(XmakeProjectDir)" StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="$(_XmakeEnv)
+ $(_XmakeExecutable) build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(FileFlag) $(XmakeTarget)" EchoOff="true" />
+ </Target>
+ <Target Name="_XmakeClean" DependsOnTargets="_XmakeProjCheck">
+ <Message Text="$xmake clean $(_XmakeCommonFlags) -a $(_XmakeCleanFlags) $(XmakeTarget)" Importance="High" />
+ <Exec WorkingDirectory="$(XmakeProjectDir)" StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="$(_XmakeEnv)
+ $(_XmakeExecutable) clean $(_XmakeCommonFlags) -a $(_XmakeCleanFlags) $(XmakeTarget)" EchoOff="true" />
+ </Target>
- <Target Name="Show">
- <Message Text="
+ <Target Name="Show">
+ <Message Text="
MSBuild Properties:
- Xmake Props:
- XmakeTarget: $(XmakeTarget)
- 'XmakePlat|Mode|Arch': '$(XmakePlat)|$(XmakeMode)|$(XmakeArch)'
- XmakeBasename: $(XmakeBasename)
- XmakeFilename: $(XmakeFilename)
- XmakeKind: $(XmakeKind)
- XmakeCudaVersion: $(XmakeCudaVersion)
- XmakeMfcKind: $(XmakeMfcKind)
- XmakeDefines: $(XmakeDefines)
- XmakeLanguages: $(XmakeLanguages)
- Xmake Path:
- XmakeProgramDir: $(XmakeProgramDir)
- XmakeProjectDir: $(XmakeProjectDir)
- XmakeScriptDir: $(XmakeScriptDir)
- XmakeBuilDir: $(XmakeBuilDir)
- XmakeConfigDir: $(XmakeConfigDir)
- XmakeConfigFileDir: $(XmakeConfigFileDir)
- XmakeIncludeDir: $(XmakeIncludeDir)
- XmakeLinkDir: $(XmakeLinkDir)
- Xmake Flags:
- XmakeWarning: $(XmakeWarning)
- XmakeVerbose: $(XmakeVerbose)
- XmakeDiagnosis: $(XmakeDiagnosis)
- XmakeCommonFlags: $(XmakeCommonFlags)
- XmakeConfigFlags: $(XmakeConfigFlags)
- XmakeBuildFlags: $(XmakeBuildFlags)
- XmakeCleanFlags: $(XmakeCleanFlags)
- Xmake Internal:
- _XmakeCommonFlags: $(_XmakeCommonFlags)
- _XmakeConfigFlags: $(_XmakeConfigFlags)
- _XmakeBuildFlags: $(_XmakeBuildFlags)
- _XmakeCleanFlags: $(_XmakeCleanFlags)
- _XmakeExecutable: $(_XmakeExecutable)
- _XmakeEnv: $(_XmakeEnv)
- Vs Props:
- 'Configuration|Platform': '$(Configuration)|$(Platform)'
- VisualStudioVersion: $(VisualStudioVersion)
- MSBuildProjectDirectory: $(MSBuildProjectDirectory)
- MSBuildProjectName: $(MSBuildProjectName)
- OutDir: $(OutDir)
- IntDir: $(IntDir)
- TargetName: $(TargetName)
- TargetExt: $(TargetExt)
- PlatformToolset: $(PlatformToolset)
- CharacterSet: $(CharacterSet)
- UseOfMfc: $(UseOfMfc)
- WindowsTargetPlatformVersion: $(WindowsTargetPlatformVersion)
- PreprocessorDefinitions: %(ClCompile.PreprocessorDefinitions)
- LanguageStandard: %(ClCompile.LanguageStandard)
- " Importance="High" />
- </Target>
+ Xmake Props:
+ XmakeTarget: $(XmakeTarget)
+ 'XmakePlat|Mode|Arch': '$(XmakePlat)|$(XmakeMode)|$(XmakeArch)'
+ XmakeBasename: $(XmakeBasename)
+ XmakeFilename: $(XmakeFilename)
+ XmakeKind: $(XmakeKind)
+ XmakeCudaVersion: $(XmakeCudaVersion)
+ XmakeMfcKind: $(XmakeMfcKind)
+ XmakeDefines: $(XmakeDefines)
+ XmakeLanguages: $(XmakeLanguages)
+ Xmake Path:
+ XmakeProgramDir: $(XmakeProgramDir)
+ XmakeProjectDir: $(XmakeProjectDir)
+ XmakeScriptDir: $(XmakeScriptDir)
+ XmakeBuilDir: $(XmakeBuilDir)
+ XmakeConfigDir: $(XmakeConfigDir)
+ XmakeConfigFileDir: $(XmakeConfigFileDir)
+ XmakeIncludeDir: $(XmakeIncludeDir)
+ XmakeLinkDir: $(XmakeLinkDir)
+ Xmake Flags:
+ XmakeWarning: $(XmakeWarning)
+ XmakeVerbose: $(XmakeVerbose)
+ XmakeDiagnosis: $(XmakeDiagnosis)
+ XmakeCommonFlags: $(XmakeCommonFlags)
+ XmakeConfigFlags: $(XmakeConfigFlags)
+ XmakeBuildFlags: $(XmakeBuildFlags)
+ XmakeCleanFlags: $(XmakeCleanFlags)
+ Xmake Internal:
+ _XmakeCommonFlags: $(_XmakeCommonFlags)
+ _XmakeConfigFlags: $(_XmakeConfigFlags)
+ _XmakeBuildFlags: $(_XmakeBuildFlags)
+ _XmakeCleanFlags: $(_XmakeCleanFlags)
+ _XmakeExecutable: $(_XmakeExecutable)
+ _XmakeEnv: $(_XmakeEnv)
+ Vs Props:
+ 'Configuration|Platform': '$(Configuration)|$(Platform)'
+ VisualStudioVersion: $(VisualStudioVersion)
+ MSBuildProjectDirectory: $(MSBuildProjectDirectory)
+ MSBuildProjectName: $(MSBuildProjectName)
+ OutDir: $(OutDir)
+ IntDir: $(IntDir)
+ TargetName: $(TargetName)
+ TargetExt: $(TargetExt)
+ PlatformToolset: $(PlatformToolset)
+ CharacterSet: $(CharacterSet)
+ UseOfMfc: $(UseOfMfc)
+ WindowsTargetPlatformVersion: $(WindowsTargetPlatformVersion)
+ PreprocessorDefinitions: %(ClCompile.PreprocessorDefinitions)
+ LanguageStandard: %(ClCompile.LanguageStandard)
+ SelectedFiles: $(SelectedFiles)
+ VCTargetsPath: $(VCTargetsPath)
+ " Importance="High" />
+ </Target>
+
+ <Target Name="BeforeBuild" />
+ <Target Name="AfterBuild" />
+ <Target Name="Build" Condition="'$(DesignTimeBuild)' != 'true'">
+ <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" />
+ <CallTarget Targets="BeforeBuild" />
+ <CallTarget Targets="_XmakeConfig;_XmakeBuild" />
+ <CallTarget Targets="AfterBuild" />
+ </Target>
+
+ <Target Name="BeforeClean" />
+ <Target Name="AfterClean" />
+ <Target Name="Clean" Condition="'$(DesignTimeBuild)' != 'true'">
+ <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" />
+ <CallTarget Targets="BeforeClean" />
+ <CallTarget Targets="_XmakeClean;_XmakeReconfig" />
+ <CallTarget Targets="AfterClean" />
+ </Target>
- <Target Name="BeforeBuild" />
- <Target Name="AfterBuild" />
- <Target Name="Build" Condition="'$(DesignTimeBuild)' != 'true'">
- <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" />
- <CallTarget Targets="BeforeBuild" />
- <CallTarget Targets="_XmakeConfig;_XmakeBuild" />
- <CallTarget Targets="AfterBuild" />
- </Target>
+ <Target Name="BeforeRebuild" />
+ <Target Name="AfterRebuild" />
+ <Target Name="Rebuild" Condition="'$(DesignTimeBuild)' != 'true'">
+ <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" />
+ <CallTarget Targets="BeforeRebuild" />
+ <CallTarget Targets="BeforeClean" />
+ <CallTarget Targets="_XmakeClean;_XmakeReconfig" />
+ <CallTarget Targets="AfterClean" />
+ <CallTarget Targets="BeforeBuild" />
+ <CallTarget Targets="_XmakeBuild" />
+ <CallTarget Targets="AfterBuild" />
+ <CallTarget Targets="AfterRebuild" />
+ </Target>
- <Target Name="BeforeClean" />
- <Target Name="AfterClean" />
- <Target Name="Clean" Condition="'$(DesignTimeBuild)' != 'true'">
- <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" />
- <CallTarget Targets="BeforeClean" />
- <CallTarget Targets="_XmakeClean;_XmakeReconfig" />
- <CallTarget Targets="AfterClean" />
- </Target>
- <Target Name="BeforeRebuild" />
- <Target Name="AfterRebuild" />
- <Target Name="Rebuild" Condition="'$(DesignTimeBuild)' != 'true'">
- <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" />
- <CallTarget Targets="BeforeRebuild" />
- <CallTarget Targets="BeforeClean" />
- <CallTarget Targets="_XmakeClean;_XmakeReconfig" />
- <CallTarget Targets="AfterClean" />
- <CallTarget Targets="BeforeBuild" />
- <CallTarget Targets="_XmakeBuild" />
- <CallTarget Targets="AfterBuild" />
- <CallTarget Targets="AfterRebuild" />
- </Target>
+ <Target Name="BeforeBuildFiles" />
+ <Target Name="AfterBuildFiles" />
+ <Target Name="BuildFiles" Condition="'$(DesignTimeBuild)' != 'true'">
+ <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" />
+ <CallTarget Targets="BeforeBuildFiles" />
+ <CallTarget Targets="_XmakeConfig;_XmakeBuildFile" />
+ <CallTarget Targets="AfterBuildFiles" />
+ </Target>
+ <!-- override default compile commands -->
+ <Target Name="ClCompile" Condition="'$(DesignTimeBuild)' != 'true'">
+ <CallTarget Targets="BuildFiles" />
+ </Target>
+ <Target Name="ResourceCompile" Condition="'$(DesignTimeBuild)' != 'true'">
+ <CallTarget Targets="BuildFiles" />
+ </Target>
+ <Target Name="CudaBuild" Condition="'$(DesignTimeBuild)' != 'true'">
+ <CallTarget Targets="BuildFiles" />
+ </Target>
- <ImportGroup Label="CustomTargets">
- <!--only search 2 levels to avoid accidentally import-->
- <Import Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.targets')"
- Project="$(MSBuildProjectDirectory)\Xmake.Custom.targets" />
- <Import Condition="!Exists('$(MSBuildProjectDirectory)\Xmake.Custom.targets') And Exists('$(MSBuildProjectDirectory)\..\Xmake.Custom.targets')"
- Project="$(MSBuildProjectDirectory)\..\Xmake.Custom.targets" />
- </ImportGroup>
+ <ImportGroup Label="CustomTargets">
+ <!--only search 2 levels to avoid accidentally import-->
+ <Import Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.targets')"
+ Project="$(MSBuildProjectDirectory)\Xmake.Custom.targets" />
+ <Import Condition="!Exists('$(MSBuildProjectDirectory)\Xmake.Custom.targets') And Exists('$(MSBuildProjectDirectory)\..\Xmake.Custom.targets')"
+ Project="$(MSBuildProjectDirectory)\..\Xmake.Custom.targets" />
+ </ImportGroup>
</Project>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/#target#.vcxproj.user b/xmake/plugins/project/vsxmake/vsproj/templates/#target#.vcxproj.user
index 399b00e30..a994443e1 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/#target#.vcxproj.user
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/#target#.vcxproj.user
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <LocalDebuggerCommandArguments></LocalDebuggerCommandArguments>
- <LocalDebuggerWorkingDirectory>$(XmakeRunDir)</LocalDebuggerWorkingDirectory>
- <LocalDebuggerEnvironment>$(XmakeRunEnvs)
+ <PropertyGroup>
+ <LocalDebuggerCommandArguments></LocalDebuggerCommandArguments>
+ <LocalDebuggerWorkingDirectory>$(XmakeRunDir)</LocalDebuggerWorkingDirectory>
+ <LocalDebuggerEnvironment>$(XmakeRunEnvs)
$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
- <LocalDebuggerMergeEnvironment>true</LocalDebuggerMergeEnvironment>
- </PropertyGroup>
+ <LocalDebuggerMergeEnvironment>true</LocalDebuggerMergeEnvironment>
+ </PropertyGroup>
</Project> \ No newline at end of file
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.items b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.items
new file mode 100644
index 000000000..a894e8d0d
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.items
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <!--
+ Use this file to include custom files for visual studio projects.
+
+ This file will be imported by .vcxproj
+ -->
+ <ItemGroup>
+ <!-- <None Include="$(XmakeProjectDir)\xxx\yyy\zzz" /> -->
+ </ItemGroup>
+</Project>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.items.filters b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.items.filters
new file mode 100644
index 000000000..f69e1abb7
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.items.filters
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <!--
+ Use this file to include custom files for visual studio projects.
+
+ This file will be imported by .vcxproj.filters
+ -->
+ <ItemGroup>
+ <!-- <None Include="$(XmakeProjectDir)\xxx\yyy\zzz">
+ <Filter>xxx\yyy</Filter>
+ </None> -->
+ </ItemGroup>
+</Project>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.props b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.props
index 6f47fe7a0..55f596456 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.props
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.props
@@ -1,35 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <!-- inherit parent settings -->
- <Import Condition="Exists('$(MSBuildThisFileDirectory)\..\Xmake.Custom.props')"
- Project="$(MSBuildThisFileDirectory)\..\Xmake.Custom.props" />
-
- <PropertyGroup Label="XmakePaths">
- <!-- set environment XMAKE_CONFIGDIR for xmake tasks -->
- <!--
- <XmakeConfigDir Condition="'$(XmakeMode)|$(XmakeArch)' == 'release|x86'">$(XmakeProjectDir)\.xmake</XmakeConfigDir>
- <XmakeBuilDir>$(XmakeProjectDir)\build</XmakeBuilDir>
- -->
- </PropertyGroup>
+ <!-- inherit parent settings -->
+ <Import Condition="Exists('$(MSBuildThisFileDirectory)\..\Xmake.Custom.props')"
+ Project="$(MSBuildThisFileDirectory)\..\Xmake.Custom.props" />
+
+ <PropertyGroup Label="XmakePaths">
+ <!-- set environment XMAKE_CONFIGDIR for xmake tasks -->
+ <!-- <XmakeConfigDir Condition="'$(XmakeMode)|$(XmakeArch)' == 'release|x86'">$(XmakeProjectDir)\.xmake</XmakeConfigDir> -->
- <PropertyGroup Label="XmakeFlags">
- <!-- Configure these flags to customize xmake build process -->
- <!--
- Inherit parents:
- <XmakeCleanFlags>$(XmakeCleanflags) -D</XmakeCleanFlags>
- Override parents:
- <XmakeCleanFlags>-D</XmakeCleanFlags>
- Respect parents:
- <XmakeCleanFlags Condition=" '$(XmakeCleanFlags)' == '' ">-D</XmakeCleanFlags>
+ <!-- set output dir for xmake tasks -->
+ <!-- <XmakeBuilDir>$(XmakeProjectDir)\build</XmakeBuilDir> -->
+ </PropertyGroup>
- For -w, -v and -D, use <XmakeWarning>, <XmakeVerbose> and <XmakeDiagnosis> is more convenient.
- -->
- <XmakeWarning Condition="'$(XmakeWarning)' == ''">true</XmakeWarning>
- <XmakeVerbose Condition="'$(XmakeVerbose)' == ''">false</XmakeVerbose>
- <XmakeDiagnosis Condition="'$(XmakeDiagnosis)' == ''">false</XmakeDiagnosis>
- <XmakeCleanFlags>$(XmakeCleanflags)</XmakeCleanFlags>
- <XmakeBuildFlags>$(XmakeBuildFlags)</XmakeBuildFlags>
- <XmakeConfigFlags>$(XmakeConfigFlags)</XmakeConfigFlags>
- <XmakeCommonFlags>$(XmakeCommonFlags)</XmakeCommonFlags>
- </PropertyGroup>
+ <PropertyGroup Label="XmakeFlags">
+ <!-- Configure these flags to customize xmake build process -->
+ <!--
+ Inherit parents:
+ <XmakeCleanFlags>$(XmakeCleanflags) -D</XmakeCleanFlags>
+ Override parents:
+ <XmakeCleanFlags>-D</XmakeCleanFlags>
+ Respect parents:
+ <XmakeCleanFlags Condition=" '$(XmakeCleanFlags)' == '' ">-D</XmakeCleanFlags>
+
+ For -w, -v and -D, use <XmakeWarning>, <XmakeVerbose> and <XmakeDiagnosis> is more convenient.
+ -->
+
+ <!-- Set -w for "xmake build" -->
+ <!-- <XmakeWarning Condition="'$(XmakeWarning)' == ''">true</XmakeWarning> -->
+
+ <!-- Set -v for all xmake call -->
+ <!-- <XmakeVerbose Condition="'$(XmakeVerbose)' == ''">false</XmakeVerbose> -->
+
+ <!-- Set -D for all xmake call -->
+ <!-- <XmakeDiagnosis Condition="'$(XmakeDiagnosis)' == ''">false</XmakeDiagnosis> -->
+
+
+ <!-- Additional flags for "xmake clean" -->
+ <XmakeCleanFlags>$(XmakeCleanflags)</XmakeCleanFlags>
+
+ <!-- Additional flags for "xmake build" -->
+ <XmakeBuildFlags>$(XmakeBuildFlags)</XmakeBuildFlags>
+
+ <!-- Additional flags for "xmake config" -->
+ <XmakeConfigFlags>$(XmakeConfigFlags)</XmakeConfigFlags>
+
+ <!-- Additional flags for all xmake call -->
+ <XmakeCommonFlags>$(XmakeCommonFlags)</XmakeCommonFlags>
+ </PropertyGroup>
</Project>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.targets b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.targets
index c63cbed32..8a5153db8 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.targets
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.targets
@@ -1,27 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <!-- inherit parent settings -->
- <Import Condition="Exists('$(MSBuildThisFileDirectory)\..\Xmake.Custom.targets')"
- Project="$(MSBuildThisFileDirectory)\..\Xmake.Custom.targets" />
+ <!-- inherit parent settings -->
+ <Import Condition="Exists('$(MSBuildThisFileDirectory)\..\Xmake.Custom.targets')"
+ Project="$(MSBuildThisFileDirectory)\..\Xmake.Custom.targets" />
- <!-- Override these targets to customize your build workflow -->
- <!--
- If you uncomment targets below,
- targets with same name that comes from ../Xmake.Custom.targets will be overrided.
+ <!-- Override these targets to customize your build workflow -->
+ <!--
+ If you uncomment targets below,
+ targets with same name that comes from ../Xmake.Custom.targets will be overrided.
- You can also define your own targets and call them like:
- <Target Name="BeforeBuild">
- <CallTarget Targets="CustomStep1;CustomStep2" />
- </Target>
-
- To find task that you can used in custom targets,
- see: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-task-reference
- -->
+ You can also define your own targets and call them like:
+ <Target Name="BeforeBuild">
+ <CallTarget Targets="CustomStep1;CustomStep2" />
+ </Target>
+
+ To find task that you can used in custom targets,
+ see: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-task-reference
+ -->
- <!-- <Target Name="BeforeRebuild"></Target> -->
- <!-- <Target Name="AfterRebuild"></Target> -->
- <!-- <Target Name="BeforeBuild"></Target> -->
- <!-- <Target Name="AfterBuild"></Target> -->
- <!-- <Target Name="BeforeClean"></Target> -->
- <!-- <Target Name="AfterClean"></Target> -->
+ <!-- <Target Name="BeforeRebuild"></Target> -->
+ <!-- <Target Name="AfterRebuild"></Target> -->
+ <!-- <Target Name="BeforeBuild"></Target> -->
+ <!-- <Target Name="AfterBuild"></Target> -->
+ <!-- <Target Name="BeforeClean"></Target> -->
+ <!-- <Target Name="AfterClean"></Target> -->
+ <!-- <Target Name="BeforeBuildFiles"></Target> -->
+ <!-- <Target Name="AfterBuildFiles"></Target> -->
</Project>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters
index c79ec740a..ce686b448 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters
@@ -2,45 +2,53 @@
<!--
#xmake_info#
- This file is auto generated by xmake.
+ This file is auto generated by xmake.
- Please DO NOT EDIT since all your modification will lost after re-generation.
- See https://github.com/xmake-io/xmake/pull/472 for more infomation.
+ Please DO NOT EDIT since all your modification will lost after re-generation.
+ See https://github.com/xmake-io/xmake/pull/472 for more infomation.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Properties">
- <UniqueIdentifier>{CC7C6180-942D-056E-3227-E6A2B3FB19CD}</UniqueIdentifier>
- </Filter>
+ <ItemGroup>
+ <Filter Include="Properties">
+ <UniqueIdentifier>{CC7C6180-942D-056E-3227-E6A2B3FB19CD}</UniqueIdentifier>
+ </Filter>
#Import(Filter)#
- </ItemGroup>
- <ItemGroup>
- <None Include="Xmake.Custom.props">
- <Filter>Properties</Filter>
- </None>
- <None Include="Xmake.Custom.targets">
- <Filter>Properties</Filter>
- </None>
- <None Include="$(XmakeScriptDir)\xmake.lua">
- <Filter>Properties</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="$(MSBuildProjectDirectory)\Xmake.Custom.props">
+ <Filter>Properties</Filter>
+ </None>
+ <None Include="$(MSBuildProjectDirectory)\Xmake.Custom.targets">
+ <Filter>Properties</Filter>
+ </None>
+ <None Include="$(MSBuildProjectDirectory)\Xmake.Custom.items">
+ <Filter>Properties</Filter>
+ </None>
+ <None Include="$(MSBuildProjectDirectory)\Xmake.Custom.items.filters">
+ <Filter>Properties</Filter>
+ </None>
+ <None Include="$(XmakeScriptDir)\xmake.lua">
+ <Filter>Properties</Filter>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
#Import(Include)#
- </ItemGroup>
- <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
#Import(File.c)#
- </ItemGroup>
- <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
#Import(File.cxx)#
- </ItemGroup>
- <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
#Import(File.cu)#
- </ItemGroup>
- <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
#Import(File.obj)#
- </ItemGroup>
- <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
#Import(File.rc)#
- </ItemGroup>
+ </ItemGroup>
+ <Import Condition="Exists('$(MSBuildThisFileDirectory)\Xmake.Custom.files.filters')"
+ Project="$(MSBuildThisFileDirectory)\Xmake.Custom.files.filters" />
</Project>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec)
index d33f87944..020488ce4 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec)
@@ -1,3 +1,3 @@
- <ClCompile Include="#path#">
- <Filter>#dir#</Filter>
- </ClCompile>
+ <ClCompile Include="$(XmakeProjectDir)#path#">
+ <Filter>#dir#</Filter>
+ </ClCompile>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cu(filecu) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cu(filecu)
index 643bb220f..520e88430 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cu(filecu)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cu(filecu)
@@ -1,3 +1,3 @@
- <CudaCompile Include="#path#">
- <Filter>#dir#</Filter>
- </CudaCompile>
+ <CudaCompile Include="$(XmakeProjectDir)#path#">
+ <Filter>#dir#</Filter>
+ </CudaCompile>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cxx(filecxx) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cxx(filecxx)
index d33f87944..020488ce4 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cxx(filecxx)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cxx(filecxx)
@@ -1,3 +1,3 @@
- <ClCompile Include="#path#">
- <Filter>#dir#</Filter>
- </ClCompile>
+ <ClCompile Include="$(XmakeProjectDir)#path#">
+ <Filter>#dir#</Filter>
+ </ClCompile>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.obj(fileobj) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.obj(fileobj)
index adacd3b67..5ee8281b7 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.obj(fileobj)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.obj(fileobj)
@@ -1,3 +1,3 @@
- <Object Include="#path#">
- <Filter>#dir#</Filter>
- </Object>
+ <Object Include="$(XmakeProjectDir)#path#">
+ <Filter>#dir#</Filter>
+ </Object>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.rc(filerc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.rc(filerc)
index a46047781..c1118ab55 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.rc(filerc)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.rc(filerc)
@@ -1,3 +1,3 @@
- <ResourceCompile Include="#path#">
- <Filter>#dir#</Filter>
- </ResourceCompile>
+ <ResourceCompile Include="$(XmakeProjectDir)#path#">
+ <Filter>#dir#</Filter>
+ </ResourceCompile>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Filter(dir) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Filter(dir)
index 6f97fa98d..763e5e83c 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Filter(dir)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Filter(dir)
@@ -1,3 +1,3 @@
- <Filter Include="#dir#">
- <UniqueIdentifier>{#dir_id#}</UniqueIdentifier>
- </Filter>
+ <Filter Include="#dir#">
+ <UniqueIdentifier>{#dir_id#}</UniqueIdentifier>
+ </Filter>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc)
index 17344346b..3a21dc7bf 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc)
@@ -1,3 +1,3 @@
- <ClInclude Include="#path#">
- <Filter>#dir#</Filter>
- </ClInclude>
+ <ClInclude Include="$(XmakeProjectDir)#path#">
+ <Filter>#dir#</Filter>
+ </ClInclude>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj
index d0e4e94d7..8df23001e 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj
@@ -2,58 +2,52 @@
<!--
#xmake_info#
- This file is auto generated by xmake.
+ This file is auto generated by xmake.
- Please DO NOT EDIT since all your modification will lost after re-generation.
- If you would like to have any customization,
- edit Xmake.Custom.props and Xmake.Custom.targets instead.
+ Please DO NOT EDIT since all your modification will lost after re-generation.
+ If you would like to have any customization,
+ edit Xmake.Custom.props and Xmake.Custom.targets instead.
- See https://github.com/xmake-io/xmake/pull/472 for more infomation.
+ See https://github.com/xmake-io/xmake/pull/472 for more infomation.
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
+ <ItemGroup Label="ProjectConfigurations">
#Import(ProjectConfiguration)#
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{#target_id#}</ProjectGuid>
- <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">$(XMAKE_PROGRAM_DIR)</XmakeProgramDir>
- <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">#programdir#</XmakeProgramDir>
- <Configuration Condition="'$(Configuration)' == ''">release</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <XmakeScriptDir>#scriptdir#</XmakeScriptDir>
- <XmakeProjectDir>#projectdir#</XmakeProjectDir>
- <XmakeProjectFile>#projectfile#</XmakeProjectFile>
- <XmakeTarget>#target#</XmakeTarget>
- </PropertyGroup>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{#target_id#}</ProjectGuid>
+ <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">$(XMAKE_PROGRAM_DIR)</XmakeProgramDir>
+ <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">#programdir#</XmakeProgramDir>
+ <Configuration Condition="'$(Configuration)' == ''">release</Configuration>
+ <Platform Condition="'$(Platform)' == ''">Win32</Platform>
+ <XmakeScriptDir>#scriptdir#</XmakeScriptDir>
+ <XmakeProjectDir>#projectdir#</XmakeProjectDir>
+ <XmakeProjectFile>#projectfile#</XmakeProjectFile>
+ <XmakeTarget>#target#</XmakeTarget>
+ </PropertyGroup>
#Import(XmakeConfig)#
#Import(XmakePath)#
- <Import Project="$(XmakeProgramDir)\plugins\project\vsxmake\vsproj\xmake.props" />
- <ItemGroup>
- <None Include="Xmake.Custom.props" />
- <None Include="Xmake.Custom.targets" />
- <None Condition="'$(XmakeScriptDir)' != '$(XmakeProjectDir)' And Exists('$(XmakeScriptDir)\xmake.lua')"
- Include="$(XmakeScriptDir)\xmake.lua" />
- </ItemGroup>
- <ItemGroup>
+ <Import Project="$(XmakeProgramDir)\plugins\project\vsxmake\vsproj\xmake.props" />
+ <ItemGroup>
#Import(Include)#
- </ItemGroup>
- <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
#Import(File.c)#
- </ItemGroup>
- <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
#Import(File.cxx)#
- </ItemGroup>
- <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
#Import(File.cu)#
- </ItemGroup>
- <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
#Import(File.obj)#
- </ItemGroup>
- <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
#Import(File.rc)#
- </ItemGroup>
- <!-- <ItemGroup>
+ </ItemGroup>
+ <!-- <ItemGroup>
#Import(ProjectRef)#
- </ItemGroup> -->
- <Import Project="$(XmakeProgramDir)\plugins\project\vsxmake\vsproj\xmake.targets" />
+ </ItemGroup> -->
+ <Import Project="$(XmakeProgramDir)\plugins\project\vsxmake\vsproj\xmake.targets" />
</Project>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.c(filec) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.c(filec)
index 36e16832a..68c1a7d5b 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.c(filec)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.c(filec)
@@ -1,3 +1,3 @@
- <ClCompile Include="#path#">
- <CompileAs>CompileAsC</CompileAs>
- </ClCompile>
+ <ClCompile Include="$(XmakeProjectDir)#path#">
+ <CompileAs>CompileAsC</CompileAs>
+ </ClCompile>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cu(filecu) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cu(filecu)
index 7b3f0a6fe..1d1d98f7d 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cu(filecu)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cu(filecu)
@@ -1 +1 @@
- <CudaCompile Include="#path#" />
+ <CudaCompile Include="$(XmakeProjectDir)#path#" />
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx)
index 076adfd5a..a8534b74b 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx)
@@ -1,3 +1,3 @@
- <ClCompile Include="#path#">
- <CompileAs>CompileAsCpp</CompileAs>
- </ClCompile>
+ <ClCompile Include="$(XmakeProjectDir)#path#">
+ <CompileAs>CompileAsCpp</CompileAs>
+ </ClCompile>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.obj(fileobj) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.obj(fileobj)
index 1e7cd6f45..5c858884d 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.obj(fileobj)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.obj(fileobj)
@@ -1 +1 @@
- <Object Include="#path#" />
+ <Object Include="$(XmakeProjectDir)#path#" />
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.rc(filerc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.rc(filerc)
index 25d1c58ab..e15b89bbe 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.rc(filerc)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.rc(filerc)
@@ -1 +1 @@
- <ResourceCompile Include="#path#" />
+ <ResourceCompile Include="$(XmakeProjectDir)#path#" />
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc)
index 0178e0f9a..dfd5df637 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc)
@@ -1 +1 @@
- <ClInclude Include="#path#" />
+ <ClInclude Include="$(XmakeProjectDir)#path#" />
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectConfiguration(mode,arch) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectConfiguration(mode,arch)
index f2169767f..f2d2eac47 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectConfiguration(mode,arch)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectConfiguration(mode,arch)
@@ -1,4 +1,4 @@
- <ProjectConfiguration Include="#mode#|#arch#">
- <Configuration>#mode#</Configuration>
- <Platform>#vsarch#</Platform>
- </ProjectConfiguration>
+ <ProjectConfiguration Include="#mode#|#arch#">
+ <Configuration>#mode#</Configuration>
+ <Platform>#vsarch#</Platform>
+ </ProjectConfiguration>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectRef(dep) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectRef(dep)
index 7804e4cba..33434eca3 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectRef(dep)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectRef(dep)
@@ -1,3 +1,3 @@
- <ProjectReference Include="..\#target#\#target#.vcxproj">
- <Project>{#target_id#}</Project>
- </ProjectReference>
+ <ProjectReference Include="..\#target#\#target#.vcxproj">
+ <Project>{#target_id#}</Project>
+ </ProjectReference>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch)
index da73700f4..341c807f9 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch)
@@ -1,13 +1,13 @@
- <PropertyGroup Label="XmakeConfig" Condition="'$(Configuration)|$(Platform)'=='#mode#|#vsarch#'">
- <XmakeBasename>#basename#</XmakeBasename>
- <XmakeFilename>#filename#</XmakeFilename>
- <XmakeMode>#mode#</XmakeMode>
- <XmakePlat>#plat#</XmakePlat>
- <XmakeArch>#arch#</XmakeArch>
- <XmakeKind>#kind#</XmakeKind>
- <XmakeDefines>#defines#</XmakeDefines>
- <XmakeLanguages>#languages#</XmakeLanguages>
- <XmakeCudaVersion>#cudaver#</XmakeCudaVersion>
- <XmakeMfcKind>#mfckind#</XmakeMfcKind>
- <XmakeRunEnvs>#runenvs#</XmakeRunEnvs>
- </PropertyGroup>
+ <PropertyGroup Label="XmakeConfig" Condition="'$(Configuration)|$(Platform)'=='#mode#|#vsarch#'">
+ <XmakeBasename>#basename#</XmakeBasename>
+ <XmakeFilename>#filename#</XmakeFilename>
+ <XmakeMode>#mode#</XmakeMode>
+ <XmakePlat>#plat#</XmakePlat>
+ <XmakeArch>#arch#</XmakeArch>
+ <XmakeKind>#kind#</XmakeKind>
+ <XmakeDefines>#defines#</XmakeDefines>
+ <XmakeLanguages>#languages#</XmakeLanguages>
+ <XmakeCudaVersion>#cudaver#</XmakeCudaVersion>
+ <XmakeMfcKind>#mfckind#</XmakeMfcKind>
+ <XmakeRunEnvs>#runenvs#</XmakeRunEnvs>
+ </PropertyGroup>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch)
index 2c8adc429..42644b1f5 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch)
@@ -1,9 +1,9 @@
- <PropertyGroup Label="XmakePath" Condition="'$(Configuration)|$(Platform)'=='#mode#|#vsarch#'">
- <XmakeBuilDir>#buildir#</XmakeBuilDir>
- <XmakeConfigDir>#configdir#</XmakeConfigDir>
- <XmakeConfigFileDir>#configfiledir#</XmakeConfigFileDir>
- <XmakeTargetDir>#targetdir#</XmakeTargetDir>
- <XmakeIncludeDir>#includedirs#</XmakeIncludeDir>
- <XmakeLinkDir>#linkdirs#</XmakeLinkDir>
- <XmakeRunDir>#rundir#</XmakeRunDir>
- </PropertyGroup>
+ <PropertyGroup Label="XmakePath" Condition="'$(Configuration)|$(Platform)'=='#mode#|#vsarch#'">
+ <XmakeBuilDir>#buildir#</XmakeBuilDir>
+ <XmakeConfigDir>#configdir#</XmakeConfigDir>
+ <XmakeConfigFileDir>#configfiledir#</XmakeConfigFileDir>
+ <XmakeTargetDir>#targetdir#</XmakeTargetDir>
+ <XmakeIncludeDir>#includedirs#</XmakeIncludeDir>
+ <XmakeLinkDir>#linkdirs#</XmakeLinkDir>
+ <XmakeRunDir>#rundir#</XmakeRunDir>
+ </PropertyGroup>
diff --git a/xmake/plugins/project/vsxmake/vsxmake.lua b/xmake/plugins/project/vsxmake/vsxmake.lua
index cf91eb40e..2526b00cb 100644
--- a/xmake/plugins/project/vsxmake/vsxmake.lua
+++ b/xmake/plugins/project/vsxmake/vsxmake.lua
@@ -23,6 +23,7 @@ import("core.base.hashset")
import("vstudio.impl.vsinfo", { rootdir = path.directory(os.scriptdir()) })
import("render")
import("getinfo")
+import("core.project.config")
local template_root = path.join(os.scriptdir(), "vsproj", "templates")
local template_sln = path.join(template_root, "sln", "vsxmake.sln")
@@ -32,6 +33,8 @@ local template_fil = path.join(template_root, "vcxproj.filters", "#target#.vcxpr
local template_usr = path.join(template_root, "#target#.vcxproj.user")
local template_props = path.join(template_root, "Xmake.Custom.props")
local template_targets = path.join(template_root, "Xmake.Custom.targets")
+local template_items = path.join(template_root, "Xmake.Custom.items")
+local template_itemfil = path.join(template_root, "Xmake.Custom.items.filters")
function _filter_files(files, exts)
local extset = hashset.from(exts)
@@ -127,12 +130,22 @@ end
-- make
function make(version)
+ if not version then
+ version = assert(tonumber(config.get("vs")), "invalid vs version, run `xmake f --vs=2015`")
+ vprint("using project kind vsxmake%d", version)
+ end
+
+ -- check
+ if version < 2010 then
+ raise("vsxmake does not support vs version lower than 2010")
+ end
+
return function(outputdir)
local info = getinfo(outputdir, vsinfo(version))
local paramsprovidersln = _buildparams(info)
-- write solution file
- local sln = path.join(info.solution_dir, info.slnfile .. "_vsxmake" .. info.vstudio_version .. ".sln")
+ local sln = path.join(info.solution_dir, info.slnfile .. ".sln")
io.writefile(sln, render(template_sln, "#([A-Za-z0-9_,%.%*%(%)]+)#", paramsprovidersln))
-- add solution custom file
@@ -153,6 +166,8 @@ function make(version)
-- add project custom file
_trycp(template_props, proj_dir)
_trycp(template_targets, proj_dir)
+ _trycp(template_items, proj_dir)
+ _trycp(template_itemfil, proj_dir)
-- add project user file
_trycp(template_usr, proj_dir, target .. ".vcxproj.user")
end
diff --git a/xmake/plugins/project/xmake.lua b/xmake/plugins/project/xmake.lua
index 023d3d87d..88d8a1ced 100644
--- a/xmake/plugins/project/xmake.lua
+++ b/xmake/plugins/project/xmake.lua
@@ -47,12 +47,10 @@ task("project")
, " - vsxmake2010 ~ vsmake2019" }
, {'m', "modes", "kv", nil, "Set the project modes."
, " .e.g "
- , " - xmake project -k makefile"
- , " - xmake project -k compile_commands"
- , " - xmake project -k vs2015 -m \"release,debug\"" }
- , {'a', "archs", "kv", nil, "Set the project archs."
+ , " - xmake project -k vs2015 -m \"release" .. path.envsep() .. "debug\"" }
+ , {'a', "archs", "kv", nil, "Set the project archs."
, " .e.g "
- , " - xmake project -k vs2015 -a \"x86,x64\"" }
+ , " - xmake project -k vs2015 -a \"x86" .. path.envsep() .. "x64\"" }
, {nil, "outputdir", "v", ".", "Set the output directory." }
}
}