Support static builds of nvbench with nvml enabled.

To do this we need to ensure that the nvml init handler is
both contained in the library/executable that uses nvbench.

The original implementation fails since the singleton can be dropped
since it has no usages. So instead we move to a function static
which we ensure will always be used.
This commit is contained in:
Robert Maynard
2023-11-14 14:08:10 -05:00
parent 57c4d42ba5
commit adaef09b20
5 changed files with 55 additions and 42 deletions

View File

@@ -21,6 +21,18 @@ macro(nvbench_generate_exports)
)
endif()
if (TARGET nvbench_json)
set(nvbench_json_code_block
[=[
add_library(nvbench_json INTERFACE IMPORTED)
if (TARGET nlohmann_json::nlohmann_json)
target_link_libraries(nvbench_json INTERFACE nlohmann_json::nlohmann_json)
endif()
]=])
string(APPEND nvbench_build_export_code_block ${nvbench_json_code_block})
string(APPEND nvbench_install_export_code_block ${nvbench_json_code_block})
endif()
rapids_export(BUILD NVBench
EXPORT_SET nvbench-targets
NAMESPACE "nvbench::"