-
Couldn't load subscription status.
- Fork 379
Add CMake File API support to Microsoft.DotNet.CMake.Sdk #16233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 8 commits
ce43af6
9853820
c21baa8
6b4def4
7eaec0c
d5a1e0c
ad3848c
82e7b52
d7b41b6
f02c537
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,47 @@ | ||
| <Project Sdk="Microsoft.Build.NoTargets"> | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>$(NetToolCurrent)</TargetFramework> | ||
| <TargetFrameworks>$(NetToolCurrent);$(NetFrameworkToolCurrent)</TargetFrameworks> | ||
| <IsPackable>true</IsPackable> | ||
| <IsBuildTaskProject>true</IsBuildTaskProject> | ||
| <Description>Common toolset for calling into CMake from MSBuild and easily reference native assets from managed projects.</Description> | ||
| <PackageType>MSBuildSdk</PackageType> | ||
| <NoWarn>$(NoWarn);NU5128</NoWarn> | ||
| <NoWarn>$(NoWarn);NU5128;CS0649</NoWarn> | ||
| <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking> | ||
| <EnableDefaultItems>false</EnableDefaultItems> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <None Include="**/*.props;**/*.targets" | ||
| <PackageReference Include="Microsoft.Build.Utilities.Core" /> | ||
| <PackageReference Include="Microsoft.Build.Framework" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'"> | ||
| <PackageReference Include="System.Text.Json" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Compile Include="src\**\*.cs" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'"> | ||
| <Compile Include="..\Common\Internal\AssemblyResolver.cs" /> | ||
| <Compile Include="..\Common\Internal\AssemblyResolution.cs" /> | ||
| <Compile Include="..\Common\Internal\BuildTask.Desktop.cs" /> | ||
| <Reference Include="WindowsBase" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Compile Include="..\Common\Internal\BuildTask.cs" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <None Include="build\**\*.props;build\**\*.targets" | ||
| Pack="true" | ||
| PackagePath="build\%(RecursiveDir)%(Filename)%(Extension)" /> | ||
| <None Include="sdk\**\*.props;sdk\**\*.targets" | ||
| Pack="true" | ||
| PackagePath="%(RecursiveDir)%(Filename)%(Extension)" /> | ||
| <None Include="$(RepoRoot)LICENSE.TXT;$(RepoRoot)THIRD-PARTY-NOTICES.TXT" Pack="true" PackagePath="%(Filename)%(Extension)" /> | ||
| PackagePath="sdk\%(RecursiveDir)%(Filename)%(Extension)" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,20 @@ | ||
| <!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. --> | ||
| <Project DefaultTargets="Build"> | ||
|
|
||
| <PropertyGroup> | ||
| <MicrosoftDotNetCMakeSdkTaskAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\tools\net\Microsoft.DotNet.CMake.Sdk.dll</MicrosoftDotNetCMakeSdkTaskAssembly> | ||
| <MicrosoftDotNetCMakeSdkTaskAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tools\netframework\Microsoft.DotNet.CMake.Sdk.dll</MicrosoftDotNetCMakeSdkTaskAssembly> | ||
| </PropertyGroup> | ||
|
|
||
| <UsingTask TaskName="Microsoft.DotNet.CMake.Sdk.CreateCMakeFileApiQuery" AssemblyFile="$(MicrosoftDotNetCMakeSdkTaskAssembly)" /> | ||
| <UsingTask TaskName="Microsoft.DotNet.CMake.Sdk.GetCMakeArtifactsFromFileApi" AssemblyFile="$(MicrosoftDotNetCMakeSdkTaskAssembly)" /> | ||
|
|
||
| <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> | ||
|
|
||
| <PropertyGroup> | ||
| <VSWhereVersion Condition="'$(VSWhereVersion)' == ''">3.1.7</VSWhereVersion> | ||
|
||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="vswhere" Version="$(VSWhereVersion)" IsImplicitlyDefined="true" GeneratePathProperty="true" /> | ||
| </ItemGroup> | ||
|
|
@@ -92,6 +104,12 @@ | |
| </ItemGroup> | ||
| </Target> | ||
|
|
||
| <Target Name="GetCMakeOutputDirProperty" Returns="$(CMakeOutputDir)"> | ||
| </Target> | ||
|
|
||
| <Target Name="GetConfigurationProperty" Returns="$(Configuration)"> | ||
| </Target> | ||
|
|
||
| <Target Name="_ResolveVSCompilerToolchainForNonVSGenerators" | ||
| Condition="$([MSBuild]::IsOsPlatform(Windows)) and !$(CMakeGenerator.StartsWith('Visual Studio')) and '$(CMakeCompilerToolchain)' == 'MSVC' and '$(CMakeCompilerSearchScript)' == ''"> | ||
| <Error Condition="'$(_VSNativeCompilerComponentArchName)' == ''" Text="Unable to determine location of MSVC tools installed for the '$(Platform)' architecture." /> | ||
|
|
@@ -175,8 +193,14 @@ | |
| </PropertyGroup> | ||
| </Target> | ||
|
|
||
| <Target Name="CreateFileApiQuery" | ||
| DependsOnTargets="GetConfigScript" | ||
| BeforeTargets="Configure"> | ||
| <CreateCMakeFileApiQuery CMakeOutputDir="$(CMakeOutputDir)" /> | ||
| </Target> | ||
|
|
||
| <Target Name="Configure" | ||
| DependsOnTargets="GetConfigScript"> | ||
| DependsOnTargets="GetConfigScript;CreateFileApiQuery"> | ||
| <Exec WorkingDirectory="$(MSBuildProjectDirectory)" Command=" | ||
| $(CMakeCompilerSearchScript) | ||
| $(CMakeConfigScript)" /> | ||
|
|
||
jkoritzinsky marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Collections.Generic; | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace Microsoft.DotNet.CMake.Sdk | ||
| { | ||
| internal class CMakeFileApiIndex | ||
| { | ||
| public CMakeFileApiIndexReply Reply { get; set; } | ||
| } | ||
|
|
||
| internal class CMakeFileApiIndexReply | ||
| { | ||
| [JsonPropertyName("client-Microsoft.DotNet.CMake.Sdk")] | ||
| public CMakeFileApiClientReply ClientReply { get; set; } | ||
| } | ||
|
|
||
| internal class CMakeFileApiClientReply | ||
| { | ||
| [JsonPropertyName("codemodel-v2")] | ||
| public CMakeFileApiIndexCodeModel CodemodelV2 { get; set; } | ||
| } | ||
|
|
||
| internal class CMakeFileApiIndexCodeModel | ||
| { | ||
| public string JsonFile { get; set; } | ||
| } | ||
|
|
||
| internal class CMakeCodeModel | ||
| { | ||
| public CMakeCodeModelPaths Paths { get; set; } | ||
| public List<CMakeConfiguration> Configurations { get; set; } | ||
| } | ||
|
|
||
| internal class CMakeCodeModelPaths | ||
| { | ||
| public string Source { get; set; } | ||
| public string Build { get; set; } | ||
| } | ||
|
|
||
| internal class CMakeConfiguration | ||
| { | ||
| public string Name { get; set; } | ||
| public List<CMakeDirectory> Directories { get; set; } | ||
| public List<CMakeTarget> Targets { get; set; } | ||
| } | ||
|
|
||
| internal class CMakeDirectory | ||
| { | ||
| public string Source { get; set; } | ||
| public string Build { get; set; } | ||
| public List<int> TargetIndexes { get; set; } | ||
| } | ||
|
|
||
| internal class CMakeTarget | ||
| { | ||
| public string Name { get; set; } | ||
| public string JsonFile { get; set; } | ||
| } | ||
|
|
||
| internal class CMakeTargetDetails | ||
| { | ||
| public List<CMakeArtifact> Artifacts { get; set; } | ||
| } | ||
|
|
||
| internal class CMakeArtifact | ||
| { | ||
| public string Path { get; set; } | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.