Skip to content

Commit

Permalink
Build snappy in the project
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Dec 5, 2023
1 parent 41ff58d commit c0dc4af
Show file tree
Hide file tree
Showing 35 changed files with 368 additions and 174 deletions.
2 changes: 1 addition & 1 deletion cmake_modules/BaseFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ function(dsn_setup_thirdparty_libs)
message(WARNING "Cannot find RocksDB depends cmake modules path, might not find snappy, zstd, lz4")
endif()
list(APPEND CMAKE_MODULE_PATH "${ROCKSDB_DEPENDS_MODULE_PATH}")
find_package(snappy)
find_package(Snappy REQUIRED)
find_package(zstd)
find_package(lz4)
if(USE_JEMALLOC)
Expand Down
35 changes: 35 additions & 0 deletions cmake_modules/FindSnappy.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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.

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

find_path(SNAPPY_INCLUDE_DIR snappy.h
# make sure we don't accidentally pick up a different version
NO_CMAKE_SYSTEM_PATH
NO_SYSTEM_ENVIRONMENT_PATH)
find_library(SNAPPY_STATIC_LIB libsnappy.a
NO_CMAKE_SYSTEM_PATH
NO_SYSTEM_ENVIRONMENT_PATH)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Snappy REQUIRED_VARS
SNAPPY_STATIC_LIB SNAPPY_INCLUDE_DIR)
7 changes: 6 additions & 1 deletion src/aio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ set(MY_PROJ_SRC "")
#"GLOB" for non - recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS dsn_runtime rocksdb)
set(MY_PROJ_LIBS
dsn_runtime
lz4
zstd
rocksdb
snappy)

#Extra files that will be installed
set(MY_BINPLACES "")
Expand Down
10 changes: 9 additions & 1 deletion src/aio/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ set(MY_PROJ_SRC "")
# "GLOB" for non-recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS gtest dsn_runtime dsn_aio test_utils rocksdb)
set(MY_PROJ_LIBS
gtest
dsn_runtime
dsn_aio
test_utils
lz4
zstd
rocksdb
snappy)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

Expand Down
7 changes: 6 additions & 1 deletion src/block_service/hdfs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ set(MY_PROJ_SRC "")
#"GLOB" for non - recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS hdfs rocksdb)
set(MY_PROJ_LIBS
hdfs
lz4
zstd
rocksdb
snappy)

#Extra files that will be installed
set(MY_BINPLACES "")
Expand Down
6 changes: 5 additions & 1 deletion src/block_service/local/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ set(MY_PROJ_SRC "")
#"GLOB" for non - recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS rocksdb)
set(MY_PROJ_LIBS
lz4
zstd
rocksdb
snappy)

#Extra files that will be installed
set(MY_BINPLACES "")
Expand Down
25 changes: 14 additions & 11 deletions src/block_service/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@ set(MY_PROJ_NAME dsn_block_service_test)
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS
dsn_replication_common
dsn.block_service
dsn.block_service.local
dsn.block_service.hdfs
dsn_runtime
dsn_utils
gtest
gtest_main
hdfs
test_utils
rocksdb)
dsn_replication_common
dsn.block_service
dsn.block_service.local
dsn.block_service.hdfs
dsn_runtime
dsn_utils
gtest
gtest_main
hdfs
test_utils
lz4
zstd
rocksdb
snappy)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

Expand Down
15 changes: 9 additions & 6 deletions src/client/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ set(MY_PROJ_SRC "")
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS
dsn_client
dsn_replication_common
dsn_runtime
dsn_utils
gtest
rocksdb)
dsn_client
dsn_replication_common
dsn_runtime
dsn_utils
gtest
lz4
zstd
rocksdb
snappy)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

Expand Down
5 changes: 4 additions & 1 deletion src/common/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ set(MY_PROJ_LIBS
dsn_replication_common
dsn_runtime
gtest
rocksdb)
lz4
zstd
rocksdb
snappy)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

Expand Down
19 changes: 11 additions & 8 deletions src/failure_detector/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@ set(MY_PROJ_SRC "")
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS
dsn_runtime
dsn_meta_server
dsn_replica_server
dsn_replication_common
dsn.failure_detector
gtest
hashtable
rocksdb)
dsn_runtime
dsn_meta_server
dsn_replica_server
dsn_replication_common
dsn.failure_detector
gtest
hashtable
lz4
zstd
rocksdb
snappy)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

