summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-01-10 00:33:28 +0800
committerruki <[email protected]>2023-01-10 00:33:28 +0800
commitf7b608aa64f4af3e26a1d48673e5f45e00fe4170 (patch)
tree27c3ca86f81b4252872cdf048ad145bf6d2ed803
parent66fcf40bc0042c401e06b8579b40f6203b21b256 (diff)
improve install dir on windows
-rw-r--r--xmake/modules/target/action/install/windows.lua18
-rw-r--r--xmake/rules/qt/install/windows.lua9
2 files changed, 22 insertions, 5 deletions
diff --git a/xmake/modules/target/action/install/windows.lua b/xmake/modules/target/action/install/windows.lua
index d508623be..84ed75a7d 100644
--- a/xmake/modules/target/action/install/windows.lua
+++ b/xmake/modules/target/action/install/windows.lua
@@ -21,9 +21,16 @@
-- imports
import("lib.detect.find_file")
+-- get install directory
+function _get_installdir(target)
+ local installdir = assert(target:installdir(), "please use `xmake install -o installdir` or `set_installdir` to set install directory on windows.")
+ return installdir
+end
+
-- install headers
function _install_headers(target, opt)
- local includedir = path.join(target:installdir(), opt and opt.includedir or "include")
+ local installdir = _get_installdir(target)
+ local includedir = path.join(installdir, opt and opt.includedir or "include")
os.mkdir(includedir)
local srcheaders, dstheaders = target:headerfiles(includedir, {installonly = true})
if srcheaders and dstheaders then
@@ -73,7 +80,8 @@ end
function install_binary(target, opt)
-- install binary
- local binarydir = path.join(target:installdir(), opt and opt.bindir or "bin")
+ local installdir = _get_installdir(target)
+ local binarydir = path.join(installdir, opt and opt.bindir or "bin")
os.mkdir(binarydir)
os.vcp(target:targetfile(), binarydir)
os.trycp(target:symbolfile(), binarydir)
@@ -103,7 +111,8 @@ end
function install_shared(target, opt)
-- install dll library to the binary directory
- local binarydir = path.join(target:installdir(), opt and opt.bindir or "bin")
+ local installdir = _get_installdir(target)
+ local binarydir = path.join(installdir, opt and opt.bindir or "bin")
os.mkdir(binarydir)
os.vcp(target:targetfile(), binarydir)
os.trycp(target:symbolfile(), binarydir)
@@ -129,7 +138,8 @@ end
function install_static(target, opt)
-- install library
- local librarydir = path.join(target:installdir(), opt and opt.libdir or "lib")
+ local installdir = _get_installdir(target)
+ local librarydir = path.join(installdir, opt and opt.libdir or "lib")
os.mkdir(librarydir)
os.vcp(target:targetfile(), librarydir)
os.trycp(target:symbolfile(), librarydir)
diff --git a/xmake/rules/qt/install/windows.lua b/xmake/rules/qt/install/windows.lua
index d30ba2172..2582d74ae 100644
--- a/xmake/rules/qt/install/windows.lua
+++ b/xmake/rules/qt/install/windows.lua
@@ -24,11 +24,18 @@ import("core.project.config")
import("core.tool.toolchain")
import("lib.detect.find_path")
+-- get install directory
+function _get_installdir(target)
+ local installdir = assert(target:installdir(), "please use `xmake install -o installdir` or `set_installdir` to set install directory on windows.")
+ return installdir
+end
+
-- install application package for windows
function main(target, opt)
local targetfile = target:targetfile()
- local installfile = path.join(target:installdir(), "bin", path.filename(targetfile))
+ local installdir = _get_installdir(target)
+ local installfile = path.join(installdir, "bin", path.filename(targetfile))
-- get qt sdk
local qt = target:data("qt")