GithubHelp home page GithubHelp logo

dnsl48 / rusty_cmake Goto Github PK

View Code? Open in Web Editor NEW

This project forked from trondhe/rusty_cmake

0.0 0.0 0.0 31 KB

Rust cmake integration template with corrosion and cxx

License: The Unlicense

CMake 86.32% C++ 6.93% Rust 6.75%

rusty_cmake's Introduction

Rusty cmake

Integrate Rust in a Cmake project with Corrosion and Cxx.

Usage

Rust_CARGO_TARGET needs to be defined before calling add_library_rust, which takes a PATH to the root of a rust crate along with a required NAMESPACE to use for the created target.
add_library_rust(PATH some/path/to/rustycrate NAMESPACE my) will result in a target my::rustycrate that includes both the crate itself and the generated cxxbridge header and source to be linked into another target.

Windows + Clang issue

Building with Clang on Windows in debug mode creates a mismatch between the c runtime being dynamic release for the rust lib and dynamic debug for cpp code. No clean solution have been found to this issue. Using the -gnu target on Windows for the Rust lib and building with mingw bypasses this.

Other notes

  • This has only been tested with calling Rust from Cpp, and not the other way around.
  • For some reason the `lib.rs.cpp' file gets compliled twice, not sure why.
  • Clean up how the bindings are placed #include "rustycrate/src/lib.rs.h" is a bit ugly.

rusty_cmake's People

Contributors

trondhe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.