mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-22 23:00:55 +00:00
chore: Rust-C++ cmake and CI integration (#7034)
This commit is contained in:
@@ -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.
|
||||
|
||||
9
src/tests/libxrpl/basics/RustInterop.cpp
Normal file
9
src/tests/libxrpl/basics/RustInterop.cpp
Normal 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");
|
||||
}
|
||||
Reference in New Issue
Block a user