mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-05-11 17:00:01 +00:00
Change CMake's nvbench::main exported target to correspond to static library
Previously, it corresponded to main.cu.o object file. Now it corresponds to static library libnvbench_main.a which is archive file with main.cu.o object in it. This closes #349
This commit is contained in:
@@ -128,21 +128,24 @@ target_compile_features(nvbench PUBLIC cuda_std_17 PRIVATE cxx_std_17)
|
||||
add_dependencies(nvbench.all nvbench)
|
||||
|
||||
# nvbench.main (nvbench::main)
|
||||
add_library(nvbench.main OBJECT main.cu)
|
||||
add_library(nvbench.main STATIC main.cu)
|
||||
nvbench_config_target(nvbench.main)
|
||||
# Internal NVBench builds should not suppress warnings from NVBench headers.
|
||||
target_compile_definitions(nvbench.main PRIVATE NVBENCH_NO_IMPLICIT_SYSTEM_HEADER)
|
||||
# Propagate `nvbench` to consumers but keep NVBench's own build warning-visible.
|
||||
target_link_libraries(nvbench.main INTERFACE nvbench)
|
||||
target_link_libraries(nvbench.main PUBLIC nvbench)
|
||||
# Ensure CUDA/CUPTI/NVML include dirs are visible for nvbench.main's build.
|
||||
target_link_libraries(nvbench.main PRIVATE ${ctk_libraries})
|
||||
# Add NVBench's headers privately so the object library itself sees warnings.
|
||||
# Add NVBench's headers privately so the main library itself sees warnings.
|
||||
target_include_directories(nvbench.main
|
||||
PRIVATE
|
||||
"$<BUILD_INTERFACE:${NVBench_SOURCE_DIR}>"
|
||||
"$<BUILD_INTERFACE:${NVBench_BINARY_DIR}>"
|
||||
)
|
||||
set_target_properties(nvbench.main PROPERTIES EXPORT_NAME main)
|
||||
set_target_properties(nvbench.main PROPERTIES
|
||||
EXPORT_NAME main
|
||||
OUTPUT_NAME nvbench_main
|
||||
)
|
||||
add_dependencies(nvbench.all nvbench.main)
|
||||
|
||||
# Support add_subdirectory:
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Provided as a CMake OBJECT library named nvbench::main so users don't have
|
||||
// Provided as a CMake static library named nvbench::main so users don't have
|
||||
// to add `NVBENCH_MAIN` to every benchmark executable.
|
||||
|
||||
#include <nvbench/main.cuh>
|
||||
|
||||
Reference in New Issue
Block a user