Skip to content

Commit

Permalink
#1588 use leveldb from deps
Browse files Browse the repository at this point in the history
  • Loading branch information
olehnikolaiev committed Jan 8, 2024
1 parent e415c9d commit d251c45
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 13 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ set( SKALE_HAVE_BOOST_FROM_HUNTER true )

option( BUILD_LEVELDB "Build leveldb from leveldb directory" OFF )

if( BUILD_LEVELDB )
add_subdirectory( leveldb )
else()
hunter_add_package( leveldb )
find_package( leveldb CONFIG REQUIRED )
endif()
# if( BUILD_LEVELDB )
# add_subdirectory( leveldb )
# else()
# hunter_add_package( leveldb )
# find_package( leveldb CONFIG REQUIRED )
# endif()

#hunter_add_package( jsoncpp )
#find_package( jsoncpp PATHS "${DEPS_INSTALL_ROOT}/libs/cmake" ) #( jsoncpp CONFIG REQUIRED )
Expand Down
45 changes: 45 additions & 0 deletions deps/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ setup_variable WITH_WANGLE "yes"
setup_variable WITH_GTEST "yes"
setup_variable WITH_FIZZ "yes"
setup_variable WITH_PROXYGEN "yes"
setup_variable WITH_LEVELDB "yes"

if [ -z "${PARALLEL_COUNT}" ];
then
Expand Down Expand Up @@ -610,6 +611,7 @@ echo -e "${COLOR_VAR_NAME}WITH_WANGLE${COLOR_DOTS}............${COLOR_VAR_DESC}L
echo -e "${COLOR_VAR_NAME}WITH_GTEST${COLOR_DOTS}.............${COLOR_VAR_DESC}LibGTEST${COLOR_DOTS}...............................${COLOR_VAR_VAL}$WITH_GTEST${COLOR_RESET}"
echo -e "${COLOR_VAR_NAME}WITH_FIZZ${COLOR_DOTS}..............${COLOR_VAR_DESC}LibFIZZ${COLOR_DOTS}................................${COLOR_VAR_VAL}$WITH_FIZZ${COLOR_RESET}"
echo -e "${COLOR_VAR_NAME}WITH_PROXYGEN${COLOR_DOTS}..........${COLOR_VAR_DESC}LibProxygen${COLOR_DOTS}............................${COLOR_VAR_VAL}$WITH_PROXYGEN${COLOR_RESET}"
echo -e "${COLOR_VAR_NAME}WITH_LEVELDB${COLOR_DOTS}..........${COLOR_VAR_DESC}LibLevelDB${COLOR_DOTS}............................${COLOR_VAR_VAL}$WITH_LEVELDB${COLOR_RESET}"

#
#
Expand Down Expand Up @@ -2327,6 +2329,49 @@ then
fi
fi

if [ "$WITH_LEVELDB" = "yes" ];
then
echo -e "${COLOR_SEPARATOR}==================== ${COLOR_PROJECT_NAME}libLevelDB${COLOR_SEPARATOR} ==================================${COLOR_RESET}"
if [ ! -f "$INSTALL_ROOT/lib/libleveldb.a" ];
then
env_restore
cd "$SOURCES_ROOT"
if [ ! -d "leveldb" ];
then
if [ ! -f "leveldb-from-git.tar.gz" ];
then
echo -e "${COLOR_INFO}getting it from git${COLOR_DOTS}...${COLOR_RESET}"
eval git clone https://github.com/google/leveldb.git --recursive
cd leveldb
eval git checkout 1.22
cd ..
echo -e "${COLOR_INFO}archiving it${COLOR_DOTS}...${COLOR_RESET}"
eval tar -czf leveldb-from-git.tar.gz ./leveldb
else
echo -e "${COLOR_INFO}unpacking it${COLOR_DOTS}...${COLOR_RESET}"
eval tar -xzf leveldb-from-git.tar.gz
fi
echo -e "${COLOR_INFO}configuring it${COLOR_DOTS}...${COLOR_RESET}"
cd leveldb
sed -i 's/int g_mmap_limit = kDefaultMmapLimit;\+/int g_mmap_limit = 0;/g' ./util/env_posix.cc
eval mkdir -p build
cd build
eval "$CMAKE" .. "${CMAKE_CROSSCOMPILING_OPTS}" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$TOP_CMAKE_BUILD_TYPE" \
-DLEVELDB_BUILD_TESTS=OFF -DLEVELDB_BUILD_BENCHMARKS=OFF
cd ..
else
cd leveldb
fi
echo -e "${COLOR_INFO}building it${COLOR_DOTS}...${COLOR_RESET}"
cd build
eval "$MAKE" "${PARALLEL_MAKE_OPTIONS}"
eval "$MAKE" "${PARALLEL_MAKE_OPTIONS}" install
cd "$SOURCES_ROOT"
else
echo -e "${COLOR_SUCCESS}SKIPPED${COLOR_RESET}"
fi
fi

echo -e "${COLOR_SEPARATOR}===================================================================${COLOR_RESET}"
echo -e "${COLOR_YELLOW}SKALED dependencies build actions...${COLOR_RESET}"
echo -e "${COLOR_SEPARATOR}==================== ${COLOR_PROJECT_NAME}FINISH${COLOR_SEPARATOR} =======================================${COLOR_RESET}"
Expand Down
2 changes: 1 addition & 1 deletion libbatched-io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ target_include_directories( devcore PRIVATE
../libdevcore
)

target_link_libraries( batched-io PRIVATE leveldb::leveldb boost_filesystem devcore)
target_link_libraries( batched-io PRIVATE leveldb boost_filesystem devcore)
2 changes: 1 addition & 1 deletion libconsensus
Submodule libconsensus updated 1 files
+4 −3 CMakeLists.txt
12 changes: 7 additions & 5 deletions libdevcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ target_link_libraries(devcore PUBLIC skale-buildinfo Boost::filesystem Boost::sy
#target_include_directories(devcore SYSTEM PUBLIC ${LEVELDB_INCLUDE_DIRS})
#target_link_libraries(devcore PRIVATE ${LEVELDB_LIBRARIES})

if( BUILD_LEVELDB )
target_link_libraries(devcore PRIVATE leveldb skutils)
else()
target_link_libraries(devcore PRIVATE leveldb::leveldb skutils)
endif()
# if( BUILD_LEVELDB )
# target_link_libraries(devcore PRIVATE leveldb skutils)
# else()
# target_link_libraries(devcore PRIVATE leveldb::leveldb skutils)
# endif()

target_link_libraries(devcore PRIVATE leveldb skutils)

0 comments on commit d251c45

Please sign in to comment.