c++boostuuidboost-uuid

How to integrate Boost.uuid into my cross-platform code?


I am writing an application with cocos2d-x which is a C++ cross-platform game engine. In the game I need to generate UUID without any input. Just I want to call a function generateUuid and assign the value returned by that function to an std::string. I know that Boost.uuid does the work. Honestly, not sure what is the function I need, but the biggest problem is that I don't know how to integrate Boost.uuid to my code. I have tried build and use Boost once, but at that time I have installed the whole library. What are the steps to integrate the minimal code for my needs. Also I hope that it will be just inclusion of some header files, otherwise I am not sure that it will work on all platform cocos2d-x supports.

Please tell me what to do or what to read to learn how to use Boost.uuid only.


Solution

  • Like much of Boost, Boost.Uuid is a header-only library, which means that only the functionality that you #include and use will become part of your project. So there's no problem with putting the entire Boost distribution somewhere in your include path and including Boost.Uuid headers.

    (Boost.Uuid may itself depend on other Boost header files, so those may also become part of your project.)

    With that said, there's no real reason not to do a standard installation of Boost, as in the question you linked; it's a good library, and only those parts that you actually use will become a part or become a dependency of your final project.

    Edit: If you really want a subset of Boost, the BCP utility is designed to help you do this. I have no experience with it. To answer your question, Boost is designed to be cross platform, and I find it simplest to just install the whole thing and let it take care of its own dependencies.