diff options
author | AlexSm <alex@ydb.tech> | 2024-01-18 11:28:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-18 11:28:56 +0100 |
commit | 9d0a3761b3201e0d9db879a7adf91876ebdb0564 (patch) | |
tree | 541d11ac878c18efd7ebca81e35112aa0fef995b /build/export_generators/hardcoded-cmake | |
parent | 404ef8886ecc9736bc58ade6da2fbd83b486a408 (diff) | |
download | ydb-9d0a3761b3201e0d9db879a7adf91876ebdb0564.tar.gz |
Library import 8 (#1074)
* Library import 8
* Add contrib/libs/cxxsupp/libcxx/include/__verbose_abort
Diffstat (limited to 'build/export_generators/hardcoded-cmake')
16 files changed, 204 insertions, 49 deletions
diff --git a/build/export_generators/hardcoded-cmake/build/scripts/create_recursive_library_for_cmake.py b/build/export_generators/hardcoded-cmake/build/scripts/create_recursive_library_for_cmake.py index 0023e7d02a..7ba030ac21 100644 --- a/build/export_generators/hardcoded-cmake/build/scripts/create_recursive_library_for_cmake.py +++ b/build/export_generators/hardcoded-cmake/build/scripts/create_recursive_library_for_cmake.py @@ -29,7 +29,7 @@ class Opts(object): if other_args[0] != '--linking-cmdline': raise Exception("expected '--linking-cmdline' arg, got {}".format(other_args[0])) - self.is_msvc_linker = other_args[1].endswith('\\link.exe') + self.is_msvc_compatible_linker = other_args[1].endswith('\\link.exe') or other_args[1].endswith('\\lld-link.exe') is_host_system_windows = self.parsed_args.cmake_host_system_name == 'Windows' std_libraries_to_exclude_from_input = ( @@ -38,11 +38,9 @@ class Opts(object): else set() ) msvc_preserved_option_prefixes = [ - 'errorreport', 'machine:', 'nodefaultlib', 'nologo', - 'subsystem', ] self.preserved_options = [] @@ -129,7 +127,7 @@ class FilesCombiner(object): # force LIBTOOL even if CMAKE_AR is defined because 'ar' under Darwin does not contain the necessary options arch_type = 'LIBTOOL' archiver_tool_path = 'libtool' - elif opts.is_msvc_linker: + elif opts.is_msvc_compatible_linker: arch_type = 'LIB' elif opts.parsed_args.cmake_ar.endswith('llvm-ar'): arch_type = 'LLVM_AR' @@ -152,7 +150,7 @@ class FilesCombiner(object): def do(self, output, input_list): input_file_path = None try: - if self.opts.is_msvc_linker: + if self.opts.is_msvc_compatible_linker: # use response file for input (because of Windows cmdline length limitations) # can't use NamedTemporaryFile because of permissions issues on Windows @@ -177,7 +175,7 @@ class FilesCombiner(object): if input_file_path is not None: os.remove(input_file_path) - if not self.opts.is_msvc_linker: + if not self.opts.is_msvc_compatible_linker: subprocess.check_call([self.opts.parsed_args.cmake_ranlib, output]) diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.arm64.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.arm64.profile new file mode 100644 index 0000000000..6147d99225 --- /dev/null +++ b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.arm64.profile @@ -0,0 +1,15 @@ +include(default) +[settings] +arch=armv8 +build_type=Release +compiler=clang +compiler.libcxx=libc++ +compiler.version=14 +compiler.cppstd=20 +os=Android +os.api_level=21 +[tool_requires] +android-ndk/r25 +[options] +[env] + diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.armv7.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.armv7.profile new file mode 100644 index 0000000000..57d8f55785 --- /dev/null +++ b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.armv7.profile @@ -0,0 +1,15 @@ +include(default) +[settings] +arch=armv7 +build_type=Release +compiler=clang +compiler.libcxx=libc++ +compiler.version=14 +compiler.cppstd=20 +os=Android +os.api_level=21 +[tool_requires] +android-ndk/r25 +[options] +[env] + diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.x86.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.x86.profile new file mode 100644 index 0000000000..d8b73b992c --- /dev/null +++ b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.x86.profile @@ -0,0 +1,15 @@ +include(default) +[settings] +arch=x86 +build_type=Release +compiler=clang +compiler.libcxx=libc++ +compiler.version=14 +compiler.cppstd=20 +os=Android +os.api_level=21 +[tool_requires] +android-ndk/r25 +[options] +[env] + diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.x86_64.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.x86_64.profile new file mode 100644 index 0000000000..50ad337afa --- /dev/null +++ b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.x86_64.profile @@ -0,0 +1,15 @@ +include(default) +[settings] +arch=x86_64 +build_type=Release +compiler=clang +compiler.libcxx=libc++ +compiler.version=14 +compiler.cppstd=20 +os=Android +os.api_level=21 +[tool_requires] +android-ndk/r25 +[options] +[env] + diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/linux.aarch64.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/linux.aarch64.profile new file mode 100644 index 0000000000..6945b1d777 --- /dev/null +++ b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/linux.aarch64.profile @@ -0,0 +1,28 @@ +include(default) + +target_host=aarch64-linux-gnu + +[settings] +arch=armv8 +build_type=Release +compiler=gcc +compiler.libcxx=libstdc++11 +compiler.version=12 +compiler.cppstd=20 +os=Linux +[options] + +[env] +CONAN_CMAKE_FIND_ROOT_PATH=/usr/$target_host +CONAN_CMAKE_SYSROOT=/usr/$target_host +SYSROOT=/usr/$target_host +CC=$target_host-gcc +CXX=$target_host-g++ +CXXFLAGS="-I/usr/$target_host/include/" +CFLAGS="-I/usr/$target_host/include/" +CHOST=$target_host +AR=$target_host-ar +AS=$target_host-as +RANLIB=$target_host-ranlib +LD=$target_host-ld +STRIP=$target_host-strip diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/linux.ppc64le.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/linux.ppc64le.profile new file mode 100644 index 0000000000..5ecd24d6ce --- /dev/null +++ b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/linux.ppc64le.profile @@ -0,0 +1,28 @@ +include(default) + +target_host=powerpc64le-linux-gnu + +[settings] +arch=ppc64le +build_type=Release +compiler=gcc +compiler.libcxx=libstdc++11 +compiler.version=12 +compiler.cppstd=20 +os=Linux +[options] + +[env] +CONAN_CMAKE_FIND_ROOT_PATH=/usr/$target_host +CONAN_CMAKE_SYSROOT=/usr/$target_host +SYSROOT=/usr/$target_host +CC=$target_host-gcc +CXX=$target_host-g++ +CXXFLAGS="-I/usr/$target_host/include/" +CFLAGS="-I/usr/$target_host/include/" +CHOST=$target_host +AR=$target_host-ar +AS=$target_host-as +RANLIB=$target_host-ranlib +LD=$target_host-ld +STRIP=$target_host-strip diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/macos.arm64.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/macos.arm64.profile new file mode 100644 index 0000000000..52ba46ab97 --- /dev/null +++ b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/macos.arm64.profile @@ -0,0 +1,11 @@ +include(default) +[settings] +arch=armv8 +build_type=Release +compiler=clang +compiler.libcxx=libc++ +compiler.version=14 +compiler.cppstd=20 +os=Macos +[options] +[env] diff --git a/build/export_generators/hardcoded-cmake/cmake/conan.cmake b/build/export_generators/hardcoded-cmake/cmake/conan.cmake index d6a8b5e8c4..9a5dee5d81 100644 --- a/build/export_generators/hardcoded-cmake/cmake/conan.cmake +++ b/build/export_generators/hardcoded-cmake/cmake/conan.cmake @@ -170,7 +170,10 @@ macro(_conan_detect_compiler) conan_cmake_detect_unix_libcxx(_LIBCXX) set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) endif () - elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang) + elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang + AND NOT "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" + AND NOT "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC") + string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) list(GET VERSION_LIST 0 MAJOR) list(GET VERSION_LIST 1 MINOR) @@ -190,7 +193,11 @@ macro(_conan_detect_compiler) conan_cmake_detect_unix_libcxx(_LIBCXX) set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) endif () - elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC) + elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC + OR (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang + AND "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" + AND "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC")) + set(_VISUAL "Visual Studio") _get_msvc_ide_version(_VISUAL_VERSION) if("${_VISUAL_VERSION}" STREQUAL "") diff --git a/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.cmake b/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.cmake index 3dcde4027f..c5d0013b20 100644 --- a/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.cmake +++ b/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.cmake @@ -48,37 +48,9 @@ if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|aarch64|ppc64le)") string(APPEND _GNU_COMMON_C_CXX_FLAGS " -fsigned-char") endif() -if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64|AMD64)$") - if (CMAKE_SYSTEM_PROCESSOR STREQUAL "i686") - string(APPEND _GNU_COMMON_C_CXX_FLAGS " -m32") - elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$") - string(APPEND _GNU_COMMON_C_CXX_FLAGS " -m64") - endif() - string(APPEND _GNU_COMMON_C_CXX_FLAGS "\ - -msse2 \ - -msse3 \ - -mssse3 \ - ") +include(global_flags.compiler.gnu.march) +string(APPEND _GNU_COMMON_C_CXX_FLAGS " ${_GNU_MARCH_C_CXX_FLAGS}") - if ((CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$") OR (NOT ANDROID)) - string(APPEND _GNU_COMMON_C_CXX_FLAGS "\ - -msse4.1 \ - -msse4.2 \ - -mpopcnt \ - ") - if (NOT ANDROID) - # older clang versions did not support this feature on Android: - # https://reviews.llvm.org/rGc32d307a49f5255602e7543e64e6c38a7f536abc - string(APPEND _GNU_COMMON_C_CXX_FLAGS " -mcx16") - endif() - endif() - - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - string(APPEND _GNU_COMMON_C_CXX_FLAGS " -D_YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE") - endif() -elseif (ANDROID AND (CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a")) - string(APPEND _GNU_COMMON_C_CXX_FLAGS " -mfloat-abi=softfp") -endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_GNU_COMMON_C_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_GNU_COMMON_C_CXX_FLAGS} \ diff --git a/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.march.cmake b/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.march.cmake new file mode 100644 index 0000000000..a81af88c70 --- /dev/null +++ b/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.march.cmake @@ -0,0 +1,34 @@ + +set(_GNU_MARCH_C_CXX_FLAGS "") + +if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64|AMD64)$") + if (CMAKE_SYSTEM_PROCESSOR STREQUAL "i686") + string(APPEND _GNU_MARCH_C_CXX_FLAGS " -m32") + elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$") + string(APPEND _GNU_MARCH_C_CXX_FLAGS " -m64") + endif() + string(APPEND _GNU_MARCH_C_CXX_FLAGS "\ + -msse2 \ + -msse3 \ + -mssse3 \ + ") + + if ((CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$") OR (NOT ANDROID)) + string(APPEND _GNU_MARCH_C_CXX_FLAGS "\ + -msse4.1 \ + -msse4.2 \ + -mpopcnt \ + ") + if (NOT ANDROID) + # older clang versions did not support this feature on Android: + # https://reviews.llvm.org/rGc32d307a49f5255602e7543e64e6c38a7f536abc + string(APPEND _GNU_MARCH_C_CXX_FLAGS " -mcx16") + endif() + endif() + + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + string(APPEND _GNU_MARCH_C_CXX_FLAGS " -D_YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE") + endif() +elseif (ANDROID AND (CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a")) + string(APPEND _GNU_MARCH_C_CXX_FLAGS " -mfloat-abi=softfp") +endif() diff --git a/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.msvc.cmake b/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.msvc.cmake index ffbd2e033c..1541beb834 100644 --- a/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.msvc.cmake +++ b/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.msvc.cmake @@ -1,3 +1,9 @@ +set(_IS_CLANG_CL_COMPILER + ${CMAKE_CXX_COMPILER_ID} STREQUAL Clang + AND "${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" + AND "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC" +) + set(_WARNS_ENABLED 4018 # 'expression' : signed/unsigned mismatch 4265 # 'class' : class has virtual functions, but destructor is not virtual @@ -64,9 +70,13 @@ set (_MSVC_COMMON_C_CXX_FLAGS " \ /permissive- \ /D_WIN32_WINNT=0x0601 \ /D_MBCS \ - /MP \ ") +if (NOT _IS_CLANG_CL_COMPILER) + # unused by clang-cl + string(APPEND _MSVC_COMMON_C_CXX_FLAGS " /MP") +endif() + if (CMAKE_GENERATOR MATCHES "Visual.Studio.*") string(APPEND _MSVC_COMMON_C_CXX_FLAGS "\ /DY_UCRT_INCLUDE=\"$(UniversalCRT_IncludePath.Split(';')[0].Replace('\\','/'))\" \ @@ -127,6 +137,15 @@ if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$") ") endif() +if (_IS_CLANG_CL_COMPILER) + # clang-cl works slighly differently than MSVC compiler when specifying arch options, so we have to set them differently + # https://github.com/llvm/llvm-project/issues/56722 + + include(global_flags.compiler.gnu.march) + string(APPEND _MSVC_COMMON_C_CXX_FLAGS " ${_GNU_MARCH_C_CXX_FLAGS}") +endif() + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_MSVC_COMMON_C_CXX_FLAGS} \ ") diff --git a/build/export_generators/hardcoded-cmake/disclaimer.jinja b/build/export_generators/hardcoded-cmake/disclaimer.jinja new file mode 100644 index 0000000000..d48958a576 --- /dev/null +++ b/build/export_generators/hardcoded-cmake/disclaimer.jinja @@ -0,0 +1,5 @@ +# This file was generated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. diff --git a/build/export_generators/hardcoded-cmake/generator.toml b/build/export_generators/hardcoded-cmake/generator.toml index bcf9042105..648d69108a 100644 --- a/build/export_generators/hardcoded-cmake/generator.toml +++ b/build/export_generators/hardcoded-cmake/generator.toml @@ -4,6 +4,7 @@ templates=[ { path="root_global_vars.jinja", dest="cmake/global_vars.cmake" }, ] copy=[ + "cmake/global_flags.compiler.gnu.march.cmake", "cmake/global_flags.compiler.gnu.cmake", "cmake/global_flags.compiler.msvc.cmake", "cmake/global_flags.linker.gnu.cmake", diff --git a/build/export_generators/hardcoded-cmake/root_cmake_lists.jinja b/build/export_generators/hardcoded-cmake/root_cmake_lists.jinja index f04b019278..fdd774fefe 100644 --- a/build/export_generators/hardcoded-cmake/root_cmake_lists.jinja +++ b/build/export_generators/hardcoded-cmake/root_cmake_lists.jinja @@ -1,9 +1,5 @@ -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. +{% include '[generator]/disclaimer.jinja' -%} cmake_minimum_required(VERSION 3.15) diff --git a/build/export_generators/hardcoded-cmake/root_global_vars.jinja b/build/export_generators/hardcoded-cmake/root_global_vars.jinja index 398801d733..f57307b465 100644 --- a/build/export_generators/hardcoded-cmake/root_global_vars.jinja +++ b/build/export_generators/hardcoded-cmake/root_global_vars.jinja @@ -1,9 +1,5 @@ -# This file was generated by the build system used internally in the Yandex monorepo. -# Only simple modifications are allowed (adding source-files to targets, adding simple properties -# like target_include_directories). These modifications will be ported to original -# ya.make files by maintainers. Any complex modifications which can't be ported back to the -# original buildsystem will not be accepted. +{% include '[generator]/disclaimer.jinja' -%} {% for i in range(platform_vars|length) %} if({{ platform_flags[i] }}) |