fix C++ builds (and make them faster) (#288)

* remove unused vcpkgs

* read platform from env var is available

* for Windows builds, use nlohmann.json NuGet package instead of vcpkg

* remove unused scripts

* add the two managed projects required to run native integration tests

* remove vcpkg references in test project

* add nlohmann.json nuget package to test project

* remove unused vcpkg script
This commit is contained in:
Lucas Pimentel 2019-03-21 07:35:30 -04:00 committed by GitHub
parent a122d153ab
commit adebdd5bf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 66 additions and 297 deletions

View File

@ -7,11 +7,21 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8CEC2042-F11C-49F5-A674-2355793B600A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Datadog.Trace.ClrProfiler.Native.Tests", "test\Datadog.Trace.ClrProfiler.Native.Tests\Datadog.Trace.ClrProfiler.Native.Tests.vcxproj", "{5728056A-51AA-4FF5-AD0C-E86E44E36102}"
ProjectSection(ProjectDependencies) = postProject
{6CE95C50-9533-4650-8F11-BCE30908DCDF} = {6CE95C50-9533-4650-8F11-BCE30908DCDF}
{901F02A8-8776-4D18-80C9-05C58262C1C7} = {901F02A8-8776-4D18-80C9-05C58262C1C7}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Datadog.Trace.ClrProfiler.Native", "src\Datadog.Trace.ClrProfiler.Native\Datadog.Trace.ClrProfiler.Native.vcxproj", "{91B6272F-5780-4C94-8071-DBBA7B4F67F3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Datadog.Trace.ClrProfiler.Native.DLL", "src\Datadog.Trace.ClrProfiler.Native\Datadog.Trace.ClrProfiler.Native.DLL.vcxproj", "{C0C8D381-D6B9-4C76-9428-F40F2FA93A9A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample-libs", "sample-libs", "{B9AA20A4-0F9A-47FB-B3BE-A5BDEA42EFF0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.ExampleLibrary", "sample-libs\Samples.ExampleLibrary\Samples.ExampleLibrary.csproj", "{901F02A8-8776-4D18-80C9-05C58262C1C7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.ExampleLibraryTracer", "sample-libs\Samples.ExampleLibraryTracer\Samples.ExampleLibraryTracer.csproj", "{6CE95C50-9533-4650-8F11-BCE30908DCDF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -51,6 +61,30 @@ Global
{C0C8D381-D6B9-4C76-9428-F40F2FA93A9A}.Release|x64.Build.0 = Release|x64
{C0C8D381-D6B9-4C76-9428-F40F2FA93A9A}.Release|x86.ActiveCfg = Release|Win32
{C0C8D381-D6B9-4C76-9428-F40F2FA93A9A}.Release|x86.Build.0 = Release|Win32
{901F02A8-8776-4D18-80C9-05C58262C1C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{901F02A8-8776-4D18-80C9-05C58262C1C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{901F02A8-8776-4D18-80C9-05C58262C1C7}.Debug|x64.ActiveCfg = Debug|Any CPU
{901F02A8-8776-4D18-80C9-05C58262C1C7}.Debug|x64.Build.0 = Debug|Any CPU
{901F02A8-8776-4D18-80C9-05C58262C1C7}.Debug|x86.ActiveCfg = Debug|Any CPU
{901F02A8-8776-4D18-80C9-05C58262C1C7}.Debug|x86.Build.0 = Debug|Any CPU
{901F02A8-8776-4D18-80C9-05C58262C1C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{901F02A8-8776-4D18-80C9-05C58262C1C7}.Release|Any CPU.Build.0 = Release|Any CPU
{901F02A8-8776-4D18-80C9-05C58262C1C7}.Release|x64.ActiveCfg = Release|Any CPU
{901F02A8-8776-4D18-80C9-05C58262C1C7}.Release|x64.Build.0 = Release|Any CPU
{901F02A8-8776-4D18-80C9-05C58262C1C7}.Release|x86.ActiveCfg = Release|Any CPU
{901F02A8-8776-4D18-80C9-05C58262C1C7}.Release|x86.Build.0 = Release|Any CPU
{6CE95C50-9533-4650-8F11-BCE30908DCDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6CE95C50-9533-4650-8F11-BCE30908DCDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CE95C50-9533-4650-8F11-BCE30908DCDF}.Debug|x64.ActiveCfg = Debug|Any CPU
{6CE95C50-9533-4650-8F11-BCE30908DCDF}.Debug|x64.Build.0 = Debug|Any CPU
{6CE95C50-9533-4650-8F11-BCE30908DCDF}.Debug|x86.ActiveCfg = Debug|Any CPU
{6CE95C50-9533-4650-8F11-BCE30908DCDF}.Debug|x86.Build.0 = Debug|Any CPU
{6CE95C50-9533-4650-8F11-BCE30908DCDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CE95C50-9533-4650-8F11-BCE30908DCDF}.Release|Any CPU.Build.0 = Release|Any CPU
{6CE95C50-9533-4650-8F11-BCE30908DCDF}.Release|x64.ActiveCfg = Release|Any CPU
{6CE95C50-9533-4650-8F11-BCE30908DCDF}.Release|x64.Build.0 = Release|Any CPU
{6CE95C50-9533-4650-8F11-BCE30908DCDF}.Release|x86.ActiveCfg = Release|Any CPU
{6CE95C50-9533-4650-8F11-BCE30908DCDF}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -59,6 +93,8 @@ Global
{5728056A-51AA-4FF5-AD0C-E86E44E36102} = {8CEC2042-F11C-49F5-A674-2355793B600A}
{91B6272F-5780-4C94-8071-DBBA7B4F67F3} = {9E5F0022-0A50-40BF-AC6A-C3078585ECAB}
{C0C8D381-D6B9-4C76-9428-F40F2FA93A9A} = {9E5F0022-0A50-40BF-AC6A-C3078585ECAB}
{901F02A8-8776-4D18-80C9-05C58262C1C7} = {B9AA20A4-0F9A-47FB-B3BE-A5BDEA42EFF0}
{6CE95C50-9533-4650-8F11-BCE30908DCDF} = {B9AA20A4-0F9A-47FB-B3BE-A5BDEA42EFF0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {160A1D00-1F5B-40F8-A155-621B4459D78F}

View File

@ -98,12 +98,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.SqlServer", "sample
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.RedisCore", "samples\Samples.RedisCore\Samples.RedisCore.csproj", "{F5B27CC4-1DF6-4ECD-A4FD-8200152F9A5A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{40A4D351-5F60-48DE-86EE-A2F2EF69F287}"
ProjectSection(SolutionItems) = preProject
scripts\generate-service-stack-redis-integrations.py = scripts\generate-service-stack-redis-integrations.py
scripts\install-vcpkgs.ps1 = scripts\install-vcpkgs.ps1
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.Elasticsearch", "samples\Samples.Elasticsearch\Samples.Elasticsearch.csproj", "{C98950B1-DC4B-43DA-974F-EF2CF325EC2B}"
ProjectSection(ProjectDependencies) = postProject
{85F35AAF-D102-4960-8B41-3BD9CBD0E77F} = {85F35AAF-D102-4960-8B41-3BD9CBD0E77F}
@ -428,18 +422,6 @@ Global
{DD3E8ED8-A0E4-482E-A5ED-115E21D543C0}.Release|x64.Build.0 = Release|x64
{DD3E8ED8-A0E4-482E-A5ED-115E21D543C0}.Release|x86.ActiveCfg = Release|x86
{DD3E8ED8-A0E4-482E-A5ED-115E21D543C0}.Release|x86.Build.0 = Release|x86
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Debug|x64.ActiveCfg = Debug|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Debug|x64.Build.0 = Debug|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Debug|x86.ActiveCfg = Debug|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Debug|x86.Build.0 = Debug|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Release|Any CPU.Build.0 = Release|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Release|x64.ActiveCfg = Release|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Release|x64.Build.0 = Release|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Release|x86.ActiveCfg = Release|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Release|x86.Build.0 = Release|Any CPU
{387E25D9-6B09-4C11-ADDC-EDE1A3311728}.Debug|Any CPU.ActiveCfg = Debug|x86
{387E25D9-6B09-4C11-ADDC-EDE1A3311728}.Debug|x64.ActiveCfg = Debug|x64
{387E25D9-6B09-4C11-ADDC-EDE1A3311728}.Debug|x64.Build.0 = Debug|x64
@ -462,6 +444,18 @@ Global
{B4AE8B0F-C2B2-41DF-88BB-D97E267D8964}.Release|x64.Build.0 = Release|Any CPU
{B4AE8B0F-C2B2-41DF-88BB-D97E267D8964}.Release|x86.ActiveCfg = Release|Any CPU
{B4AE8B0F-C2B2-41DF-88BB-D97E267D8964}.Release|x86.Build.0 = Release|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Debug|x64.ActiveCfg = Debug|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Debug|x64.Build.0 = Debug|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Debug|x86.ActiveCfg = Debug|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Debug|x86.Build.0 = Debug|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Release|Any CPU.Build.0 = Release|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Release|x64.ActiveCfg = Release|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Release|x64.Build.0 = Release|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Release|x86.ActiveCfg = Release|Any CPU
{99A62CCF-8E7F-4D57-8383-D38C371C8087}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -492,9 +486,9 @@ Global
{5B52C0C0-A554-4E53-9D17-B121E78FF919} = {8CEC2042-F11C-49F5-A674-2355793B600A}
{3493346B-44F6-4F50-8FB4-51D0090DF544} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE}
{DD3E8ED8-A0E4-482E-A5ED-115E21D543C0} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE}
{99A62CCF-8E7F-4D57-8383-D38C371C8087} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE}
{387E25D9-6B09-4C11-ADDC-EDE1A3311728} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE}
{B4AE8B0F-C2B2-41DF-88BB-D97E267D8964} = {FA03944C-2391-4C25-8979-2E078A8CE0DD}
{99A62CCF-8E7F-4D57-8383-D38C371C8087} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {160A1D00-1F5B-40F8-A155-621B4459D78F}

View File

@ -1,149 +0,0 @@
#!/usr/bin/env python3
from typing import Dict, List, Union
import urllib.request
import json
VERSION = "0.8.0.0"
class Signature(object):
def __init__(self, types: List[str]):
self.data = Signature.types_to_signature(types)
self.types = types
@staticmethod
def type_to_bytes(type_name: str) -> List[int]:
if type_name.endswith("[]"):
return [0x1D] + Signature.type_to_bytes(type_name[:len(type_name)-2])
types = {
"void": 0x01,
"bool": 0x02,
"char": 0x03,
"sbyte": 0x04,
"byte": 0x05,
"short": 0x06,
"ushort": 0x07,
"int": 0x08,
"uint": 0x09,
"long": 0x0a,
"ulong": 0x0b,
"float": 0x0c,
"double": 0x0d,
"string": 0x0e,
# ptr
# byref
# valuetype
# class
# var
# mdarray
# genericinst
# typedref
# native integer
# native unsigned integer
# FNPTR
"object": 0x1c,
# SZARRAY
# MVAR
}
return [types[type_name]]
@staticmethod
def types_to_signature(types: List[str]) -> List[int]:
return [0x00, len(types)-1] + sum((Signature.type_to_bytes(t) for t in types), [])
def to_string(self) -> str:
return " ".join("%02x" % x for x in self.data)
class MethodReplacement(object):
def __init__(self, method_name: str, signature: Union[Signature, List[str]], caller: dict = None, target_signature: Union[Signature, List[str]] = None):
self.name = method_name
if isinstance(signature, Signature):
self.signature = signature
else:
self.signature = Signature(signature)
self.caller = caller
def to_dict(self, integration: 'Integration', type_replacement: 'TypeReplacement') -> dict:
caller = self.caller
if caller is None:
caller = {"assembly": integration.assembly}
return {
"caller": caller,
"target": {
"assembly": integration.assembly,
"type": type_replacement.name,
"method": self.name
},
"wrapper": {
"assembly": f"Datadog.Trace.ClrProfiler.Managed, Version={VERSION}, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": f"Datadog.Trace.ClrProfiler.Integrations.{type_replacement.name}",
"method": self.name,
"signature": self.signature.to_string()
}
}
class TypeReplacement(object):
def __init__(self, name: str, method_replacements: List[MethodReplacement]):
self.name = name
self.method_replacements = method_replacements
def to_list(self, integration: 'Integration') -> list:
return [x.to_dict(integration, self) for x in self.method_replacements]
class Integration(object):
def __init__(self, name: str, assembly: str, type_replacements: List[TypeReplacement]):
self.name = name
self.assembly = assembly
self.type_replacements = type_replacements
def to_dict(self) -> dict:
return {
"name": self.name,
"method_replacements": [
x
for tr in self.type_replacements
for x in tr.to_list(self)
]
}
integrations = [
Integration("ServiceStackRedis", "ServiceStack.Redis", [
TypeReplacement("ServiceStack.Redis.RedisNativeClient", [
MethodReplacement("SendExpectCode", ["string", "object", "byte[][]"]),
MethodReplacement("SendExpectComplexResponse", ["object", "object", "byte[][]"]),
MethodReplacement("SendExpectData", ["byte[]", "object", "byte[][]"]),
MethodReplacement("SendExpectDeeplyNestedMultiData", [
"object[]", "object", "byte[][]"]),
MethodReplacement("SendExpectDouble", ["double", "object", "byte[][]"]),
MethodReplacement("SendExpectLong", ["long", "object", "byte[][]"]),
MethodReplacement("SendExpectMultiData", ["byte[][]", "object", "byte[][]"]),
MethodReplacement("SendExpectSuccess", ["void", "object", "byte[][]"]),
MethodReplacement("SendWithoutRead", ["void", "object", "byte[][]"]),
]),
]),
]
def main():
print("INTEGRATIONS:")
print(json.dumps([i.to_dict() for i in integrations],
indent=2, separators=(',', ': ')))
print("")
print("")
print("METHODS:")
for i in integrations:
for tr in i.type_replacements:
for mr in tr.method_replacements:
print(f"public static {mr.signature.types[0]} {mr.name}({','.join(t for t in mr.signature.types[1:])})")
if __name__ == "__main__":
main()

View File

@ -1,57 +0,0 @@
$solutionRoot = [IO.Path]::GetFullPath(([IO.Path]::Combine($PSScriptRoot, "..")))
$workspaceRoot = [IO.Path]::GetFullPath(([IO.Path]::Combine($solutionRoot, "..")))
$vcpkgRoot = [IO.Path]::Combine($workspaceRoot, "vcpkg")
$vcpkgExe = [IO.Path]::Combine($vcpkgRoot, "vcpkg.exe")
function Run {
param(
[Parameter(Position=0)][string] $Name,
[Parameter(Position=1)][String[]] $Args,
[Parameter(Position=2)][string] $WorkingDirectory
)
Write-Host "running $($Name) $($Args)"
$proc = Start-Process $Name -ArgumentList $Args -WorkingDirectory $WorkingDirectory -NoNewWindow -PassThru
$handle = $proc.Handle # cache proc.Handle
$proc.WaitForExit(1000 * 60 * 10)
return $proc
}
if (Test-Path $vcpkgRoot) {
Write-Host "vcpkg repo found"
} else {
Write-Host "vcpkg repo not found, cloning"
$p = Run "git" "clone","https://github.com/Microsoft/vcpkg.git" $workspaceRoot
if ($p.ExitCode -ne 0) {
Write-Host "failed to clone vcpkg repo: $($p.ExitCode)"
Exit 1
}
}
if (Test-Path $vcpkgExe) {
Write-Host "vcpkg.exe found"
} else {
Write-Host "vcpkg.exe not found, bootstrapping"
$p = Run "cmd" "/c","bootstrap-vcpkg.bat" $vcpkgRoot
if ($p.ExitCode -ne 0) {
Write-Host "failed to bootstrap vcpkg: $($p.ExitCode)"
Exit 1
}
}
$packages = @("fmt", "spdlog", "nlohmann-json", "re2")
$platforms = @("x86", "x64")
foreach ($platform in $platforms) {
foreach ($package in $packages) {
Write-Host "installing $($package):$($platform)-windows-static"
$p = Run $vcpkgExe "install","$($package):$($platform)-windows-static" $vcpkgRoot
if ($p.ExitCode -ne 0) {
Write-Host "failed to install $($package):$($platform): $($p.ExitCode)"
Exit 1
}
}
}
Exit 0

View File

@ -23,12 +23,6 @@
<ProjectGuid>{C0C8D381-D6B9-4C76-9428-F40F2FA93A9A}</ProjectGuid>
<RootNamespace>DatadogTraceClrProfilerNativeDLL</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<VCPKG_PLATFORM Condition="'$(Platform)'=='Win32' OR '$(Platform)'=='x86'">x86</VCPKG_PLATFORM>
<VCPKG_PLATFORM Condition="'$(Platform)'=='x64'">x64</VCPKG_PLATFORM>
<VCPKG_DIR>..\..\..\vcpkg\</VCPKG_DIR>
<VCPKG_INCLUDES>$(VCPKG_DIR)packages\fmt_$(VCPKG_PLATFORM)-windows-static\include;$(VCPKG_DIR)packages\spdlog_$(VCPKG_PLATFORM)-windows-static\include;$(VCPKG_DIR)packages\nlohmann-json_$(VCPKG_PLATFORM)-windows-static\include</VCPKG_INCLUDES>
<VCPKG_LIBS Condition="'$(Configuration)'=='Release'">$(VCPKG_DIR)packages\fmt_$(VCPKG_PLATFORM)-windows-static\lib\fmt.lib</VCPKG_LIBS>
<VCPKG_LIBS Condition="'$(Configuration)'=='Debug'">$(VCPKG_DIR)packages\fmt_$(VCPKG_PLATFORM)-windows-static\debug\lib\fmtd.lib</VCPKG_LIBS>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -107,13 +101,11 @@
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>$(VCPKG_INCLUDES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ModuleDefinitionFile>.\Datadog.Trace.ClrProfiler.Native.def</ModuleDefinitionFile>
<AdditionalDependencies>$(VCPKG_LIBS);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -124,13 +116,11 @@
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>$(VCPKG_INCLUDES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ModuleDefinitionFile>.\Datadog.Trace.ClrProfiler.Native.def</ModuleDefinitionFile>
<AdditionalDependencies>$(VCPKG_LIBS);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -142,7 +132,6 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(VCPKG_INCLUDES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -150,7 +139,6 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>.\Datadog.Trace.ClrProfiler.Native.def</ModuleDefinitionFile>
<AdditionalDependencies>$(VCPKG_LIBS);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -162,7 +150,6 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(VCPKG_INCLUDES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -170,7 +157,6 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>.\Datadog.Trace.ClrProfiler.Native.def</ModuleDefinitionFile>
<AdditionalDependencies>$(VCPKG_LIBS);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -25,10 +25,6 @@
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<CORECLR_PATH>..\..\lib\coreclr</CORECLR_PATH>
<ProjectName>Datadog.Trace.ClrProfiler.Native</ProjectName>
<VCPKG_PLATFORM Condition="'$(Platform)'=='Win32' OR '$(Platform)'=='x86'">x86</VCPKG_PLATFORM>
<VCPKG_PLATFORM Condition="'$(Platform)'=='x64'">x64</VCPKG_PLATFORM>
<VCPKG_DIR>..\..\..\vcpkg\</VCPKG_DIR>
<VCPKG_INCLUDES>$(VCPKG_DIR)packages\nlohmann-json_$(VCPKG_PLATFORM)-windows-static\include</VCPKG_INCLUDES>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
@ -60,6 +56,7 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\packages\nlohmann.json.3.5.0\build\native\nlohmann.json.targets" Condition="Exists('..\..\packages\nlohmann.json.3.5.0\build\native\nlohmann.json.targets')" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -96,7 +93,6 @@
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(VCPKG_INCLUDES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -109,7 +105,6 @@
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(VCPKG_INCLUDES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -127,7 +122,6 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>$(VCPKG_INCLUDES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -145,7 +139,6 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>$(VCPKG_INCLUDES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
@ -185,5 +178,14 @@
<ClCompile Include="string.cpp" />
<ClCompile Include="util.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\nlohmann.json.3.5.0\build\native\nlohmann.json.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\nlohmann.json.3.5.0\build\native\nlohmann.json.targets'))" />
</Target>
</Project>

View File

@ -1 +0,0 @@
msbuild /p:Configuration="%BuildType%" /p:BuildOS="Windows_NT" /p:BuildType="%BuildType%" /p:BuildArch="%BuildArch%" /p:CORECLR_PATH="%CORECLR_PATH%"

View File

@ -1,35 +0,0 @@
#!/bin/bash
set -euxo pipefail
CORECLR_OS=Linux
CORECLR_ARCH=x64
CORECLR_CONFIGURATION=Debug
CXX_FLAGS="${CXX_FLAGS:-} \
-Wno-invalid-noreturn \
-fPIC \
-fms-extensions \
-DBIT64 \
-DPAL_STDCPP_COMPAT \
-DPLATFORM_UNIX \
-std=c++11 \
"
LD_FLAGS="${LD_FLAGS:-} \
-I /opt/coreclr/src/pal/inc/rt \
-I /opt/coreclr/src/pal/prebuilt/inc \
-I /opt/coreclr/src/pal/inc \
-I /opt/coreclr/src/inc \
-I /opt/coreclr/bin/Product/$CORECLR_OS.$CORECLR_ARCH.$CORECLR_CONFIGURATION/inc \
-I /opt/spdlog/include \
"
mkdir -p obj/$CORECLR_CONFIGURATION/$CORECLR_ARCH
clang++-3.9 \
-shared \
-o obj/$CORECLR_CONFIGURATION/$CORECLR_ARCH/Datadog.Trace.ClrProfiler.Native.so \
$CXX_FLAGS \
$LD_FLAGS \
class_factory.cpp \
dllmain.cpp

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="nlohmann.json" version="3.5.0" targetFramework="native" />
</packages>

View File

@ -26,12 +26,6 @@
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<VCPKG_PLATFORM Condition="'$(Platform)'=='Win32' OR '$(Platform)'=='x86'">x86</VCPKG_PLATFORM>
<VCPKG_PLATFORM Condition="'$(Platform)'=='x64'">x64</VCPKG_PLATFORM>
<VCPKG_DIR>..\..\..\vcpkg\</VCPKG_DIR>
<VCPKG_INCLUDES>$(VCPKG_DIR)packages\fmt_$(VCPKG_PLATFORM)-windows-static\include;$(VCPKG_DIR)packages\spdlog_$(VCPKG_PLATFORM)-windows-static\include;$(VCPKG_DIR)packages\nlohmann-json_$(VCPKG_PLATFORM)-windows-static\include</VCPKG_INCLUDES>
<VCPKG_LIBS Condition="'$(Configuration)'=='Release'">$(VCPKG_DIR)packages\fmt_$(VCPKG_PLATFORM)-windows-static\lib\fmt.lib</VCPKG_LIBS>
<VCPKG_LIBS Condition="'$(Configuration)'=='Debug'">$(VCPKG_DIR)packages\fmt_$(VCPKG_PLATFORM)-windows-static\debug\lib\fmtd.lib</VCPKG_LIBS>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@ -88,6 +82,7 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\packages\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-static.1.8.0\build\native\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-static.targets" Condition="Exists('..\..\packages\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-static.1.8.0\build\native\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-static.targets')" />
<Import Project="..\..\packages\nlohmann.json.3.5.0\build\native\nlohmann.json.targets" Condition="Exists('..\..\packages\nlohmann.json.3.5.0\build\native\nlohmann.json.targets')" />
</ImportGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@ -100,12 +95,10 @@
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>$(VCPKG_INCLUDES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>$(VCPKG_LIBS);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -119,12 +112,10 @@
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>$(VCPKG_INCLUDES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>$(VCPKG_LIBS);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -135,14 +126,12 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>$(VCPKG_INCLUDES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<AdditionalDependencies>$(VCPKG_LIBS);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -153,14 +142,12 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>$(VCPKG_INCLUDES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<AdditionalDependencies>$(VCPKG_LIBS);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
@ -168,5 +155,6 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-static.1.8.0\build\native\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-static.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-static.1.8.0\build\native\Microsoft.googletest.v140.windesktop.msvcstl.static.rt-static.targets'))" />
<Error Condition="!Exists('..\..\packages\nlohmann.json.3.5.0\build\native\nlohmann.json.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\nlohmann.json.3.5.0\build\native\nlohmann.json.targets'))" />
</Target>
</Project>

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.googletest.v140.windesktop.msvcstl.static.rt-static" version="1.8.0" targetFramework="native" />
<package id="nlohmann.json" version="3.5.0" targetFramework="native" />
</packages>