Skip to content

Commit

Permalink
Add csproj to build static nuget package
Browse files Browse the repository at this point in the history
  • Loading branch information
gleocadie committed Nov 22, 2024
1 parent 191a68a commit 2551d1f
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 14 deletions.
53 changes: 53 additions & 0 deletions windows/libdatadog-static.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<id>libdatadog</id>
<Company>Datadog</Company>
<Authors>Datadog</Authors>
<Title>Datadog libdatadog</Title>
<Version>$(LibdatadogVersion)</Version>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<IncludeBuildOutput>false</IncludeBuildOutput>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageProjectUrl>https://github.com/DataDog/libdatadog</PackageProjectUrl>
<Description>libdatadog provides a static library containing common code used in the
implementation of Datadog's libraries, including Datadog Continuous Profilers</Description>
<PackageReleaseNotes>Release of libdatadog</PackageReleaseNotes>
<Copyright>Copyright 2022 Datadog, Inc.</Copyright>
<PackageTags>Datadog;native;</PackageTags>
<RepositoryType>git</RepositoryType>

<!-- NuGet packages -->
<IsPackable>true</IsPackable>
</PropertyGroup>
<ItemGroup>
<None Include="..\README.md" Pack="true" PackagePath="\" />
<None Include="..\LICENSE" Pack="true" PackagePath="\" />
<None Include="libdatadog-static.props" Pack="true" PackagePath="build\native\libdatadog-static.props" />

<None Include="$(LibDatadogBinariesOutputDir)\common.h" Pack="true"
PackagePath="include\native\datadog\common.h" />
<None Include="$(LibDatadogBinariesOutputDir)\profiling.h" Pack="true"
PackagePath="include\native\datadog\profiling.h" />
<None Include="$(LibDatadogBinariesOutputDir)\telemetry.h" Pack="true"
PackagePath="include\native\datadog\telemetry.h" />
<None Include="$(LibDatadogBinariesOutputDir)\crashtracker.h" Pack="true"
PackagePath="include\native\datadog\crashtracker.h" />
<None Include="$(LibDatadogBinariesOutputDir)\data-pipeline.h" Pack="true"
PackagePath="include\native\datadog\data-pipeline.h" />

<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\debug\datadog_profiling_ffi.lib"
Pack="true" PackagePath="build\native\lib\x64\debug\static\datadog_profiling_ffi.lib" />

<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\release\datadog_profiling_ffi.lib"
Pack="true" PackagePath="build\native\lib\x64\release\static\datadog_profiling_ffi.lib" />

<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\debug\datadog_profiling_ffi.lib"
Pack="true" PackagePath="build\native\lib\x86\debug\static\datadog_profiling_ffi.lib" />

