Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for static linking RocksDb. (#40)
* Added rocksdb as a submodule in vendor directory. * Add support for static linking using nimble. * Add script to build static library dependencies. * Disable warnings as error in deps build. * Set recommended compression options in build and in library. * Move static linking into wrapper code. * Conditionally set linker using when defined(macosx). * Add support for linking windows static libraries. * Build rocksdb static libs using vcpkg. * Remove lib prefix from library names for windows. * Static linking is not supported on windows. Update documentation and CI.
- Loading branch information
1 parent
fc2ba4a
commit 90027f1
Showing
13 changed files
with
124 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[submodule "vendor/rocksdb"] | ||
path = vendor/rocksdb | ||
url = https://github.com/facebook/rocksdb | ||
ignore = dirty | ||
branch = master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
-p:"src" | ||
|
||
--threads:on | ||
--outdir:build | ||
--hints:off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Nim-RocksDB | ||
# Copyright 2018-2024 Status Research & Development GmbH | ||
# Licensed under either of | ||
# | ||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) | ||
# * GPL license, version 2.0, ([LICENSE-GPLv2](LICENSE-GPLv2) or https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) | ||
# | ||
# at your option. This file may not be copied, modified, or distributed except according to those terms. | ||
|
||
set -e | ||
|
||
cd "$(dirname "${BASH_SOURCE[0]}")"/.. | ||
|
||
REPO_DIR="${PWD}" | ||
ROCKSDB_LIB_DIR="${REPO_DIR}/vendor/rocksdb" | ||
BUILD_DEST="${REPO_DIR}/build/lib" | ||
|
||
|
||
|
||
[[ -z "$NPROC" ]] && NPROC=2 # number of CPU cores available | ||
|
||
git submodule update --init | ||
|
||
export DISABLE_WARNING_AS_ERROR=1 | ||
|
||
export ROCKSDB_DISABLE_SNAPPY=1 | ||
export ROCKSDB_DISABLE_ZLIB=1 | ||
export ROCKSDB_DISABLE_BZIP=1 | ||
|
||
export PORTABLE=1 | ||
export DEBUG_LEVEL=0 | ||
|
||
make -C "${ROCKSDB_LIB_DIR}" -j${NPROC} liblz4.a libzstd.a --no-print-directory > /dev/null | ||
|
||
export EXTRA_CFLAGS="-fpermissive -Wno-error -w -I${ROCKSDB_LIB_DIR}/lz4-1.9.4/lib -I${ROCKSDB_LIB_DIR}/zstd-1.5.5/lib -DLZ4 -DZSTD" | ||
export EXTRA_CXXFLAGS="-fpermissive -Wno-error -w -I${ROCKSDB_LIB_DIR}/lz4-1.9.4/lib -I${ROCKSDB_LIB_DIR}/zstd-1.5.5/lib -DLZ4 -DZSTD" | ||
|
||
make -C "${ROCKSDB_LIB_DIR}" -j${NPROC} static_lib --no-print-directory > /dev/null | ||
|
||
#cat "${REPO_DIR}/vendor/rocksdb/make_config.mk" | ||
|
||
mkdir -p "${BUILD_DEST}" | ||
|
||
cp "${ROCKSDB_LIB_DIR}/liblz4.a" "${BUILD_DEST}/" | ||
cp "${ROCKSDB_LIB_DIR}/libzstd.a" "${BUILD_DEST}/" | ||
cp "${ROCKSDB_LIB_DIR}/librocksdb.a" "${BUILD_DEST}/" |