Skip to content

Commit

Permalink
build: cmake: unsupported compilers cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
spalicki committed Dec 20, 2024
1 parent f6f9669 commit 5397f1c
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 45 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@ Runtime-specific dependencies:

### Validated Configurations

CPU engine was validated on RedHat\* Enterprise Linux 8 with
* GNU Compiler Collection 5.4, 6.1, 7.2, 8.1, 9.1, 11.1, 11.3
* Clang\* 7.1, 8.0, 9.0, 14.0.6
x86-64 CPU engine was validated on RedHat\* Enterprise Linux 8 with
* GNU Compiler Collection 8.5, 9.5, 11.1, 11.3
* Clang\* 11.0, 14.0.6
* [Intel oneAPI DPC++/C++ Compiler] 2024.0

on Windows Server\* 2019 with
Expand All @@ -307,16 +307,19 @@ on Windows Server\* 2019 with
on macOS 11 (Big Sur) with
* Apple LLVM version 13.0

on Ubuntu 20.04 AArch64 with
* GNU Compiler Collection 7.0, 8.0, 9.0, 10.0
* Clang\* 9.0, 17.0
AArch64 CPU engine was validated on Ubuntu 22.04 with
* GNU Compiler Collection 10, 13 and 17
* Clang\* 17.0
* [Arm Compiler for Linux] 24.04
* [Arm Compute Library (ACL)] built for armv8-a arch, latest stable version
available at the time of release

on macOS 14 (Sonoma) with
* Apple LLVM version 15.0

