forked from DataDog/dd-trace-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
96 lines (75 loc) · 2.86 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
cmake_minimum_required (VERSION 3.8..3.19)
cmake_policy(SET CMP0015 NEW)
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
# ******************************************************
# Project definition
# ******************************************************
project("Datadog.APM.Native" VERSION 2.18.0)
# ******************************************************
# Environment detection
# ******************************************************
SET(OSX_ARCH ${CMAKE_OSX_ARCHITECTURES})
# Detect architecture
if (OSX_ARCH STREQUAL x86_64)
message(STATUS "Architecture is x64/AMD64 configured by CMAKE_OSX_ARCHITECTURES")
SET(ISAMD64 true)
elseif (OSX_ARCH STREQUAL arm64)
message(STATUS "Architecture is ARM64 configured by CMAKE_OSX_ARCHITECTURES")
SET(ISARM64 true)
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
message(STATUS "Architecture is x64/AMD64")
SET(ISAMD64 true)
SET(OSX_ARCH "x86_64")
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL x86 OR CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
message(STATUS "Architecture is x86")
SET(ISX86 true)
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm64)
message(STATUS "Architecture is ARM64")
SET(ISARM64 true)
SET(OSX_ARCH "arm64")
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm)
message(STATUS "Architecture is ARM")
SET(ISARM true)
endif()
# Detect operating system
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
message(FATAL_ERROR "Windows builds are not supported using CMAKE. Please use Visual Studio")
SET(ISWINDOWS true)
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
message(STATUS "Preparing Linux build")
SET(ISLINUX true)
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
message(STATUS "Preparing macOS build")
SET(ISMACOS true)
endif()
# Detect bitness of the build
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
message(STATUS "Setting compilation for 64bits processor")
SET(BIT64 true)
endif()
SET(DOTNET_TRACER_REPO_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/build/cmake")
find_package(Coreclr REQUIRED)
message(STATUS "Coreclr files ")
find_package(Re2 REQUIRED)
message(STATUS "Re2 library " ${RE2_VERSION})
find_package(Spdlog REQUIRED)
message(STATUS "Spdlog headers")
find_package(ManagedLoader REQUIRED)
message(STATUS "Tracer Managed Loader")
find_package(Libunwind REQUIRED)
message(STATUS "Libunwind library " ${LIBUNWIND_VERSION})
find_package(Libdatadog REQUIRED)
message(STATUS "Libdatadog library " ${LIBDATADOG_VERSION})
find_package(GoogleTest REQUIRED)
message(STATUS "GoogleTest library")
find_package(PPDB REQUIRED)
message(STATUS "PPDB library")
add_subdirectory(tracer)
# profiler cannot be built on MacOS (yet)
if (NOT ISMACOS)
add_subdirectory(profiler)
endif()
add_subdirectory(shared)