Updated finalizer to have the same changes that were done in the SDK repo branch. Removed the chain of cs/proj file calling. finalizer-build.csproj drives the main process. Adjustments to simplify CMakeLists.txt paths.

This commit is contained in:
Michael Yanni 2024-02-07 12:24:17 -08:00
parent c4501c8e8f
commit 990e256cef
7 changed files with 31 additions and 101 deletions

View file

@ -1,48 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28603.18
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED2FE3E2-F7E7-4389-8231-B65123F2076F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "finalizer_shim", "src\finalizer_shim\finalizer_shim.csproj", "{688E2883-C5A9-4D66-A207-772C9160989C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Debug|x64 = Debug|x64
Debug|arm64 = Debug|arm64
Debug|arm = Debug|arm
Release|x86 = Release|x86
Release|x64 = Release|x64
Release|arm64 = Release|arm64
Release|arm = Release|arm
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{688E2883-C5A9-4D66-A207-772C9160989C}.Debug|x86.ActiveCfg = Debug|x86
{688E2883-C5A9-4D66-A207-772C9160989C}.Debug|x86.Build.0 = Debug|x86
{688E2883-C5A9-4D66-A207-772C9160989C}.Debug|x64.ActiveCfg = Debug|x64
{688E2883-C5A9-4D66-A207-772C9160989C}.Debug|x64.Build.0 = Debug|x64
{688E2883-C5A9-4D66-A207-772C9160989C}.Debug|arm64.ActiveCfg = Debug|arm64
{688E2883-C5A9-4D66-A207-772C9160989C}.Debug|arm64.Build.0 = Debug|arm64
{688E2883-C5A9-4D66-A207-772C9160989C}.Debug|arm.ActiveCfg = Debug|arm
{688E2883-C5A9-4D66-A207-772C9160989C}.Debug|arm.Build.0 = Debug|arm
{688E2883-C5A9-4D66-A207-772C9160989C}.Release|x86.ActiveCfg = Release|x86
{688E2883-C5A9-4D66-A207-772C9160989C}.Release|x86.Build.0 = Release|x86
{688E2883-C5A9-4D66-A207-772C9160989C}.Release|x64.ActiveCfg = Release|x64
{688E2883-C5A9-4D66-A207-772C9160989C}.Release|x64.Build.0 = Release|x64
{688E2883-C5A9-4D66-A207-772C9160989C}.Release|arm64.ActiveCfg = Release|arm64
{688E2883-C5A9-4D66-A207-772C9160989C}.Release|arm64.Build.0 = Release|arm64
{688E2883-C5A9-4D66-A207-772C9160989C}.Release|arm.ActiveCfg = Release|arm
{688E2883-C5A9-4D66-A207-772C9160989C}.Release|arm.Build.0 = Release|arm
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{688E2883-C5A9-4D66-A207-772C9160989C} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {18FCFCA3-D1A8-4D3A-9763-6A658D0D726F}
EndGlobalSection
EndGlobal

View file

@ -13,8 +13,7 @@
<ItemGroup>
<ProjectToBuild Include="$(RepoRoot)Microsoft.DotNet.Cli.sln" />
<ProjectToBuild Condition="'$(OS)' == 'Windows_NT' And ('$(Architecture)' == 'x86' Or '$(Architecture)' == 'x64' Or '$(Architecture)' == 'arm64' Or '$(Architecture)' == 'arm')"
Include="$(RepoRoot)eng\version.csproj;
$(RepoRoot)eng\native.proj" />
Include="$(RepoRoot)src\finalizer\finalizer-build.csproj" />
</ItemGroup>
</Otherwise>
</Choose>

View file

@ -1,16 +0,0 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<PropertyGroup>
<Platform Condition="'$(Platform)'=='' Or $(Platform)=='AnyCPU'">$(Architecture)</Platform>
</PropertyGroup>
<Target Name="Build">
<MSBuild Projects="$(RepoRoot)Native.sln" Properties="Platform=$(Platform)" Targets="Restore;Build" />
</Target>
<Target Name="Test" />
<Target Name="Pack" />
<Target Name="Rebuild" />
<Target Name="IntegrationTest" />
<Target Name="PerformanceTest" />
</Project>

View file

@ -1,8 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>$(CoreSdkTargetFramework)</TargetFramework>
<NativeVersionFile>$(ArtifactsObjDir)sdk_version.h</NativeVersionFile>
</PropertyGroup>
<Target Name="GenerateSdkVersionFile" BeforeTargets="CoreCompile" DependsOnTargets="GenerateNativeVersionFile" />
</Project>

View file

