fewensa / rtdlib

TDLib for rust
MIT License
46 stars 9 forks source link

Internal build? #2

Closed nuxeh closed 4 years ago

nuxeh commented 4 years ago

Hi,

Is there any chance of td being built and linked internally as part of the crate build, as is the case with most standard *-sys crates?

Thanks!

fewensa commented 4 years ago

@nuxeh Thanks for your issue, It's a great idea. can your create a pull request to implement this idea? don't worry, if you cannot submit now, maybe the next version I will use your idea.

If you will create a pull request, I need tell you, DON'T CHANGE THIS REPOSITORY, this repository is generated by another project fantasy.

nuxeh commented 4 years ago

It looks like it uses cmake so potentially it might work, since there's a support crate for that. And yes, this is something I could have a look at. I still need to grok how these crates fit together, with the fantasy crate you mention.

nuxeh commented 4 years ago

Actually what I could do is have a look at making a tdlib-sys crate, and then I imagine this crate could depend on that to get the linkage.

fewensa commented 4 years ago

Yes, of course, don't need change fantasy project, you can create tdlib-sys crate, move rtdlib/tdjson.rs to your project, and then the rtdlib/fantasy project not generate this file, add your tdlib-sys to dependencies.

When you complete your proejct, please pin me, then I change my code. Thanks

fewensa commented 4 years ago

I create a new crate in there https://github.com/fewensa/tdlib-sys

nuxeh commented 4 years ago

Hi @fewensa , I have put a sys crate together, https://github.com/nuxeh/tdlib-sys.

Builds on Linux and OSX, but Windows is still WIP. It currently statically links TDlib at its master. I still haven't had a look at how this crate is currently integrated, but hoping you should have a better idea!

fewensa commented 4 years ago

@nuxeh Thanks for your create this crate, The next commit I will do some test and change rtdlib to dependence your crate. during this period, you can try to solve the problem of Windows compilation failure.

And the API of tdlibjson should not change for a long period of time, so you don’t need to follow the td release version in real time. Using the current master version should have no effect

fewensa commented 4 years ago

I'm sorry for you, now the rtdlib is use rtdlib-sys, not use yours.

https://github.com/fewensa/rtdlib/commit/7ea7d7a29c2654262a420fe559fbc3772a42f5b3

nuxeh commented 4 years ago

?

fewensa commented 4 years ago

Sorry, because your project is not suitable for the current rtdlib dependencies, complex and long compilation process, and also includes dependencies of other libraries. This is not needed

nuxeh commented 4 years ago

What extra dependencies? Most of them should be build dependencies only, and there's no way to avoid that when building and linking using cargo.

Having to build manually and copying compiled objects is a fairly poor solution, when compared with doing it with Cargo.

nuxeh commented 4 years ago

Assuming you mean Rust dependencies. Otherwise, if it inadvertently links unnecessary C dependencies, this is certainly something that can be discussed/fixed, the sys crate build I wrote was only a first pass.

fewensa commented 4 years ago

So, If I create a pr, change your code like to rtdlib-sys can you accept? Because in the rtdlib project, I only want a simple library to call td jsonlib.

nuxeh commented 4 years ago

Of course, I would be more than happy to review any changes you have