Correct Clang version detection and support for multiple prefix paths.

Bumps cmake minimum version to 3.7 for version comparison operator.

Previously the Clang cmake project version strings were used.  These
are not defined if the clang cmake project has not been loaded.
We should use CMAKE_CXX_COMPILER_VERSION to check the version when
only the compiler binary is redirected and the project files are
not available.

Also adjust device libs lookup logic to handle multiple paths in
CMAKE_PREFIX_PATH.

Change-Id: I67b6958d8241685cd6c3a0af68507c9fdc6331ef
이 커밋은 다음에 포함됨:
Sean Keely가 2021-09-20 19:23:04 -05:00를 커밋했습니다
1 부모 a8c3ea82a4
커밋 2e9a9f7c7a
3 파일이 변경됨
+13 -9

검색과 일치하는 파일 없음

+10 -5
파일 보기
@@ -40,7 +40,7 @@
##
################################################################################
cmake_minimum_required ( VERSION 3.5.0 )
cmake_minimum_required ( VERSION 3.7 )
# Flag to abort before executing after default initialization of cache variables
set (QUIT 0)
@@ -49,15 +49,20 @@ set (QUIT 0)
find_package(Clang REQUIRED HINTS ${CMAKE_INSTALL_PREFIX}/llvm ${CMAKE_PREFIX_PATH}/llvm PATHS /opt/rocm/llvm )
# Device libs doesn't support find_package yet.
# FIXME: HINTS should not use CMAKE_INSTALL_PREFIX
set(PREFIX_HINTS "")
foreach(hint "/amdgcn/bitcode" "/lib/bitcode" "/lib/x86_64/bitcode")
foreach(path ${CMAKE_PREFIX_PATH})
string(APPEND path ${hint})
list(APPEND PREFIX_HINTS ${path})
endforeach(path)
endforeach(hint)
get_include_path(BITCODE_DIR "Bitcode library path" RESULT FOUND NAMES "opencl.bc" "opencl.amdgcn.bc"
HINTS
"${CMAKE_INSTALL_PREFIX}/amdgcn/bitcode"
"${CMAKE_INSTALL_PREFIX}/lib/bitcode"
"${CMAKE_INSTALL_PREFIX}/lib/x86_64/bitcode"
"${CMAKE_PREFIX_PATH}/amdgcn/bitcode"
"${CMAKE_PREFIX_PATH}/lib/bitcode"
"${CMAKE_PREFIX_PATH}/lib/x86_64/bitcode"
"${PREFIX_HINTS}"
PATHS
"/opt/rocm/amdgcn/bitcode"
"/opt/rocm/lib/bitcode"