diff options
| author | ruki <[email protected]> | 2024-09-23 22:43:36 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-09-23 22:43:36 +0800 |
| commit | 886cc712bd80ac9a71a779b7eb518e72e05ed7ed (patch) | |
| tree | 164a8f8800a1c0e70b1cc2a0e5a4464c5f5c8905 | |
| parent | 6295d86eeb3be2761a61ffa1672c0b2ca4492643 (diff) | |
improve program file for vsxmake #5642
4 files changed, 12 insertions, 3 deletions
diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua index 2981024ea..6feffa9dc 100644 --- a/xmake/plugins/project/vsxmake/getinfo.lua +++ b/xmake/plugins/project/vsxmake/getinfo.lua @@ -388,6 +388,7 @@ function main(outputdir, vsinfo) -- init solution directory vsinfo.solution_dir = path.absolute(path.join(outputdir, "vsxmake" .. vsinfo.vstudio_version)) vsinfo.programdir = _make_dirs(xmake.programdir()) + vsinfo.programfile = _make_dirs(xmake.programfile()) vsinfo.projectdir = project.directory() vsinfo.sln_projectfile = path.relative(project.rootfile(), vsinfo.solution_dir) local projectfile = path.filename(project.rootfile()) diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.Defaults.props b/xmake/scripts/vsxmake/vsproj/Xmake.Defaults.props index 702647639..e10bfe203 100644 --- a/xmake/scripts/vsxmake/vsproj/Xmake.Defaults.props +++ b/xmake/scripts/vsxmake/vsproj/Xmake.Defaults.props @@ -3,16 +3,19 @@ <PropertyGroup Label="XmakePathsResolve"> <_XmakeProgramDir>$(XmakeProgramDir)</_XmakeProgramDir> + <_XmakeProgramFile>$(XmakeProgramFile)</_XmakeProgramFile> <_XmakeProjectDir>$(XmakeProjectDir)</_XmakeProjectDir> <_XmakeScriptDir>$(XmakeScriptDir)</_XmakeScriptDir> <!-- resolve if they are relative paths --> <_XmakeProgramDir Condition="!$([System.IO.Path]::IsPathRooted('$(_XmakeProgramDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(_XmakeProgramDir)'))</_XmakeProgramDir> + <_XmakeProgramFile Condition="!$([System.IO.Path]::IsPathRooted('$(_XmakeProgramFile)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(_XmakeProgramFile)'))</_XmakeProgramFile> <_XmakeProjectDir Condition="!$([System.IO.Path]::IsPathRooted('$(_XmakeProjectDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(_XmakeProjectDir)'))</_XmakeProjectDir> <_XmakeScriptDir Condition="!$([System.IO.Path]::IsPathRooted('$(_XmakeScriptDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(_XmakeScriptDir)'))</_XmakeScriptDir> <!-- normalize paths --> <XmakeProgramDir>$([System.IO.Path]::GetFullPath('$(_XmakeProgramDir)'))</XmakeProgramDir> + <XmakeProgramFile>$([System.IO.Path]::GetFullPath('$(_XmakeProgramFile)'))</XmakeProgramFile> <XmakeProjectDir>$([System.IO.Path]::GetFullPath('$(_XmakeProjectDir)'))</XmakeProjectDir> <XmakeScriptDir>$([System.IO.Path]::GetFullPath('$(_XmakeScriptDir)'))</XmakeScriptDir> </PropertyGroup> diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.targets b/xmake/scripts/vsxmake/vsproj/Xmake.targets index 1dddc7728..bb5f64f52 100644 --- a/xmake/scripts/vsxmake/vsproj/Xmake.targets +++ b/xmake/scripts/vsxmake/vsproj/Xmake.targets @@ -30,6 +30,7 @@ <!-- these paths resolved in Xmake.Default.props, just normalize --> <XmakeProgramDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeProgramDir)/'))</XmakeProgramDirResolved> + <XmakeProgramFileResolved>$([System.IO.Path]::GetFullPath('$(XmakeProgramFile)/'))</XmakeProgramFileResolved> <XmakeProjectDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeProjectDir)/'))</XmakeProjectDirResolved> <XmakeScriptDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeScriptDir)/'))</XmakeScriptDirResolved> </PropertyGroup> @@ -61,7 +62,7 @@ <_XmakeCommonFlags>$(_XmakeCommonFlags.Trim())</_XmakeCommonFlags> <_XmakeTarget>"$(XmakeTarget.Trim())"</_XmakeTarget> - <_XmakeExecutable>"$([System.IO.Path]::GetFullPath('$(XmakeProgramDirResolved)xmake.exe'))"</_XmakeExecutable> + <_XmakeExecutable>"$([System.IO.Path]::GetFullPath('$(XmakeProgramFileResolved)'))"</_XmakeExecutable> <_XmakeEnv> pushd $(XmakeProjectDirResolved) set XMAKE_CONFIGDIR=$(XmakeConfigDirResolved.TrimEnd('\').TrimEnd('/')) @@ -82,8 +83,8 @@ Text="File '$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets' not found" /> <Warning Condition="'$(XmakeCudaVersion)' != '' And !Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props')" Text="File '$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props' not found" /> - <Error Condition="!Exists('$(XmakeProgramDirResolved)\xmake.exe')" - Text="xmake.exe not found at '$(XmakeProgramDirResolved)', please set XMAKE_PROGRAM_DIR in environments or XmakeProgramDir in vcxproj file" /> + <Error Condition="!Exists('$(XmakeProgramFileResolved)')" + Text="xmake.exe not found at '$(XmakeProgramFileResolved)'" /> <Error Condition="'$(XmakeProjectFile)' == '' And !Exists('$(XmakeProjectDirResolved)\xmake.lua')" Text="xmake.lua not found at '$(XmakeProjectDirResolved)', please set XmakeProjectDir in vcxproj file" /> <Error Condition="'$(XmakeProjectFile)' != '' And !Exists('$(XmakeProjectDirResolved)\$(XmakeProjectFile)')" @@ -150,6 +151,7 @@ MSBuild Properties: XmakeRunArgs: $(XmakeRunArgs) Xmake Path: XmakeProgramDir: $(XmakeProgramDir) + XmakeProgramFile: $(XmakeProgramFile) XmakeProjectDir: $(XmakeProjectDir) XmakeScriptDir: $(XmakeScriptDir) XmakeBuilDir: $(XmakeBuilDir) @@ -159,6 +161,7 @@ MSBuild Properties: XmakeRunDir: $(XmakeRunDir) Xmake Resolved Path: XmakeProgramDir: $(XmakeProgramDirResolved) + XmakeProgramFile: $(XmakeProgramFileResolved) XmakeProjectDir: $(XmakeProjectDirResolved) XmakeScriptDir: $(XmakeScriptDirResolved) XmakeBuilDir: $(XmakeBuilDirResolved) diff --git a/xmake/scripts/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj b/xmake/scripts/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj index 1918f4997..e3c87ba4e 100644 --- a/xmake/scripts/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj +++ b/xmake/scripts/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj @@ -26,6 +26,8 @@ <PropertyGroup Label="XmakeProgram"> <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">$(XMAKE_PROGRAM_DIR)</XmakeProgramDir> <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">#programdir#</XmakeProgramDir> + <XmakeProgramFile Condition="'$(XmakeProgramFile)' == ''">$(XMAKE_PROGRAM_FILE)</XmakeProgramDir> + <XmakeProgramFile Condition="'$(XmakeProgramFile)' == ''">#programfile#</XmakeProgramFile> </PropertyGroup> <Import Project="$(XmakeProgramDir)\scripts\vsxmake\vsproj\Xmake.Defaults.props" /> #Import(XmakeConfig)# |
