You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.MD
+45-7Lines changed: 45 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,21 @@
1
1
# Example of using [CXX](https://cxx.rs/) and [Corrosion](https://github.com/corrosion-rs/corrosion) in CMake project to call Rust functions from C++
2
2
3
-
This is a fork of the [rusty_cmake](https://github.com/trondhe/rusty_cmake) repository to use CXX and Corrosion in a CMake project with the following modifications:
3
+
This is a fork of the [rusty_cmake](https://github.com/trondhe/rusty_cmake) repository to use CXX and Corrosion in a CMake project to use CXX and Corrosion in a CMake project with the following modifications:
4
4
5
5
### `cxx_corrosion.cmake` file:
6
-
- Windows-related code is removed (Linux and MacOS are supported).
7
-
- Get STEM function is removed in a favor of using one line `get_filename_component(_LIB_PATH_STEM ${lib_path} NAME)`.
6
+
### `cxx_corrosion.cmake` file:
7
+
- Windows-related code is removed (Linux and MacOS are supported) (Linux and MacOS are supported).
8
+
- Windows-related code is removed (Linux and MacOS are supported) (Linux and MacOS are supported).
8
9
- Simplify by using a simple one CMakeLists file for the project.
9
10
10
11
### Code examples to call Rust functions from C++:
11
12
-[Example of using a different primitive types](https://github.com/geekbrother/cxx-corrosion-cmake/blob/main/src/main.cpp) for arguments and returns.
12
13
- Example of using [Rust Result type](https://cxx.rs/binding/result.html#returning-result-from-rust-to-c) in return and [Anyhow](https://docs.rs/anyhow/latest/anyhow/).
13
14
-[Example of using panics](https://github.com/geekbrother/cxx-corrosion-cmake/blob/2a981b2ec34ee4d4ffe261b1be07691f74c31a04/src/main.cpp#L15) in Rust + C++.
15
+
### Code examples to call Rust functions from C++:
16
+
-[Example of using a different primitive types](https://github.com/geekbrother/cxx-corrosion-cmake/blob/main/src/main.cpp) for arguments and returns.
17
+
- Example of using [Rust Result type](https://cxx.rs/binding/result.html#returning-result-from-rust-to-c) in return and [Anyhow](https://docs.rs/anyhow/latest/anyhow/).
18
+
-[Example of using panics](https://github.com/geekbrother/cxx-corrosion-cmake/blob/2a981b2ec34ee4d4ffe261b1be07691f74c31a04/src/main.cpp#L15) in Rust + C++.
14
19
15
20
# Why?
16
21
@@ -22,10 +27,6 @@ This repo can be used as a sandbox playground for testing simple ideas of the Ru
0 commit comments