Skip to content

Commit

Permalink
ZIL-4866: revert vcpkg. (Zilliqa#2980)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaron-zilliqa authored Sep 14, 2022
1 parent 5602418 commit dad5912
Show file tree
Hide file tree
Showing 47 changed files with 23,964 additions and 339 deletions.
18 changes: 18 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
[submodule "src/depends/g3log"]
path = src/depends/g3log
url = https://github.com/Zilliqa/g3log.git
[submodule "src/depends/openssl"]
path = src/depends/openssl
url = https://github.com/openssl/openssl.git
[submodule "src/depends/protobuf"]
path = src/depends/protobuf
url = https://github.com/google/protobuf.git
branch = 3.9.x
[submodule "src/depends/websocketpp"]
path = src/depends/websocketpp
url = https://github.com/zaphoyd/websocketpp
[submodule "src/depends/Schnorr"]
path = src/depends/Schnorr
url = https://github.com/Zilliqa/schnorr.git
branch = sig_fix_plus_bn
[submodule "src/depends/mongo-c-driver"]
path = src/depends/mongo-c-driver
url = https://github.com/mongodb/mongo-c-driver.git
branch = r1.17
[submodule "src/depends/mongo-cxx-driver"]
path = src/depends/mongo-cxx-driver
url = https://github.com/n-hutton/mongo-cxx-driver.git
branch = releases/stable
[submodule "src/depends/cryptoutils"]
path = src/depends/cryptoutils
url = https://github.com/Zilliqa/cryptoutils.git
Expand Down
59 changes: 51 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,60 @@ matrix:
# - os: osx
# osx_image: xcode10.1

addons:
apt:
update: true
packages:
# APT packages are organized into two groups, build dependency and
# development dependency, where the former is necessary for users who
# want to build Zilliqa whereas the latter is only for CI.
# Note that the names are sorted in each group.
#
# Build dependency
- build-essential
- cmake
- libboost-filesystem-dev
- libboost-program-options-dev
- libboost-system-dev
- libboost-test-dev
- libboost-python-dev
- libcurl4-openssl-dev
- libevent-dev
- libjsoncpp-dev
- libjsonrpccpp-dev
- libleveldb-dev
- libmicrohttpd-dev
- libminiupnpc-dev
- libsnappy-dev
- libssl-dev
- cargo
- pkg-config
# Development dependency
- ccache
- clang-5.0
- clang-format-5.0
- clang-tidy-5.0
- curl
- gawk
- git
- lcov
- libxml2-utils
- python-dev
- python3-dev
- libsecp256k1-dev

install:
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
- unzip awscliv2.zip
- sudo ./aws/install
- wget https://github.com/Kitware/CMake/releases/download/v3.19.3/cmake-3.19.3-Linux-x86_64.sh
- mkdir -p "${HOME}"/.local
- bash ./cmake-3.19.3-Linux-x86_64.sh --skip-license --prefix="${HOME}"/.local/
- cmake --version
- rm cmake-3.19.3-Linux-x86_64.sh
- docker run --rm -it -v /scilla:/root/scilla zilliqa/scilla:v0.11.0 cp -r /scilla /root/
- ls /scilla/0/
- docker login -u AWS -p $(aws ecr get-login-password --region ${AWS_REGION}) ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com
- docker build --build-arg AWS_ACCOUNT_ID=${AWS_ACCOUNT_ID} --build-arg AWS_REGION=${AWS_REGION} -t "zilliqa_build:$TRAVIS_COMMIT" -f ./scripts/Dockerfile.build .

script:
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then docker run --rm -it -v /scilla:/scilla zilliqa_build:$TRAVIS_COMMIT -c './scripts/ci_build.sh ; ./scripts/ci_report_coverage.sh'; fi
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then ./scripts/ci_build.sh; fi

env:
- VCPKG_ROOT=/vcpkg
# Code coverage is currently only implemented for GCC builds, so OSX is currently excluded from reporting
after_success:
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then ./scripts/ci_report_coverage.sh; fi
32 changes: 24 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,23 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
#
# check dependencies
#
find_package(Libevent REQUIRED)
find_package(jsoncpp REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBEVENT REQUIRED libevent)
link_directories(${LIBEVENT_LIBRARY_DIRS})

if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
pkg_check_modules(MINIUPNPC miniupnpc REQUIRED)
link_directories(${MINIUPNPC_LIBRARY_DIRS})
find_package(jsoncpp REQUIRED)
set(JSON_PREFIX,"json")
set(JSONCPP_LINK_TARGETS "jsoncpp_lib")
else()
pkg_check_modules(JSONCPP REQUIRED jsoncpp)
include_directories(${JSONCPP_INCLUDE_DIRS})
link_directories(${JSONCPP_LIBRARY_DIRS})
set(JSONCPP_LINK_TARGETS "jsoncpp")
set(JSON_PREFIX "jsoncpp")
endif()

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
Expand All @@ -32,10 +47,11 @@ include(InstallCryptoUtils)

include(ProjectSecp256k1)

find_package(mongocxx REQUIRED)
find_package(bsoncxx REQUIRED)
include(InstallMongo)
find_package(mongocxx CONFIG REQUIRED)

find_package(websocketpp REQUIRED)
include(InstallWebsocketpp)
find_package(websocketpp CONFIG REQUIRED)

include(InstallSchnorr)
include_directories(${SCHNORR_INCLUDE_DIR}/include)
Expand Down Expand Up @@ -101,7 +117,7 @@ endif()
find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})

