forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpaimon-cpp-cache.cmake
More file actions
136 lines (117 loc) · 7.01 KB
/
Copy pathpaimon-cpp-cache.cmake
File metadata and controls
136 lines (117 loc) · 7.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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 Initial Cache for paimon-cpp
# Configures paimon-cpp to reuse selected Doris third-party libraries
# Usage: cmake -C paimon-cpp-cache.cmake ...
# Get the Doris thirdparty installation directory from environment
set(DORIS_THIRDPARTY_DIR "$ENV{TP_INSTALL_DIR}" CACHE PATH "Doris thirdparty install directory")
if(NOT DORIS_THIRDPARTY_DIR)
message(FATAL_ERROR "TP_INSTALL_DIR environment variable must be set")
endif()
message(STATUS "Using Doris thirdparty libraries from: ${DORIS_THIRDPARTY_DIR}")
# Set CMAKE_PREFIX_PATH to help find_package locate our libraries
set(CMAKE_PREFIX_PATH "${DORIS_THIRDPARTY_DIR};${CMAKE_PREFIX_PATH}" CACHE STRING "Search path for find_package")
# Library and include paths
set(DORIS_LIB_DIR "${DORIS_THIRDPARTY_DIR}/lib" CACHE PATH "Doris library directory")
set(DORIS_INCLUDE_DIR "${DORIS_THIRDPARTY_DIR}/include" CACHE PATH "Doris include directory")
# ============================================================================
# ZLIB - Reuse from Doris (version 1.3.1)
# ============================================================================
set(ZLIB_ROOT "${DORIS_THIRDPARTY_DIR}" CACHE PATH "ZLIB root directory")
set(ZLIB_LIBRARY "${DORIS_LIB_DIR}/libz.a" CACHE FILEPATH "ZLIB library")
set(ZLIB_INCLUDE_DIR "${DORIS_INCLUDE_DIR}" CACHE PATH "ZLIB include directory")
# ============================================================================
# ZSTD - Reuse from Doris (version 1.5.7)
# ============================================================================
set(ZSTD_ROOT "${DORIS_THIRDPARTY_DIR}" CACHE PATH "ZSTD root directory")
set(ZSTD_LIBRARY "${DORIS_LIB_DIR}/libzstd.a" CACHE FILEPATH "ZSTD library")
set(ZSTD_INCLUDE_DIR "${DORIS_INCLUDE_DIR}" CACHE PATH "ZSTD include directory")
# ============================================================================
# LZ4 - Reuse from Doris (version 1.9.4)
# ============================================================================
set(LZ4_ROOT "${DORIS_THIRDPARTY_DIR}" CACHE PATH "LZ4 root directory")
set(LZ4_LIBRARY "${DORIS_LIB_DIR}/liblz4.a" CACHE FILEPATH "LZ4 library")
set(LZ4_INCLUDE_DIR "${DORIS_INCLUDE_DIR}" CACHE PATH "LZ4 include directory")
# ============================================================================
# glog - NOT reused from Doris
# paimon-cpp's build_glog() unconditionally calls externalproject_add() to
# build glog 0.7.1. Any GLOG_ROOT/GLOG_LIBRARY/GLOG_INCLUDE_DIR set here
# would be overwritten by that macro, so we skip them entirely.
# ============================================================================
# ============================================================================
# Arrow - Reuse from Doris (Doris Arrow now includes COMPUTE/DATASET/ACERO/FILESYSTEM)
# Doris's Arrow 17.0.0 is built with the full module set that paimon-cpp
# needs, so we skip paimon-cpp's internal externalproject_add(arrow_ep ...).
# ============================================================================
set(PAIMON_USE_EXTERNAL_ARROW ON CACHE BOOL "Use pre-built Arrow from Doris instead of building from source")
set(DORIS_LIB64_DIR "${DORIS_THIRDPARTY_DIR}/lib64" CACHE PATH "Doris lib64 directory")
set(PAIMON_EXTERNAL_ARROW_INCLUDE_DIR "${DORIS_INCLUDE_DIR}" CACHE PATH "Arrow include directory")
set(PAIMON_EXTERNAL_ARROW_LIB "${DORIS_LIB64_DIR}/libarrow.a" CACHE FILEPATH "Arrow core library")
set(PAIMON_EXTERNAL_ARROW_DATASET_LIB "${DORIS_LIB64_DIR}/libarrow_dataset.a" CACHE FILEPATH "Arrow Dataset library")
set(PAIMON_EXTERNAL_ARROW_ACERO_LIB "${DORIS_LIB64_DIR}/libarrow_acero.a" CACHE FILEPATH "Arrow Acero library")
set(PAIMON_EXTERNAL_PARQUET_LIB "${DORIS_LIB64_DIR}/libparquet.a" CACHE FILEPATH "Parquet library")
set(PAIMON_EXTERNAL_ARROW_BUNDLED_DEPS_LIB "${DORIS_LIB64_DIR}/libarrow_bundled_dependencies.a" CACHE FILEPATH "Arrow bundled dependencies library")
# Protobuf, Thrift - still built separately by paimon-cpp
# ============================================================================
# Snappy - Reuse from Doris
# ============================================================================
set(Snappy_ROOT "${DORIS_THIRDPARTY_DIR}" CACHE PATH "Snappy root directory")
set(SNAPPY_ROOT "${DORIS_THIRDPARTY_DIR}" CACHE PATH "Snappy root directory (legacy)")
set(SNAPPY_LIBRARY "${DORIS_LIB_DIR}/libsnappy.a" CACHE FILEPATH "Snappy library")
set(SNAPPY_INCLUDE_DIR "${DORIS_INCLUDE_DIR}" CACHE PATH "Snappy include directory")
# ============================================================================
# Build configuration
# ============================================================================
set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "Build with -fPIC")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type")
# Symbol visibility control to prevent conflicts with Doris
# paimon-cpp builds Arrow/ORC/etc with hidden symbols to avoid conflicts
set(CMAKE_CXX_VISIBILITY_PRESET "hidden" CACHE STRING "Hide C++ symbols by default")
set(CMAKE_C_VISIBILITY_PRESET "hidden" CACHE STRING "Hide C symbols by default")
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON CACHE BOOL "Hide inline function symbols")
# Verify that required libraries exist
if(NOT EXISTS "${ZLIB_LIBRARY}")
message(FATAL_ERROR "ZLIB library not found: ${ZLIB_LIBRARY}")
endif()
if(NOT EXISTS "${ZSTD_LIBRARY}")
message(FATAL_ERROR "ZSTD library not found: ${ZSTD_LIBRARY}")
endif()
if(NOT EXISTS "${LZ4_LIBRARY}")
message(FATAL_ERROR "LZ4 library not found: ${LZ4_LIBRARY}")
endif()
if(NOT EXISTS "${SNAPPY_LIBRARY}")
message(FATAL_ERROR "Snappy library not found: ${SNAPPY_LIBRARY}")
endif()
message(STATUS "========================================")
message(STATUS "Paimon-cpp Library Reuse Configuration")
message(STATUS "========================================")
message(STATUS "Reusing from Doris:")
message(STATUS " ✓ ZLIB, ZSTD, LZ4, Snappy")
if(PAIMON_USE_EXTERNAL_ARROW)
message(STATUS " ✓ Arrow, Parquet, Arrow Dataset, Arrow Acero (Plan B)")
else()
message(STATUS " ✗ Arrow (building separately, symbol visibility=hidden)")
endif()
message(STATUS "")
message(STATUS "Building separately:")
if(NOT PAIMON_USE_EXTERNAL_ARROW)
message(STATUS " - Arrow, Protobuf, Thrift, ORC")
else()
message(STATUS " - Protobuf, Thrift, ORC")
endif()
message(STATUS " - glog, RapidJSON, TBB")
message(STATUS "========================================")