Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate shared libraries and python modules #163

Merged
merged 1 commit into from
Sep 27, 2024
Merged

Conversation

arahlin
Copy link
Member

@arahlin arahlin commented Sep 26, 2024

Each of the sub-libraries (core, calibration, dfmux, gcp, maps) are separated into two parts:

A shared library called libspt3g-<name>, which is installed to $CMAKE_INSTALL_PREFIX/lib and contains all of the C++ structures defined in that library. A shared module called _lib<name>, which is added as an extension module to the spt3g python package, and whose namespace is internally imported into the spt3g.<name> python module. This allows linking the shared libraries against each other, while treating the modules as independent endpoints that just expose the appropriate components to python, thus removing the need for the dload and load_pybindings infrastructure.

Libraries link against the Python::Module cmake target and use dynamic lookup to avoid linking against libpython until their associated module is loaded by the interpeter. Compiled executables then link against libpython explicitly via the Python::Python cmake target.

This PR is the last step toward producing a portable package that can be installed using standard python tools like pip.

@arahlin arahlin self-assigned this Sep 26, 2024
@arahlin arahlin mentioned this pull request Sep 26, 2024
Each of the sub-libraries (core, calibration, dfmux, gcp, maps) are separated
into two parts:

A shared library called `libspt3g-<name>`, which is installed to
`$CMAKE_INSTALL_PREFIX/lib` and contains all of the C++ structures defined in
that library.  A shared module called `_lib<name>`, which is added as an
extension module to the `spt3g` python package, and whose namespace is
internally imported into the `spt3g.<name>` python module.  This allows linking
the shared libraries against each other, while treating the modules as
independent endpoints that just expose the appropriate components to python,
thus removing the need for the `dload` and `load_pybindings` infrastructure.

Libraries link against the `Python::Module`` cmake target and use dynamic lookup
to avoid linking against `libpython`.  Compiled executables then link against
`libpython` explicitly.

This PR is the last step toward producing a portable package that can
be installed using standard python tools like `pip`.
@arahlin
Copy link
Member Author

arahlin commented Sep 27, 2024

This PR is a subset of #159, which has been approved, so I'll merge the two in stages.

@arahlin arahlin merged commit 69eb84a into master Sep 27, 2024
2 checks passed
@arahlin arahlin deleted the python_modules branch September 27, 2024 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant