# Copyright 2023 PingCAP, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required (VERSION 3.21)
project (TiFlash LANGUAGES C CXX ASM)
cmake_policy(SET CMP0048 NEW)
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${TiFlash_SOURCE_DIR}/cmake/Modules/")
set(CMAKE_MACOSX_RPATH 1)
option(TIFLASH_ENABLE_LLVM_DEVELOPMENT "enable facilities for development with LLVM" OFF)
if(CMAKE_PREFIX_PATH)
# append paths for cmake to check libs
set(ENV{LD_LIBRARY_PATH}
"${CMAKE_PREFIX_PATH}/lib:${CMAKE_PREFIX_PATH}/lib/x86_64-unknown-linux-gnu/:${CMAKE_PREFIX_PATH}/lib/aarch64-unknown-linux-gnu/")
endif()
include (cmake/arch.cmake)
include (cmake/target.cmake)
include (cmake/tools.cmake)
include (cmake/find_rust.cmake)
include (cmake/add_warning.cmake)
include (cmake/utils.cmake)
option(ENABLE_PCH "Enable `Precompiled header`" OFF)
include (cmake/find_ccache.cmake)
# Write compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "None")
set (CMAKE_BUILD_TYPE "RelWithDebInfo")
message (STATUS "CMAKE_BUILD_TYPE is not set, set to default = ${CMAKE_BUILD_TYPE}")
endif ()
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
message (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
# ASan - build type with address sanitizer
# UBSan - build type with undefined behaviour sanitizer
# TSan is not supported due to false positive errors in libstdc++ and necessity to rebuild libstdc++ with TSan
set (CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Debug;Release;MinSizeRel;ASan;UBSan" CACHE STRING "" FORCE)
if (NOT MSVC)
set (COMMON_WARNING_FLAGS "${COMMON_WARNING_FLAGS} -Wall") # -Werror is also added inside directories with our own code.
endif ()
set (CXX_WARNING_FLAGS "${CXX_WARNING_FLAGS} -Wnon-virtual-dtor")
option(ENABLE_TIME_TRACES "Enable clang feature time traces" OFF)
if (ENABLE_TIME_TRACES)
set (CLANG_TIME_TRACES_FLAGS "-ftime-trace")
message (STATUS "Using clang time traces flag `${CLANG_TIME_TRACES_FLAGS}`. Generates JSON file based on output filename. Results can be analyzed with chrome://tracing or https://www.speedscope.app for flamegraph visualization.")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CLANG_TIME_TRACES_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLANG_TIME_TRACES_FLAGS}")
endif ()
option(ENABLE_TSA "Enable clang feature thread safety analysis " ON)
if (ENABLE_TSA)
set (CLANG_TSA_FLAGS "-Wthread-safety")
add_definitions(-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS)
message (STATUS "Enable clang thread safety analysis flag: -Wthread-safety -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS.")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CLANG_TSA_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLANG_TSA_FLAGS}")
endif ()
# https://clang.llvm.org/docs/ThinLTO.html
# Applies to clang only.
option(ENABLE_THINLTO "Clang-specific link time optimization" OFF)
if (ENABLE_THINLTO AND NOT ENABLE_TESTS)
# Link time optimization
set (THINLTO_JOBS "0" CACHE STRING "ThinLTO compilation parallelism")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto=thin -fvisibility=hidden -fvisibility-inlines-hidden -fsplit-lto-unit")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto=thin -fvisibility=hidden -fvisibility-inlines-hidden -fwhole-program-vtables -fsplit-lto-unit")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto=thin -flto-jobs=${THINLTO_JOBS} -fvisibility=hidden -fvisibility-inlines-hidden -fwhole-program-vtables -fsplit-lto-unit")
elseif (ENABLE_THINLTO)
message (WARNING "Cannot enable ThinLTO")
endif ()
option (ENABLE_LLVM_PROFILE_INSTR "Generate instrumented code to collect execution counts" OFF)
option (ENABLE_LLVM_PGO "Enables flags for Profile Guided Optimization (PGO)" OFF)
option (ENABLE_LLVM_PGO_USE_SAMPLE "Enables flags for Profile Guided Optimization (PGO) and use sampling profilers" OFF)
set (USE_LLVM_FDO OFF CACHE BOOL "" FORCE)
if (ENABLE_LLVM_PGO)
if (ENABLE_LLVM_PROFILE_INSTR)
message (FATAL_ERROR "`ENABLE_LLVM_PROFILE_INSTR` can not be used with `ENABLE_LLVM_PGO`")
endif ()
if (ENABLE_LLVM_PGO_USE_SAMPLE)
# Follow https://clang.llvm.org/docs/UsersManual.html#using-sampling-profilers
# Use https://github.com/google/autofdo
set (_LLVM_PGO_USE_SAMPLE_FLAGS "-gline-tables-only -fdebug-info-for-profiling -funique-internal-linkage-names")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_LLVM_PGO_USE_SAMPLE_FLAGS}")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_LLVM_PGO_USE_SAMPLE_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-rosegment")
message (STATUS "Add flags `${_LLVM_PGO_USE_SAMPLE_FLAGS}` for profiling")
if (NOT "$ENV{TIFLASH_LLVM_PROFDATA}" STREQUAL "")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-sample-use=$ENV{TIFLASH_LLVM_PROFDATA}")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-sample-use=$ENV{TIFLASH_LLVM_PROFDATA}")
message (STATUS "Use sample profile data `$ENV{TIFLASH_LLVM_PROFDATA}` for profile-guided optimization")
set (USE_LLVM_FDO ON CACHE BOOL "" FORCE)
else ()
message (STATUS "NOT use sample profile data")
endif ()
unset (_LLVM_PGO_USE_SAMPLE_FLAGS)
else ()
if ("$ENV{TIFLASH_LLVM_PROFDATA}" STREQUAL "")
message (FATAL_ERROR "Please set env var `TIFLASH_LLVM_PROFDATA`")
endif ()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-instr-use=$ENV{TIFLASH_LLVM_PROFDATA} -Wno-profile-instr-unprofiled")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-instr-use=$ENV{TIFLASH_LLVM_PROFDATA} -Wno-profile-instr-unprofiled")
message (STATUS "Use instrumentation data `$ENV{TIFLASH_LLVM_PROFDATA}` for profile-guided optimization")
endif ()
endif ()
# clang: warning: argument unused during compilation: '-stdlib=libc++'
# clang: warning: argument unused during compilation: '-specs=/usr/share/dpkg/no-pie-compile.specs' [-Wunused-command-line-argument]
set (COMMON_WARNING_FLAGS "${COMMON_WARNING_FLAGS} -Wno-unused-command-line-argument")
option (USE_STATIC_LIBRARIES "Set to FALSE to use shared libraries" ON)
option (MAKE_STATIC_LIBRARIES "Set to FALSE to make shared libraries" ${USE_STATIC_LIBRARIES})
if (NOT MAKE_STATIC_LIBRARIES)
option (SPLIT_SHARED_LIBRARIES "DEV ONLY. Keep all internal libs as separate .so for faster linking" OFF)
endif ()
if (SPLIT_SHARED_LIBRARIES)
set (SPLIT_SHARED SHARED)
endif ()
if (USE_STATIC_LIBRARIES)
list(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
endif ()
if (ARCH_AMD64)
option (USE_INTERNAL_MEMCPY "Use internal implementation of 'memcpy' function instead of provided by libc. Only for x86_64." ON)
endif ()
if ((ARCH_AMD64 OR ARCH_AARCH64) AND OS_LINUX)
option (GLIBC_COMPATIBILITY "Set to TRUE to enable compatibility with older glibc libraries. Only for x86_64, Linux. Implies USE_INTERNAL_MEMCPY." ON)
endif ()
option (PIPE "-pipe compiler option [less /tmp usage, more ram usage]" ON)
if (PIPE)
set (COMPILER_FLAGS "${COMPILER_FLAGS} -pipe")
endif ()
include (cmake/cpu_features.cmake)
set (CMAKE_CXX_STANDARD 20)
set (CMAKE_CXX_EXTENSIONS 1) # https://cmake.org/cmake/help/latest/prop_tgt/CXX_EXTENSIONS.html#prop_tgt:CXX_EXTENSIONS
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_R
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
TiFlash 是 TiDB 和 TiDB Cloud 的列式存储组件,TiDB 是 TiDB 的全托管服务。在 TiDB 的混合事务/分析处理 (HTAP) 架构中,它主要扮演分析处理 (AP) 的角色。TiFlash 以列式格式存储数据,并通过 Raft 日志实时同步 TiKV 的数据更新,时延为亚秒级。TiFlash 中的读取保证在事务上与 Snapshot 隔离级别一致。TiFlash 采用大规模并行处理 (MPP) 计算架构,加速分析工作负载。TiFlash 仓库基于 ClickHouse
资源推荐
资源详情
资源评论
收起资源包目录
TiFlash 是 TiDB 和 TiDB Cloud 的列式存储组件,TiDB Cloud 是 TiDB 的全托管服务 (2000个子文件)
lgamma.c 10KB
glibc-compatibility.c 4KB
posix_spawn.c 3KB
futimens.c 1KB
pipe2.c 1KB
siglongjmp.c 930B
longjmp.c 918B
vasprintf.c 893B
sched_cpucount.c 842B
fallocate.c 826B
syscall_ret.c 733B
gtest_join_executor.cpp 199KB
gtest_dm_delta_merge_store.cpp 135KB
Segment.cpp 115KB
gtest_page_directory.cpp 102KB
Join.cpp 100KB
ExpressionAnalyzer.cpp 99KB
Aggregator.cpp 93KB
JoinPartition.cpp 90KB
gtest_dm_file.cpp 88KB
DeltaMergeStore.cpp 82KB
PageDirectory.cpp 80KB
gtest_dm_minmax_index.cpp 77KB
DAGExpressionAnalyzer.cpp 71KB
StorageDeltaMerge.cpp 68KB
DAGStorageInterpreter.cpp 68KB
gtest_kvstore.cpp 65KB
gtest_blob_store.cpp 64KB
Context.cpp 60KB
gtest_page_storage.cpp 60KB
gtest_dm_segment.cpp 60KB
gtest_json_test.cpp 58KB
DAGUtils.cpp 57KB
BlobStore.cpp 57KB
PageStorage.cpp 53KB
PageFile.cpp 52KB
gtest_dm_delta_merge_store_for_fast_scan.cpp 52KB
WindowBlockInputStream.cpp 52KB
FlashService.cpp 51KB
gtest_checkpoint.cpp 51KB
DAGQueryBlockInterpreter.cpp 49KB
DeltaMergeStore_Ingest.cpp 48KB
gtest_compute_server.cpp 48KB
gtest_segment.cpp 47KB
gtests_parse_push_down_filter.cpp 47KB
gtest_dm_delta_value_space.cpp 46KB
InterpreterSelectQuery.cpp 46KB
DMFile.cpp 45KB
gtest_page_storage.cpp 45KB
FilterParser.cpp 43KB
gtest_aggregation_executor.cpp 43KB
BaseDaemon.cpp 42KB
gtest_raftstore_v2.cpp 42KB
S3Common.cpp 42KB
gtest_page_storage_mix_mode.cpp 42KB
PathPool.cpp 40KB
gtest_spiller.cpp 38KB
gtest_wal_store.cpp 37KB
gtest_segment_test_basic.cpp 37KB
gtest_new_kvstore.cpp 37KB
gtest_filecache.cpp 36KB
StoragePool.cpp 36KB
DeltaMergeStore_InternalBg.cpp 35KB
CrossJoinProbeHelper.cpp 35KB
gtest_kvstore_fast_add_peer.cpp 34KB
gtest_dm_storage_delta_merge.cpp 33KB
ExchangeReceiver.cpp 33KB
gtest_dm_segment_common_handle.cpp 33KB
ColumnArray.cpp 33KB
gtest_physical_plan.cpp 32KB
ProxyFFI.cpp 32KB
gtest_segment_read_task.cpp 32KB
PageStorageCtlV3.cpp 31KB
ReadIndexWorker.cpp 31KB
MPPTask.cpp 30KB
gtest_filter_parser.cpp 29KB
gtest_region_persister.cpp 29KB
S3GCManager.cpp 29KB
gtest_window_executor.cpp 29KB
gtest_region_block_reader.cpp 29KB
gtest_s3gcmanager.cpp 29KB
ArrowColCodec.cpp 29KB
mockExecutor.cpp 28KB
gtest_spill_join.cpp 28KB
gtest_page_map_version_set.cpp 27KB
gtest_version_filter.cpp 27KB
PageStorage.cpp 27KB
SegmentReadTask.cpp 27KB
gtest_mpptunnel.cpp 27KB
gtest_query_expr.cpp 26KB
ExpressionActions.cpp 26KB
gtest_wal_log.cpp 26KB
DMFileReader.cpp 26KB
StorageDisaggregatedRemote.cpp 26KB
gtest_resource_control_queue.cpp 26KB
InterpreterCreateQuery.cpp 26KB
DataCompactor.cpp 26KB
gtest_file_read_write.cpp 25KB
ExpressionElementParsers.cpp 25KB
gtest_mpp_exchange_writer.cpp 25KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6718
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功