Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support compile on Rocky Linux #417

Merged
merged 10 commits into from
Aug 19, 2024
29 changes: 20 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

CMAKE_MINIMUM_REQUIRED(VERSION 3.14)
PROJECT(PikiwiDB)
include(GNUInstallDirs)
AlexStocks marked this conversation as resolved.
Show resolved Hide resolved

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type")

Expand Down Expand Up @@ -79,7 +80,7 @@ ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(CMAKE_CXX_FLAGS "-stdlib=libc++ -pthread ${CMAKE_CXX_FLAGS}")
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
ELSEIF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -lstdc++")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wl,--no-as-needed -ldl -Wno-restrict")
ENDIF ()
ADD_DEFINITIONS(-DOS_LINUX)
Expand All @@ -105,17 +106,28 @@ SET_PROPERTY(DIRECTORY PROPERTY EP_BASE ${CMAKE_CURRENT_SOURCE_DIR}/${EP_BASE_SU
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules/")
SET(BUILD_SUPPORT_DIR ${PROJECT_SOURCE_DIR}/build_support)

SET(PLIB_INSTALL_DIR ${CMAKE_BINARY_DIR}/lib)
SET(CMAKE_INSTALL_LIBDIR lib)
SET(PLIB_INSTALL_DIR ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
SET(LIB_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/${LIB_SUFFIX})
SET(LIB_INCLUDE_DIR ${LIB_INSTALL_PREFIX}/include)
SET(LIB_INSTALL_DIR ${LIB_INSTALL_PREFIX}/lib)
SET(LIB_INSTALL_DIR ${LIB_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
SET(LIB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${EP_BASE_SUFFIX}/Source)

SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${LIB_INSTALL_DIR})
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${LIB_INSTALL_DIR})
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIB_INSTALL_DIR})
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_INSTALL_DIR})
SET(CMAKE_INSTALL_PREFIX ${LIB_INSTALL_DIR})
SET(LIBDIR ${CMAKE_INSTALL_LIBDIR})
SET(FIND_LIBRARY_USE_LIB32_PATHS true)
Copy link
Collaborator

@panlei-coder panlei-coder Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“LIBDIR” 的作用是?
需要包含 32 位库的搜索路径么?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上面提到了,这个参数就是引发编译不成功的原因(cmake 在一部分操作系统上会设置为 lib,一部分是 lib64,结果因为这种不统一,使得不同操作系统的编译行为不一样,进而不能移植,我就直接手动统一参数了)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那这个需要包含 32 位库的搜索路径么

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那这个需要包含 32 位库的搜索路径么

需要,32位库的是 lib 路径

SET(FIND_LIBRARY_USE_LIB64_PATHS true)
SET(INSTALL_LOCATION ${LIB_INSTALL_DIR})
AlexStocks marked this conversation as resolved.
Show resolved Hide resolved

# make sure we use the same compiler for all dependencies
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)

MESSAGE(STATUS "${PROJECT_NAME} staged install: ${STAGED_INSTALL_PREFIX}")
MESSAGE(STATUS "Current platform: ${OS_VERSION} ")
MESSAGE(STATUS "Current platform: ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ")
CMAKE_HOST_SYSTEM_INFORMATION(RESULT CPU_CORE QUERY NUMBER_OF_LOGICAL_CORES)
MESSAGE(STATUS "CPU core ${CPU_CORE}")

Expand Down Expand Up @@ -152,22 +164,21 @@ ENDIF()
SET(LIB ${LIB} CACHE INTERNAL "libs which should be linked for executable target")

INCLUDE(ExternalProject)

