aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--src/CMakeLists.txt45
2 files changed, 37 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 8eb1d54189d..fef563bb534 100644
--- a/Makefile
+++ b/Makefile
@@ -85,17 +85,17 @@ ifeq ($(OS_VERSION_ID),20.04)
DEB_DEPENDS += python3-virtualenv
DEB_DEPENDS += libssl-dev
DEB_DEPENDS += libelf-dev # for libbpf (af_xdp)
- DEB_DEPENDS += clang-11 clang-format-11
+ DEB_DEPENDS += clang clang-format-11
LIBFFI=libffi7
DEB_DEPENDS += enchant-2 # for docs
else ifeq ($(OS_VERSION_ID),20.10)
- DEB_DEPENDS += clang-11 clang-format-11
+ DEB_DEPENDS += clang clang-format-11
LIBFFI=libffi8ubuntu1
else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-10)
DEB_DEPENDS += virtualenv
else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-11)
DEB_DEPENDS += virtualenv
- DEB_DEPENDS += clang-11 clang-format-11
+ DEB_DEPENDS += clang clang-format-11
LIBFFI=libffi7
else
DEB_DEPENDS += clang-11 clang-format-11
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a1c18ff0951..de0c24135d7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -13,17 +13,7 @@
cmake_minimum_required(VERSION 3.13)
-set(CMAKE_C_COMPILER_NAMES
- clang-14
- clang-13
- clang-12
- clang-11
- clang-10
- clang-9
- gcc-10
- gcc-9
- cc
-)
+set(CMAKE_C_COMPILER_NAMES clang gcc cc)
project(vpp C)
@@ -51,6 +41,39 @@ string(REPLACE "-" ";" VPP_LIB_VERSION ${VPP_VERSION})
list(GET VPP_LIB_VERSION 0 VPP_LIB_VERSION)
##############################################################################
+# compiler specifics
+##############################################################################
+
+set(MIN_SUPPORTED_CLANG_C_COMPILER_VERSION 9.0.0)
+set(MIN_SUPPORTED_GNU_C_COMPILER_VERSION 9.0.0)
+
+if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ if (CMAKE_C_COMPILER_VERSION VERSION_LESS MIN_SUPPORTED_CLANG_C_COMPILER_VERSION)
+ set(COMPILER_TOO_OLD TRUE)
+ endif()
+elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ if (CMAKE_C_COMPILER_VERSION VERSION_LESS MIN_SUPPORTED_GNU_C_COMPILER_VERSION)
+ set(COMPILER_TOO_OLD TRUE)
+ endif()
+else()
+ message(WARNING "WARNING: Unsupported C compiler `${CMAKE_C_COMPILER_ID}` is used")
+ set (PRINT_MIN_C_COMPILER_VER TRUE)
+endif()
+if (COMPILER_TOO_OLD)
+ message(WARNING "WARNING: C compiler version is too old and it's usage may result")
+ message(WARNING " in sub-optimal binaries or lack of support for specific CPU types.")
+ set (PRINT_MIN_C_COMPILER_VER TRUE)
+endif()
+
+if (PRINT_MIN_C_COMPILER_VER)
+ string (APPEND _t "Supported C compilers are ")
+ string (APPEND _t "Clang ${MIN_SUPPORTED_CLANG_C_COMPILER_VERSION} or higher ")
+ string (APPEND _t "and GNU ${MIN_SUPPORTED_GNU_C_COMPILER_VERSION} or higher.")
+ message(WARNING " ${_t}")
+ unset (_t)
+endif()
+
+##############################################################################
# cross compiling
##############################################################################
if(CMAKE_CROSSCOMPILING)