Skip to content

Commit ca7657b

Browse files
committed
add zstd and lz4 libs
1 parent 2183a98 commit ca7657b

File tree

5 files changed

+95
-13
lines changed

5 files changed

+95
-13
lines changed

cmake_modules/BaseFunctions.cmake

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,19 +326,14 @@ function(dsn_setup_thirdparty_libs)
326326
find_package(fmt REQUIRED)
327327
set(DEFAULT_THIRDPARTY_LIBS ${THRIFT_LIB} fmt::fmt CACHE STRING "default thirdparty libs" FORCE)
328328

329-
# rocksdb
330-
file(GLOB ROCKSDB_DEPENDS_MODULE_PATH ${THIRDPARTY_ROOT}/build/Source/rocksdb/cmake/modules)
331-
if(NOT ROCKSDB_DEPENDS_MODULE_PATH)
332-
message(WARNING "Cannot find RocksDB depends cmake modules path, might not find snappy, zstd, lz4")
333-
endif()
334-
list(APPEND CMAKE_MODULE_PATH "${ROCKSDB_DEPENDS_MODULE_PATH}")
329+
# rocksdb and dependent libs
330+
find_package(RocksDB REQUIRED)
335331
find_package(Snappy REQUIRED)
336-
find_package(zstd)
337-
find_package(lz4)
332+
find_package(Zstd REQUIRED)
333+
find_package(Lz4 REQUIRED)
338334
if(USE_JEMALLOC)
339335
find_package(Jemalloc REQUIRED)
340336
endif()
341-
find_package(RocksDB REQUIRED)
342337

343338
# libhdfs
344339
find_package(JNI REQUIRED)

cmake_modules/FindLz4.cmake

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# - Find LZ4 (lz4.h, liblz4.a)
19+
# This module defines
20+
# LZ4_INCLUDE_DIR, directory containing headers
21+
# LZ4_STATIC_LIB, path to lz4's static library
22+
# LZ4_FOUND, whether lz4 has been found
23+
24+
find_path(LZ4_INCLUDE_DIR lz4.h
25+
# make sure we don't accidentally pick up a different version
26+
NO_CMAKE_SYSTEM_PATH
27+
NO_SYSTEM_ENVIRONMENT_PATH)
28+
find_library(LZ4_STATIC_LIB liblz4.a
29+
NO_CMAKE_SYSTEM_PATH
30+
NO_SYSTEM_ENVIRONMENT_PATH)
31+
32+
include(FindPackageHandleStandardArgs)
33+
find_package_handle_standard_args(Lz4 REQUIRED_VARS
34+
LZ4_STATIC_LIB LZ4_INCLUDE_DIR)

cmake_modules/FindSnappy.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
# - Find SNAPPY (snappy.h, libsnappy.a, libsnappy.so, and libsnappy.so.1)
18+
# - Find SNAPPY (snappy.h, libsnappy.a)
1919
# This module defines
2020
# SNAPPY_INCLUDE_DIR, directory containing headers
21-
# SNAPPY_SHARED_LIB, path to snappy's shared library
2221
# SNAPPY_STATIC_LIB, path to snappy's static library
2322
# SNAPPY_FOUND, whether snappy has been found
2423

cmake_modules/FindZstd.cmake

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# - Find ZSTD (zstd.h, libzstd.a)
19+
# This module defines
20+
# ZSTD_INCLUDE_DIR, directory containing headers
21+
# ZSTD_STATIC_LIB, path to zstd's static library
22+
# ZSTD_FOUND, whether zstd has been found
23+
24+
find_path(ZSTD_INCLUDE_DIR zstd.h
25+
# make sure we don't accidentally pick up a different version
26+
NO_CMAKE_SYSTEM_PATH
27+
NO_SYSTEM_ENVIRONMENT_PATH)
28+
find_library(ZSTD_STATIC_LIB libzstd.a
29+
NO_CMAKE_SYSTEM_PATH
30+
NO_SYSTEM_ENVIRONMENT_PATH)
31+
32+
include(FindPackageHandleStandardArgs)
33+
find_package_handle_standard_args(Zstd REQUIRED_VARS
34+
ZSTD_STATIC_LIB ZSTD_INCLUDE_DIR)

thirdparty/CMakeLists.txt

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,14 +395,34 @@ ExternalProject_Add(zstd
395395
https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-1.5.5.tar.gz
396396
URL_MD5 63251602329a106220e0a5ad26ba656f
397397
PATCH_COMMAND ""
398-
CMAKE_COMMAND cmake build/cmake
399-
CMAKE_ARGS
398+
CONFIGURE_COMMAND cmake build/cmake
400399
-DCMAKE_INSTALL_PREFIX=${TP_OUTPUT}
400+
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
401401
-DCMAKE_BUILD_TYPE=Release
402402
-DZSTD_BUILD_PROGRAMS=OFF
403403
-DZSTD_BUILD_TESTS=OFF
404404
-DZSTD_BUILD_CONTRIB=OFF
405405
-DZSTD_BUILD_SHARED=OFF
406+
-DZSTD_BUILD_STATIC=ON
407+
BUILD_COMMAND make -j${PARALLEL}
408+
INSTALL_COMMAND make install
409+
BUILD_IN_SOURCE 1
410+
DOWNLOAD_EXTRACT_TIMESTAMP true
411+
DOWNLOAD_NO_PROGRESS true
412+
)
413+
414+
ExternalProject_Add(lz4
415+
URL ${OSS_URL_PREFIX}/lz4-1.9.4.tar.gz
416+
https://github.com/lz4/lz4/releases/download/v1.9.4/lz4-1.9.4.tar.gz
417+
URL_MD5 e9286adb64040071c5e23498bf753261
418+
PATCH_COMMAND ""
419+
CONFIGURE_COMMAND cmake build/cmake
420+
-DCMAKE_INSTALL_PREFIX=${TP_OUTPUT}
421+
-DLZ4_POSITION_INDEPENDENT_LIB=ON
422+
-DCMAKE_BUILD_TYPE=Release
423+
-DLZ4_BUILD_CLI=OFF
424+
-DBUILD_SHARED_LIBS=OFF
425+
-DBUILD_STATIC_LIBS=ON
406426
BUILD_COMMAND make -j${PARALLEL}
407427
INSTALL_COMMAND make install
408428
BUILD_IN_SOURCE 1

0 commit comments

Comments
 (0)