blob: 4a2a76a214fe283ab030c653b75e2a68f7af633b [file] [log] [blame]
Yatian XUc246e2e2019-09-15 00:13:07 +08001#!/bin/bash
2set -x
3
4#3rd party
5cmake_build_type=RELEASE
6LEVELDB_VER=1.22
7THRIFT_VER=0.12.0
8JSON_VER=3.5.0
9SPDLOG_VER=1.3.1
10
11sudo yum install -y cppcheck bison libcurl-devel; yum clean all
12sudo pip install gcovr
13
14#cmake
15cd /tmp/
16wget https://github.com/Kitware/CMake/releases/download/v3.15.3/cmake-3.15.3-Linux-x86_64.tar.gz
17tar xzvf cmake*.tar.gz
18sudo rpm -e cmake
19sudo ln -s $(pwd)/cmake-3.15.3-Linux-x86_64/bin/cmake /usr/bin/cmake
20
21#leveldb
22cd /tmp
23curl -o leveldb.zip https://codeload.github.com/google/leveldb/zip/$LEVELDB_VER
24unzip leveldb.zip
25rm leveldb.zip
26mv leveldb-$LEVELDB_VER leveldb
27mkdir leveldb/_build
28cd leveldb/_build;cmake .. -DCMAKE_BUILD_TYPE=$cmake_build_type -DCMAKE_POSITION_INDEPENDENT_CODE=ON; make -j 10; sudo make install
29
30#json
31cd /tmp
32curl -o json.zip https://codeload.github.com/nlohmann/json/zip/v$JSON_VER
33unzip json.zip
34rm json.zip
35mv json-$JSON_VER json
36cd json;mkdir _build
37cd _build/;cmake .. -DCMAKE_BUILD_TYPE=$cmake_build_type -DJSON_BuildTests=OFF;make -j 10;sudo make install
38
39#spdlog
40cd /tmp
41curl -o spdlog.zip https://codeload.github.com/gabime/spdlog/zip/v$SPDLOG_VER
42unzip spdlog.zip
43rm spdlog.zip
44mv spdlog-$SPDLOG_VER spdlog
45cd spdlog;mkdir _build
46cd _build/;cmake .. -DCMAKE_BUILD_TYPE=$cmake_build_type -DSPDLOG_BUILD_EXAMPLES=OFF -DSPDLOG_BUILD_BENCH=OFF -DSPDLOG_BUILD_TESTS=OFF; make -j 10; sudo make install
47
48#thrift
49cd /tmp
50curl -o thrift.zip https://codeload.github.com/apache/thrift/zip/v$THRIFT_VER
51unzip thrift.zip
52rm thrift.zip
53mv thrift-$THRIFT_VER thrift
54cd thrift;mkdir _build
55cd _build/;cmake .. -DCMAKE_BUILD_TYPE=$cmake_build_type -DBUILD_PYTHON=OFF -DBUILD_JAVA=OFF -DBUILD_C_GLIB=OFF -DWITH_LIBEVENT=OFF -DWITH_ZLIB=OFF -DWITH_OPENSSL=OFF -DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON;make -j 10;sudo make install
56
57#verify/sonar
58if [[ "${JOB_NAME}" == "vnfsdk-ves-agent-cmake-sonar" ]]; then
59echo "sonar"
60mkdir -p ${BUILD_DIR}
61cppcheck --enable=all --inconclusive --xml --xml-version=2 --output-file=${BUILD_DIR}/cppcheck.xml .
62
63cd ${BUILD_DIR}
64cat >> sonar-project.properties <<EOF
65sonar.cfamily.gcov.reportsPath=${BUILD_DIR}/coverage
66sonar.cppcheck.reportPath=${BUILD_DIR}/cppcheck.xml
67sonar.exclusions=**/gen-cpp/**/*,**/build/**/*
68sonar.projectBaseDir=${WORKSPACE}/veslibrary/ves_cpplibrary
69sonar.cfamily.threads=4
70EOF
71
72ls ${BUILD_DIR}/sonar-project.properties
73cat ${BUILD_DIR}/sonar-project.properties
74
75fi