<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\release\datadog_profiling_ffi.lib"
Pack="true" PackagePath="build\native\lib\x86\release\static\datadog_profiling_ffi.lib" />
</ItemGroup>
</Project>
24 changes: 24 additions & 0 deletions windows/libdatadog-static.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion="15.0">
<PropertyGroup>
<LIBDATADOG-PLATFORM Condition="'$(Platform)'=='x64'">x64</LIBDATADOG-PLATFORM>
<LIBDATADOG-PLATFORM Condition="'$(Platform)'=='Win32' OR '$(Platform)'=='x86'">x86</LIBDATADOG-PLATFORM>
</PropertyGroup>
<ItemGroup>
<LibDatadogStaticLibs Include="$(MSBuildThisFileDirectory)..\..\build\native\lib\$(LIBDATADOG-PLATFORM)\$(Configuration)\*.lib" />
</ItemGroup>
<PropertyGroup>
<!-- Expland the items to a property -->
<LibDatadogStaticLibraries>@(LibDatadogStaticLibs)</LibDatadogStaticLibraries>
<LibDatadogDependencies>PowrProf.lib;NtDll.lib;UserEnv.lib;Bcrypt.lib;crypt32.lib;wsock32.lib;ws2_32.lib;shlwapi.lib;Secur32.lib;Ncrypt.lib</LibDatadogDependencies>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\include\native;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>$(LibDatadogStaticLibraries);$(LibDatadogDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
</Project>
8 changes: 0 additions & 8 deletions windows/libdatadog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,35 +38,27 @@
<None Include="$(LibDatadogBinariesOutputDir)\data-pipeline.h" Pack="true"
PackagePath="include\native\datadog\data-pipeline.h" />

<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\debug\datadog_profiling_ffi.lib"
Pack="true" PackagePath="build\native\lib\x64\debug\static\datadog_profiling_ffi.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\debug\datadog_profiling_ffi.dll.lib"
Pack="true" PackagePath="build\native\lib\x64\debug\datadog_profiling_ffi.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\debug\datadog_profiling_ffi.dll"
Pack="true" PackagePath="build\native\lib\x64\debug\datadog_profiling_ffi.dll" />
<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\debug\datadog_profiling_ffi.pdb"
Pack="true" PackagePath="build\native\lib\x64\debug\datadog_profiling_ffi.pdb" />

<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\release\datadog_profiling_ffi.lib"
Pack="true" PackagePath="build\native\lib\x64\release\static\datadog_profiling_ffi.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\release\datadog_profiling_ffi.dll.lib"
Pack="true" PackagePath="build\native\lib\x64\release\datadog_profiling_ffi.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\release\datadog_profiling_ffi.dll"
Pack="true" PackagePath="build\native\lib\x64\release\datadog_profiling_ffi.dll" />
<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\release\datadog_profiling_ffi.pdb"
Pack="true" PackagePath="build\native\lib\x64\release\datadog_profiling_ffi.pdb" />

<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\debug\datadog_profiling_ffi.lib"
Pack="true" PackagePath="build\native\lib\x86\debug\static\datadog_profiling_ffi.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\debug\datadog_profiling_ffi.dll.lib"
Pack="true" PackagePath="build\native\lib\x86\debug\datadog_profiling_ffi.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\debug\datadog_profiling_ffi.dll"
Pack="true" PackagePath="build\native\lib\x86\debug\datadog_profiling_ffi.dll" />
<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\debug\datadog_profiling_ffi.pdb"
Pack="true" PackagePath="build\native\lib\x86\debug\datadog_profiling_ffi.pdb" />

<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\release\datadog_profiling_ffi.lib"
Pack="true" PackagePath="build\native\lib\x86\release\static\datadog_profiling_ffi.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\release\datadog_profiling_ffi.dll.lib"
Pack="true" PackagePath="build\native\lib\x86\release\datadog_profiling_ffi.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\release\datadog_profiling_ffi.dll"
Expand Down
9 changes: 3 additions & 6 deletions windows/libdatadog.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
<LIBDATADOG-PLATFORM Condition="'$(Platform)'=='Win32' OR '$(Platform)'=='x86'">x86</LIBDATADOG-PLATFORM>
</PropertyGroup>
<ItemGroup>
<LibDatadogStaticLibs Include="$(MSBuildThisFileDirectory)..\..\build\native\lib\$(LIBDATADOG-PLATFORM)\$(Configuration)\static\*.lib" />
<LibDatadogDynLibs Include="$(MSBuildThisFileDirectory)..\..\build\native\lib\$(LIBDATADOG-PLATFORM)\$(Configuration)\*.lib" />
<LibDatadogDlls Include="$(MSBuildThisFileDirectory)..\..\build\native\lib\$(LIBDATADOG-PLATFORM)\$(Configuration)\*.dll" />
<LibDatadogPdbs Include="$(MSBuildThisFileDirectory)..\..\build\native\lib\$(LIBDATADOG-PLATFORM)\$(Configuration)\*.pdb" />
</ItemGroup>
<PropertyGroup>
<!-- Expland the items to a property -->
<LibDatadogStaticLibraries>@(LibDatadogStaticLibs)</LibDatadogStaticLibraries>
<LibDatadogDynLibraries>@(LibDatadogDynLibs)</LibDatadogDynLibraries>
<LibDatadogDependencies>PowrProf.lib;NtDll.lib;UserEnv.lib;Bcrypt.lib;crypt32.lib;wsock32.lib;ws2_32.lib;shlwapi.lib;Secur32.lib;Ncrypt.lib</LibDatadogDependencies>
</PropertyGroup>
Expand All @@ -22,15 +20,14 @@
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\include\native;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies Condition="'$(LibDatadogDynamicLink)' == 'true' OR '$(LibDatadogDynamicLink)' == ''">$(LibDatadogDynLibraries);$(LibDatadogDependencies);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(LibDatadogDynamicLink)' == 'false'">$(LibDatadogStaticLibraries);$(LibDatadogDependencies);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>$(LibDatadogDynLibraries);$(LibDatadogDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<LibDatadogFiles Include="@(LibDatadogDlls)" />
<LibDatadogFiles Include="@(LibDatadogPdbs)" />
</ItemGroup>
<Target Name="CopyLibDatadogDlls" AfterTargets="Build" Condition="'$(LibDatadogDynamicLink)' == 'true' OR '$(LibDatadogDynamicLink)' == ''">
<Target Name="CopyLibDatadogDlls" AfterTargets="Build">
<Copy
SourceFiles="@(LibDatadogFiles)"
DestinationFolder="$(OutDir)"
Expand All @@ -50,4 +47,4 @@
Importance="high"
Condition="'@(FilesToDelete)' != ''" />
</Target>
</Project>
</Project>

0 comments on commit 2551d1f

Please sign in to comment.