summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-07-15 10:29:38 +0800
committerOpportunityLiu <[email protected]>2019-07-15 10:29:38 +0800
commit91b6dd5c47463d3e38514e63d71e305bda4501a5 (patch)
tree2d60fd14c6ebb4013cc7a5833f593f3150dfa9b5
parent8f82eac730b6ce94706c067f33bc1b25068b4ae6 (diff)
fix path resolve
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/Xmake.props19
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/Xmake.targets8
2 files changed, 16 insertions, 11 deletions
diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.props b/xmake/plugins/project/vsxmake/vsproj/Xmake.props
index 02c36e28b..c4677ae71 100644
--- a/xmake/plugins/project/vsxmake/vsproj/Xmake.props
+++ b/xmake/plugins/project/vsxmake/vsproj/Xmake.props
@@ -7,10 +7,11 @@
<XmakeArch Condition="'$(XmakeArch)' == '' And '$(Platform.ToLower())' == 'win32'">x86</XmakeArch>
<XmakeArch Condition="'$(XmakeArch)' == '' And '$(Platform.ToLower())' != 'win32'">$(Platform)</XmakeArch>
- <XmakeArch Condition="'$(XmakeArch)' == ''">auto</XmakeArch>
+ <XmakeArch Condition="'$(XmakeArch)' == ''">x86</XmakeArch>
</PropertyGroup>
<ImportGroup Label="CustomSettings">
+ <!--only search 2 levels to avoid accidentally import-->
<Import Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.props')"
Project="$(MSBuildProjectDirectory)\Xmake.Custom.props" />
<Import Condition="!Exists('$(MSBuildProjectDirectory)\Xmake.Custom.props') And Exists('$(MSBuildProjectDirectory)\..\Xmake.Custom.props')"
@@ -39,13 +40,13 @@
<PropertyGroup Label="XmakePathsResolve">
<!-- resolve if they are relative paths -->
- <XmakeProjectDir Condition="Exists('$(MSBuildProjectDirectory)\$(XmakeProjectDir)')">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeProjectDir)'))</XmakeProjectDir>
- <XmakeScriptDir Condition="Exists('$(MSBuildProjectDirectory)\$(XmakeScriptDir)')">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeScriptDir)'))</XmakeScriptDir>
- <XmakeBuilDir Condition="Exists('$(MSBuildProjectDirectory)\$(XmakeBuilDir)')">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuilDir)'))</XmakeBuilDir>
- <XmakeTargetDir Condition="Exists('$(MSBuildProjectDirectory)\$(XmakeTargetDir)')">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeTargetDir)'))</XmakeTargetDir>
- <XmakeConfigDir Condition="Exists('$(MSBuildProjectDirectory)\$(XmakeConfigDir)')">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigDir)'))</XmakeConfigDir>
- <XmakeConfigFileDir Condition="Exists('$(MSBuildProjectDirectory)\$(XmakeConfigFileDir)')">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigFileDir)'))</XmakeConfigFileDir>
- <XmakeRunDir Condition="Exists('$(MSBuildProjectDirectory)\$(XmakeRunDir)')">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeRunDir)'))</XmakeRunDir>
+ <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>
+ <XmakeBuilDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeBuilDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuilDir)'))</XmakeBuilDir>
+ <XmakeTargetDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeTargetDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeTargetDir)'))</XmakeTargetDir>
+ <XmakeConfigDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeConfigDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigDir)'))</XmakeConfigDir>
+ <XmakeConfigFileDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeConfigFileDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigFileDir)'))</XmakeConfigFileDir>
+ <XmakeRunDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeRunDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeRunDir)'))</XmakeRunDir>
<!-- normalize paths -->
<XmakeProjectDir>$([System.IO.Path]::GetFullPath('$(XmakeProjectDir)'))</XmakeProjectDir>
@@ -131,7 +132,7 @@
</PropertyGroup>
<PropertyGroup Label="Path">
- <IncludePath>$(XmakeIncludeDir);$(XmakeConfigFileDir);$(IncludePath)</IncludePath>
+ <IncludePath>$(XmakeIncludeDir);$(IncludePath)</IncludePath>
<LibraryPath>$(XmakeLinkDir);$(LibraryPath)</LibraryPath>
<OutDir>$(XmakeTargetDir)</OutDir>
<IntDir>$(XmakeBuilDir)\.vs\$(TargetName)\$(XmakeArch)\$(XmakeMode)\</IntDir>
diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets
index e87012146..c3ce99b64 100644
--- a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets
+++ b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets
@@ -30,8 +30,11 @@
<_XmakeCommonFlags>$(_XmakeCommonFlags.Trim())</_XmakeCommonFlags>
<_XmakeExecutable>"$([System.IO.Path]::GetFullPath('$(XmakeProgramDir)\xmake.exe'))"</_XmakeExecutable>
- <_XmakeEnv>pushd "$(XmakeProjectDir)"
-set XMAKE_CONFIGDIR=$(XmakeConfigDir)</_XmakeEnv>
+ <_XmakeEnv>
+ pushd "$(XmakeProjectDir)"
+ set XMAKE_CONFIGDIR=$(XmakeConfigDir)
+ set XMAKE_PROGRAM_DIR=$(XmakeProgramDir)
+ </_XmakeEnv>
</PropertyGroup>
<Target Name="_XmakeProjCheck">
@@ -153,6 +156,7 @@ MSBuild Properties:
</Target>
<ImportGroup Label="CustomTargets">
+ <!--only search 2 levels to avoid accidentally import-->
<Import Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.targets')"
Project="$(MSBuildProjectDirectory)\Xmake.Custom.targets" />
<Import Condition="!Exists('$(MSBuildProjectDirectory)\Xmake.Custom.targets') And Exists('$(MSBuildProjectDirectory)\..\Xmake.Custom.targets')"