@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.15.5)
# Create project named finalizer, this will
# will generate Finalizer.vcxproj
# Create project named finalizer, this will generate Finalizer.vcxproj
project(Finalizer)
set(CMAKE_MACOSX_RPATH 1)
@ -10,12 +9,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:wmainCRTStartup")
# The WiX SDK is extracted from a NuGet package using an SDK .csproj (finalizer_shim)
# that copies the "lib" and "inc" folders to a stable location.
include_directories(../../artifacts/WixSdk/inc)
include_directories(../../artifacts/obj)
link_directories(../../artifacts/WixSdk/lib/${Platform})
# The WiX SDK is extracted from a NuGet package using an SDK .csproj (finalizer-build) that copies the "lib" and "inc" folders to a stable location.
# The defines below (values in ${}) are set in the finalizer.nativeproj.
# See: https://github.com/dotnet/arcade/tree/main/src/Microsoft.DotNet.CMake.Sdk#common-items
include_directories(${ArtifactsDir}/WixSdk/inc)
include_directories(${ArtifactsDir}/obj)
link_directories(${ArtifactsDir}/WixSdk/lib/${Platform})
add_compile_options(/MT)
@ -48,9 +47,7 @@ add_executable(Finalizer
native.rc
)
# These are normally part of a .vcxproj in Visual Studio, but
# appears to be missing when CMAKE generates a .vcxproj
# for arm64.
# These are normally part of a .vcxproj in Visual Studio, but appears to be missing when CMAKE generates a .vcxproj for arm64.
target_link_libraries(Finalizer shell32.lib)
target_link_libraries(Finalizer advapi32.lib)
target_link_libraries(Finalizer version.lib)

View file

@ -1,14 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<!--
This is a shim project to restore the WiX library and copy out the *.lib and *.h files so
we can build the finalizer.
-->
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<Platform Condition="'$(Platform)' == 'AnyCPU' Or '$(Platform)' == ''">$(Architecture)</Platform>
<TargetFramework>$(CoreSdkTargetFramework)</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<CopyBuildOutputToPublishDirectory>false</CopyBuildOutputToPublishDirectory>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<NativeVersionFile>$(ArtifactsObjDir)sdk_version.h</NativeVersionFile>
</PropertyGroup>
<ItemGroup>
@ -16,20 +13,26 @@
</ItemGroup>
<ItemGroup>
<NativeProjectReference Include="$(RepoRoot)src\finalizer\CMakeLists.txt" CMakeProject="$(RepoRoot)src\finalizer\finalizer.proj" BuildNative="true"/>
<!-- See: https://github.com/dotnet/arcade/tree/main/src/Microsoft.DotNet.CMake.Sdk#referencing-native-assets-with-nativeprojectreference -->
<NativeProjectReference Include="CMakeLists.txt" CMakeProject="finalizer.nativeproj" BuildNative="true" />
</ItemGroup>
<Target Name="GenerateSdkVersionFile" BeforeTargets="CoreCompile" DependsOnTargets="GenerateNativeVersionFile" />
<!-- This target needs to run before the native project reference is built. -->
<Target Name="CopySdk" AfterTargets="Restore" BeforeTargets="Build">
<Target Name="CopyWixSdk" AfterTargets="Restore" BeforeTargets="Build">
<ItemGroup>
<WixLib Include="$(WixSdkPath)vs2017\lib\**\*.*" />
<WixInclude Include="$(WixSdkPath)inc\**\*.*" />
</ItemGroup>
<!-- Copy all the lib files for x86, x64, and arm64 -->
<!-- Copy all the lib files for x86, x64, and arm64. -->
<Copy SourceFiles="@(WixLib)" DestinationFiles="@(WixLib->'$(ArtifactsDir)WixSdk\lib\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
<Copy SourceFiles="@(WixInclude)" DestinationFolder="$(ArtifactsDir)WixSdk\inc" SkipUnchangedFiles="true" />
</Target>
<!-- This imports the CMake SDK and because BuildNative is true, it builds the native project. -->
<!-- See: https://github.com/dotnet/arcade/tree/main/src/Microsoft.DotNet.CMake.Sdk#referencing-native-assets-with-nativeprojectreference -->
<Import Project="ProjectReference.targets" Sdk="Microsoft.DotNet.CMake.Sdk" />
</Project>
</Project>

View file

@ -1,14 +1,17 @@
<Project Sdk="Microsoft.DotNet.CMake.Sdk">
<!-- Platform needs to be set with TreatAsLocalProperty since it is a global property and cannot be overridden otherwise. -->
<Project Sdk="Microsoft.DotNet.CMake.Sdk" TreatAsLocalProperty="Platform">
<PropertyGroup>
<Platform Condition="'$(Platform)' == '' Or $(Platform) == 'AnyCPU'">$(Architecture)</Platform>
<CMakeLists>CMakeLists.txt</CMakeLists>
</PropertyGroup>
<!--
This will be passed through -D and referenced by the CMakeLists.txt to correctly resolve
the platform specific libs
-->
<!-- This will be passed through -D and referenced by the CMakeLists.txt to correctly resolve the platform specific libs. -->
<ItemGroup>
<CMakeDefines Include="Platform" Value="$(Platform)" />
<CMakeDefines Include="ArtifactsDir" Value="$(ArtifactsDir)" />
<!-- Include this item below to create a binlog for the native build. -->
<!-- <CMakeNativeToolArguments Include="/bl:$(ArtifactsDir)native.binlog" /> -->
</ItemGroup>
</Project>