Skip to content

Commit 6ede5ed

Browse files
author
elsa
committed
fix: include customlabels in cmake deps
* CMakeLists.txt * cmake/deps/customlabels.cmake * include/datadog/tracer_signature.h * src/datadog/trace_segment.cpp
1 parent 9dca183 commit 6ede5ed

File tree

4 files changed

+59
-3
lines changed

4 files changed

+59
-3
lines changed

CMakeLists.txt

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ endif ()
2424

2525
set(DD_TRACE_TRANSPORT "curl" CACHE STRING "HTTP transport that dd-trace-cpp uses to communicate with the Datadog Agent, can be either 'none' or 'curl'")
2626

27+
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
28+
include(cmake/deps/customlabels.cmake)
29+
message(STATUS "customlabels Library is available")
30+
endif()
31+
2732
if(DD_TRACE_TRANSPORT STREQUAL "curl")
2833
include(cmake/deps/curl.cmake)
2934
message(STATUS "DD_TRACE_TRANSPORT is set to 'curl', including curl")
@@ -203,11 +208,17 @@ if (BUILD_SHARED_LIBS)
203208
PUBLIC
204209
dd_trace::obj
205210
CURL::libcurl_shared
206-
customlabels
207211
PRIVATE
208212
dd_trace::specs
209213
)
210214

215+
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
216+
target_link_libraries(dd_trace_cpp-shared
217+
PUBLIC
218+
customlabels
219+
)
220+
endif ()
221+
211222
install(TARGETS dd_trace_cpp-objects dd_trace_cpp-shared
212223
EXPORT dd_trace_cpp-export
213224
FILE_SET public_headers DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
@@ -250,6 +261,13 @@ if (BUILD_STATIC_LIBS)
250261
dd_trace::specs
251262
)
252263

264+
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
265+
target_link_libraries(dd_trace_cpp-static
266+
PUBLIC
267+
customlabels
268+
)
269+
endif ()
270+
253271
install(TARGETS dd_trace_cpp-objects dd_trace_cpp-static
254272
EXPORT dd_trace_cpp-export
255273
FILE_SET public_headers DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
@@ -258,3 +276,10 @@ if (BUILD_STATIC_LIBS)
258276
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
259277
)
260278
endif ()
279+
280+
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
281+
target_include_directories(dd_trace_cpp-objects
282+
PRIVATE
283+
${customlabels_SOURCE_DIR}/src
284+
)
285+
endif()

cmake/deps/customlabels.cmake

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
include(FetchContent)
2+
3+
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
4+
set(TLS_DIALECT desc)
5+
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64")
6+
set(TLS_DIALECT gnu2)
7+
else()
8+
message(FATAL_ERROR "Only aarch64 and x86-64 are supported (found: ${CMAKE_SYSTEM_PROCESSOR})")
9+
endif()
10+
11+
FetchContent_Declare(customlabels
12+
GIT_REPOSITORY https://github.com/DataDog/custom-labels.git
13+
GIT_TAG elsa/add-process-storage
14+
)
15+
16+
FetchContent_MakeAvailable(customlabels)
17+
18+
add_compile_options(
19+
-fPIC
20+
-ftls-model=global-dynamic
21+
-mtls-dialect=${TLS_DIALECT}
22+
)
23+
24+
add_library(customlabels SHARED
25+
${customlabels_SOURCE_DIR}/src/customlabels.c
26+
)
27+
28+
target_include_directories(customlabels
29+
PUBLIC
30+
${customlabels_SOURCE_DIR}/src
31+
)

include/datadog/tracer_signature.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <cstring>
2424
#include <vector>
2525
extern "C" {
26-
#include <customlabels/customlabels.h>
26+
#include <customlabels.h>
2727
}
2828
#endif
2929

src/datadog/trace_segment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#ifdef __linux__
22
extern "C" {
3-
#include <customlabels/customlabels.h>
3+
#include <customlabels.h>
44
}
55
#endif
66

0 commit comments

Comments
 (0)