[CXX-1257] Revise static library naming and link configuration Created: 15/Mar/17  Updated: 23/Mar/18  Resolved: 12/May/17

Status: Closed
Project: C++ Driver
Component/s: Build
Affects Version/s: None
Fix Version/s: 3.2.0-rc0

Type: Epic Priority: Major - P3
Reporter: David Golden Assignee: J Rassi
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CDRIVER-2074 Convenient usage as a static library Closed
depends on CDRIVER-2083 Distribute CMake config packages for ... Closed
depends on CDRIVER-2037 Distribute pkg-config files for dynam... Closed
is depended on by CXX-1160 Please add instructions to compile Mo... Closed
Duplicate
is duplicated by CXX-1346 PR: fixing more __imp_bson and __imp_... Closed
Backwards Compatibility: Minor Change

 Description   

We've decided to have a consistent approach to static library naming and provision of .cmake and .pc files across both the C Driver and mongocxx.

A summary of the approach is here:

  • Naming convention: For library 'foo', static libraries will be always named 'foo-static' (or that such a name will exist as symlink) on all operating systems with an OS-specific suffix (e.g. ".a" or ".lib")
  • Install both 'libfoo' and 'libfoo-static' pkg-config '.pc' files on all operating systems
  • Install both 'libfoo-config' and 'libfoo-static-config' CMake '.cmake' files on all operating systems
  • Static '.pc' and '.cmake' will not be installed if the static library is not built
  • 'libfoo.pc' (dynamic) config files will list in 'Requires' only those dynamic dependencies that must have cflags and libraries expanded for applications to compile/link successfully (i.e. to find all headers and avoid unresolved reference errors). It will not list deep dependencies in 'Requires'. It will not have 'Requires.private'. It will not add any appropriate "FOO_STATIC" defines to cflags.
  • 'libfoo-static.pc' config files will list all deep dependencies (whether dynamic or static) in 'Requires'. It will not have 'Requires.private'. It will add any appropriate "FOO_STATIC" defines to cflags.
  • Cmake '.cmake' files will follow similar conventions as the '.pc' files.


 Comments   
Comment by Githook User [ 16/May/17 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1257 Build against C driver master in Travis
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/4a6eb63e425891a45f97688885c7011610968db2

Comment by Githook User [ 12/May/17 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1257 Update install docs to reflect changes to link configuration
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/68b400a3bde4d5da28aa99ebfa78883338947e11

Comment by Githook User [ 05/May/17 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1257 Add new example projects which use installed pkg-config files

New projects added:

Comment by Githook User [ 05/May/17 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1257 Add new example projects which use installed CMake files

New projects added:

Comment by Githook User [ 05/May/17 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1257 Remove existing example CMake projects

These are out-of-date and no longer build, and will be replaced with
new projects hooked into the build system.
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/7c23d757ea6ca1487844bf2afe2f6306f0f019dc

Comment by Githook User [ 05/May/17 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1257 Stop using special vars for MSBuild.exe/cmake in CI scripts

MSBuild.exe/cmake are now accessed via $PATH as usual, which
simplifies the environment variable management in these scripts.
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/f072758813df7b88a724e4af51b08715f1fafc9b

Comment by Githook User [ 05/May/17 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1257 Revise static library naming and link configuration

This work improves the end-user experience of linking an application
against the driver, particularly for users of the static libraries.
Most notably, users who require a static build of the driver can use
the new dedicated static library CMake or pkg-config files and have
programmatic access to the required definitions that need to be set to
use the driver headers.

Complete list of user-visible changes:

  • The static library names are changed to "libbsoncxx-static" and
    "libmongocxx-static", for consistency across platforms. The
    "install" target now installs new dedicated CMake and pkg-config
    files for the static libraries which reference the library files by
    these names.
  • BUILD_SHARED_LIBS=ON no longer builds static libraries. When this
    flag is enabled, the tests now link against the shared library (this
    enables test coverage against the shared library, which the driver
    was previously lacking).
  • The static library now builds against the C driver static library,
    instead of unconditionally building against the C driver shared
    library.
  • The driver build system now always locates the C driver via its
    installed CMake files, instead of relying on pkg-config or
    LIBBSON_DIR/LIBMONGOC_DIR. Users should ensure to set
    CMAKE_PREFIX_PATH to the install locations of libbson/libmongoc when
    building the driver.
  • The installed CMake files now always export absolute paths to the
    driver libraries, and no longer export XCXX_LIBRARY_DIRS variables.
    Branch: master
    https://github.com/mongodb/mongo-cxx-driver/commit/189a4efc2bb09429a5d509534c6b1d13743a7ab7
Comment by Githook User [ 05/May/17 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1257 Add export macros to some private syms when building test lib

This work adds new macros BSONCXX_TEST_API and MONGOCXX_TEST_API,
which are intended to be used to tag private functionality which needs
to be referenced by the driver tests.

This is groundwork for allowing the tests to link against the shared
library. Currently, the tests unconditionally link to the static
library.
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/b63117d9f0221dc23d517afb4b8fd1adf553ce45

Comment by Githook User [ 05/May/17 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1257 Bump minimum required C driver version to 1.7.0

Also removes Evergreen tasks depending on earlier versions of the C
driver.
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/61711e6aedd1913bf685759ea8c3143ffd642f9d

Comment by Githook User [ 04/May/17 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1257 Update .gitattributes
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/472f37ca19ca1157e7573d149c081885c11c211a

Comment by J Rassi [ 11/Apr/17 ]

The initial development for this epic will be done on the feature branch CXX-1257-revise-static-linking.

Generated at Wed Feb 07 22:01:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.