summaryrefslogtreecommitdiff
path: root/xmake/scripts
diff options
context:
space:
mode:
authorruki <[email protected]>2024-09-23 22:43:36 +0800
committerruki <[email protected]>2024-09-23 22:43:36 +0800
commit886cc712bd80ac9a71a779b7eb518e72e05ed7ed (patch)
tree164a8f8800a1c0e70b1cc2a0e5a4464c5f5c8905 /xmake/scripts
parent6295d86eeb3be2761a61ffa1672c0b2ca4492643 (diff)
improve program file for vsxmake #5642
Diffstat (limited to 'xmake/scripts')
-rw-r--r--xmake/scripts/vsxmake/vsproj/Xmake.Defaults.props3
-rw-r--r--xmake/scripts/vsxmake/vsproj/Xmake.targets9
-rw-r--r--xmake/scripts/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj2
3 files changed, 11 insertions, 3 deletions
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)#