You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEA] Optionally compile rmm as object library #2463
Is your feature request related to a problem? Please describe.
When someone is creating a static library (e.g., libnvcomp_static.a), they might want to embed librmm.a into their own artifact. This is to simplify dependency management for users, especially, if rmm is only used for a subset of the library's functionality. This is basically the case for nvcomp, where we only use librmm in a subset of the functions and we don't want to force users to always have librmm available on their system.
During a static library creation, the linker is not invoked, so we cannot pull of the -Wl,--whole-archive trick that one can do when creating a shared library.
Describe the solution you'd like
Ideally we would like to have a cmake option to allow us to compile librmm into an OBJECT library.
On your side, the change is something along the lines of:
option(BUILD_OBJECT_LIBS"Configure CMake to build rmm as object library"OFF)
if(BUILD_OBJECT_LIBS)
set(RMM_LIB_TYPE OBJECT)
elseif(BUILD_SHARED_LIBS)
set(RMM_LIB_TYPE SHARED)
else()
set(RMM_LIB_TYPE STATIC)
endif()
add_library(rmm${RMM_LIB_TYPE}...)
We could certainly run ar x librmm.a to get back the object files and embed those, but a lot more elegant way would be to embed rmm via $<TARGET_OBJECTS:rmm::rmm> once we compiled it as an object library.
Describe alternatives you've considered
ar x librmm.a and then embedding the resulting object files
Activity