From 888ccbc205f8a732996dcd5a2167dac5fa87b263 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Fri, 19 Jul 2019 04:45:56 +0000 Subject: [PATCH] [hit] Workaround for %cc and %cxx mappings. (#1233) * [hit] Workaround for %cc and %cxx mappings. HIP CMakeLists.txt modifies CMAKE_C_COMPILER and CMAKE_CXX_COMPILER. This messes up any dtests that want to test against cc/c++. So hardcode %cc to /usr/bin/cc and %cxx to /usr/bin/c++ for now till we come up with a better solution. Change-Id: I7dce93ce8360191e612a94e3a735e5612ac27ab5 * [hit] Add auto-variable %hip-path to syntax for BUILD_CMD Change-Id: Id097a183fbce2b2c9691d0180d3304dd17a4e016 --- tests/README.md | 4 +++- tests/hit/HIT.cmake | 4 +++- tests/hit/parser | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/README.md b/tests/README.md index b1f70048a1..0c2c645085 100644 --- a/tests/README.md +++ b/tests/README.md @@ -66,7 +66,9 @@ BUILD_CMD: EXCLUDE_HIP_PLATFORM %s: refers to current source file name. Additional source files needed for the test can be specified by name (including relative path). %t: refers to target executable named derived by removing the extension from the current source file. Alternatively a target executable name can be specified. %hc: refers to hipcc pointed to by $CMAKE_INSTALL_PREFIX/bin/hipcc. -%cc: refers to system c compiler pointed to by $CC. +%hip-path: refers to hip installed location pointed to by $CMAKE_INSTALL_PREFIX +%cc: refers to system c compiler pointed to by /usr/bin/cc. +%cxx: refers to system c compiler pointed to by /usr/bin/c++. %S: refers to path to current source file. %T: refers to path to current build target. diff --git a/tests/hit/HIT.cmake b/tests/hit/HIT.cmake index d4c162f4b9..d446742dd1 100644 --- a/tests/hit/HIT.cmake +++ b/tests/hit/HIT.cmake @@ -201,7 +201,9 @@ macro(HIT_ADD_FILES _dir _label _parent) OUTPUT_STRIP_TRAILING_WHITESPACE) string(REGEX REPLACE "\n" ";" _contents "${_contents}") string(REGEX REPLACE "%hc" "${HIP_HIPCC_EXECUTABLE}" _contents "${_contents}") - string(REGEX REPLACE "%cc" "${CC}" _contents "${_contents}") + string(REGEX REPLACE "%hip-path" "${HIP_ROOT_DIR}" _contents "${_contents}") + string(REGEX REPLACE "%cc" "/usr/bin/cc" _contents "${_contents}") + string(REGEX REPLACE "%cxx" "/usr/bin/c++" _contents "${_contents}") string(REGEX REPLACE "%S" ${_dir} _contents "${_contents}") string(REGEX REPLACE "%T" ${_label} _contents "${_contents}") foreach(_cmd ${_contents}) diff --git a/tests/hit/parser b/tests/hit/parser index 8381c78a3c..d6e3564d7f 100755 --- a/tests/hit/parser +++ b/tests/hit/parser @@ -46,7 +46,8 @@ sub parse_file { $line =~ s/^ \* BUILD_CMD: //g; # Remove " * BUILD_CMD: " $line =~ s/%s/$file/g; # Substitute %s -> filename $line =~ s/%t/$exe/g; # Substitute %t -> targetname - # Substitute %hc -> /path/to/hipcc and %cc -> /path/to/cc happens in cmake + # Substitute %hc -> /path/to/hipcc and %hip-path -> /path/to/hip happens in cmake + # Substitute %cc -> /usr/bin/cc and %cxx -> /usr/bin/c++ happens in cmake # Substitute %S -> src dir and %T -> target build dir happens in cmake $line =~ s/\R//g; # Remove line endings push @customBuildCMDs, $line;