diff options
| author | OpportunityLiu <[email protected]> | 2019-07-17 08:48:41 +0800 |
|---|---|---|
| committer | OpportunityLiu <[email protected]> | 2019-07-19 11:48:32 +0800 |
| commit | 948e157842d7498486067c05708cf5cfd9a0b509 (patch) | |
| tree | 7536b169afe460ab3b8e0ff8a206769d97a7dd24 | |
| parent | 0a771e41e5057d2f6dc9dce3cbe2078cbc19aa83 (diff) | |
add compile selected files
27 files changed, 538 insertions, 467 deletions
diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua index 4567adb1e..cbb1c7a54 100644 --- a/xmake/plugins/project/vsxmake/getinfo.lua +++ b/xmake/plugins/project/vsxmake/getinfo.lua @@ -53,7 +53,7 @@ function _make_dirs(dir) r[k] = _make_dirs(v) end r = table.unique(r) - return table.concat(r, path.envsep()) + return path.joinenv(r) end function _get_values(target, name) @@ -103,7 +103,7 @@ function _make_targetinfo(mode, arch, target) for _, d in ipairs(v) do table.insert(defs, vformat(d)) end - table.insert(runenvs, format("%s=%s", k, table.concat(defs, path.envsep()))) + table.insert(runenvs, format("%s=%s", k, path.joinenv(defs))) end targetinfo.runenvs = table.concat(runenvs, "\n") @@ -266,7 +266,7 @@ function main(outputdir, vsinfo) local dir = path.directory(f) target._sub2[f] = { - path = path.join("$(XmakeProjectDir)", f), + path = f, dir = dir } while dir ~= "." do diff --git a/xmake/plugins/project/vsxmake/render.lua b/xmake/plugins/project/vsxmake/render.lua index c672b30cd..99f635d04 100644 --- a/xmake/plugins/project/vsxmake/render.lua +++ b/xmake/plugins/project/vsxmake/render.lua @@ -37,14 +37,14 @@ function _expand(params) for _, v in ipairs(params) do if type(v) == "string" then for i, p in ipairs(r) do - r[i] = p .. ";" .. v + r[i] = p .. "\0" .. v end else local newr = {} for _, c in ipairs(v) do local rcopy = {} for i, p in ipairs(r) do - rcopy[i] = p .. ";" .. c + rcopy[i] = p .. "\0" .. c end newr= table.join(newr, rcopy) end @@ -52,7 +52,7 @@ function _expand(params) end end for i, p in ipairs(r) do - r[i] = p:split(";") + r[i] = p:split("\0") end return r end diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.props b/xmake/plugins/project/vsxmake/vsproj/Xmake.props index 20432fec3..1814bc6b9 100644 --- a/xmake/plugins/project/vsxmake/vsproj/Xmake.props +++ b/xmake/plugins/project/vsxmake/vsproj/Xmake.props @@ -1,141 +1,141 @@ <?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup Label="XmakePropsInit"> - <!-- initialize this first to allow `Condition="'$(XmakeMode)|$(XmakeArch)' == 'release|x86'"` in custom props file --> - <XmakeMode Condition="'$(XmakeMode)' == ''">$(Configuration)</XmakeMode> - <XmakeMode Condition="'$(XmakeMode)' == ''">release</XmakeMode> + <PropertyGroup Label="XmakePropsInit"> + <!-- initialize this first to allow `Condition="'$(XmakeMode)|$(XmakeArch)' == 'release|x86'"` in custom props file --> + <XmakeMode Condition="'$(XmakeMode)' == ''">$(Configuration)</XmakeMode> + <XmakeMode Condition="'$(XmakeMode)' == ''">release</XmakeMode> - <XmakeArch Condition="'$(XmakeArch)' == '' And '$(Platform.ToLower())' == 'win32'">x86</XmakeArch> - <XmakeArch Condition="'$(XmakeArch)' == '' And '$(Platform.ToLower())' != 'win32'">$(Platform)</XmakeArch> - <XmakeArch Condition="'$(XmakeArch)' == ''">x86</XmakeArch> - </PropertyGroup> + <XmakeArch Condition="'$(XmakeArch)' == '' And '$(Platform.ToLower())' == 'win32'">x86</XmakeArch> + <XmakeArch Condition="'$(XmakeArch)' == '' And '$(Platform.ToLower())' != 'win32'">$(Platform)</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')" - Project="$(MSBuildProjectDirectory)\..\Xmake.Custom.props" /> - </ImportGroup> + <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')" + Project="$(MSBuildProjectDirectory)\..\Xmake.Custom.props" /> + </ImportGroup> - <PropertyGroup Label="XmakePropsFallback"> - <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(XmakeTarget)</XmakeBasename> - <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(TargetName)</XmakeBasename> - <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(MSBuildProjectName)</XmakeBasename> + <PropertyGroup Label="XmakePropsFallback"> + <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(XmakeTarget)</XmakeBasename> + <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(TargetName)</XmakeBasename> + <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(MSBuildProjectName)</XmakeBasename> - <XmakeKind Condition="'$(XmakeKind)' == ''">binary</XmakeKind> - <XmakePlat Condition="'$(XmakePlat)' == ''">windows</XmakePlat> - </PropertyGroup> + <XmakeKind Condition="'$(XmakeKind)' == ''">binary</XmakeKind> + <XmakePlat Condition="'$(XmakePlat)' == ''">windows</XmakePlat> + </PropertyGroup> - <PropertyGroup Label="XmakePathsFallback"> - <XmakeBuilDir Condition="'$(XmakeBuilDir)' == ''">$(XmakeProjectDir)\build</XmakeBuilDir> - <XmakeTargetDir Condition="'$(XmakeTargetDir)' == ''">$(XmakeBuilDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeTargetDir> - <XmakeConfigFileDir Condition="'$(XmakeConfigFileDir)' == ''">$(XmakeBuilDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeConfigFileDir> + <PropertyGroup Label="XmakePathsFallback"> + <XmakeBuilDir Condition="'$(XmakeBuilDir)' == ''">$(XmakeProjectDir)\build</XmakeBuilDir> + <XmakeTargetDir Condition="'$(XmakeTargetDir)' == ''">$(XmakeBuilDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeTargetDir> + <XmakeConfigFileDir Condition="'$(XmakeConfigFileDir)' == ''">$(XmakeBuilDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeConfigFileDir> - <XmakeConfigDir Condition="'$(XmakeConfigDir)' == ''">$(XMAKE_CONFIGDIR)</XmakeConfigDir> - <XmakeConfigDir Condition="'$(XmakeConfigDir)' == ''">$(XmakeProjectDir)\.xmake</XmakeConfigDir> + <XmakeConfigDir Condition="'$(XmakeConfigDir)' == ''">$(XMAKE_CONFIGDIR)</XmakeConfigDir> + <XmakeConfigDir Condition="'$(XmakeConfigDir)' == ''">$(XmakeProjectDir)\.xmake</XmakeConfigDir> - <XmakeRunDir Condition="'$(XmakeRunDir)' == ''">$(XmakeTargetDir)</XmakeRunDir> - </PropertyGroup> + <XmakeRunDir Condition="'$(XmakeRunDir)' == ''">$(XmakeTargetDir)</XmakeRunDir> + </PropertyGroup> - <PropertyGroup Label="XmakePathsResolve"> - <!-- resolve if they are relative paths --> - <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> + <PropertyGroup Label="XmakePathsResolve"> + <!-- resolve if they are relative paths --> + <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 --> - <XmakeProgramDir>$([System.IO.Path]::GetFullPath('$(XmakeProgramDir)/'))</XmakeProgramDir> - <XmakeProjectDir>$([System.IO.Path]::GetFullPath('$(XmakeProjectDir)/'))</XmakeProjectDir> - <XmakeScriptDir>$([System.IO.Path]::GetFullPath('$(XmakeScriptDir)/'))</XmakeScriptDir> - <XmakeBuilDir>$([System.IO.Path]::GetFullPath('$(XmakeBuilDir)/'))</XmakeBuilDir> - <XmakeTargetDir>$([System.IO.Path]::GetFullPath('$(XmakeTargetDir)/'))</XmakeTargetDir> - <XmakeConfigDir>$([System.IO.Path]::GetFullPath('$(XmakeConfigDir)/'))</XmakeConfigDir> - <XmakeConfigFileDir>$([System.IO.Path]::GetFullPath('$(XmakeConfigFileDir)/'))</XmakeConfigFileDir> - <XmakeRunDir>$([System.IO.Path]::GetFullPath('$(XmakeRunDir)/'))</XmakeRunDir> - </PropertyGroup> + <!-- normalize paths --> + <XmakeProgramDir>$([System.IO.Path]::GetFullPath('$(XmakeProgramDir)/'))</XmakeProgramDir> + <XmakeProjectDir>$([System.IO.Path]::GetFullPath('$(XmakeProjectDir)/'))</XmakeProjectDir> + <XmakeScriptDir>$([System.IO.Path]::GetFullPath('$(XmakeScriptDir)/'))</XmakeScriptDir> + <XmakeBuilDir>$([System.IO.Path]::GetFullPath('$(XmakeBuilDir)/'))</XmakeBuilDir> + <XmakeTargetDir>$([System.IO.Path]::GetFullPath('$(XmakeTargetDir)/'))</XmakeTargetDir> + <XmakeConfigDir>$([System.IO.Path]::GetFullPath('$(XmakeConfigDir)/'))</XmakeConfigDir> + <XmakeConfigFileDir>$([System.IO.Path]::GetFullPath('$(XmakeConfigFileDir)/'))</XmakeConfigFileDir> + <XmakeRunDir>$([System.IO.Path]::GetFullPath('$(XmakeRunDir)/'))</XmakeRunDir> + </PropertyGroup> - <PropertyGroup Label="XmakeFlagsFallback"> - <XmakeWarning Condition="'$(XmakeWarning)' == ''">true</XmakeWarning> - <XmakeVerbose Condition="'$(XmakeVerbose)' == ''">false</XmakeVerbose> - <XmakeDiagnosis Condition="'$(XmakeDiagnosis)' == ''">false</XmakeDiagnosis> - </PropertyGroup> + <PropertyGroup Label="XmakeFlagsFallback"> + <XmakeWarning Condition="'$(XmakeWarning)' == ''">true</XmakeWarning> + <XmakeVerbose Condition="'$(XmakeVerbose)' == ''">false</XmakeVerbose> + <XmakeDiagnosis Condition="'$(XmakeDiagnosis)' == ''">false</XmakeDiagnosis> + </PropertyGroup> - <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)' == ''"> - <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '14.0'">10.0.10240.0</WindowsTargetPlatformVersion> - <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '15.0'">10.0.14393.0</WindowsTargetPlatformVersion> - <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '16.0'">10.0.17763.0</WindowsTargetPlatformVersion> - <WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">10.0</WindowsTargetPlatformVersion> - </PropertyGroup> - <PropertyGroup Condition="'$(PlatformToolset)' == ''"> - <PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset> - <PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset> - <PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset> - <PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset> - <PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset> - <PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset> - </PropertyGroup> + <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)' == ''"> + <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '14.0'">10.0.10240.0</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '15.0'">10.0.14393.0</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '16.0'">10.0.17763.0</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">10.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(PlatformToolset)' == ''"> + <PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset> + <PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset> + <PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset> + <PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset> + <PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset> + <PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset> + </PropertyGroup> - <PropertyGroup Label="AdditionalProps"> - <UseOfMfc Condition="'$(XmakeMfcKind)' != ''">$(XmakeMfcKind)</UseOfMfc> - <CharacterSet Condition="'$(CharacterSet)' == '' And ($(XmakeDefines.Contains(';UNICODE;')) Or $(XmakeDefines.EndsWith(';UNICODE')) Or $(XmakeDefines.StartsWith('UNICODE;')) Or $(XmakeDefines.Equals('UNICODE')))">Unicode</CharacterSet> - <CharacterSet Condition="'$(CharacterSet)' == ''">MultiByte</CharacterSet> - </PropertyGroup> + <PropertyGroup Label="AdditionalProps"> + <UseOfMfc Condition="'$(XmakeMfcKind)' != ''">$(XmakeMfcKind)</UseOfMfc> + <CharacterSet Condition="'$(CharacterSet)' == '' And ($(XmakeDefines.Contains(';UNICODE;')) Or $(XmakeDefines.EndsWith(';UNICODE')) Or $(XmakeDefines.StartsWith('UNICODE;')) Or $(XmakeDefines.Equals('UNICODE')))">Unicode</CharacterSet> + <CharacterSet Condition="'$(CharacterSet)' == ''">MultiByte</CharacterSet> + </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <Choose> - <When Condition="'$(XmakeKind)' == 'binary'"> - <PropertyGroup> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - </When> - <When Condition="'$(XmakeKind)' == 'shared'"> - <PropertyGroup> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - </When> - <When Condition="'$(XmakeKind)' == 'static'"> - <PropertyGroup> - <ConfigurationType>StaticLibrary</ConfigurationType> - </PropertyGroup> - </When> - </Choose> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <Choose> + <When Condition="'$(XmakeKind)' == 'binary'"> + <PropertyGroup> + <ConfigurationType>Application</ConfigurationType> + </PropertyGroup> + </When> + <When Condition="'$(XmakeKind)' == 'shared'"> + <PropertyGroup> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + </When> + <When Condition="'$(XmakeKind)' == 'static'"> + <PropertyGroup> + <ConfigurationType>StaticLibrary</ConfigurationType> + </PropertyGroup> + </When> + </Choose> - <ItemDefinitionGroup> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);$(XmakeDefines)</PreprocessorDefinitions> - <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx17'))">stdcpp17</LanguageStandard> - <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx14'))">stdcpp14</LanguageStandard> - <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx11'))">stdcpp11</LanguageStandard> - </ClCompile> - </ItemDefinitionGroup> + <ItemDefinitionGroup> + <ClCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions);$(XmakeDefines)</PreprocessorDefinitions> + <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx17'))">stdcpp17</LanguageStandard> + <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx14'))">stdcpp14</LanguageStandard> + <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx11'))">stdcpp11</LanguageStandard> + </ClCompile> + </ItemDefinitionGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - <Import Condition="'$(XmakeCudaVersion)' != '' And Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props')" - Project="$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props" /> - </ImportGroup> + <ImportGroup Label="ExtensionSettings"> + <Import Condition="'$(XmakeCudaVersion)' != '' And Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props')" + Project="$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props" /> + </ImportGroup> - <ImportGroup Label="PropertySheets"> - <Import Condition="Exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" - Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" /> - </ImportGroup> + <ImportGroup Label="PropertySheets"> + <Import Condition="Exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" + Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" /> + </ImportGroup> - <PropertyGroup Label="GlobalsFallback"> - <TargetName Condition="'$(XmakeFilename)' == ''">$(XmakeBasename)</TargetName> - <TargetName Condition="'$(XmakeFilename)' != ''">$([System.IO.Path]::GetFileNameWithoutExtension('$(XmakeFilename)'))</TargetName> - <TargetExt Condition="'$(XmakeFilename)' != ''">$([System.IO.Path]::GetExtension('$(XmakeFilename)'))</TargetExt> - </PropertyGroup> - - <PropertyGroup Label="Path"> - <IncludePath>$(XmakeIncludeDir);$(IncludePath)</IncludePath> - <LibraryPath>$(XmakeLinkDir);$(LibraryPath)</LibraryPath> - <OutDir>$(XmakeTargetDir)</OutDir> - <IntDir>$(XmakeBuilDir).vs\$(TargetName)\$(XmakeArch)\$(XmakeMode)\</IntDir> - </PropertyGroup> + <PropertyGroup Label="GlobalsFallback"> + <TargetName Condition="'$(XmakeFilename)' == ''">$(XmakeBasename)</TargetName> + <TargetName Condition="'$(XmakeFilename)' != ''">$([System.IO.Path]::GetFileNameWithoutExtension('$(XmakeFilename)'))</TargetName> + <TargetExt Condition="'$(XmakeFilename)' != ''">$([System.IO.Path]::GetExtension('$(XmakeFilename)'))</TargetExt> + </PropertyGroup> + + <PropertyGroup Label="Path"> + <IncludePath>$(XmakeIncludeDir);$(IncludePath)</IncludePath> + <LibraryPath>$(XmakeLinkDir);$(LibraryPath)</LibraryPath> + <OutDir>$(XmakeTargetDir)</OutDir> + <IntDir>$(XmakeBuilDir).vs\$(TargetName)\$(XmakeArch)\$(XmakeMode)\</IntDir> + </PropertyGroup> </Project> diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets index 05102ab40..940490271 100644 --- a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets +++ b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets @@ -1,169 +1,194 @@ <?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - <Import Condition="'$(XmakeCudaVersion)' != '' And Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets')" - Project="$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets" /> - </ImportGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + <Import Condition="'$(XmakeCudaVersion)' != '' And Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets')" + Project="$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets" /> + </ImportGroup> - <PropertyGroup Label="XmakeInternal"> - <_XmakeProjectFlag Condition="'$(XmakeProjectFile)' != ''">-F "$(XmakeProjectFile)"</_XmakeProjectFlag> - <_XmakeProjectFlag Condition="'$(XmakeProjectFile)' == ''">-P .</_XmakeProjectFlag> - - <_XmakeCommonFlags>$(XmakeCommonFlags.Trim())</_XmakeCommonFlags> - <_XmakeCommonFlags Condition="$(XmakeVerbose)">$(_XmakeCommonFlags) -v</_XmakeCommonFlags> - <_XmakeCommonFlags Condition="$(XmakeDiagnosis)">$(_XmakeCommonFlags) -D</_XmakeCommonFlags> - <_XmakeCommonFlags>$(_XmakeCommonFlags) $(_XmakeProjectFlag)</_XmakeCommonFlags> + <PropertyGroup Label="XmakeInternal"> + <_XmakeProjectFlag Condition="'$(XmakeProjectFile)' != ''">-F "$(XmakeProjectFile)"</_XmakeProjectFlag> + <_XmakeProjectFlag Condition="'$(XmakeProjectFile)' == ''">-P .</_XmakeProjectFlag> + + <_XmakeCommonFlags>$(XmakeCommonFlags.Trim())</_XmakeCommonFlags> + <_XmakeCommonFlags Condition="$(XmakeVerbose)">-v $(_XmakeCommonFlags)</_XmakeCommonFlags> + <_XmakeCommonFlags Condition="$(XmakeDiagnosis)">-D $(_XmakeCommonFlags)</_XmakeCommonFlags> + <_XmakeCommonFlags>$(XmakeCommonFlags.Trim())</_XmakeCommonFlags> + <_XmakeCommonFlags>$(_XmakeCommonFlags) $(_XmakeProjectFlag)</_XmakeCommonFlags> - <_XmakeBuilDir>$([MSBuild]::MakeRelative('$(XmakeProjectDir)', '$(XmakeBuilDir)').TrimEnd('/\'.ToCharArray()))</_XmakeBuilDir> + <_XmakeBuilDir>$([MSBuild]::MakeRelative('$(XmakeProjectDir)', '$(XmakeBuilDir)').TrimEnd('/\'.ToCharArray()))</_XmakeBuilDir> - <_XmakeConfigFlags>$(XmakeConfigFlags.Trim())</_XmakeConfigFlags> - <_XmakeConfigFlags>-p $(XmakePlat) -m $(XmakeMode) -a $(XmakeArch) -o "$(_XmakeBuilDir)" $(_XmakeConfigFlags)</_XmakeConfigFlags> + <_XmakeConfigFlags>$(XmakeConfigFlags.Trim())</_XmakeConfigFlags> + <_XmakeConfigFlags>-p $(XmakePlat) -m $(XmakeMode) -a $(XmakeArch) -o "$(_XmakeBuilDir)" $(_XmakeConfigFlags)</_XmakeConfigFlags> - <_XmakeBuildFlags>$(XmakeBuildFlags.Trim())</_XmakeBuildFlags> - <_XmakeBuildFlags Condition="$(XmakeWarning)">$(_XmakeBuildFlags) -w</_XmakeBuildFlags> - - <_XmakeCleanFlags>$(XmakeCleanFlags.Trim())</_XmakeCleanFlags> + <_XmakeBuildFlags>$(XmakeBuildFlags.Trim())</_XmakeBuildFlags> + <_XmakeBuildFlags Condition="$(XmakeWarning)">-w $(_XmakeBuildFlags)</_XmakeBuildFlags> + + <_XmakeCleanFlags>$(XmakeCleanFlags.Trim())</_XmakeCleanFlags> - <_XmakeBuildFlags>$(_XmakeBuildFlags.Trim())</_XmakeBuildFlags> - <_XmakeCleanFlags>$(_XmakeCleanFlags.Trim())</_XmakeCleanFlags> - <_XmakeConfigFlags>$(_XmakeConfigFlags.Trim())</_XmakeConfigFlags> - <_XmakeCommonFlags>$(_XmakeCommonFlags.Trim())</_XmakeCommonFlags> + <_XmakeBuildFlags>$(_XmakeBuildFlags.Trim())</_XmakeBuildFlags> + <_XmakeCleanFlags>$(_XmakeCleanFlags.Trim())</_XmakeCleanFlags> + <_XmakeConfigFlags>$(_XmakeConfigFlags.Trim())</_XmakeConfigFlags> + <_XmakeCommonFlags>$(_XmakeCommonFlags.Trim())</_XmakeCommonFlags> - <_XmakeExecutable>"$([System.IO.Path]::GetFullPath('$(XmakeProgramDir)xmake.exe'))"</_XmakeExecutable> - <_XmakeEnv> - pushd "$(XmakeProjectDir)" - set XMAKE_CONFIGDIR=$(XmakeConfigDir) - set XMAKE_PROGRAM_DIR=$(XmakeProgramDir) - </_XmakeEnv> - </PropertyGroup> + <_XmakeExecutable>"$([System.IO.Path]::GetFullPath('$(XmakeProgramDir)xmake.exe'))"</_XmakeExecutable> + <_XmakeEnv> + pushd "$(XmakeProjectDir)" + set XMAKE_CONFIGDIR=$(XmakeConfigDir) + set XMAKE_PROGRAM_DIR=$(XmakeProgramDir) + </_XmakeEnv> + </PropertyGroup> - <Target Name="_XmakeProjCheck"> - <Warning Condition="'$(XmakeCudaVersion)' != '' And !Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets')" - 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('$(XmakeProgramDir)\xmake.exe')" - Text="xmake.exe not found at '$(XmakeProgramDir)', please set XMAKE_PROGRAM_DIR in environments or XmakeProgramDir in vcxproj file" /> - <Error Condition="'$(XmakeProjectFile)' == '' And !Exists('$(XmakeProjectDir)\xmake.lua')" - Text="xmake.lua not found at '$(XmakeProjectDir)', please set XmakeProjectDir in vcxproj file" /> - <Error Condition="'$(XmakeProjectFile)' != '' And !Exists('$(XmakeProjectDir)\$(XmakeProjectFile)')" - Text="$(XmakeProjectFile) not found at '$(XmakeProjectDir)', please set XmakeProjectDir in vcxproj file" /> - </Target> - <Target Name="_XmakeConfig" DependsOnTargets="_XmakeProjCheck"> - <Message Text="$xmake config $(_XmakeCommonFlags) $(_XmakeConfigFlags) $(XmakeTarget)" Importance="High" /> - <Exec Command="$(_XmakeEnv) -$(_XmakeExecutable) config $(_XmakeCommonFlags) $(_XmakeConfigFlags) $(XmakeTarget)" EchoOff="true"/> - </Target> - <Target Name="_XmakeReconfig" DependsOnTargets="_XmakeProjCheck"> - <Message Text="$xmake config $(_XmakeCommonFlags) -c $(_XmakeConfigFlags) $(XmakeTarget)" Importance="High" /> - <Exec Command="$(_XmakeEnv) -$(_XmakeExecutable) config $(_XmakeCommonFlags) -c $(_XmakeConfigFlags) $(XmakeTarget)" EchoOff="true"/> - </Target> - <Target Name="_XmakeBuild" DependsOnTargets="_XmakeProjCheck"> - <Message Text="$xmake build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(XmakeTarget)" Importance="High" /> - <Exec Command="$(_XmakeEnv) -$(_XmakeExecutable) build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(XmakeTarget)" EchoOff="true"/> - </Target> - <Target Name="_XmakeClean" DependsOnTargets="_XmakeProjCheck"> - <Message Text="$xmake clean $(_XmakeCommonFlags) -a $(_XmakeCleanFlags) $(XmakeTarget)" Importance="High" /> - <Exec Command="$(_XmakeEnv) -$(_XmakeExecutable) clean $(_XmakeCommonFlags) -a $(_XmakeCleanFlags) $(XmakeTarget)" EchoOff="true"/> - </Target> + <Target Name="_XmakeProjCheck"> + <Warning Condition="'$(XmakeCudaVersion)' != '' And !Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets')" + 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('$(XmakeProgramDir)\xmake.exe')" + Text="xmake.exe not found at '$(XmakeProgramDir)', please set XMAKE_PROGRAM_DIR in environments or XmakeProgramDir in vcxproj file" /> + <Error Condition="'$(XmakeProjectFile)' == '' And !Exists('$(XmakeProjectDir)\xmake.lua')" + Text="xmake.lua not found at '$(XmakeProjectDir)', please set XmakeProjectDir in vcxproj file" /> + <Error Condition="'$(XmakeProjectFile)' != '' And !Exists('$(XmakeProjectDir)\$(XmakeProjectFile)')" + Text="$(XmakeProjectFile) not found at '$(XmakeProjectDir)', please set XmakeProjectDir in vcxproj file" /> + </Target> + <Target Name="_XmakeConfig" DependsOnTargets="_XmakeProjCheck"> + <Message Text="$xmake config $(_XmakeCommonFlags) $(_XmakeConfigFlags) $(XmakeTarget)" Importance="High" /> + <Exec Command="$(_XmakeEnv) + $(_XmakeExecutable) config $(_XmakeCommonFlags) $(_XmakeConfigFlags) $(XmakeTarget)" EchoOff="true"/> + </Target> + <Target Name="_XmakeReconfig" DependsOnTargets="_XmakeProjCheck"> + <Message Text="$xmake config $(_XmakeCommonFlags) -c $(_XmakeConfigFlags) $(XmakeTarget)" Importance="High" /> + <Exec Command="$(_XmakeEnv) + $(_XmakeExecutable) config $(_XmakeCommonFlags) -c $(_XmakeConfigFlags) $(XmakeTarget)" EchoOff="true"/> + </Target> + <Target Name="_XmakeBuild" DependsOnTargets="_XmakeProjCheck"> + <Message Text="$xmake build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(XmakeTarget)" Importance="High" /> + <Exec Command="$(_XmakeEnv) + $(_XmakeExecutable) build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(XmakeTarget)" EchoOff="true"/> + </Target> + <Target Name="_XmakeBuildFile" DependsOnTargets="_XmakeProjCheck"> + <ItemGroup> + <SelectedFile Include="$(SelectedFiles)"/> + <File Include="$([MSBuild]::MakeRelative('$(XmakeProjectDir)', $([System.IO.Path]::GetFullPath('%(SelectedFile.Identity)'))))"/> + </ItemGroup> + <PropertyGroup> + <FileList>@(File)</FileList> + <FileFlag>--files="$(FileList)"</FileFlag> + </PropertyGroup> + <Message Text="$xmake build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(FileFlag) $(XmakeTarget)" Importance="High" /> + <Exec Command="$(_XmakeEnv) + $(_XmakeExecutable) build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(FileFlag) $(XmakeTarget)" EchoOff="true"/> + </Target> + <Target Name="_XmakeClean" DependsOnTargets="_XmakeProjCheck"> + <Message Text="$xmake clean $(_XmakeCommonFlags) -a $(_XmakeCleanFlags) $(XmakeTarget)" Importance="High" /> + <Exec Command="$(_XmakeEnv) + $(_XmakeExecutable) clean $(_XmakeCommonFlags) -a $(_XmakeCleanFlags) $(XmakeTarget)" EchoOff="true"/> + </Target> - <Target Name="Show"> - <Message Text=" + <Target Name="Show"> + <Message Text=" MSBuild Properties: - Xmake Props: - XmakeTarget: $(XmakeTarget) - 'XmakePlat|Mode|Arch': '$(XmakePlat)|$(XmakeMode)|$(XmakeArch)' - XmakeBasename: $(XmakeBasename) - XmakeFilename: $(XmakeFilename) - XmakeKind: $(XmakeKind) - XmakeCudaVersion: $(XmakeCudaVersion) - XmakeMfcKind: $(XmakeMfcKind) - XmakeDefines: $(XmakeDefines) - XmakeLanguages: $(XmakeLanguages) - Xmake Path: - XmakeProgramDir: $(XmakeProgramDir) - XmakeProjectDir: $(XmakeProjectDir) - XmakeScriptDir: $(XmakeScriptDir) - XmakeBuilDir: $(XmakeBuilDir) - XmakeConfigDir: $(XmakeConfigDir) - XmakeConfigFileDir: $(XmakeConfigFileDir) - XmakeIncludeDir: $(XmakeIncludeDir) - XmakeLinkDir: $(XmakeLinkDir) - Xmake Flags: - XmakeWarning: $(XmakeWarning) - XmakeVerbose: $(XmakeVerbose) - XmakeDiagnosis: $(XmakeDiagnosis) - XmakeCommonFlags: $(XmakeCommonFlags) - XmakeConfigFlags: $(XmakeConfigFlags) - XmakeBuildFlags: $(XmakeBuildFlags) - XmakeCleanFlags: $(XmakeCleanFlags) - Xmake Internal: - _XmakeCommonFlags: $(_XmakeCommonFlags) - _XmakeConfigFlags: $(_XmakeConfigFlags) - _XmakeBuildFlags: $(_XmakeBuildFlags) - _XmakeCleanFlags: $(_XmakeCleanFlags) - _XmakeExecutable: $(_XmakeExecutable) - _XmakeEnv: $(_XmakeEnv) - Vs Props: - 'Configuration|Platform': '$(Configuration)|$(Platform)' - VisualStudioVersion: $(VisualStudioVersion) - MSBuildProjectDirectory: $(MSBuildProjectDirectory) - MSBuildProjectName: $(MSBuildProjectName) - OutDir: $(OutDir) - IntDir: $(IntDir) - TargetName: $(TargetName) - TargetExt: $(TargetExt) - PlatformToolset: $(PlatformToolset) - CharacterSet: $(CharacterSet) - UseOfMfc: $(UseOfMfc) - WindowsTargetPlatformVersion: $(WindowsTargetPlatformVersion) - PreprocessorDefinitions: %(ClCompile.PreprocessorDefinitions) - LanguageStandard: %(ClCompile.LanguageStandard) - " Importance="High" /> - </Target> + Xmake Props: + XmakeTarget: $(XmakeTarget) + 'XmakePlat|Mode|Arch': '$(XmakePlat)|$(XmakeMode)|$(XmakeArch)' + XmakeBasename: $(XmakeBasename) + XmakeFilename: $(XmakeFilename) + XmakeKind: $(XmakeKind) + XmakeCudaVersion: $(XmakeCudaVersion) + XmakeMfcKind: $(XmakeMfcKind) + XmakeDefines: $(XmakeDefines) + XmakeLanguages: $(XmakeLanguages) + Xmake Path: + XmakeProgramDir: $(XmakeProgramDir) + XmakeProjectDir: $(XmakeProjectDir) + XmakeScriptDir: $(XmakeScriptDir) + XmakeBuilDir: $(XmakeBuilDir) + XmakeConfigDir: $(XmakeConfigDir) + XmakeConfigFileDir: $(XmakeConfigFileDir) + XmakeIncludeDir: $(XmakeIncludeDir) + XmakeLinkDir: $(XmakeLinkDir) + Xmake Flags: + XmakeWarning: $(XmakeWarning) + XmakeVerbose: $(XmakeVerbose) + XmakeDiagnosis: $(XmakeDiagnosis) + XmakeCommonFlags: $(XmakeCommonFlags) + XmakeConfigFlags: $(XmakeConfigFlags) + XmakeBuildFlags: $(XmakeBuildFlags) + XmakeCleanFlags: $(XmakeCleanFlags) + Xmake Internal: + _XmakeCommonFlags: $(_XmakeCommonFlags) + _XmakeConfigFlags: $(_XmakeConfigFlags) + _XmakeBuildFlags: $(_XmakeBuildFlags) + _XmakeCleanFlags: $(_XmakeCleanFlags) + _XmakeExecutable: $(_XmakeExecutable) + _XmakeEnv: $(_XmakeEnv) + Vs Props: + 'Configuration|Platform': '$(Configuration)|$(Platform)' + VisualStudioVersion: $(VisualStudioVersion) + MSBuildProjectDirectory: $(MSBuildProjectDirectory) + MSBuildProjectName: $(MSBuildProjectName) + OutDir: $(OutDir) + IntDir: $(IntDir) + TargetName: $(TargetName) + TargetExt: $(TargetExt) + PlatformToolset: $(PlatformToolset) + CharacterSet: $(CharacterSet) + UseOfMfc: $(UseOfMfc) + WindowsTargetPlatformVersion: $(WindowsTargetPlatformVersion) + PreprocessorDefinitions: %(ClCompile.PreprocessorDefinitions) + LanguageStandard: %(ClCompile.LanguageStandard) + SelectedFiles: $(SelectedFiles) + " Importance="High" /> + </Target> + + <Target Name="BeforeBuild" /> + <Target Name="AfterBuild" /> + <Target Name="Build" Condition="'$(DesignTimeBuild)' != 'true'"> + <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" /> + <CallTarget Targets="BeforeBuild" /> + <CallTarget Targets="_XmakeConfig;_XmakeBuild" /> + <CallTarget Targets="AfterBuild" /> + </Target> + + <Target Name="BeforeClean" /> + <Target Name="AfterClean" /> + <Target Name="Clean" Condition="'$(DesignTimeBuild)' != 'true'"> + <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" /> + <CallTarget Targets="BeforeClean" /> + <CallTarget Targets="_XmakeClean;_XmakeReconfig" /> + <CallTarget Targets="AfterClean" /> + </Target> - <Target Name="BeforeBuild" /> - <Target Name="AfterBuild" /> - <Target Name="Build" Condition="'$(DesignTimeBuild)' != 'true'"> - <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" /> - <CallTarget Targets="BeforeBuild" /> - <CallTarget Targets="_XmakeConfig;_XmakeBuild" /> - <CallTarget Targets="AfterBuild" /> - </Target> + <Target Name="BeforeRebuild" /> + <Target Name="AfterRebuild" /> + <Target Name="Rebuild" Condition="'$(DesignTimeBuild)' != 'true'"> + <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" /> + <CallTarget Targets="BeforeRebuild" /> + <CallTarget Targets="BeforeClean" /> + <CallTarget Targets="_XmakeClean;_XmakeReconfig" /> + <CallTarget Targets="AfterClean" /> + <CallTarget Targets="BeforeBuild" /> + <CallTarget Targets="_XmakeBuild" /> + <CallTarget Targets="AfterBuild" /> + <CallTarget Targets="AfterRebuild" /> + </Target> - <Target Name="BeforeClean" /> - <Target Name="AfterClean" /> - <Target Name="Clean" Condition="'$(DesignTimeBuild)' != 'true'"> - <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" /> - <CallTarget Targets="BeforeClean" /> - <CallTarget Targets="_XmakeClean;_XmakeReconfig" /> - <CallTarget Targets="AfterClean" /> - </Target> - <Target Name="BeforeRebuild" /> - <Target Name="AfterRebuild" /> - <Target Name="Rebuild" Condition="'$(DesignTimeBuild)' != 'true'"> - <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" /> - <CallTarget Targets="BeforeRebuild" /> - <CallTarget Targets="BeforeClean" /> - <CallTarget Targets="_XmakeClean;_XmakeReconfig" /> - <CallTarget Targets="AfterClean" /> - <CallTarget Targets="BeforeBuild" /> - <CallTarget Targets="_XmakeBuild" /> - <CallTarget Targets="AfterBuild" /> - <CallTarget Targets="AfterRebuild" /> - </Target> + <Target Name="BeforeBuildFiles" /> + <Target Name="AfterBuildFiles" /> + <Target Name="ClCompile"> + <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" /> + <CallTarget Targets="BeforeBuildFiles" /> + <CallTarget Targets="_XmakeConfig;_XmakeBuildFile" /> + <CallTarget Targets="AfterBuildFiles" /> + </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')" - Project="$(MSBuildProjectDirectory)\..\Xmake.Custom.targets" /> - </ImportGroup> + <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')" + Project="$(MSBuildProjectDirectory)\..\Xmake.Custom.targets" /> + </ImportGroup> </Project> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/#target#.vcxproj.user b/xmake/plugins/project/vsxmake/vsproj/templates/#target#.vcxproj.user index 399b00e30..a994443e1 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/#target#.vcxproj.user +++ b/xmake/plugins/project/vsxmake/vsproj/templates/#target#.vcxproj.user @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <LocalDebuggerCommandArguments></LocalDebuggerCommandArguments> - <LocalDebuggerWorkingDirectory>$(XmakeRunDir)</LocalDebuggerWorkingDirectory> - <LocalDebuggerEnvironment>$(XmakeRunEnvs) + <PropertyGroup> + <LocalDebuggerCommandArguments></LocalDebuggerCommandArguments> + <LocalDebuggerWorkingDirectory>$(XmakeRunDir)</LocalDebuggerWorkingDirectory> + <LocalDebuggerEnvironment>$(XmakeRunEnvs) $(LocalDebuggerEnvironment)</LocalDebuggerEnvironment> - <LocalDebuggerMergeEnvironment>true</LocalDebuggerMergeEnvironment> - </PropertyGroup> + <LocalDebuggerMergeEnvironment>true</LocalDebuggerMergeEnvironment> + </PropertyGroup> </Project>
\ No newline at end of file diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.props b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.props index 6f47fe7a0..55f596456 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.props +++ b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.props @@ -1,35 +1,50 @@ <?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <!-- inherit parent settings --> - <Import Condition="Exists('$(MSBuildThisFileDirectory)\..\Xmake.Custom.props')" - Project="$(MSBuildThisFileDirectory)\..\Xmake.Custom.props" /> - - <PropertyGroup Label="XmakePaths"> - <!-- set environment XMAKE_CONFIGDIR for xmake tasks --> - <!-- - <XmakeConfigDir Condition="'$(XmakeMode)|$(XmakeArch)' == 'release|x86'">$(XmakeProjectDir)\.xmake</XmakeConfigDir> - <XmakeBuilDir>$(XmakeProjectDir)\build</XmakeBuilDir> - --> - </PropertyGroup> + <!-- inherit parent settings --> + <Import Condition="Exists('$(MSBuildThisFileDirectory)\..\Xmake.Custom.props')" + Project="$(MSBuildThisFileDirectory)\..\Xmake.Custom.props" /> + + <PropertyGroup Label="XmakePaths"> + <!-- set environment XMAKE_CONFIGDIR for xmake tasks --> + <!-- <XmakeConfigDir Condition="'$(XmakeMode)|$(XmakeArch)' == 'release|x86'">$(XmakeProjectDir)\.xmake</XmakeConfigDir> --> - <PropertyGroup Label="XmakeFlags"> - <!-- Configure these flags to customize xmake build process --> - <!-- - Inherit parents: - <XmakeCleanFlags>$(XmakeCleanflags) -D</XmakeCleanFlags> - Override parents: - <XmakeCleanFlags>-D</XmakeCleanFlags> - Respect parents: - <XmakeCleanFlags Condition=" '$(XmakeCleanFlags)' == '' ">-D</XmakeCleanFlags> + <!-- set output dir for xmake tasks --> + <!-- <XmakeBuilDir>$(XmakeProjectDir)\build</XmakeBuilDir> --> + </PropertyGroup> - For -w, -v and -D, use <XmakeWarning>, <XmakeVerbose> and <XmakeDiagnosis> is more convenient. - --> - <XmakeWarning Condition="'$(XmakeWarning)' == ''">true</XmakeWarning> - <XmakeVerbose Condition="'$(XmakeVerbose)' == ''">false</XmakeVerbose> - <XmakeDiagnosis Condition="'$(XmakeDiagnosis)' == ''">false</XmakeDiagnosis> - <XmakeCleanFlags>$(XmakeCleanflags)</XmakeCleanFlags> - <XmakeBuildFlags>$(XmakeBuildFlags)</XmakeBuildFlags> - <XmakeConfigFlags>$(XmakeConfigFlags)</XmakeConfigFlags> - <XmakeCommonFlags>$(XmakeCommonFlags)</XmakeCommonFlags> - </PropertyGroup> + <PropertyGroup Label="XmakeFlags"> + <!-- Configure these flags to customize xmake build process --> + <!-- + Inherit parents: + <XmakeCleanFlags>$(XmakeCleanflags) -D</XmakeCleanFlags> + Override parents: + <XmakeCleanFlags>-D</XmakeCleanFlags> + Respect parents: + <XmakeCleanFlags Condition=" '$(XmakeCleanFlags)' == '' ">-D</XmakeCleanFlags> + + For -w, -v and -D, use <XmakeWarning>, <XmakeVerbose> and <XmakeDiagnosis> is more convenient. + --> + + <!-- Set -w for "xmake build" --> + <!-- <XmakeWarning Condition="'$(XmakeWarning)' == ''">true</XmakeWarning> --> + + <!-- Set -v for all xmake call --> + <!-- <XmakeVerbose Condition="'$(XmakeVerbose)' == ''">false</XmakeVerbose> --> + + <!-- Set -D for all xmake call --> + <!-- <XmakeDiagnosis Condition="'$(XmakeDiagnosis)' == ''">false</XmakeDiagnosis> --> + + + <!-- Additional flags for "xmake clean" --> + <XmakeCleanFlags>$(XmakeCleanflags)</XmakeCleanFlags> + + <!-- Additional flags for "xmake build" --> + <XmakeBuildFlags>$(XmakeBuildFlags)</XmakeBuildFlags> + + <!-- Additional flags for "xmake config" --> + <XmakeConfigFlags>$(XmakeConfigFlags)</XmakeConfigFlags> + + <!-- Additional flags for all xmake call --> + <XmakeCommonFlags>$(XmakeCommonFlags)</XmakeCommonFlags> + </PropertyGroup> </Project> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.targets b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.targets index c63cbed32..8a5153db8 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.targets +++ b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.targets @@ -1,27 +1,29 @@ <?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <!-- inherit parent settings --> - <Import Condition="Exists('$(MSBuildThisFileDirectory)\..\Xmake.Custom.targets')" - Project="$(MSBuildThisFileDirectory)\..\Xmake.Custom.targets" /> + <!-- inherit parent settings --> + <Import Condition="Exists('$(MSBuildThisFileDirectory)\..\Xmake.Custom.targets')" + Project="$(MSBuildThisFileDirectory)\..\Xmake.Custom.targets" /> - <!-- Override these targets to customize your build workflow --> - <!-- - If you uncomment targets below, - targets with same name that comes from ../Xmake.Custom.targets will be overrided. + <!-- Override these targets to customize your build workflow --> + <!-- + If you uncomment targets below, + targets with same name that comes from ../Xmake.Custom.targets will be overrided. - You can also define your own targets and call them like: - <Target Name="BeforeBuild"> - <CallTarget Targets="CustomStep1;CustomStep2" /> - </Target> - - To find task that you can used in custom targets, - see: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-task-reference - --> + You can also define your own targets and call them like: + <Target Name="BeforeBuild"> + <CallTarget Targets="CustomStep1;CustomStep2" /> + </Target> + + To find task that you can used in custom targets, + see: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-task-reference + --> - <!-- <Target Name="BeforeRebuild"></Target> --> - <!-- <Target Name="AfterRebuild"></Target> --> - <!-- <Target Name="BeforeBuild"></Target> --> - <!-- <Target Name="AfterBuild"></Target> --> - <!-- <Target Name="BeforeClean"></Target> --> - <!-- <Target Name="AfterClean"></Target> --> + <!-- <Target Name="BeforeRebuild"></Target> --> + <!-- <Target Name="AfterRebuild"></Target> --> + <!-- <Target Name="BeforeBuild"></Target> --> + <!-- <Target Name="AfterBuild"></Target> --> + <!-- <Target Name="BeforeClean"></Target> --> + <!-- <Target Name="AfterClean"></Target> --> + <!-- <Target Name="BeforeBuildFiles"></Target> --> + <!-- <Target Name="AfterBuildFiles"></Target> --> </Project> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters index c79ec740a..a4c6cf5c1 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters @@ -2,45 +2,45 @@ <!-- #xmake_info# - This file is auto generated by xmake. + This file is auto generated by xmake. - Please DO NOT EDIT since all your modification will lost after re-generation. - See https://github.com/xmake-io/xmake/pull/472 for more infomation. + Please DO NOT EDIT since all your modification will lost after re-generation. + See https://github.com/xmake-io/xmake/pull/472 for more infomation. --> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Properties"> - <UniqueIdentifier>{CC7C6180-942D-056E-3227-E6A2B3FB19CD}</UniqueIdentifier> - </Filter> + <ItemGroup> + <Filter Include="Properties"> + <UniqueIdentifier>{CC7C6180-942D-056E-3227-E6A2B3FB19CD}</UniqueIdentifier> + </Filter> #Import(Filter)# - </ItemGroup> - <ItemGroup> - <None Include="Xmake.Custom.props"> - <Filter>Properties</Filter> - </None> - <None Include="Xmake.Custom.targets"> - <Filter>Properties</Filter> - </None> - <None Include="$(XmakeScriptDir)\xmake.lua"> - <Filter>Properties</Filter> - </None> - </ItemGroup> - <ItemGroup> + </ItemGroup> + <ItemGroup> + <None Include="Xmake.Custom.props"> + <Filter>Properties</Filter> + </None> + <None Include="Xmake.Custom.targets"> + <Filter>Properties</Filter> + </None> + <None Include="$(XmakeScriptDir)\xmake.lua"> + <Filter>Properties</Filter> + </None> + </ItemGroup> + <ItemGroup> #Import(Include)# - </ItemGroup> - <ItemGroup> + </ItemGroup> + <ItemGroup> #Import(File.c)# - </ItemGroup> - <ItemGroup> + </ItemGroup> + <ItemGroup> #Import(File.cxx)# - </ItemGroup> - <ItemGroup> + </ItemGroup> + <ItemGroup> #Import(File.cu)# - </ItemGroup> - <ItemGroup> + </ItemGroup> + <ItemGroup> #Import(File.obj)# - </ItemGroup> - <ItemGroup> + </ItemGroup> + <ItemGroup> #Import(File.rc)# - </ItemGroup> + </ItemGroup> </Project> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec) index d33f87944..020488ce4 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec) @@ -1,3 +1,3 @@ - <ClCompile Include="#path#"> - <Filter>#dir#</Filter> - </ClCompile> + <ClCompile Include="$(XmakeProjectDir)#path#"> + <Filter>#dir#</Filter> + </ClCompile> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cu(filecu) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cu(filecu) index 643bb220f..520e88430 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cu(filecu) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cu(filecu) @@ -1,3 +1,3 @@ - <CudaCompile Include="#path#"> - <Filter>#dir#</Filter> - </CudaCompile> + <CudaCompile Include="$(XmakeProjectDir)#path#"> + <Filter>#dir#</Filter> + </CudaCompile> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cxx(filecxx) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cxx(filecxx) index d33f87944..020488ce4 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cxx(filecxx) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cxx(filecxx) @@ -1,3 +1,3 @@ - <ClCompile Include="#path#"> - <Filter>#dir#</Filter> - </ClCompile> + <ClCompile Include="$(XmakeProjectDir)#path#"> + <Filter>#dir#</Filter> + </ClCompile> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.obj(fileobj) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.obj(fileobj) index adacd3b67..5ee8281b7 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.obj(fileobj) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.obj(fileobj) @@ -1,3 +1,3 @@ - <Object Include="#path#"> - <Filter>#dir#</Filter> - </Object> + <Object Include="$(XmakeProjectDir)#path#"> + <Filter>#dir#</Filter> + </Object> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.rc(filerc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.rc(filerc) index a46047781..c1118ab55 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.rc(filerc) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.rc(filerc) @@ -1,3 +1,3 @@ - <ResourceCompile Include="#path#"> - <Filter>#dir#</Filter> - </ResourceCompile> + <ResourceCompile Include="$(XmakeProjectDir)#path#"> + <Filter>#dir#</Filter> + </ResourceCompile> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Filter(dir) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Filter(dir) index 6f97fa98d..763e5e83c 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Filter(dir) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Filter(dir) @@ -1,3 +1,3 @@ - <Filter Include="#dir#"> - <UniqueIdentifier>{#dir_id#}</UniqueIdentifier> - </Filter> + <Filter Include="#dir#"> + <UniqueIdentifier>{#dir_id#}</UniqueIdentifier> + </Filter> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc) index 17344346b..3a21dc7bf 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc) @@ -1,3 +1,3 @@ - <ClInclude Include="#path#"> - <Filter>#dir#</Filter> - </ClInclude> + <ClInclude Include="$(XmakeProjectDir)#path#"> + <Filter>#dir#</Filter> + </ClInclude> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj index d0e4e94d7..164140542 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj @@ -2,58 +2,58 @@ <!-- #xmake_info# - This file is auto generated by xmake. + This file is auto generated by xmake. - Please DO NOT EDIT since all your modification will lost after re-generation. - If you would like to have any customization, - edit Xmake.Custom.props and Xmake.Custom.targets instead. + Please DO NOT EDIT since all your modification will lost after re-generation. + If you would like to have any customization, + edit Xmake.Custom.props and Xmake.Custom.targets instead. - See https://github.com/xmake-io/xmake/pull/472 for more infomation. + See https://github.com/xmake-io/xmake/pull/472 for more infomation. --> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> + <ItemGroup Label="ProjectConfigurations"> #Import(ProjectConfiguration)# - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{#target_id#}</ProjectGuid> - <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">$(XMAKE_PROGRAM_DIR)</XmakeProgramDir> - <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">#programdir#</XmakeProgramDir> - <Configuration Condition="'$(Configuration)' == ''">release</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <XmakeScriptDir>#scriptdir#</XmakeScriptDir> - <XmakeProjectDir>#projectdir#</XmakeProjectDir> - <XmakeProjectFile>#projectfile#</XmakeProjectFile> - <XmakeTarget>#target#</XmakeTarget> - </PropertyGroup> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{#target_id#}</ProjectGuid> + <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">$(XMAKE_PROGRAM_DIR)</XmakeProgramDir> + <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">#programdir#</XmakeProgramDir> + <Configuration Condition="'$(Configuration)' == ''">release</Configuration> + <Platform Condition="'$(Platform)' == ''">Win32</Platform> + <XmakeScriptDir>#scriptdir#</XmakeScriptDir> + <XmakeProjectDir>#projectdir#</XmakeProjectDir> + <XmakeProjectFile>#projectfile#</XmakeProjectFile> + <XmakeTarget>#target#</XmakeTarget> + </PropertyGroup> #Import(XmakeConfig)# #Import(XmakePath)# - <Import Project="$(XmakeProgramDir)\plugins\project\vsxmake\vsproj\xmake.props" /> - <ItemGroup> - <None Include="Xmake.Custom.props" /> - <None Include="Xmake.Custom.targets" /> - <None Condition="'$(XmakeScriptDir)' != '$(XmakeProjectDir)' And Exists('$(XmakeScriptDir)\xmake.lua')" - Include="$(XmakeScriptDir)\xmake.lua" /> - </ItemGroup> - <ItemGroup> + <Import Project="$(XmakeProgramDir)\plugins\project\vsxmake\vsproj\xmake.props" /> + <ItemGroup> + <None Include="Xmake.Custom.props" /> + <None Include="Xmake.Custom.targets" /> + <None Condition="'$(XmakeScriptDir)' != '$(XmakeProjectDir)' And Exists('$(XmakeScriptDir)\xmake.lua')" + Include="$(XmakeScriptDir)\xmake.lua" /> + </ItemGroup> + <ItemGroup> #Import(Include)# - </ItemGroup> - <ItemGroup> + </ItemGroup> + <ItemGroup> #Import(File.c)# - </ItemGroup> - <ItemGroup> + </ItemGroup> + <ItemGroup> #Import(File.cxx)# - </ItemGroup> - <ItemGroup> + </ItemGroup> + <ItemGroup> #Import(File.cu)# - </ItemGroup> - <ItemGroup> + </ItemGroup> + <ItemGroup> #Import(File.obj)# - </ItemGroup> - <ItemGroup> + </ItemGroup> + <ItemGroup> #Import(File.rc)# - </ItemGroup> - <!-- <ItemGroup> + </ItemGroup> + <!-- <ItemGroup> #Import(ProjectRef)# - </ItemGroup> --> - <Import Project="$(XmakeProgramDir)\plugins\project\vsxmake\vsproj\xmake.targets" /> + </ItemGroup> --> + <Import Project="$(XmakeProgramDir)\plugins\project\vsxmake\vsproj\xmake.targets" /> </Project> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.c(filec) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.c(filec) index 36e16832a..68c1a7d5b 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.c(filec) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.c(filec) @@ -1,3 +1,3 @@ - <ClCompile Include="#path#"> - <CompileAs>CompileAsC</CompileAs> - </ClCompile> + <ClCompile Include="$(XmakeProjectDir)#path#"> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cu(filecu) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cu(filecu) index 7b3f0a6fe..1d1d98f7d 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cu(filecu) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cu(filecu) @@ -1 +1 @@ - <CudaCompile Include="#path#" /> + <CudaCompile Include="$(XmakeProjectDir)#path#" /> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx) index 076adfd5a..a8534b74b 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx) @@ -1,3 +1,3 @@ - <ClCompile Include="#path#"> - <CompileAs>CompileAsCpp</CompileAs> - </ClCompile> + <ClCompile Include="$(XmakeProjectDir)#path#"> + <CompileAs>CompileAsCpp</CompileAs> + </ClCompile> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.obj(fileobj) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.obj(fileobj) index 1e7cd6f45..5c858884d 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.obj(fileobj) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.obj(fileobj) @@ -1 +1 @@ - <Object Include="#path#" /> + <Object Include="$(XmakeProjectDir)#path#" /> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.rc(filerc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.rc(filerc) index 25d1c58ab..e15b89bbe 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.rc(filerc) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.rc(filerc) @@ -1 +1 @@ - <ResourceCompile Include="#path#" /> + <ResourceCompile Include="$(XmakeProjectDir)#path#" /> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc) index 0178e0f9a..dfd5df637 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc) @@ -1 +1 @@ - <ClInclude Include="#path#" /> + <ClInclude Include="$(XmakeProjectDir)#path#" /> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectConfiguration(mode,arch) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectConfiguration(mode,arch) index f2169767f..f2d2eac47 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectConfiguration(mode,arch) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectConfiguration(mode,arch) @@ -1,4 +1,4 @@ - <ProjectConfiguration Include="#mode#|#arch#"> - <Configuration>#mode#</Configuration> - <Platform>#vsarch#</Platform> - </ProjectConfiguration> + <ProjectConfiguration Include="#mode#|#arch#"> + <Configuration>#mode#</Configuration> + <Platform>#vsarch#</Platform> + </ProjectConfiguration> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectRef(dep) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectRef(dep) index 7804e4cba..33434eca3 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectRef(dep) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectRef(dep) @@ -1,3 +1,3 @@ - <ProjectReference Include="..\#target#\#target#.vcxproj"> - <Project>{#target_id#}</Project> - </ProjectReference> + <ProjectReference Include="..\#target#\#target#.vcxproj"> + <Project>{#target_id#}</Project> + </ProjectReference> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) index da73700f4..341c807f9 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) @@ -1,13 +1,13 @@ - <PropertyGroup Label="XmakeConfig" Condition="'$(Configuration)|$(Platform)'=='#mode#|#vsarch#'"> - <XmakeBasename>#basename#</XmakeBasename> - <XmakeFilename>#filename#</XmakeFilename> - <XmakeMode>#mode#</XmakeMode> - <XmakePlat>#plat#</XmakePlat> - <XmakeArch>#arch#</XmakeArch> - <XmakeKind>#kind#</XmakeKind> - <XmakeDefines>#defines#</XmakeDefines> - <XmakeLanguages>#languages#</XmakeLanguages> - <XmakeCudaVersion>#cudaver#</XmakeCudaVersion> - <XmakeMfcKind>#mfckind#</XmakeMfcKind> - <XmakeRunEnvs>#runenvs#</XmakeRunEnvs> - </PropertyGroup> + <PropertyGroup Label="XmakeConfig" Condition="'$(Configuration)|$(Platform)'=='#mode#|#vsarch#'"> + <XmakeBasename>#basename#</XmakeBasename> + <XmakeFilename>#filename#</XmakeFilename> + <XmakeMode>#mode#</XmakeMode> + <XmakePlat>#plat#</XmakePlat> + <XmakeArch>#arch#</XmakeArch> + <XmakeKind>#kind#</XmakeKind> + <XmakeDefines>#defines#</XmakeDefines> + <XmakeLanguages>#languages#</XmakeLanguages> + <XmakeCudaVersion>#cudaver#</XmakeCudaVersion> + <XmakeMfcKind>#mfckind#</XmakeMfcKind> + <XmakeRunEnvs>#runenvs#</XmakeRunEnvs> + </PropertyGroup> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) index 2c8adc429..42644b1f5 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) @@ -1,9 +1,9 @@ - <PropertyGroup Label="XmakePath" Condition="'$(Configuration)|$(Platform)'=='#mode#|#vsarch#'"> - <XmakeBuilDir>#buildir#</XmakeBuilDir> - <XmakeConfigDir>#configdir#</XmakeConfigDir> - <XmakeConfigFileDir>#configfiledir#</XmakeConfigFileDir> - <XmakeTargetDir>#targetdir#</XmakeTargetDir> - <XmakeIncludeDir>#includedirs#</XmakeIncludeDir> - <XmakeLinkDir>#linkdirs#</XmakeLinkDir> - <XmakeRunDir>#rundir#</XmakeRunDir> - </PropertyGroup> + <PropertyGroup Label="XmakePath" Condition="'$(Configuration)|$(Platform)'=='#mode#|#vsarch#'"> + <XmakeBuilDir>#buildir#</XmakeBuilDir> + <XmakeConfigDir>#configdir#</XmakeConfigDir> + <XmakeConfigFileDir>#configfiledir#</XmakeConfigFileDir> + <XmakeTargetDir>#targetdir#</XmakeTargetDir> + <XmakeIncludeDir>#includedirs#</XmakeIncludeDir> + <XmakeLinkDir>#linkdirs#</XmakeLinkDir> + <XmakeRunDir>#rundir#</XmakeRunDir> + </PropertyGroup> diff --git a/xmake/plugins/project/vsxmake/vsxmake.lua b/xmake/plugins/project/vsxmake/vsxmake.lua index cf91eb40e..348138ed7 100644 --- a/xmake/plugins/project/vsxmake/vsxmake.lua +++ b/xmake/plugins/project/vsxmake/vsxmake.lua @@ -45,6 +45,35 @@ function _filter_files(files, exts) return f end +-- escape special chars in msbuild file +function _escape(str) + if not str then + return nil + end + + local map = + { ["%"] = "%25" -- Referencing metadata + ,["$"] = "%24" -- Referencing properties + ,["@"] = "%40" -- Referencing item lists + ,["'"] = "%27" -- Conditions and other expressions + ,[";"] = "%3B" -- List separator + ,["?"] = "%3F" -- Wildcard character for file names in Include and Exclude attributes + ,["*"] = "%2A" -- Wildcard character for use in file names in Include and Exclude attributes + } + + local has_prefix = false + if str:startswith("$(XmakeProjectDir)") then + has_prefix = true + str = str:sub(#("$(XmakeProjectDir)") + 1) + end + + str = (string.gsub(str, "[%%%$@'\";%?%*]", function (c) return assert(map[c]) end)) + if has_prefix then + str = "$(XmakeProjectDir)" .. str + end + return str +end + function _buildparams(info, target, default) local function getprop(match, opt) @@ -62,7 +91,7 @@ function _buildparams(info, target, default) r = i[match] or r end - return r or default + return _escape(r) or default end local function listconfig(args) |
