summaryrefslogtreecommitdiff
path: root/xmake/plugins
diff options
context:
space:
mode:
authorruki <[email protected]>2025-06-04 03:04:35 +0800
committerGitHub <[email protected]>2025-06-04 03:04:35 +0800
commitc8d17a7e9e935a66202fb90aedcf55f957a0ca33 (patch)
treed92c759ae652175f44e78bc5a126b03ed5fcaab0 /xmake/plugins
parentc09fc2cef2c3cb3191bc8c6a74f72e2bd2dcf582 (diff)
parent08b1b83e2ea26ff9cba52df62ec6e41376f9177e (diff)
Merge pull request #6520 from xmake-io/vsxmake
Add generator.vsxmake.root_sln policy
Diffstat (limited to 'xmake/plugins')
-rw-r--r--xmake/plugins/project/vsxmake/getinfo.lua10
-rw-r--r--xmake/plugins/project/vsxmake/vsxmake.lua4
2 files changed, 10 insertions, 4 deletions
diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua
index ae69fbb58..d9c4b4b6b 100644
--- a/xmake/plugins/project/vsxmake/getinfo.lua
+++ b/xmake/plugins/project/vsxmake/getinfo.lua
@@ -393,7 +393,12 @@ function main(outputdir, vsinfo)
local oldir = os.cd(project.directory())
-- init solution directory
- vsinfo.solution_dir = path.absolute(path.join(outputdir, "vsxmake" .. vsinfo.vstudio_version))
+ vsinfo.vcxproj_rootdir = path.absolute(path.join(outputdir, "vsxmake" .. vsinfo.vstudio_version))
+ if project.policy("generator.vsxmake.root_sln") then
+ vsinfo.solution_dir = path.absolute(outputdir)
+ else
+ vsinfo.solution_dir = vsinfo.vcxproj_rootdir
+ end
vsinfo.programdir = _make_dirs(xmake.programdir())
vsinfo.programfile = xmake.programfile()
vsinfo.projectdir = project.directory()
@@ -491,7 +496,8 @@ function main(outputdir, vsinfo)
-- init target info
_target.target = targetname
- _target.vcxprojdir = path.join(vsinfo.solution_dir, targetname)
+ _target.vcxprojdir = path.join(vsinfo.vcxproj_rootdir, targetname)
+ _target.vcxprojdir_relative_sln = path.relative(_target.vcxprojdir, vsinfo.solution_dir)
_target.target_id = hash.uuid4(targetname)
_target.kind = target:kind()
_target.absscriptdir = target:scriptdir()
diff --git a/xmake/plugins/project/vsxmake/vsxmake.lua b/xmake/plugins/project/vsxmake/vsxmake.lua
index 2b3ded5d6..d5cd5e078 100644
--- a/xmake/plugins/project/vsxmake/vsxmake.lua
+++ b/xmake/plugins/project/vsxmake/vsxmake.lua
@@ -235,8 +235,8 @@ function make(version)
_writefileifneeded(sln, render(template_sln, "#([A-Za-z0-9_,%.%*%(%)]+)#", "@([^@]+)@", paramsprovidersln))
-- add solution custom file
- _trycp(template_props, info.solution_dir)
- _trycp(template_targets, info.solution_dir)
+ _trycp(template_props, info.vcxproj_rootdir)
+ _trycp(template_targets, info.vcxproj_rootdir)
for _, target in ipairs(info.targets) do
local paramsprovidertarget = _buildparams(info, target, "<!-- nil -->")