find_package(leveldb REQUIRED)
find_package(LevelDB REQUIRED)

if(OPENCL_MINE AND CUDA_MINE)
message(FATAL_ERROR "Cannot support OpenCL (OPENCL_MINE=ON) and CUDA (CUDA=ON) at the same time")
Expand Down Expand Up @@ -231,8 +247,8 @@ endif()

include(FindProtobuf)
set(protobuf_MODULE_COMPATIBLE TRUE)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
find_package(Protobuf CONFIG REQUIRED)
include_directories(${PROTOBUF_INSTALL_DIR}/include)

include_directories(${CMAKE_SOURCE_DIR}/src/depends/cryptoutils/include/)

Expand Down
7 changes: 2 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
- cat
tty: true
- name: "ubuntu"
image: "648273915458.dkr.ecr.us-west-2.amazonaws.com/zilliqa:v8.2.0-deps"
image: "ubuntu:bionic"
command:
- cat
tty: true
Expand All @@ -36,15 +36,12 @@ timestamps {
}
}
container('ubuntu') {
env.VCPKG_ROOT="/vcpkg"
stage('Configure environment') {
sh "./scripts/setup_environment.sh"
// sh "git clone https://github.com/microsoft/vcpkg ${env.VCPKG_ROOT}"
// sh "export VCPKG_FORCE_SYSTEM_BINARIES=1 && cd ${env.VCPKG_ROOT} && git checkout 2022.07.25 && ${env.VCPKG_ROOT}/bootstrap-vcpkg.sh"
}
stage('Build') {
sh "git config --global --add safe.directory '*'"
sh "export VCPKG_ROOT=${env.VCPKG_ROOT} && ./scripts/ci_build.sh"
sh "./scripts/ci_build.sh"
}
stage('Report coverage') {
// Code coverage is currently only implemented for GCC builds, so OSX is currently excluded from reporting
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ Run the following to install the build dependencies:

```bash
sudo apt-get update
sudo apt-get install git \
libmicrohttpd-dev bison \
libjsonrpccpp-dev build-essential pkg-config \
libcurl4-openssl-dev python3-dev \
sudo apt-get install git libboost-system-dev libboost-filesystem-dev libboost-test-dev \
libssl-dev libleveldb-dev libjsoncpp-dev libsnappy-dev libmicrohttpd-dev \
libjsonrpccpp-dev build-essential pkg-config libevent-dev libminiupnpc-dev \
libcurl4-openssl-dev libboost-program-options-dev libboost-python-dev python3-dev \
python3-setuptools python3-pip gawk
```
Run the following to install latest version of cmake. Please make sure you have cmake 3.19 or above:
Expand Down
7 changes: 1 addition & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@

set -e

if [ -z ${VCPKG_ROOT} ]; then
echo -e "\033[1;33mVCPKG_ROOT is not set\033[0m"
exit 1
fi

# set n_parallel to fully utilize the resources
os=$(uname)
case $os in
Expand Down Expand Up @@ -178,7 +173,7 @@ do
esac
done

cmake -H. -B${dir} ${CMAKE_EXTRA_OPTIONS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTESTS=ON -DCMAKE_INSTALL_PREFIX=.. -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-linux-dynamic
cmake -H. -B${dir} ${CMAKE_EXTRA_OPTIONS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTESTS=ON -DCMAKE_INSTALL_PREFIX=..
cmake --build ${dir} -- -j${n_parallel}
./scripts/license_checker.sh
./scripts/depends/check_guard.sh
Expand Down
27 changes: 27 additions & 0 deletions cmake/FindLevelDB.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Find LevelDB

find_path(
LEVELDB_INCLUDE_DIR
NAMES leveldb/db.h
DOC "LevelDB include directory"
)

find_library(
LEVELDB_LIBRARY
NAMES leveldb
DOC "LevelDB library"
)

set(LEVELDB_INCLUDE_DIRS ${LEVELDB_INCLUDE_DIR})
set(LEVELDB_LIBRARIES ${LEVELDB_LIBRARY})

if (NOT BUILD_SHARED_LIBS AND APPLE)
find_path(SNAPPY_INCLUDE_DIR snappy.h PATH_SUFFIXES snappy)
find_library(SNAPPY_LIBRARY snappy)
set(LEVELDB_INCLUDE_DIRS ${LEVELDB_INCLUDE_DIR} ${SNAPPY_INCLUDE_DIR})
set(LEVELDB_LIBRARIES ${LEVELDB_LIBRARY} ${SNAPPY_LIBRARY})
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LevelDB DEFAULT_MSG
LEVELDB_LIBRARY LEVELDB_INCLUDE_DIR)
48 changes: 0 additions & 48 deletions cmake/FindMiniupnpc.cmake

This file was deleted.

74 changes: 74 additions & 0 deletions cmake/FindProtobuf.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
set(PROTOBUF_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/depends/protobuf/cmake)
set(PROTOBUF_BINARY_DIR ${CMAKE_BINARY_DIR}/src/depends/protobuf)
set(PROTOBUF_INSTALL_DIR ${CMAKE_BINARY_DIR}/protobuf)
set(PROTOBUF_INSTALL_LOG ${CMAKE_BINARY_DIR}/install_protobuf.log)

file(MAKE_DIRECTORY ${PROTOBUF_INSTALL_DIR})
file(MAKE_DIRECTORY ${PROTOBUF_BINARY_DIR})

message(STATUS "Building and installing protobuf")

# download, check and untar
execute_process(
COMMAND git submodule update --init src/depends/protobuf
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE PROTOBUF_INSTALL_RET
OUTPUT_FILE ${PROTOBUF_INSTALL_LOG}
ERROR_FILE ${PROTOBUF_INSTALL_LOG}
)

if(NOT "${PROTOBUF_INSTALL_RET}" STREQUAL "0")
message(FATAL_ERROR "Error when building and installing protobuf (1), see more in log ${PROTOBUF_INSTALL_LOG}")
endif()

set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests")
set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib.")
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "")

# generate build directory
execute_process(
COMMAND ${CMAKE_COMMAND}
-H${PROTOBUF_SOURCE_DIR}
-B${PROTOBUF_BINARY_DIR}
-Dprotobuf_BUILD_TESTS:BOOL=OFF
-Dprotobuf_WITH_ZLIB:BOOL=OFF
-Dprotobuf_MSVC_STATIC_RUNTIME:BOOL=OFF
-Dprotobuf_MODULE_COMPATIBLE:BOOL=ON
-DCMAKE_INSTALL_PREFIX=${PROTOBUF_INSTALL_DIR}
-DCMAKE_BUILD_TYPE:STRING=Release
-Wno-dev
RESULT_VARIABLE PROTOBUF_INSTALL_RET
OUTPUT_FILE ${PROTOBUF_INSTALL_LOG}
ERROR_FILE ${PROTOBUF_INSTALL_LOG}
)

if(NOT "${PROTOBUF_INSTALL_RET}" STREQUAL "0")
message(FATAL_ERROR "Error when building and installing protobuf (2), see more in log ${PROTOBUF_INSTALL_LOG}")
endif()

# build and install proto
execute_process(
COMMAND ${CMAKE_COMMAND} --build ${PROTOBUF_BINARY_DIR} -- -j${N}
RESULT_VARIABLE PROTOBUF_INSTALL_RET
OUTPUT_FILE ${PROTOBUF_INSTALL_LOG}
ERROR_FILE ${PROTOBUF_INSTALL_LOG}
)

if(NOT "${PROTOBUF_INSTALL_RET}" STREQUAL "0")
message(FATAL_ERROR "Error when building and installing protobuf (3), see more in log ${PROTOBUF_INSTALL_LOG}")
endif()

execute_process(
COMMAND ${CMAKE_COMMAND} --build ${PROTOBUF_BINARY_DIR} --target install
RESULT_VARIABLE PROTOBUF_INSTALL_RET
OUTPUT_FILE ${PROTOBUF_INSTALL_LOG}
ERROR_FILE ${PROTOBUF_INSTALL_LOG}
)

if(NOT "${PROTOBUF_INSTALL_RET}" STREQUAL "0")
message(FATAL_ERROR "Error when building and installing protobuf (4), see more in log ${PROTOBUF_INSTALL_LOG}")
endif()

list(APPEND CMAKE_PREFIX_PATH ${PROTOBUF_INSTALL_DIR})
list(APPEND CMAKE_MODULE_PATH "${PROTOBUF_INSTALL_DIR}/lib/cmake/protobuf")
link_directories(${PROTOBUF_INSTALL_DIR}/lib)
3 changes: 0 additions & 3 deletions cmake/InstallG3log.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ if(NOT "${G3LOG_INSTALL_RET}" STREQUAL "0")
message(FATAL_ERROR "Error when building and installing g3log, see more in log ${G3LOG_INSTALL_LOG}")
endif()

file(COPY ${CMAKE_SOURCE_DIR}/vcpkg.json DESTINATION ${G3LOG_SOURCE_DIR})

# generate build directory
execute_process(
Expand All @@ -31,8 +30,6 @@ execute_process(
-DUSE_DYNAMIC_LOGGING_LEVELS=ON
-DG3_SHARED_LIB=OFF
-DCMAKE_INSTALL_PREFIX=${G3LOG_INSTALL_DIR}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DVCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}
-DADD_FATAL_EXAMPLE=OFF
-DENABLE_FATAL_SIGNALHANDLING=OFF
-Wno-dev
Expand Down
Loading

0 comments on commit dad5912

Please sign in to comment.