Expand Down
8 changes: 5 additions & 3 deletions src/geo/bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ set(MY_PROJ_LIBS
s2testing
s2
pegasus_client_static
RocksDB::rocksdb
dsn_utils
)
lz4
zstd
rocksdb
snappy
dsn_utils)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

Expand Down
14 changes: 8 additions & 6 deletions src/http/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ set(MY_PROJ_SRC "")
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS
dsn_http
dsn_runtime
curl
gtest
rocksdb
)
dsn_http
dsn_runtime
curl
gtest
lz4
zstd
rocksdb
snappy)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

Expand Down
31 changes: 17 additions & 14 deletions src/meta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,23 @@ set(DUPLICATION_SRC
set(MY_PROJ_SRC "${DUPLICATION_SRC}")

set(MY_PROJ_LIBS
dsn_replication_common
dsn.block_service
dsn.block_service.local
dsn.block_service.hdfs
dsn.failure_detector
dsn.replication.zookeeper_provider
dsn_dist_cmd
dsn_http
dsn_runtime
dsn_aio
zookeeper
hashtable
hdfs
rocksdb)
dsn_replication_common
dsn.block_service
dsn.block_service.local
dsn.block_service.hdfs
dsn.failure_detector
dsn.replication.zookeeper_provider
dsn_dist_cmd
dsn_http
dsn_runtime
dsn_aio
zookeeper
hashtable
hdfs
lz4
zstd
rocksdb
snappy)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

Expand Down
11 changes: 10 additions & 1 deletion src/nfs/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,16 @@ set(MY_PROJ_SRC "")
# "GLOB" for non-recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS dsn_nfs dsn_runtime gtest dsn_aio rocksdb test_utils)
set(MY_PROJ_LIBS
dsn_nfs
dsn_runtime
gtest
dsn_aio
lz4
zstd
rocksdb
snappy
test_utils)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

Expand Down
8 changes: 7 additions & 1 deletion src/perf_counter/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ set(MY_PROJ_SRC "")
# "GLOB" for non-recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS gtest dsn_runtime rocksdb)
set(MY_PROJ_LIBS
gtest
dsn_runtime
lz4
zstd
rocksdb
snappy)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

Expand Down
29 changes: 16 additions & 13 deletions src/replica/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,22 @@ set(MY_PROJ_SRC
# "GLOB" for non-recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS
dsn_replication_common
dsn.failure_detector
dsn.block_service
dsn.block_service.local
dsn.block_service.hdfs
dsn_nfs
dsn_dist_cmd
dsn_http
dsn_runtime
dsn_aio
dsn_meta_server
rocksdb)
set(MY_PROJ_LIBS
dsn_replication_common
dsn.failure_detector
dsn.block_service
dsn.block_service.local
dsn.block_service.hdfs
dsn_nfs
dsn_dist_cmd
dsn_http
dsn_runtime
dsn_aio
dsn_meta_server
lz4
zstd
rocksdb
snappy)

set(MY_BOOST_LIBS Boost::filesystem)

Expand Down
5 changes: 4 additions & 1 deletion src/replica/backup/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ set(MY_PROJ_LIBS dsn_meta_server
dsn_utils
hashtable
gtest
rocksdb)
lz4
zstd
rocksdb
snappy)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

Expand Down
7 changes: 5 additions & 2 deletions src/replica/bulk_load/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ set(MY_PROJ_LIBS dsn_meta_server
hashtable
gtest
test_utils
rocksdb)
lz4
zstd
rocksdb
snappy)

set(MY_BOOST_LIBS Boost::system Boost::filesystem rocksdb test_utils)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES
config-test.ini
Expand Down
5 changes: 4 additions & 1 deletion src/replica/duplication/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ set(MY_PROJ_LIBS dsn_meta_server
hashtable
gtest
test_utils
rocksdb)
lz4
zstd
rocksdb
snappy)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

Expand Down
11 changes: 10 additions & 1 deletion src/replica/storage/simple_kv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,16 @@ set(MY_PROJ_SRC ${SIMPLE_KV_THRIFT_SRCS})
# "GLOB" for non-recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS dsn_replica_server dsn_meta_server dsn_client dsn_runtime hashtable rocksdb)
set(MY_PROJ_LIBS
dsn_replica_server
dsn_meta_server
dsn_client
dsn_runtime
hashtable
lz4
zstd
rocksdb
snappy)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

Expand Down
Loading

0 comments on commit c0dc4af

Please sign in to comment.