From b87ef4f152b78664b6add44a59fe3cc9cd6efb94 Mon Sep 17 00:00:00 2001 From: Siu Chi Chan Date: Thu, 3 Oct 2019 13:25:25 -0400 Subject: [PATCH] detect the hcc version and conditionally add the -hc-function-calls switch --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 490dbad5d6..cebeb18642 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,7 +152,13 @@ if("${HIP_COMPILER}" MATCHES "clang") endif() if("${HIP_COMPILER}" MATCHES "hcc") - target_link_libraries(rccl PRIVATE -hc-function-calls) + find_program( hcc_executable hcc ) + execute_process(COMMAND bash "-c" "${hcc_executable} --version | sed -e '1!d' -e 's/.*based on HCC\\s*//'" OUTPUT_VARIABLE hcc_version_string) + execute_process(COMMAND bash "-c" "echo \"${hcc_version_string}\" | awk -F\".\" '{ printf $1}'" OUTPUT_VARIABLE hcc_major_version) + execute_process(COMMAND bash "-c" "echo \"${hcc_version_string}\" | awk -F\".\" '{ printf $2}'" OUTPUT_VARIABLE hcc_minor_version) + if ("${hcc_major_version}.${hcc_minor_version}" VERSION_LESS "2.10") + target_link_libraries(rccl PRIVATE -hc-function-calls) + endif() endif() if(TARGET hip::device)