Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,26 @@ execute_process(
if(${clangxx_result} MATCHES "0")
string(REPLACE "\n" ";" IntelSyclCompiler_VERSION_LIST "${clangxx_ver}")
set(IDX 0)
set(IntelSyclCompiler_VERSION "")
foreach(X ${IntelSyclCompiler_VERSION_LIST})
message(STATUS "dpcpp ver[${IDX}]: ${X}")
MATH(EXPR IDX "${IDX}+1")
endforeach()
list(GET IntelSyclCompiler_VERSION_LIST 0 VERSION_STRING)
if("x${IntelSyclCompiler_VERSION}" STREQUAL "x")
# Match 'clang version xx.x.x'
string(REGEX MATCH "^.*clang version [0-9]+\\.[0-9]+\\.[0-9]+.*$" _clang_match "${X}")
if(_clang_match)
string(REGEX REPLACE "^.*clang version ([0-9]+\\.[0-9]+\\.[0-9]+).*$" "\\1" IntelSyclCompiler_VERSION "${_clang_match}")
endif()

# Get the dpcpp version
string(REGEX MATCH
"[0-9]+\.[0-9]+\.[0-9]+"
IntelSyclCompiler_VERSION
${VERSION_STRING}
)
# Match 'Intel(R) oneAPI DPC++/C++ Compiler xxxx.x.x (...)'
string(REGEX MATCH "^.*Intel\\(R\\) oneAPI DPC\\+\\+\\/C\\+\\+ Compiler [0-9]+\\.[0-9]+\\.[0-9]+.*$" _oneapi_match "${X}")
if(_oneapi_match)
string(REGEX REPLACE "^.*Intel\\(R\\) oneAPI DPC\\+\\+\\/C\\+\\+ Compiler ([0-9]+\\.[0-9]+\\.[0-9]+).*$" "\\1" IntelSyclCompiler_VERSION "${_oneapi_match}")
endif()
endif()
math(EXPR IDX "${IDX}+1")
endforeach()

# Split out the version into major, minor an patch
# Split out the version into major, minor and patch
string(REPLACE "." ";" IntelSyclCompiler_VERSION_LIST1 "${IntelSyclCompiler_VERSION}")
list(GET IntelSyclCompiler_VERSION_LIST1 0 IntelSyclCompiler_VERSION_MAJOR)
list(GET IntelSyclCompiler_VERSION_LIST1 1 IntelSyclCompiler_VERSION_MINOR)
Expand Down
Loading