summaryrefslogtreecommitdiff
path: root/xmake/plugins/project/main.lua
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-07-17 18:21:48 +0800
committerOpportunityLiu <[email protected]>2019-07-19 11:48:32 +0800
commit623add4344bf5e5d29b116356de7d398c2ddec2f (patch)
tree80c9f2d205622e3e5c183f76cea1731d14c31cb0 /xmake/plugins/project/main.lua
parent5f0af08bc708259905d8bb5921fbe0b354b56f5c (diff)
add auto detect vs version
Diffstat (limited to 'xmake/plugins/project/main.lua')
-rwxr-xr-xxmake/plugins/project/main.lua21
1 files changed, 20 insertions, 1 deletions
diff --git a/xmake/plugins/project/main.lua b/xmake/plugins/project/main.lua
index d2ce39a10..ede6989fb 100755
--- a/xmake/plugins/project/main.lua
+++ b/xmake/plugins/project/main.lua
@@ -21,6 +21,7 @@
-- imports
import("core.base.option")
import("core.base.task")
+import("core.project.config")
import("core.platform.environment")
import("make.makefile")
import("cmake.cmakelists")
@@ -30,6 +31,22 @@ import("vsxmake.vsxmake")
import("clang.compile_flags")
import("clang.compile_commands")
+function _vs(outputdir)
+ local vsver = assert(tonumber(config.get("vs")), "invalid vs version, run `xmake f --vs=2015`")
+ vprint("using project kind vs%d", vsver)
+ if vsver < 2010 then
+ return vs.make(vsver)(outputdir)
+ else
+ return vsx.make(vsver)(outputdir)
+ end
+end
+
+function _vsxmake(outputdir)
+ local vsver = assert(tonumber(config.get("vs")), "invalid vs version, run `xmake f --vs=2015`")
+ vprint("using project kind vsxmake%d", vsver)
+ return vsxmake.make(vsver)(outputdir)
+end
+
-- make project
function _make(kind)
@@ -48,17 +65,19 @@ function _make(kind)
, vs2015 = vsx.make(2015)
, vs2017 = vsx.make(2017)
, vs2019 = vsx.make(2019)
+ , vs = _vs
, 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
, 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