diff options
| author | ruki <[email protected]> | 2022-05-31 22:21:31 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-05-31 22:21:31 +0800 |
| commit | 64c41bd8ef06038cebdbbf39a85da51d69e718e7 (patch) | |
| tree | eae3dfeec2a2592f086bc53aac6ba0ebcb21cfc2 /xmake/modules/private/utils/batchcmds.lua | |
| parent | 50c5f96edb3f6c7a45e1bd24c921ec2c0afac33f (diff) | |
fix path for batchcmds
Diffstat (limited to 'xmake/modules/private/utils/batchcmds.lua')
| -rw-r--r-- | xmake/modules/private/utils/batchcmds.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/xmake/modules/private/utils/batchcmds.lua b/xmake/modules/private/utils/batchcmds.lua index a5a636f07..cf2c421d9 100644 --- a/xmake/modules/private/utils/batchcmds.lua +++ b/xmake/modules/private/utils/batchcmds.lua @@ -241,6 +241,17 @@ function batchcmds:compile(sourcefiles, objectfile, opt) local compiler_inst = compiler.load(sourcekind, opt) local program, argv = compiler_inst:compargv(sourcefiles, path(objectfile), opt) + -- we need translate path for the project generator + for idx, item in ipairs(argv) do + if type(item) == "string" then + if item:startswith("-I") then + argv[idx] = path(item:sub(3), function (p) return "-I" .. p end) + elseif item:startswith("/I") then + argv[idx] = path(item:sub(3), function (p) return "/I" .. p end) + end + end + end + -- add compilation command and bind run environments of compiler self:mkdir(path.directory(objectfile)) self:vrunv(program, argv, {envs = table.join(compiler_inst:runenvs(), opt.envs)}) @@ -265,6 +276,19 @@ function batchcmds:link(objectfiles, targetfile, opt) local linker_inst = target and target:linker() or linker.load(opt.targetkind, opt.sourcekinds, opt) local program, argv = linker_inst:linkargv(objectfiles, path(targetfile), opt) + -- we need translate path for the project generator + for idx, item in ipairs(argv) do + if type(item) == "string" then + if item:startswith("-L") then + argv[idx] = path(item:sub(3), function (p) return "-L" .. p end) + elseif item:startswith("-F") then + argv[idx] = path(item:sub(3), function (p) return "-F" .. p end) + elseif item:startswith("-libpath:") then + argv[idx] = path(item:sub(10), function (p) return "-libpath:" .. p end) + end + end + end + -- add link command and bind run environments of linker self:mkdir(path.directory(targetfile)) self:vrunv(program, argv, {envs = table.join(linker_inst:runenvs(), opt.envs)}) |
