[BUILD] Support clang++ compiler (#1316)
* [BUILD] Support clang++ compiler Signed-off-by: nileshnegi <Nilesh.Negi@amd.com> * [BUILD] Enable check_symbol_exists for BFD and clang++ Signed-off-by: nileshnegi <Nilesh.Negi@amd.com> * [BUILD] Define default C compiler Signed-off-by: nileshnegi <Nilesh.Negi@amd.com> --------- Signed-off-by: nileshnegi <Nilesh.Negi@amd.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
391c7ea070
Коммит
d3012d3307
@@ -114,6 +114,11 @@ if("${CMAKE_CXX_COMPILER}" MATCHES ".*amdclang\\+\\+")
|
||||
set(COMPILER_EXE_NAME amdclang++)
|
||||
set(COMPILER_GREP_STRING "AMD clang version")
|
||||
set(COMPILER_AWK_CMD "awk -F\" \" '{ printf $4}'")
|
||||
elseif("${CMAKE_CXX_COMPILER}" MATCHES ".*clang\\+\\+")
|
||||
message(STATUS "Compiling with clang++")
|
||||
set(COMPILER_EXE_NAME clang++)
|
||||
set(COMPILER_GREP_STRING "AMD clang version")
|
||||
set(COMPILER_AWK_CMD "awk -F\" \" '{ printf $4}'")
|
||||
elseif("${CMAKE_CXX_COMPILER}" MATCHES ".*hipcc$")
|
||||
message(STATUS "Compiling with hipcc")
|
||||
set(COMPILER_EXE_NAME hipcc)
|
||||
@@ -238,6 +243,9 @@ if(BUILD_BFD)
|
||||
if (HAVE_BFD)
|
||||
message(STATUS "-- Found BFD support")
|
||||
|
||||
### Required for checking HIP device symbols when building with amdclang++
|
||||
set(CMAKE_REQUIRED_LIBRARIES hip::device)
|
||||
|
||||
# Check for specific BFD feature support
|
||||
CHECK_SYMBOL_EXISTS(bfd_get_section_flags "bfd.h" HAVE_DECL_BFD_GET_SECTION_FLAGS)
|
||||
CHECK_SYMBOL_EXISTS(bfd_get_section_vma "bfd.h" HAVE_DECL_BFD_GET_SECTION_VMA)
|
||||
@@ -253,6 +261,8 @@ if(BUILD_BFD)
|
||||
}"
|
||||
HAVE_TWO_ARG_BFD_SECTION_SIZE)
|
||||
|
||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
# Check for iberty support
|
||||
find_library(HAVE_IBERTY iberty PATHS /usr/lib64 /usr/lib/ PATH_SUFFIXES x86_64-linux-gnu)
|
||||
if(HAVE_IBERTY)
|
||||
|
||||
@@ -16,3 +16,14 @@ if (NOT DEFINED ENV{CXXFLAGS})
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O1")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED ENV{CC})
|
||||
set(CMAKE_C_COMPILER "${rocm_bin}/amdclang" CACHE PATH "Path to the C compiler")
|
||||
else()
|
||||
set(CMAKE_C_COMPILER "$ENV{CC}" CACHE PATH "Path to the C compiler")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED ENV{CFLAGS})
|
||||
set(CMAKE_C_FLAGS_DEBUG "-g -O1")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3")
|
||||
endif()
|
||||
|
||||
Ссылка в новой задаче
Block a user