Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build without CMake ? #39

Closed
thebootroo opened this issue Feb 5, 2018 · 3 comments
Closed

How to build without CMake ? #39

thebootroo opened this issue Feb 5, 2018 · 3 comments

Comments

@thebootroo
Copy link

thebootroo commented Feb 5, 2018

I need to integrate a small part of the lib into a C++/Qt app and I don't want to handle CMake in additional to my usual build system (Qbs) so I was wondering a few questions :

  1. How is the source organized (understand : "which folder defines which part, which part depends on which other ?")

  2. What is the minimum set to compile to have a fully fonctional C++ lib, without external bindings, or tests, or examples, or docs ?

  3. All I need is a in-app build, kinda like static build, so what is the smallest entity to build ?

  4. What folders contains the include headers for my app ? I just need to add a path to them, not to install anywhere...

  5. Are they any code generation steps mandatory before being able to build ?

  6. I need only Linux support (GCC and Clang) so which parts of the code are other OSes specific (Android, Windows, OSX ?)

Thanks in advance

@levlam
Copy link
Contributor

levlam commented Feb 5, 2018

The best way to answer all questions is to read CMakeLists.txt files.

  1. CMakeLists.txt files contains exhaustive description of all source code dependencies. If I try to write them here, I just write CMakeLists.txt from scratch.
  2. Section "https://github.com/tdlib/td#using-in-cmake-c-projects" of README.md contains list of targets supposed to be externally used. Choose one and follow its dependencies.
  3. It looks like you need Td::TdStatic target.
  4. Follow install target described in CMakeLists.txt.
  5. Yes. Some source code files are auto-generated. Follow prepare_cross_compiling CMake target to see, how they are generated.
  6. You don't need to exclude anything manually. All unneeded OSes specific code (which is localized in tdutils/td/utils/port) will be excluded automatically.

Anyway, I recommend to use CMake, even your project uses another build system, because it will be hard to maintain your own build files. Just specify CMAKE_INSTALL_PREFIX to CMake, compile and install TDLib to local directory, and use prebuilt library in your project.

@thebootroo
Copy link
Author

I understand but I really don't want to build full lib with Cmake, it takes ages (more than 30 min on my very decent machine), and produces a lot of things which I don't need/use. Also using prebuild lib will complicate the build steps and deploy, and source management. On one of my target systems, I'm not even sure to have Cmake available to prebuild lib once.

I'll try to create my Qbs file by extracting information from Cmake for the TdStatic target.

@arseny30
Copy link
Contributor

arseny30 commented Feb 5, 2018

Just a fair warning: do not expect compilation time to be decreased after migration to Qbs.
To build TdStatic means to build almost everything.

Also the build should be much faster than 30min when you are using clang and parallel build with make or ninja.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants