Skip to content

Commit da734e9

Browse files
committed
fix some more linking
1 parent af989e3 commit da734e9

File tree

2 files changed

+50
-8
lines changed

2 files changed

+50
-8
lines changed

windows/libdatadog.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@
3838
<None Include="$(LibDatadogBinariesOutputDir)\data-pipeline.h" Pack="true"
3939
PackagePath="include\native\datadog\data-pipeline.h" />
4040

41+
<!--
42+
Follow https://learn.microsoft.com/en-us/nuget/create-packages/native-files-in-net-packages
43+
44+
Contoso.Native.1.0.0.nuspec
45+
ref/net8.0/Contoso.Native.dll
46+
runtimes/any/lib/net8.0/Contoso.Native.dll
47+
runtimes/linux-arm64/native/libcontoso.so
48+
runtimes/linux-x64/native/libcontoso.so
49+
runtimes/osx-arm64/native/libcontoso.dylib
50+
runtimes/osx-x64/native/libcontoso.dylib
51+
runtimes/win-arm64/native/contoso.dll
52+
runtimes/win-x64/native/contoso.dll
53+
-->
54+
4155
<!-- win-x64 debug -->
4256
<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\debug\datadog_profiling_ffi.lib"
4357
Pack="true" PackagePath="runtimes\win-x64\native\debug\datadog_profiling_ffi.lib" />

windows/libdatadog.props

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,49 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
3-
ToolsVersion="15.0">
4-
<PropertyGroup>
5-
<LIBDATADOG-PLATFORM Condition="'$(Platform)'=='x64'">x64</LIBDATADOG-PLATFORM>
6-
<LIBDATADOG-PLATFORM Condition="'$(Platform)'=='Win32' OR '$(Platform)'=='x86'">x86</LIBDATADOG-PLATFORM>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="15.0">
3+
4+
<PropertyGroup Condition="($(RuntimeIdentifier) == '' and $([MSBuild]::IsOSPlatform('Linux'))) or $(RuntimeIdentifier.StartsWith('linux'))">
5+
<LibdatadogPlatform>linux</LibdatadogPlatform>
6+
<LibdatadogLibraryType>so</LibdatadogLibraryType>
7+
</PropertyGroup>
8+
9+
<PropertyGroup Condition="($(RuntimeIdentifier) == '' and $([MSBuild]::IsOSPlatform('Windows'))) or $(RuntimeIdentifier.StartsWith('win'))">
10+
<LibdatadogPlatform>win</LibdatadogPlatform>
11+
<LibdatadogLibraryType>dll</LibdatadogLibraryType>
12+
</PropertyGroup>
13+
14+
<PropertyGroup Condition="($(RuntimeIdentifier) == '' and $([MSBuild]::IsOSPlatform('OSX'))) or $(RuntimeIdentifier.StartsWith('osx'))">
15+
<LibdatadogPlatform>osx</LibdatadogPlatform>
16+
<LibdatadogLibraryType>dylib</LibdatadogLibraryType>
17+
</PropertyGroup>
18+
19+
<PropertyGroup Condition="($(RuntimeIdentifier) == '' and $([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) == 'x64') or $(RuntimeIdentifier.EndsWith('x64'))">
20+
<LibdatadogArchitecture>x64</LibdatadogArchitecture>
21+
</PropertyGroup>
22+
23+
<PropertyGroup Condition="($(RuntimeIdentifier) == '' and $([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) == 'Arm64') or $(RuntimeIdentifier.EndsWith('arm64'))">
24+
<LibdatadogArchitecture>arm64</LibdatadogArchitecture>
25+
</PropertyGroup>
26+
27+
<PropertyGroup Condition="($(RuntimeIdentifier) == '' and $([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) == 'Arm') or $(RuntimeIdentifier.EndsWith('arm'))">
28+
<LibdatadogArchitecture>arm</LibdatadogArchitecture>
29+
</PropertyGroup>
30+
31+
<PropertyGroup Condition="($(RuntimeIdentifier) == '' and $([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) == 'x86') or $(RuntimeIdentifier.EndsWith('x86'))">
32+
<LibdatadogArchitecture>x86</LibdatadogArchitecture>
733
</PropertyGroup>
34+
835
<ItemGroup>
9-
<LibdatadogLibs Include="$(MSBuildThisFileDirectory)..\..\build\native\lib\$(LIBDATADOG-PLATFORM)\$(Configuration)\*.lib" />
36+
<LibdatadogDynamic Include="$(MSBuildThisFileDirectory)\runtimes\$(LibdatadogPlatform)-$(LibdatadogArchitecture)\native\$(Configuration)\*.$(LibdatadogLibraryType)" />
1037
</ItemGroup>
38+
1139
<PropertyGroup>
1240
<!-- Expland the items to a property -->
13-
<LibdatadogLibraries>@(LibdatadogLibs)</LibdatadogLibraries>
41+
<LibdatadogLibraries>@(LibdatadogDynamic)</LibdatadogLibraries>
1442
<LibdatadogDependencies>PowrProf.lib;NtDll.lib;UserEnv.lib;Bcrypt.lib;crypt32.lib;wsock32.lib;ws2_32.lib;shlwapi.lib;Secur32.lib;Ncrypt.lib</LibdatadogDependencies>
1543
</PropertyGroup>
1644
<ItemDefinitionGroup>
1745
<ClCompile>
18-
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\include\native;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
46+
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)\include\native;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
1947
</ClCompile>
2048
<Link>
2149
<AdditionalDependencies>$(LibdatadogLibraries);$(LibdatadogDependencies);%(AdditionalDependencies)</AdditionalDependencies>

0 commit comments

Comments
 (0)