Skip to content

Commit 5659b91

Browse files
committed
Fix python build script path.
* Call build_libnative from project's root folder. * Fix FindLibNative in order not to include libnative whole folder structure. * Workaround test linking.
1 parent b48d766 commit 5659b91

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

build_libnative.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def install_dedup_headers():
1919
)
2020

2121

22-
def build_crate(crate_dir: Path, release: bool, features: list[str] = None):
22+
def build_crate(crate_dir: Path, release: bool, features: list = None):
2323
env = os.environ.copy()
2424
abs_dir = crate_dir.absolute()
2525
env["CARGO_TARGET_DIR"] = str(abs_dir / "target")

ddtrace/internal/datadog/profiling/build_standalone.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ add_target() {
368368
#Build rust dependencies
369369
build_rust() {
370370
echo "Building Rust dependencies"
371-
python3 ../../../../build_libnative.py --crate ../../../../src/native --release --features profiling
371+
python3 build_libnative.py --crate ./src/native --release --features profiling
372372
}
373373

374374

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
set(SOURCE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/../../../../../src/native/target/include)
22
set(SOURCE_LIB_DIR ${CMAKE_SOURCE_DIR}/../../../../../src/native/target/release)
33

4-
set(DEST_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/libnative)
4+
set(DEST_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR})
55
set(DEST_INCLUDE_DIR ${DEST_LIB_DIR}/include)
6-
set(DEST_LIB_OUTPUT_DIR ${DEST_LIB_DIR}/lib)
6+
set(DEST_LIB_OUTPUT_DIR ${DEST_LIB_DIR})
77

88
file(COPY ${SOURCE_INCLUDE_DIR} DESTINATION ${DEST_LIB_DIR})
99

@@ -14,7 +14,7 @@ file(COPY ${LIB_FILES} DESTINATION ${DEST_LIB_OUTPUT_DIR})
1414
add_library(native SHARED IMPORTED)
1515

1616
set_target_properties(native PROPERTIES
17-
IMPORTED_LOCATION "${DEST_LIB_OUTPUT_DIR}/libnative.so"
17+
IMPORTED_LOCATION ${DEST_LIB_OUTPUT_DIR}/libnative.so
1818
INTERFACE_INCLUDE_DIRECTORIES ${DEST_INCLUDE_DIR}
1919
)
2020

ddtrace/internal/datadog/profiling/dd_wrapper/test/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
include(FetchContent)
12
FetchContent_Declare(
23
googletest
34
GIT_REPOSITORY https://github.com/google/googletest.git
@@ -12,6 +13,8 @@ FetchContent_MakeAvailable(googletest)
1213
include(GoogleTest)
1314
include(AnalysisFunc)
1415

16+
find_package(Python3 COMPONENTS Interpreter Development)
17+
1518
if(DO_VALGRIND)
1619
find_program(
1720
VALGRIND_EXECUTABLE
@@ -33,8 +36,10 @@ endif()
3336
function(dd_wrapper_add_test name)
3437
add_executable(${name} ${ARGN})
3538
target_include_directories(${name} PRIVATE ../include)
36-
target_link_libraries(${name} PRIVATE gmock gtest_main dd_wrapper)
39+
#target_link_libraries(${name} PRIVATE ${Python3_LIBRARIES})
40+
target_link_libraries(${name} PRIVATE gmock gtest_main dd_wrapper ${Python3_LIBRARIES})
3741
add_ddup_config(${name})
42+
target_link_options(${name} PRIVATE -Wl,--no-as-needed)
3843

3944
gtest_discover_tests(
4045
${name}

0 commit comments

Comments
 (0)