[CDRIVER-2074] Convenient usage as a static library Created: 28/Feb/17  Updated: 23/Mar/18  Resolved: 16/Jun/17

Status: Closed
Project: C Driver
Component/s: Build, libbson, libmongoc
Affects Version/s: None
Fix Version/s: 1.7.0

Type: Epic Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CXX-1257 Revise static library naming and link... Closed
Related
related to CDRIVER-2171 make uninstall leaves cmake & static ... Closed
is related to CDRIVER-2157 Linking to libmongoc with MinGW-64 fa... Closed

 Description   

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


 Comments   
Comment by Githook User [ 19/Jun/17 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: Merge branch 'evergreen-fix' into CDRIVER-2037-static-pkg

Comment by Githook User [ 19/Jun/17 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-2074 Fix static linking evergreen matrix to fail on error
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/5a6003cdea18299d2334968a13c36e41a3214a3d

Comment by Githook User [ 10/Apr/17 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-2074 static-link guide for MSVC GUI
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/52b3d7b11f6682d98c31199b3f8ebcfac6acf532

Comment by Githook User [ 06/Apr/17 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-2074 instructions for MSVC GUI
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/6d1ea889e48db42910ebeb197d56d214f4e3c463

Comment by Githook User [ 06/Apr/17 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-2074 instructions for MSVC GUI
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/72863e8c18a30ac0fbc39f9d6a9a6412f55ab03a

Generated at Wed Feb 07 21:14:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.