Skip to content

feature, add option to build Intel LIBBID as a shared library #38

Description

@steven-varga

Add a CMake option to build Intel LIBBID as a shared library instead of always statically linking it.

Motivation:
libdecimal is header-only, but it currently forces LIBBID to be built and installed as libbid_static.a. Some deployment models (e.g., multiple executables or language bindings in the same process) benefit from sharing the LIBBID runtime via a single .so/.dylib.

Proposed behavior:
Introduce a top-level option:

option(libdecimal_BUILD_SHARED_LIBS "Build Intel LIBBID as a shared library" OFF)
  • When OFF (default): keep the current behavior — static libbid_static.a.
  • When ON: build libbid.so / libbid.dylib / libbid.dll and install it as a runtime library.

Scope and constraints:

  • The libdecimal target itself remains INTERFACE/header-only.
  • The exported target should remain usable as libdecimal::libdecimal regardless of this option.
  • Windows support may require WINDOWS_EXPORT_ALL_SYMBOLS or may be documented as unsupported if LIBBID lacks __declspec(dllexport/dllimport) annotations.
  • Existing default builds must be unchanged.

Acceptance criteria:

  • Default configure + build + install still produces libbid_static.a and all tests pass.
  • cmake -Dlibdecimal_BUILD_SHARED_LIBS=ON ... produces a shared library and installs it.
  • A downstream consumer can find_package(libdecimal REQUIRED) and link against libdecimal::libdecimal in both modes.
  • No regression in the install layout for the default static build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions