yourWaifu / sleepy-discord

C++ library for the Discord chat client. Please use Rust for new bots
https://yourWaifu.github.io/sleepy-discord/
MIT License
707 stars 92 forks source link

how to use precompiled sleepy_discord for own projects #187

Open Xephobia opened 3 years ago

Xephobia commented 3 years ago

Hello, we all know that compilation speed is a major bottleneck in c++. You can reduce greatly this problem by using precompiled headers. I have been able to staticly compile sleepy_discord to libsleepy-discord.a simply by running cmake. Hoever i am unable to use that static lib in my own project (i'm not a c++ pro) could you give instruction how to do this?

dreamscached commented 3 years ago

In my project I added a Git submodule into include/sleepy-discord, then added this to my CMakeLists.txt:

ADD_SUBDIRECTORY(include/sleepy-discord)
# ...
TARGET_LINK_LIBRARIES(${PROJECT_NAME} sleepy-discord)

Then I run cmake and it configured everything for me automatically. After all I was able to include it in my code.

CMake won't recompile entire project along with dependencies every time you run make, so it'll spare you some time.