summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2018-10-07 00:05:45 +0800
committerruki <[email protected]>2018-10-07 00:05:45 +0800
commitfbc34dadcfdff7f06a1927fbb593503c5149995b (patch)
treec9008e3c62e5f22e5a9e0a261b20d9c6d1b4ce21 /xmake/modules
parent4307ac5dabce5177d1517b0e043a35b5a7c58512 (diff)
add macos and winos version
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/os/winver.lua31
-rw-r--r--xmake/modules/package/tools/cmake.lua17
2 files changed, 13 insertions, 35 deletions
diff --git a/xmake/modules/os/winver.lua b/xmake/modules/os/winver.lua
index e684ffa02..92b1d6a72 100644
--- a/xmake/modules/os/winver.lua
+++ b/xmake/modules/os/winver.lua
@@ -119,34 +119,3 @@ function subsystem(name)
}
return defvals[name] or "10.00"
end
-
--- get windows system version
---
--- $ xmake l os.winver
---
--- - win10: 10.0.14393
--- - xp: 5.1.2600
---
-function main()
-
- -- get it from cache first
- if _g.winver ~= nil then
- return _g.winver
- end
-
- -- get winver
- local winver = nil
- local verstr = try { function () return os.iorun("cmd /c ver") end }
- if verstr then
- winver = verstr:match("%[.-(%d+%.%d+%.%d+)]")
- if winver then
- winver = winver:trim()
- end
- end
-
- -- save to cache
- _g.winver = winver or false
-
- -- done
- return winver
-end
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index ae1ecee16..a4c94bc33 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -29,18 +29,27 @@ import("lib.detect.find_file")
-- install package
function install(package, configs)
os.mkdir("build/install")
- os.cd("build")
+ local oldir = os.cd("build")
os.vrun("cmake -a $(arch) -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install"))
if is_host("windows") then
local slnfile = assert(find_file("*.sln", os.curdir()), "*.sln file not found!")
os.vrun("msbuild \"%s\" -nologo -t:Rebuild -p:Configuration=%s -p:Platform=%s", slnfile, package:debug() and "Debug" or "Release", is_arch("x64") and "x64" or "Win32")
local projfile = os.isfile("INSTALL.vcxproj") and "INSTALL.vcxproj" or "INSTALL.vcproj"
- os.vrun("msbuild \"%s\" /property:configuration=%s", projfile, package:debug() and "Debug" or "Release")
+ if os.isfile(projfile) then
+ os.vrun("msbuild \"%s\" /property:configuration=%s", projfile, package:debug() and "Debug" or "Release")
+ os.cp("install/lib", package:installdir())
+ os.cp("install/include", package:installdir())
+ else
+ os.cp("**.lib", package:installdir("lib"))
+ os.cp("**.dll", package:installdir("lib"))
+ os.cp("**.exp", package:installdir("lib"))
+ end
else
os.vrun("make -j4")
os.vrun("make install")
+ os.cp("install/lib", package:installdir())
+ os.cp("install/include", package:installdir())
end
- os.cp("install/lib", package:installdir())
- os.cp("install/include", package:installdir())
+ os.cd(oldir)
end