INCLUDE(cmake/findTools.cmake)
INCLUDE(cmake/openssl.cmake)
INCLUDE(cmake/gflags.cmake)
INCLUDE(cmake/lz4.cmake)
INCLUDE(cmake/zlib.cmake)
INCLUDE(cmake/protobuf.cmake)
INCLUDE(cmake/zstd.cmake)
INCLUDE(cmake/gflags.cmake)
INCLUDE(cmake/snappy.cmake)
INCLUDE(cmake/zlib.cmake)
INCLUDE(cmake/leveldb.cmake)
INCLUDE(cmake/llhttp.cmake)
INCLUDE(cmake/fmt.cmake)
INCLUDE(cmake/spdlog.cmake)
INCLUDE(cmake/gtest.cmake)
INCLUDE(cmake/rocksdb.cmake)
INCLUDE(cmake/protobuf.cmake)
INCLUDE(cmake/brpc.cmake)
INCLUDE(cmake/rocksdb.cmake)
INCLUDE(cmake/braft.cmake)

SET(PROTO_OUTPUT_DIR "${CMAKE_BINARY_DIR}/generated_pb")
Expand Down
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,20 @@ A C++20 implementation of Redis Server, use RocksDB for persist storage.(not inc

## Requirements

* C++20
* Linux or OS X or FreeBSD

## compile
## Compile

**It is recommended to use the latest version of Ubuntu or Debian for Linux systems**

Execute compilation

If the machine's GCC version is less than 11, especially on CentOS6 or CentOS7, you need to upgrade the gcc version firstly.

Execute the following commands on CentOS:
Execute the following commands on Rocky Linux:

```bash
sudo yum -y install centos-release-scl
sudo yum -y install devtoolset-11-gcc devtoolset-11-gcc-c++
scl enable devtoolset-11 bash
sudo dnf groupinstall -y 'Development Tools'
sudo dnf install cmake g++ autoconf perl -y
git config --global http.version HTTP/1.1
```

Execute this command to start compiling Pikiwidb:
Expand All @@ -38,7 +35,7 @@ Pikiwidb is compiled by default in release mode, which does not support debuggin
./etc/script/build.sh --debug
```

## run
## Run

```bash
bin/pikiwidb etc/conf/pikiwidb.conf
Expand Down
11 changes: 4 additions & 7 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ C++20 实现的增强版 Redis 服务器,使用 RocksDB 作为持久化存储引

## 环境需求

* C++20、CMake
* Linux 或 MAC OS 或 FreeBSD

## 编译
Expand All @@ -15,14 +14,12 @@ C++20 实现的增强版 Redis 服务器,使用 RocksDB 作为持久化存储引

执行编译:

如果机器的 GCC 版本低于 11,特别是在 CentOS 6.x 或 CentOS 7.x 上,你需要先升级 GCC 版本。

在 CentOS 上执行以下命令:
在 Rocky Linux 下执行如下的指令:

```bash
sudo yum -y install centos-release-scl
sudo yum -y install devtoolset-11-gcc devtoolset-11-gcc-c++
scl enable devtoolset-11 bash
sudo dnf groupinstall -y 'Development Tools'
sudo dnf install cmake g++ autoconf perl -y
git config --global http.version HTTP/1.1
```

执行以下命令开始编译 PikiwiDB:
Expand Down
2 changes: 2 additions & 0 deletions cmake/braft.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ ExternalProject_Add(
# The pr on braft is not merged, so I am using my own warehouse to run the test for the time being
GIT_REPOSITORY "https://github.com/pikiwidb/braft.git"
GIT_TAG v1.1.2-alpha2
URL_HASH SHA256=6afed189e97b7e6bf5864c5162fab3365b07d515fe0de4c1b0d61eff96cf772f
GIT_SHALLOW true
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=${LIB_BUILD_TYPE}
-DCMAKE_CXX_FLAGS=${BRAFT_CXX_FLAGS}
-DCMAKE_INSTALL_PREFIX=${LIB_INSTALL_PREFIX}
-DCMAKE_LIBRARY_PATH=${LIB_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DBRPC_LIB=${BRPC_LIBRARIES}
-DBRPC_INCLUDE_PATH=${BRPC_INCLUDE_DIR}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
Expand Down
1 change: 1 addition & 0 deletions cmake/brpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ExternalProject_Add(
-DCMAKE_BUILD_TYPE=${LIB_BUILD_TYPE}
-DCMAKE_CPP_FLAGS=${CMAKE_CPP_FLAGS}
-DCMAKE_INSTALL_PREFIX=${BRPC_INSTALL_DIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_FIND_LIBRARY_SUFFIXES=${LIB_INSTALL_PREFIX}
-DCMAKE_LIBRARY_PATH=${LIB_INSTALL_PREFIX}
-DGFLAGS_INCLUDE_PATH=${GFLAGS_INCLUDE_DIR}
Expand Down
1 change: 1 addition & 0 deletions cmake/fmt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ExternalProject_Add(
URL_HASH SHA256=3c2e73019178ad72b0614a3124f25de454b9ca3a1afe81d5447b8d3cbdb6d322
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${LIB_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_BUILD_TYPE=${LIB_BUILD_TYPE}
-DFMT_DOC=FALSE
-DFMT_TEST=FALSE
Expand Down
10 changes: 5 additions & 5 deletions cmake/gflags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ ELSE ()
ENDIF ()

SET(GFLAGS_ROOT ${LIB_INSTALL_PREFIX} CACHE PATH "gflags source directory." FORCE)
SET(GFLAGS_INCLUDE_DIR "${LIB_INCLUDE_DIR}" CACHE PATH "gflags include directory." FORCE)
SET(GFLAGS_LIBRARIES "${LIB_INSTALL_DIR}/${LIB_GFLAGS}" CACHE FILEPATH "gflags library." FORCE)
SET(GFLAGS_LIBRARY "${LIB_INSTALL_DIR}/${LIB_GFLAGS}" CACHE FILEPATH "gflags library." FORCE)
SET(GFLAGS_INCLUDE_DIR ${LIB_INCLUDE_DIR} CACHE PATH "gflags include directory." FORCE)
SET(GFLAGS_LIBRARIES ${LIB_INSTALL_DIR}/${LIB_GFLAGS} CACHE FILEPATH "gflags library." FORCE)
SET(GFLAGS_LIBRARY ${LIB_INSTALL_DIR}/${LIB_GFLAGS} CACHE FILEPATH "gflags library." FORCE)

SET(GFLAGS_INCLUDE_PATH "${LIB_INCLUDE_DIR}/gflags" CACHE PATH "gflags include directory." FORCE)

Expand All @@ -22,9 +22,9 @@ ExternalProject_Add(
URL_HASH SHA256=19713a36c9f32b33df59d1c79b4958434cb005b5b47dc5400a7a4b078111d9b5
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=${LIB_BUILD_TYPE}
-DGFLAGS_BUILD_STATIC_LIBS=ON
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DBUILD_SHARED_LIBS=OFF
-DGFLAGS_BUILD_STATIC_LIBS=ON
-DGFLAGS_BUILD_SHARED_LIBS=OFF
-DGFLAGS_BUILD_gflags_LIB=ON
-DGFLAGS_BUILD_gflags_nothreads_LIB=ON
Expand All @@ -36,4 +36,4 @@ ExternalProject_Add(

ADD_LIBRARY(gflags STATIC IMPORTED GLOBAL)
SET_PROPERTY(TARGET gflags PROPERTY IMPORTED_LOCATION ${GFLAGS_LIBRARIES})
ADD_DEPENDENCIES(gflags extern_gflags)
ADD_DEPENDENCIES(gflags extern_gflags)
1 change: 1 addition & 0 deletions cmake/gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ExternalProject_Add(
GIT_TAG v1.14.0
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${LIB_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
)

Expand Down
5 changes: 3 additions & 2 deletions cmake/leveldb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

SET(LEVELDB_INCLUDE_DIR "${LIB_INCLUDE_DIR}/leveldb" CACHE PATH "leveldb include directory." FORCE)
SET(LEVELDB_LIBRARIES "${LIB_INSTALL_DIR}/libleveldb.a" CACHE FILEPATH "leveldb include directory." FORCE)
SET(LEVELDB_INSTALL_LIBDIR "${LIB_INSTALL_PREFIX}/lib")
SET(LEVELDB_INSTALL_LIBDIR "${LIB_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")

ExternalProject_Add(
extern_leveldb
Expand All @@ -14,9 +14,10 @@ ExternalProject_Add(
GIT_REPOSITORY "https://github.com/google/leveldb.git"
GIT_TAG "1.23"
CMAKE_ARGS
-DCMAKE_INSTALL_LIBDIR=${LEVELDB_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${LEVELDB_INCLUDE_DIR}
-DCMAKE_FIND_LIBRARY_SUFFIXES=${LIB_INSTALL_PREFIX}
-DCMAKE_INSTALL_PREFIX=${LIB_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DSnappy_INCLUDE_DIR=${Snappy_INCLUDE_DIRS}
-DSnappy_LIBRARIES=${Snappy_LIBRARIES}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
Expand Down
4 changes: 3 additions & 1 deletion cmake/llhttp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ ExternalProject_Add(
extern_llhttp
${EXTERNAL_PROJECT_LOG_ARGS}
URL https://github.com/nodejs/llhttp/archive/refs/tags/release/v6.0.5.tar.gz
URL_HASH MD5=7ec6829c56642cce27e3d8e06504ddca
URL_HASH SHA256=28d5bc494d379228cd7a9af32dfc518fc9e6c5ad56838cafb63e8062bee06bda
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${LIB_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_BUILD_TYPE=${LIB_BUILD_TYPE}
BUILD_COMMAND make -j${CPU_CORE}
)

ADD_DEPENDENCIES(extern_llhttp snappy gflags zlib)
Expand Down
5 changes: 3 additions & 2 deletions cmake/lz4.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ SET(LZ4_LIBRARIES "${LIB_INSTALL_DIR}/liblz4.a" CACHE FILEPATH "lz4 include dire
ExternalProject_Add(
extern_lz4
URL https://github.com/lz4/lz4/archive/refs/tags/v1.9.4.tar.gz
URL_HASH MD5=e9286adb64040071c5e23498bf753261
URL_HASH SHA256=0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b
${EXTERNAL_PROJECT_LOG_ARGS}
SOURCE_SUBDIR build/cmake
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${LIB_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_BUILD_TYPE=${LIB_BUILD_TYPE}
-DBUILD_TESTING=OFF
-DBUILD_STATIC_LIBS=ON
Expand All @@ -23,4 +24,4 @@ ExternalProject_Add(

ADD_LIBRARY(lz4 STATIC IMPORTED GLOBAL)
SET_PROPERTY(TARGET lz4 PROPERTY IMPORTED_LOCATION ${LZ4_LIBRARIES})
ADD_DEPENDENCIES(lz4 extern_lz4)
ADD_DEPENDENCIES(lz4 extern_lz4)
5 changes: 3 additions & 2 deletions cmake/openssl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ FILE(MAKE_DIRECTORY ${OPENSSL_INCLUDE_DIR})

ExternalProject_Add(
OpenSSL
# SOURCE_DIR ${OPENSSL_SOURCE_DIR}
URL https://github.com/openssl/openssl/archive/refs/tags/openssl-3.2.1.tar.gz
URL_HASH SHA256=75cc6803ffac92625c06ea3c677fb32ef20d15a1b41ecc8dddbc6b9d6a2da84c
USES_TERMINAL_DOWNLOAD TRUE
CONFIGURE_COMMAND
<SOURCE_DIR>/config
--prefix=${OPENSSL_INSTALL_DIR}
--openssldir=${OPENSSL_INSTALL_DIR}
--libdir=${OPENSSL_INSTALL_DIR}/lib
--libdir=${OPENSSL_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_PREFIX=${LIB_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
no-docs
BUILD_COMMAND make -j${CPU_CORE}
TEST_COMMAND ""
Expand Down
1 change: 1 addition & 0 deletions cmake/protobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ExternalProject_Add(
URL_HASH SHA256=14e8042b5da37652c92ef6a2759e7d2979d295f60afd7767825e3de68c856c54
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${LIB_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_BUILD_TYPE=${LIB_BUILD_TYPE}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DBUILD_SHARED_LIBS=OFF
Expand Down
5 changes: 3 additions & 2 deletions cmake/rocksdb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ ExternalProject_Add(
${EXTERNAL_PROJECT_LOG_ARGS}
GIT_REPOSITORY https://github.com/facebook/rocksdb.git
GIT_TAG v9.4.0
URL https://github.com/facebook/rocksdb/archive/refs/tags/v9.4.0.tar.gz
URL_HASH MD5=ce19cb3e2b6db927ef88cbf25c42097e
URL https://github.com/facebook/rocksdb/archive/refs/tags/v9.4.0.tar.gz
URL_HASH SHA256=1f829976aa24b8ba432e156f52c9e0f0bd89c46dc0cc5a9a628ea70571c1551c
DOWNLOAD_NO_PROGRESS 1
DEPENDS
gflags
Expand All @@ -23,6 +23,7 @@ ExternalProject_Add(
zstd
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${LIB_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_BUILD_TYPE=${LIB_BUILD_TYPE}
-DWITH_BENCHMARK=OFF
-DWITH_BENCHMARK_TOOLS=OFF
Expand Down
1 change: 1 addition & 0 deletions cmake/snappy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ExternalProject_Add(
GIT_TAG "1.2.1"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${LIB_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_BUILD_TYPE=${LIB_BUILD_TYPE}
-DSNAPPY_BUILD_TESTS=OFF
-DSNAPPY_BUILD_BENCHMARKS=OFF
Expand Down
3 changes: 2 additions & 1 deletion cmake/spdlog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ ExternalProject_Add(
extern_spdlog
${EXTERNAL_PROJECT_LOG_ARGS}
URL https://github.com/gabime/spdlog/archive/v1.12.0.zip
URL_HASH SHA256=6174BF8885287422A6C6A0312EB8A30E8D22BCFCEE7C48A6D02D1835D7769232
URL_HASH SHA256=6174bf8885287422a6c6a0312eb8a30e8d22bcfcee7c48a6d02d1835d7769232
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${LIB_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DSPDLOG_BUILD_EXAMPLE=OFF
-DSPDLOG_FMT_EXTERNAL=ON
Expand Down
2 changes: 2 additions & 0 deletions cmake/zlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ ExternalProject_Add(
GIT_TAG "v1.2.8"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${LIB_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
BUILD_COMMAND make -j${CPU_CORE}
)

ADD_LIBRARY(zlib STATIC IMPORTED GLOBAL)
Expand Down
5 changes: 3 additions & 2 deletions cmake/zstd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ SET(zstd_LIBRARIES "${LIB_INSTALL_DIR}/libzstd.a" CACHE FILEPATH "zstd include d

ExternalProject_Add(
extern_zstd
URL https://github.com/facebook/zstd/releases/download/v1.5.4/zstd-1.5.4.tar.gz
URL_HASH MD5=2352b1f9ccc7446641046bb3d440c3ed
${EXTERNAL_PROJECT_LOG_ARGS}
URL https://github.com/facebook/zstd/releases/download/v1.5.4/zstd-1.5.4.tar.gz
URL_HASH SHA256=0f470992aedad543126d06efab344dc5f3e171893810455787d38347343a4424
SOURCE_SUBDIR build/cmake
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${LIB_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_BUILD_TYPE=${LIB_BUILD_TYPE}
-DBUILD_TESTING=OFF
-DZSTD_BUILD_STATIC=ON
Expand Down
Loading