diff options
| author | ruki <[email protected]> | 2026-04-19 22:59:34 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-19 22:59:34 +0800 |
| commit | 1813ff50ab7bd0cbddd2d7f9e510f7a2309fa4c9 (patch) | |
| tree | ca11c14b9f0d213c2fe39953999e02770d55c072 /xmake/scripts | |
| parent | fabb25749492d6b26887da0217486bfbfd104bdd (diff) | |
| parent | 839a0b74facd029e4b13aa2a6657abfdaa445964 (diff) | |
Merge pull request #7489 from xmake-io/csharp
vsxmake: generate .csproj for C# targets
Diffstat (limited to 'xmake/scripts')
13 files changed, 260 insertions, 14 deletions
diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets b/xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets new file mode 100644 index 000000000..2ac8336f5 --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets @@ -0,0 +1,165 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + + <PropertyGroup Label="XmakePathsResolve"> + <XmakeBuildDirResolved>$(XmakeBuildDir)</XmakeBuildDirResolved> + <XmakeTargetDirResolved>$(XmakeTargetDir)</XmakeTargetDirResolved> + <XmakeConfigDirResolved>$(XmakeConfigDir)</XmakeConfigDirResolved> + <XmakeConfigFileDirResolved>$(XmakeConfigFileDir)</XmakeConfigFileDirResolved> + <XmakeRunDirResolved>$(XmakeRunDir)</XmakeRunDirResolved> + + <!-- resolve if they are relative paths --> + <XmakeBuildDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeBuildDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuildDirResolved)'))</XmakeBuildDirResolved> + <XmakeTargetDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeTargetDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeTargetDirResolved)'))</XmakeTargetDirResolved> + <XmakeConfigDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeConfigDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigDirResolved)'))</XmakeConfigDirResolved> + <XmakeConfigFileDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeConfigFileDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigFileDirResolved)'))</XmakeConfigFileDirResolved> + <XmakeRunDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeRunDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeRunDirResolved)'))</XmakeRunDirResolved> + + <!-- normalize paths --> + <XmakeBuildDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeBuildDirResolved)/'))</XmakeBuildDirResolved> + <XmakeTargetDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeTargetDirResolved)/'))</XmakeTargetDirResolved> + <XmakeConfigDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeConfigDirResolved)/'))</XmakeConfigDirResolved> + <XmakeConfigFileDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeConfigFileDirResolved)/'))</XmakeConfigFileDirResolved> + <XmakeRunDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeRunDirResolved)/'))</XmakeRunDirResolved> + + <!-- 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> + + <PropertyGroup Label="XmakeInternal"> + <_XmakeProjectFlag Condition="'$(XmakeProjectFile)' != ''">-F "$(XmakeProjectFile)"</_XmakeProjectFlag> + <_XmakeProjectFlag Condition="'$(XmakeProjectFile)' == ''">-P .</_XmakeProjectFlag> + + <_XmakeCommonFlags>$(XmakeCommonFlags.Trim())</_XmakeCommonFlags> + <_XmakeCommonFlags Condition="$(XmakeVerbose)">-v $(_XmakeCommonFlags.Trim())</_XmakeCommonFlags> + <_XmakeCommonFlags Condition="$(XmakeDiagnosis)">-D $(_XmakeCommonFlags.Trim())</_XmakeCommonFlags> + <_XmakeCommonFlags>-y $(_XmakeCommonFlags.Trim()) $(_XmakeProjectFlag)</_XmakeCommonFlags> + + <_XmakeOutFlag>-o "$([MSBuild]::MakeRelative('$(XmakeProjectDirResolved)', '$(XmakeBuildDirResolved)').TrimEnd('\').TrimEnd('/'))"</_XmakeOutFlag> + + <_XmakeConfigFlags>$(XmakeConfigFlags.Trim())</_XmakeConfigFlags> + <_XmakeConfigFlags>-p $(XmakePlat) -m $(XmakeMode) -a $(XmakeArch) $(_XmakeOutFlag) $(_XmakeConfigFlags.Trim())</_XmakeConfigFlags> + + <_XmakeBuildFlags>$(XmakeBuildFlags.Trim())</_XmakeBuildFlags> + + <_XmakeBuildFileFlags>$(_XmakeBuildFlags.Trim())</_XmakeBuildFileFlags> + <_XmakeBuildFileFlags Condition="$(XmakeRebuildFile)">$(_XmakeBuildFileFlags.Trim()) -r</_XmakeBuildFileFlags> + + <_XmakeCleanFlags>$(XmakeCleanFlags.Trim())</_XmakeCleanFlags> + <_XmakeCleanFlags Condition="$(XmakeCleanAll)">-a $(_XmakeCleanFlags.Trim())</_XmakeCleanFlags> + + <_XmakeBuildFlags>$(_XmakeBuildFlags.Trim())</_XmakeBuildFlags> + <_XmakeBuildFileFlags>$(_XmakeBuildFileFlags.Trim())</_XmakeBuildFileFlags> + <_XmakeCleanFlags>$(_XmakeCleanFlags.Trim())</_XmakeCleanFlags> + <_XmakeConfigFlags>$(_XmakeConfigFlags.Trim())</_XmakeConfigFlags> + <_XmakeCommonFlags>$(_XmakeCommonFlags.Trim())</_XmakeCommonFlags> + <_XmakeTarget>"$(XmakeTarget.Trim())"</_XmakeTarget> + + <_XmakeExecutable>"$([System.IO.Path]::GetFullPath('$(XmakeProgramFileResolved)'))"</_XmakeExecutable> + <_XmakeEnv> + pushd $(XmakeProjectDirResolved) + set XMAKE_CONFIGDIR=$(XmakeConfigDirResolved.TrimEnd('\').TrimEnd('/')) + set XMAKE_PROGRAM_DIR=$(XmakeProgramDirResolved.TrimEnd('\').TrimEnd('/')) + set XMAKE_PROGRAM_FILE=$(XmakeProgramFileResolved.TrimEnd('\').TrimEnd('/')) + set XMAKE_SKIP_HISTORY=1 + set XMAKE_IN_VSTUDIO=1 + </_XmakeEnv> + <_XmakeEnv Condition="$(XmakeDiagnosis)"> + $(_XmakeEnv) + echo XMAKE_CONFIGDIR=%25XMAKE_CONFIGDIR%25 + echo XMAKE_PROGRAM_DIR=%25XMAKE_PROGRAM_DIR%25 + echo XMAKE_PROGRAM_FILE=%25XMAKE_PROGRAM_FILE%25 + echo CD=%25CD%25 + </_XmakeEnv> + </PropertyGroup> + + <Target Name="_XmakeProjCheck"> + <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 csproj file" /> + <Error Condition="'$(XmakeProjectFile)' != '' And !Exists('$(XmakeProjectDirResolved)\$(XmakeProjectFile)')" + Text="$(XmakeProjectFile) not found at '$(XmakeProjectDirResolved)', please set XmakeProjectDir in csproj file" /> + </Target> + <Target Name="_XmakeConfig" DependsOnTargets="_XmakeProjCheck"> + <Message Text="$xmake config $(_XmakeCommonFlags) $(_XmakeConfigFlags)" Importance="High" /> + <Exec Command="$(_XmakeEnv) + $(_XmakeExecutable) config $(_XmakeCommonFlags) $(_XmakeConfigFlags)" 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="_XmakeRebuild" DependsOnTargets="_XmakeProjCheck"> + <Message Text="$xmake build -r $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(_XmakeTarget)" Importance="High" /> + <Exec Command="$(_XmakeEnv) + $(_XmakeExecutable) build -r $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(_XmakeTarget)" EchoOff="true" /> + </Target> + <Target Name="_XmakeBuildFile" DependsOnTargets="_XmakeProjCheck"> + <ItemGroup> + <SelectedFile Include="$(SelectedFiles)" /> + <File Include="$([MSBuild]::MakeRelative('$(XmakeProjectDirResolved)', $([System.IO.Path]::GetFullPath('%(SelectedFile.Identity)'))))" /> + </ItemGroup> + <PropertyGroup> + <FileFlag>--files="@(File)"</FileFlag> + </PropertyGroup> + <Message Text="$xmake build $(_XmakeCommonFlags) $(_XmakeBuildFileFlags) $(FileFlag) $(_XmakeTarget)" Importance="High" /> + <Exec Command="$(_XmakeEnv) + $(_XmakeExecutable) build $(_XmakeCommonFlags) $(_XmakeBuildFileFlags) $(FileFlag) $(_XmakeTarget)" EchoOff="true" /> + </Target> + <Target Name="_XmakeClean" DependsOnTargets="_XmakeProjCheck"> + <Message Text="$xmake clean $(_XmakeCommonFlags) $(_XmakeCleanFlags) $(_XmakeTarget)" Importance="High" /> + <Exec Command="$(_XmakeEnv) + $(_XmakeExecutable) clean $(_XmakeCommonFlags) $(_XmakeCleanFlags) $(_XmakeTarget)" EchoOff="true" /> + </Target> + + <Target Name="BeforeBuild" /> + <Target Name="AfterBuild" /> + <Target Name="Build" Condition="'$(DesignTimeBuild)' != 'true'"> + <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="BeforeClean" /> + <CallTarget Targets="_XmakeConfig;_XmakeClean" /> + <CallTarget Targets="AfterClean" /> + </Target> + + <Target Name="BeforeRebuild" /> + <Target Name="AfterRebuild" /> + <Target Name="Rebuild" Condition="'$(DesignTimeBuild)' != 'true'"> + <CallTarget Targets="BeforeRebuild" /> + <CallTarget Targets="_XmakeConfig;_XmakeRebuild" /> + <CallTarget Targets="AfterRebuild" /> + </Target> + + <Target Name="BeforeBuildFiles" /> + <Target Name="AfterBuildFiles" /> + <Target Name="BuildFiles" Condition="'$(DesignTimeBuild)' != 'true'"> + <CallTarget Targets="BeforeBuildFiles" /> + <CallTarget Targets="_XmakeConfig;_XmakeBuildFile" /> + <CallTarget Targets="AfterBuildFiles" /> + </Target> + <!-- override default C# compile to call xmake instead of csc --> + <Target Name="CoreCompile" Condition="'$(DesignTimeBuild)' != 'true'"> + <CallTarget Targets="BuildFiles" /> + </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> +</Project> diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.props b/xmake/scripts/vsxmake/vsproj/Xmake.props index e2bf58dfe..6bde5d90a 100644 --- a/xmake/scripts/vsxmake/vsproj/Xmake.props +++ b/xmake/scripts/vsxmake/vsproj/Xmake.props @@ -29,9 +29,9 @@ </PropertyGroup> <PropertyGroup Label="XmakePathsFallback"> - <XmakeBuilDDir Condition="'$(XmakeBuilDDir)' == ''">$(XmakeProjectDir)\build</XmakeBuilDDir> - <XmakeTargetDir Condition="'$(XmakeTargetDir)' == ''">$(XmakeBuilDDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeTargetDir> - <XmakeConfigFileDir Condition="'$(XmakeConfigFileDir)' == ''">$(XmakeBuilDDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeConfigFileDir> + <XmakeBuildDir Condition="'$(XmakeBuildDir)' == ''">$(XmakeProjectDir)\build</XmakeBuildDir> + <XmakeTargetDir Condition="'$(XmakeTargetDir)' == ''">$(XmakeBuildDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeTargetDir> + <XmakeConfigFileDir Condition="'$(XmakeConfigFileDir)' == ''">$(XmakeBuildDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeConfigFileDir> <XmakeConfigDir Condition="'$(XmakeConfigDir)' == ''">$(XMAKE_CONFIGDIR)</XmakeConfigDir> <XmakeConfigDir Condition="'$(XmakeConfigDir)' == ''">$(XmakeProjectDir)</XmakeConfigDir> @@ -171,7 +171,7 @@ <PropertyGroup Label="Path"> <LibraryPath>$(XmakeLinkDirs);$(LibraryPath)</LibraryPath> <OutDir>$(XmakeTargetDir)\</OutDir> - <IntDir>$(XmakeBuilDDir)\.vs\$(TargetName)\$(XmakeArch)\$(XmakeMode)\</IntDir> + <IntDir>$(XmakeBuildDir)\.vs\$(TargetName)\$(XmakeArch)\$(XmakeMode)\</IntDir> <SourcePath>$(XmakeSourceDirs);$(SourcePath)</SourcePath> </PropertyGroup> diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.targets b/xmake/scripts/vsxmake/vsproj/Xmake.targets index ec7ea3532..e789e7862 100644 --- a/xmake/scripts/vsxmake/vsproj/Xmake.targets +++ b/xmake/scripts/vsxmake/vsproj/Xmake.targets @@ -8,21 +8,21 @@ </ImportGroup> <PropertyGroup Label="XmakePathsResolve"> - <XmakeBuilDDirResolved>$(XmakeBuilDDir)</XmakeBuilDDirResolved> + <XmakeBuildDirResolved>$(XmakeBuildDir)</XmakeBuildDirResolved> <XmakeTargetDirResolved>$(XmakeTargetDir)</XmakeTargetDirResolved> <XmakeConfigDirResolved>$(XmakeConfigDir)</XmakeConfigDirResolved> <XmakeConfigFileDirResolved>$(XmakeConfigFileDir)</XmakeConfigFileDirResolved> <XmakeRunDirResolved>$(XmakeRunDir)</XmakeRunDirResolved> <!-- resolve if they are relative paths --> - <XmakeBuilDDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeBuilDDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuilDDirResolved)'))</XmakeBuilDDirResolved> + <XmakeBuildDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeBuildDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuildDirResolved)'))</XmakeBuildDirResolved> <XmakeTargetDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeTargetDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeTargetDirResolved)'))</XmakeTargetDirResolved> <XmakeConfigDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeConfigDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigDirResolved)'))</XmakeConfigDirResolved> <XmakeConfigFileDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeConfigFileDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigFileDirResolved)'))</XmakeConfigFileDirResolved> <XmakeRunDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeRunDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeRunDirResolved)'))</XmakeRunDirResolved> <!-- normalize paths --> - <XmakeBuilDDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeBuilDDirResolved)/'))</XmakeBuilDDirResolved> + <XmakeBuildDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeBuildDirResolved)/'))</XmakeBuildDirResolved> <XmakeTargetDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeTargetDirResolved)/'))</XmakeTargetDirResolved> <XmakeConfigDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeConfigDirResolved)/'))</XmakeConfigDirResolved> <XmakeConfigFileDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeConfigFileDirResolved)/'))</XmakeConfigFileDirResolved> @@ -44,11 +44,13 @@ <_XmakeCommonFlags Condition="$(XmakeDiagnosis)">-D $(_XmakeCommonFlags.Trim())</_XmakeCommonFlags> <_XmakeCommonFlags>-y $(_XmakeCommonFlags.Trim()) $(_XmakeProjectFlag)</_XmakeCommonFlags> - <_XmakeOutFlag>-o "$([MSBuild]::MakeRelative('$(XmakeProjectDirResolved)', '$(XmakeBuilDDirResolved)').TrimEnd('\').TrimEnd('/'))"</_XmakeOutFlag> + <_XmakeOutFlag>-o "$([MSBuild]::MakeRelative('$(XmakeProjectDirResolved)', '$(XmakeBuildDirResolved)').TrimEnd('\').TrimEnd('/'))"</_XmakeOutFlag> <_XmakeConfigFlags>$(XmakeConfigFlags.Trim())</_XmakeConfigFlags> <_XmakeConfigFlags>-p $(XmakePlat) -m $(XmakeMode) -a $(XmakeArch) $(_XmakeOutFlag) $(_XmakeConfigFlags.Trim())</_XmakeConfigFlags> + <_XmakeBuildFlags>$(XmakeBuildFlags.Trim())</_XmakeBuildFlags> + <_XmakeBuildFileFlags>$(_XmakeBuildFlags.Trim())</_XmakeBuildFileFlags> <_XmakeBuildFileFlags Condition="$(XmakeRebuildFile)">$(_XmakeBuildFileFlags.Trim()) -r</_XmakeBuildFileFlags> @@ -156,7 +158,7 @@ MSBuild Properties: XmakeProgramFile: $(XmakeProgramFile) XmakeProjectDir: $(XmakeProjectDir) XmakeScriptDir: $(XmakeScriptDir) - XmakeBuilDDir: $(XmakeBuilDDir) + XmakeBuildDir: $(XmakeBuildDir) XmakeTargetDir: $(XmakeTargetDir) XmakeConfigDir: $(XmakeConfigDir) XmakeConfigFileDir: $(XmakeConfigFileDir) @@ -166,7 +168,7 @@ MSBuild Properties: XmakeProgramFile: $(XmakeProgramFileResolved) XmakeProjectDir: $(XmakeProjectDirResolved) XmakeScriptDir: $(XmakeScriptDirResolved) - XmakeBuilDDir: $(XmakeBuilDDirResolved) + XmakeBuildDir: $(XmakeBuildDirResolved) XmakeTargetDir: $(XmakeTargetDirResolved) XmakeConfigDir: $(XmakeConfigDirResolved) XmakeConfigFileDir: $(XmakeConfigFileDirResolved) diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.xml b/xmake/scripts/vsxmake/vsproj/Xmake.xml index 3f5600ba6..9bccf1b28 100644 --- a/xmake/scripts/vsxmake/vsproj/Xmake.xml +++ b/xmake/scripts/vsxmake/vsproj/Xmake.xml @@ -66,7 +66,7 @@ Description="Set environment XMAKE_CONFIGDIR for xmake tasks" Subtype="folder" /> <StringProperty - Name="XmakeBuilDDir" + Name="XmakeBuildDir" DisplayName="Build dir" Category="Paths" Description="Set output dir for xmake tasks" diff --git a/xmake/scripts/vsxmake/vsproj/templates/Xmake.Custom.props b/xmake/scripts/vsxmake/vsproj/templates/Xmake.Custom.props index 22e84fc46..00d471bc8 100644 --- a/xmake/scripts/vsxmake/vsproj/templates/Xmake.Custom.props +++ b/xmake/scripts/vsxmake/vsproj/templates/Xmake.Custom.props @@ -9,7 +9,7 @@ <!-- <XmakeConfigDir Condition="'$(XmakeMode)|$(XmakeArch)' == 'release|x86'">$(XmakeProjectDir)\.xmake</XmakeConfigDir> --> <!-- set output dir for xmake tasks --> - <!-- <XmakeBuilDDir>$(XmakeProjectDir)\build</XmakeBuilDDir> --> + <!-- <XmakeBuildDir>$(XmakeProjectDir)\build</XmakeBuildDir> --> </PropertyGroup> <PropertyGroup Label="XmakeFlags"> diff --git a/xmake/scripts/vsxmake/vsproj/templates/csproj/#target#.csproj b/xmake/scripts/vsxmake/vsproj/templates/csproj/#target#.csproj new file mode 100644 index 000000000..7074a136d --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/templates/csproj/#target#.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +#xmake_info# + + 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. +--> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> +#Import(ProjectConfiguration)# + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{#target_id#}</ProjectGuid> + <Configuration Condition="'$(Configuration)' == ''">release</Configuration> + <Platform Condition="'$(Platform)' == ''">AnyCPU</Platform> + <XmakeScriptDir>#scriptdir#</XmakeScriptDir> + <XmakeProjectDir>#projectdir#</XmakeProjectDir> + <XmakeProjectFile>#projectfile#</XmakeProjectFile> + <XmakeTarget>#targetname#</XmakeTarget> + </PropertyGroup> + <PropertyGroup Label="XmakeProgram"> + <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">$(XMAKE_PROGRAM_DIR)</XmakeProgramDir> + <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">#programdir#</XmakeProgramDir> + <XmakeProgramFile Condition="'$(XmakeProgramFile)' == ''">$(XMAKE_PROGRAM_FILE)</XmakeProgramFile> + <XmakeProgramFile Condition="'$(XmakeProgramFile)' == ''">#programfile#</XmakeProgramFile> + </PropertyGroup> + <Import Project="$(XmakeProgramDir)\scripts\vsxmake\vsproj\Xmake.Defaults.props" /> +#Import(XmakeConfig)# +#Import(XmakePath)# + <PropertyGroup> + <OutputType Condition="'$(XmakeKind)' == 'binary'">Exe</OutputType> + <OutputType Condition="'$(XmakeKind)' == 'shared'">Library</OutputType> + <OutputType Condition="'$(XmakeKind)' == 'static'">Library</OutputType> + <OutputType Condition="'$(OutputType)' == ''">Library</OutputType> + <AssemblyName>$(XmakeBasename)</AssemblyName> + <RootNamespace>#targetname#</RootNamespace> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <ItemGroup> +#Import(File.cs)# + </ItemGroup> + <!-- <ItemGroup> +#Import(ProjectRef)# + </ItemGroup> --> + <Import Project="$(XmakeProgramDir)\scripts\vsxmake\vsproj\Xmake.CSharp.targets" /> +</Project> diff --git a/xmake/scripts/vsxmake/vsproj/templates/csproj/File.cs(filecs) b/xmake/scripts/vsxmake/vsproj/templates/csproj/File.cs(filecs) new file mode 100644 index 000000000..f1f9c063a --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/templates/csproj/File.cs(filecs) @@ -0,0 +1 @@ + <Compile Include="#path#" /> diff --git a/xmake/scripts/vsxmake/vsproj/templates/csproj/ProjectConfiguration(mode,arch) b/xmake/scripts/vsxmake/vsproj/templates/csproj/ProjectConfiguration(mode,arch) new file mode 100644 index 000000000..d6956bf15 --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/templates/csproj/ProjectConfiguration(mode,arch) @@ -0,0 +1,4 @@ + <ProjectConfiguration Include="#mode#|#vsarch#"> + <Configuration>#mode#</Configuration> + <Platform>#vsarch#</Platform> + </ProjectConfiguration> diff --git a/xmake/scripts/vsxmake/vsproj/templates/csproj/ProjectRef(dep) b/xmake/scripts/vsxmake/vsproj/templates/csproj/ProjectRef(dep) new file mode 100644 index 000000000..88c9645b2 --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/templates/csproj/ProjectRef(dep) @@ -0,0 +1,3 @@ + <ProjectReference Include="..\#targetname_inpath#\#targetname_inpath#.#projext#"> + <Project>{#target_id#}</Project> + </ProjectReference> diff --git a/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakeConfig(mode,arch) b/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakeConfig(mode,arch) new file mode 100644 index 000000000..864300fd7 --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakeConfig(mode,arch) @@ -0,0 +1,14 @@ + <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> + <XmakeDefault>#default#</XmakeDefault> + <XmakeDefines>#defines#</XmakeDefines> + <XmakeLanguages>#languages#</XmakeLanguages> + <XmakeRunEnvs>#runenvs#</XmakeRunEnvs> + <XmakeRunArgs>#runargs#</XmakeRunArgs> + <XmakeConfigFlags>#configflags#</XmakeConfigFlags> + </PropertyGroup> diff --git a/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakePath(mode,arch) b/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakePath(mode,arch) new file mode 100644 index 000000000..7e423ee00 --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakePath(mode,arch) @@ -0,0 +1,7 @@ + <PropertyGroup Label="XmakePath" Condition="'$(Configuration)|$(Platform)'=='#mode#|#vsarch#'"> + <XmakeBuildDir>#builddir#</XmakeBuildDir> + <XmakeConfigDir>#configdir#</XmakeConfigDir> + <XmakeConfigFileDir>#configfiledir#</XmakeConfigFileDir> + <XmakeTargetDir>#targetdir#</XmakeTargetDir> + <XmakeRunDir>#rundir#</XmakeRunDir> + </PropertyGroup> diff --git a/xmake/scripts/vsxmake/vsproj/templates/sln/Project(target) b/xmake/scripts/vsxmake/vsproj/templates/sln/Project(target) index e53697651..96fa75078 100644 --- a/xmake/scripts/vsxmake/vsproj/templates/sln/Project(target) +++ b/xmake/scripts/vsxmake/vsproj/templates/sln/Project(target) @@ -1,2 +1,2 @@ -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "#targetname#", "#vcxprojdir_relative_sln#\#targetname_inpath#.vcxproj", "{#target_id#}" +Project("{#projtypeguid#}") = "#targetname#", "#vcxprojdir_relative_sln#\#targetname_inpath#.#projext#", "{#target_id#}" EndProject diff --git a/xmake/scripts/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) b/xmake/scripts/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) index f724ee28c..7e423ee00 100644 --- a/xmake/scripts/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) +++ b/xmake/scripts/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) @@ -1,5 +1,5 @@ <PropertyGroup Label="XmakePath" Condition="'$(Configuration)|$(Platform)'=='#mode#|#vsarch#'"> - <XmakeBuilDDir>#builddir#</XmakeBuilDDir> + <XmakeBuildDir>#builddir#</XmakeBuildDir> <XmakeConfigDir>#configdir#</XmakeConfigDir> <XmakeConfigFileDir>#configfiledir#</XmakeConfigFileDir> <XmakeTargetDir>#targetdir#</XmakeTargetDir> |
