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