Can a combined rust and C++ project maintain Cargo compatability? #3610
              
                Unanswered
              
          
                  
                    
                      eladmaimoni
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment
-
| One way is to handle the C++ deps is the build script -- be it picking a bundled object file, or compiling using cmake/cc. cmake and cc are crates that help with that: https://crates.io/crates/cmake & https://crates.io/crates/cc. Look at their dependents for inspiration. | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
I am building a combined rust and C++ project. My goal is to have rust crates that C++ libraries may use through ffi and a rust binary that will link both C++ libraries and rust libraries.
If I simplify this, I have the following targets:
I am experimenting with bazel, and currently trying to maintain the cargo files (using crate universe). My main incentive for maintaining the cargo files is to be able to use the cargo ecosystem and IDE integration.
With C++, I use a bazel only.
However, I am not sure how I should express the fact that the rust binary application depends on a C++ target(s). I can't express that in cargo I guess (since these are bazel targets) and specifying it in bazel will break cargo compatibility.
The documentation strongly implies that I need to go the "Cargo Free" path. however, I fear of losing all the neat IDE features that come with cargo.
So my question is - is is possible to have a rust crate depend on a C++ target while still maintaining cargo compatibility? or in this scenario I must do a cargo free approach?
Beta Was this translation helpful? Give feedback.
All reactions