Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2074

Convenient usage as a static library

    • Type: Icon: Epic Epic
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.7.0
    • Affects Version/s: None
    • Component/s: Build, libbson, libmongoc
    • None
    • Done
    • convenient-static

      Make it convenient and obvious how direct users of libbson and libmongoc should compile their code and link to libbson as a dynamic or standard library. This applies to Unix and Windows, and it applies to people using CMake, pkg-config, or manually specifying configuration flags.

      Coordinate with immediate dependency libraries like the C++11 Driver so that its users, too, can conveniently compile and link in all these configurations.

      Possible steps (my current understanding):

      • Done Introduce preprocessor symbols BSON_STATIC and MONGOC_STATIC, by analogy with this code from the legacy C++ driver - this should resolve CDRIVER-2054
      • Done Update our .pc files so pkg-config --static defines the right options
      • Done Update our CMake modules so the C++11 driver (and similar direct dependency libraries or applications that use CMake) can choose to link statically or dynamically
      • Done I removed the CMake options BSON_ROOT_DIR and MONGOC_ROOT_DIR in CDRIVER-1058, in favor of the standard CMAKE_PREFIX_PATH, should we reintroduce them? This is ok?
      • Done Update libbson and libmongoc docs to better explain how to use the libbson and libmongoc as static or shared libs
      • Done Instructions for linking, statically or not, with libmongoc and libbson using Visual Studio GUI
      • Add "#pragma lib" statements to bson.h and mongoc.h so Visual Studio users can have their linker options automatically configured

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: