diff --git a/CMakeLists.txt b/CMakeLists.txt index 367af2bbf92..56faf4ca2b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,14 +225,14 @@ endif () if (COMPILER_GCC OR COMPILER_CLANG) # to make numeric_limits<__int128> works with GCC - set (_CXX_STANDARD "-std=gnu++2a") + set (_CXX_STANDARD "gnu++2a") else() - set (_CXX_STANDARD "-std=c++2a") + set (_CXX_STANDARD "c++2a") endif() # cmake < 3.12 doesn't support 20. We'll set CMAKE_CXX_FLAGS for now # set (CMAKE_CXX_STANDARD 20) -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_CXX_STANDARD}") +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=${_CXX_STANDARD}") set (CMAKE_CXX_EXTENSIONS 0) # https://cmake.org/cmake/help/latest/prop_tgt/CXX_EXTENSIONS.html#prop_tgt:CXX_EXTENSIONS set (CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/cmake/limit_jobs.cmake b/cmake/limit_jobs.cmake index 5b962f34c38..241fa509477 100644 --- a/cmake/limit_jobs.cmake +++ b/cmake/limit_jobs.cmake @@ -35,6 +35,15 @@ if (NOT PARALLEL_LINK_JOBS AND AVAILABLE_PHYSICAL_MEMORY AND MAX_LINKER_MEMORY) endif () endif () +# ThinLTO provides its own parallel linking +# But use 2 parallel jobs, since: +# - this is what llvm does +# - and I've verfied that lld-11 does not use all available CPU time (in peak) while linking one binary +if (ENABLE_THINLTO AND PARALLEL_LINK_JOBS GREATER 2) + message(STATUS "ThinLTO provides its own parallel linking - limiting parallel link jobs to 2.") + set (PARALLEL_LINK_JOBS 2) +endif() + if (PARALLEL_LINK_JOBS AND (NOT NUMBER_OF_LOGICAL_CORES OR PARALLEL_COMPILE_JOBS LESS NUMBER_OF_LOGICAL_CORES)) set(CMAKE_JOB_POOL_LINK link_job_pool${CMAKE_CURRENT_SOURCE_DIR}) string (REGEX REPLACE "[^a-zA-Z0-9]+" "_" CMAKE_JOB_POOL_LINK ${CMAKE_JOB_POOL_LINK}) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 48d760e7540..a7b1abb9f49 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -241,6 +241,14 @@ if (USE_EMBEDDED_COMPILER AND USE_INTERNAL_LLVM_LIBRARY) set (LLVM_ENABLE_RTTI 1 CACHE INTERNAL "") set (LLVM_ENABLE_PIC 0 CACHE INTERNAL "") set (LLVM_TARGETS_TO_BUILD "X86;AArch64" CACHE STRING "") + # Yes it is set globally, but this is not enough, since llvm will add -std=c++11 after default + # And c++2a cannot be used, due to ambiguous operator != + if (COMPILER_GCC OR COMPILER_CLANG) + set (_CXX_STANDARD "gnu++17") + else() + set (_CXX_STANDARD "c++17") + endif() + set (LLVM_CXX_STD ${_CXX_STANDARD} CACHE STRING "" FORCE) add_subdirectory (llvm/llvm) target_include_directories(LLVMSupport SYSTEM BEFORE PRIVATE ${ZLIB_INCLUDE_DIR}) endif () diff --git a/debian/control b/debian/control index 12d69d9fff6..9b34e982698 100644 --- a/debian/control +++ b/debian/control @@ -5,8 +5,8 @@ Maintainer: Alexey Milovidov Build-Depends: debhelper (>= 9), cmake | cmake3, ninja-build, - gcc-9 [amd64 i386] | gcc-8 [amd64 i386], g++-9 [amd64 i386] | g++-8 [amd64 i386], - clang-8 [arm64 armhf] | clang-7 [arm64 armhf] | clang-6.0 [arm64 armhf], + clang-11, + llvm-11, libc6-dev, libicu-dev, libreadline-dev, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ac735cb3bc3..6021065f937 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,6 +6,18 @@ if (USE_CLANG_TIDY) set (CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_PATH}") endif () +if(COMPILER_PIPE) + set(MAX_COMPILER_MEMORY 2500) +else() + set(MAX_COMPILER_MEMORY 1500) +endif() +if(MAKE_STATIC_LIBRARIES) + set(MAX_LINKER_MEMORY 3500) +else() + set(MAX_LINKER_MEMORY 2500) +endif() +include(../cmake/limit_jobs.cmake) + set (CONFIG_VERSION ${CMAKE_CURRENT_BINARY_DIR}/Common/config_version.h) set (CONFIG_COMMON ${CMAKE_CURRENT_BINARY_DIR}/Common/config.h) diff --git a/src/Parsers/New/CMakeLists.txt b/src/Parsers/New/CMakeLists.txt index 1c3fd8368be..360dd4d7488 100644 --- a/src/Parsers/New/CMakeLists.txt +++ b/src/Parsers/New/CMakeLists.txt @@ -58,7 +58,7 @@ check_cxx_compiler_flag("-Wshadow" HAS_SHADOW) target_compile_options (clickhouse_parsers_new PRIVATE - -Wno-c++20-compat + -Wno-c++2a-compat -Wno-deprecated-this-capture -Wno-documentation-html -Wno-documentation diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 322ad2630d1..a27a7e9dadc 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -2,6 +2,13 @@ if (USE_CLANG_TIDY) set (CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_PATH}") endif () +if(MAKE_STATIC_LIBRARIES) + set(MAX_LINKER_MEMORY 3500) +else() + set(MAX_LINKER_MEMORY 2500) +endif() +include(../cmake/limit_jobs.cmake) + # Utils used in package add_subdirectory (config-processor) add_subdirectory (report)