summaryrefslogtreecommitdiff
path: root/xmake/modules/target
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 /xmake/modules/target
parent66fcf40bc0042c401e06b8579b40f6203b21b256 (diff)
improve install dir on windows
Diffstat (limited to 'xmake/modules/target')
-rw-r--r--xmake/modules/target/action/install/windows.lua18
1 files changed, 14 insertions, 4 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)