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

검색과 일치하는 파일 없음

+2 -2
파일 보기
@@ -40,7 +40,7 @@
##
################################################################################
cmake_minimum_required ( VERSION 3.6.3 )
cmake_minimum_required ( VERSION 3.7 )
## Clear target dependency data.
## Needed to allow UI transitions between static and dynamic builds.
@@ -136,7 +136,7 @@ if ( CMAKE_COMPILER_IS_GNUCXX )
endif ()
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set ( HSA_CXX_FLAGS ${HSA_CXX_FLAGS} -Wno-error=self-assign)
if( CLANG_VERSION_MAJOR -ge 13)
if( ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL 13)
set ( HSA_CXX_FLAGS ${HSA_CXX_FLAGS} -Wno-error=unused-but-set-variable)
endif()
endif()
+1 -2
파일 보기
@@ -20,7 +20,7 @@ utils - Utilities required to build the core runtime.
#### Build Environment
CMake build framework is used to build the ROC runtime. The minimum version is
3.6.3.
3.7.
Obtain cmake infrastructure: http://www.cmake.org/download/
@@ -32,7 +32,6 @@ The following support packages are required to successfully build the runtime:
* libelf-dev
* g++
* libc6-dev-i386 (for libhsakmt 32bit)
#### Building the Runtime
+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"