X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2FCMakeLists.txt;h=8947c8afff68fcd16db69315307a28dbd6db8abe;hb=027d813a509be0f30e05b48b888007b0094e4faf;hp=e2937c99db62aeb94f01c9a463b04684b74ccb40;hpb=ec3a3f16e4cd3b33e2a409fb01b8d8826e05f9fa;p=vpp.git diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e2937c99db6..8947c8afff6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -11,13 +11,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.5 FATAL_ERROR) +cmake_minimum_required(VERSION 3.10) -set(CMAKE_C_COMPILER_NAMES clang-10 clang-9 gcc-9 cc) +set(CMAKE_C_COMPILER_NAMES clang-11 clang-10 clang-9 gcc-10 gcc-9 cc) project(vpp C) include(CheckCCompilerFlag) +include(CheckIPOSupported) include(cmake/misc.cmake) include(cmake/cpu.cmake) include(cmake/ccache.cmake) @@ -105,19 +106,29 @@ string(REPLACE ";" " " BUILD_TYPES "${BUILD_TYPES}") set_property(CACHE CMAKE_BUILD_TYPE PROPERTY HELPSTRING "Build type - valid options are: ${BUILD_TYPES}") +############################################################################## +# link time optimizations +############################################################################## +if (CMAKE_BUILD_TYPE_UC STREQUAL "RELEASE") + check_ipo_supported(RESULT _result) + if (_result) + option(VPP_USE_LTO "Link time optimization of release binaries" ON) + endif() +endif() + ############################################################################## # sanitizers ############################################################################## option(VPP_ENABLE_SANITIZE_ADDR "Enable Address Sanitizer" OFF) -set(VPP_SANITIZE_ADDR_ARGS +set(VPP_SANITIZE_ADDR_OPTIONS "unmap_shadow_on_exit=1:disable_coredump=0:abort_on_error=1:detect_leaks=0" CACHE STRING "Address sanitizer arguments" ) if (VPP_ENABLE_SANITIZE_ADDR) - set(CMAKE_C_FLAGS "-fsanitize=address --param asan-stack=0 -DCLIB_SANITIZE_ADDR ${CMAKE_C_FLAGS}") + set(CMAKE_C_FLAGS "-fsanitize=address -DCLIB_SANITIZE_ADDR ${CMAKE_C_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=address ${CMAKE_EXE_LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "-fsanitize=address ${CMAKE_SHARED_LINKER_FLAGS}") endif (VPP_ENABLE_SANITIZE_ADDR) @@ -153,7 +164,7 @@ if(VPP_HOST_TOOLS_ONLY) elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") find_package(OpenSSL REQUIRED) set(SUBDIRS - vppinfra svm vlib vlibmemory vlibapi vnet vpp vat vcl plugins + vppinfra svm vlib vlibmemory vlibapi vnet vpp vat vat2 vcl plugins vpp-api tools/vppapigen tools/g2 tools/perftool cmake pkg tools/appimage )