GPU engine was validated on Ubuntu\* 22.04 with
* GNU Compiler Collection 7.2, 8.1, and 9.1
* Clang 7.1, 8.0, 9.0
* GNU Compiler Collection 8.5, and 9.5
* Clang 11.0
* [Intel oneAPI DPC++/C++ Compiler] 2024.0
* [Intel Software for General Purpose GPU capabilities] latest stable version
available at the time of release
Expand Down
7 changes: 0 additions & 7 deletions cmake/OpenMP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ if(NOT OpenMP_CXX_FOUND AND MSVC AND CMAKE_CXX_COMPILER_ID MATCHES "(Clang|Intel
# The ICX driver doesn't link OpenMP library even if `/Qopenmp`
# was specified.
set(OpenMP_FLAGS "/Qopenmp -Xclang --dependent-lib=libiomp5md")
else()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.0")
# version < 10 can't pass cl-style `/openmp` flag
set(OpenMP_FLAGS "-Xclang -fopenmp")
# ... and requires explicit linking against omp library
set(OpenMP_CXX_LIBRARIES "libomp.lib")
endif()
endif()
set(OpenMP_C_FLAGS ${OpenMP_FLAGS})
set(OpenMP_CXX_FLAGS ${OpenMP_FLAGS})
Expand Down
14 changes: 5 additions & 9 deletions cmake/SDL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ macro(sdl_unix_common_ccxx_flags var)
append(${var} "-fPIC -Wformat -Wformat-security")
endmacro()

macro(sdl_gnu_common_ccxx_flags var gnu_version)
if(${gnu_version} VERSION_LESS 4.9)
append(${var} "-fstack-protector-all")
else()
append(${var} "-fstack-protector-strong")
if(NOT (${gnu_version} VERSION_LESS 8.0) AND (DNNL_TARGET_ARCH STREQUAL "X64"))
append(${var} "-fcf-protection=full")
endif()
macro(sdl_gnu_common_ccxx_flags var)
append(${var} "-fstack-protector-strong")
if(DNNL_TARGET_ARCH STREQUAL "X64")
append(${var} "-fcf-protection=full")
endif()
endmacro()

Expand Down Expand Up @@ -65,7 +61,7 @@ if(UNIX)
append(ONEDNN_SDL_COMPILER_FLAGS "-D_FORTIFY_SOURCE=2")
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
sdl_gnu_common_ccxx_flags(ONEDNN_SDL_COMPILER_FLAGS CMAKE_CXX_COMPILER_VERSION)
sdl_gnu_common_ccxx_flags(ONEDNN_SDL_COMPILER_FLAGS)
sdl_gnu_src_ccxx_flags(CMAKE_SRC_CCXX_FLAGS)
sdl_gnu_example_ccxx_flags(CMAKE_EXAMPLE_CCXX_FLAGS)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang")
Expand Down
6 changes: 1 addition & 5 deletions cmake/coverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ if("${DNNL_CODE_COVERAGE}" STREQUAL "GCOV")
message(FATAL_ERROR "GCOV not found in path")
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang")
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 3)
message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...")
endif()
elseif(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang|GNU")
message(FATAL_ERROR "Unsupported compiler: ${CMAKE_CXX_COMPILER_ID}")
endif()

Expand Down
2 changes: 1 addition & 1 deletion cmake/host_compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ if(DPCPP_HOST_COMPILER_KIND MATCHES "^(GNU|CLANG)$")

if(DPCPP_HOST_COMPILER_KIND STREQUAL "GNU")
platform_gnu_nowarn_ccxx_flags(DPCPP_CXX_NOWARN_FLAGS ${DPCPP_HOST_COMPILER_MAJOR_VER}.${DPCPP_HOST_COMPILER_MINOR_VER})
sdl_gnu_common_ccxx_flags(DPCPP_HOST_COMPILER_OPTS DPCPP_HOST_COMPILER_VER)
sdl_gnu_common_ccxx_flags(DPCPP_HOST_COMPILER_OPTS)
sdl_gnu_src_ccxx_flags(DPCPP_SRC_CXX_FLAGS)
sdl_gnu_example_ccxx_flags(DPCPP_EXAMPLE_CXX_FLAGS)

Expand Down
8 changes: 4 additions & 4 deletions cmake/host_compiler_id.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ message(STATUS "Host compiler version: ${DPCPP_HOST_COMPILER_MAJOR_VER}.${DPCPP_

# Check the version of the provided host compiler.
if(DPCPP_HOST_COMPILER_KIND STREQUAL "GNU")
if((DPCPP_HOST_COMPILER_MAJOR_VER LESS 7) OR (DPCPP_HOST_COMPILER_MAJOR_VER EQUAL 7 AND DPCPP_HOST_COMPILER_MINOR_VER LESS 4))
message(FATAL_ERROR "The minimum version of ${DPCPP_HOST_COMPILER_KIND} host compiler is 7.4.")
if(DPCPP_HOST_COMPILER_MAJOR_VER LESS 8)
message(FATAL_ERROR "The minimum version of ${DPCPP_HOST_COMPILER_KIND} host compiler is 8.0.")
endif()
endif()

if(DPCPP_HOST_COMPILER_KIND STREQUAL "CLANG")
if(DPCPP_HOST_COMPILER_MAJOR_VER LESS 8)
message(FATAL_ERROR "The minimum version of ${DPCPP_HOST_COMPILER_KIND} host compiler is 8.0.")
if(DPCPP_HOST_COMPILER_MAJOR_VER LESS 11)
message(FATAL_ERROR "The minimum version of ${DPCPP_HOST_COMPILER_KIND} host compiler is 11.0.")
endif()
endif()
11 changes: 0 additions & 11 deletions cmake/platform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,6 @@ elseif(UNIX OR MINGW)
append(CMAKE_CCXX_FLAGS "-Wno-ignored-attributes")
endif()

# XXX: Suppress an erroneous warning of nested lambda visibility
# exceeding that of the containing class (GCC Bugzilla - Bug 80947).
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8 AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
append(CMAKE_CCXX_FLAGS "-Wno-attributes")
endif()

if(DNNL_TARGET_ARCH STREQUAL "AARCH64")
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
set(DEF_ARCH_OPT_FLAGS "-O3")
Expand Down Expand Up @@ -482,10 +476,5 @@ if (DNNL_TARGET_ARCH STREQUAL "RV64")
message(STATUS "DNNL_RISCV_USE_RVV_INTRINSICS: ${DNNL_RISCV_USE_RVV_INTRINSICS}")
endif()

# Old compiler versions do not support warnings available on newer compilers.
if(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0.0)
append(CMAKE_CCXX_FLAGS "-Wno-unknown-warning-option")
endif()

append(CMAKE_C_FLAGS "${CMAKE_CCXX_FLAGS}")
append(CMAKE_CXX_FLAGS "${CMAKE_CCXX_FLAGS}")

0 comments on commit 5397f1c

Please sign in to comment.