mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-03-14 20:27:24 +00:00
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.
52 lines
1.7 KiB
CMake
52 lines
1.7 KiB
CMake
macro(nvbench_generate_exports)
|
|
if(NVBench_ENABLE_INSTALL_RULES)
|
|
set(nvbench_build_export_code_block "")
|
|
set(nvbench_install_export_code_block "")
|
|
|
|
if (NVBench_ENABLE_NVML)
|
|
string(APPEND nvbench_build_export_code_block
|
|
"include(\"${NVBench_SOURCE_DIR}/cmake/NVBenchNVML.cmake\")\n"
|
|
)
|
|
string(APPEND nvbench_install_export_code_block
|
|
"include(\"\${CMAKE_CURRENT_LIST_DIR}/NVBenchNVML.cmake\")\n"
|
|
)
|
|
endif()
|
|
|
|
if (NVBench_ENABLE_CUPTI)
|
|
string(APPEND nvbench_build_export_code_block
|
|
"include(\"${NVBench_SOURCE_DIR}/cmake/NVBenchCUPTI.cmake\")\n"
|
|
)
|
|
string(APPEND nvbench_install_export_code_block
|
|
"include(\"\${CMAKE_CURRENT_LIST_DIR}/NVBenchCUPTI.cmake\")\n"
|
|
)
|
|
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::"
|
|
GLOBAL_TARGETS nvbench main ctl internal_build_interface
|
|
LANGUAGES CUDA CXX
|
|
FINAL_CODE_BLOCK nvbench_build_export_code_block
|
|
)
|
|
rapids_export(INSTALL NVBench
|
|
EXPORT_SET nvbench-targets
|
|
NAMESPACE "nvbench::"
|
|
GLOBAL_TARGETS nvbench main ctl internal_build_interface
|
|
LANGUAGES CUDA CXX
|
|
FINAL_CODE_BLOCK nvbench_install_export_code_block
|
|
)
|
|
endif()
|
|
endmacro()
|