chore: Rust-C++ cmake and CI integration (#7034)

This commit is contained in:
Sergey Kuznetsov
2026-08-19 14:30:06 +00:00
committed by GitHub
parent d1dc7a6ccf
commit f370289733
33 changed files with 838 additions and 12 deletions

View File

@@ -43,6 +43,9 @@ set(test_modules
if(NOT WIN32)
list(APPEND test_modules net)
endif()
if(rust)
target_link_libraries(xrpl_tests PRIVATE rs_hello_world_cxxbridge)
endif()
foreach(module IN LISTS test_modules)
# Append the module's sources (${module}/*.cpp and ${module}.cpp, if any).
@@ -52,6 +55,12 @@ foreach(module IN LISTS test_modules)
"${CMAKE_CURRENT_SOURCE_DIR}/${module}/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/${module}.cpp"
)
if(NOT rust)
# Tests of the Rust interop include generated cxxbridge headers, which
# do not exist without the crates, so keep them out of the build tree
# entirely. They are named `Rust<something>.cpp`.
list(FILTER sources EXCLUDE REGEX "/Rust[^/]*\\.cpp$")
endif()
target_sources(xrpl_tests PRIVATE ${sources})
# Expose the module's private headers under their canonical include path.

View File

@@ -0,0 +1,9 @@
#include <gtest/gtest.h>
#include <rs_hello_world_cxxbridge/lib.h>
#include <string>
TEST(RustInteropTest, hello_world)
{
EXPECT_EQ(std::string(rs::hello_world::hello_world()), "hello_world");
}