From 60f69e22e2ed4b2985770f74837e87090b2d7943 Mon Sep 17 00:00:00 2001 From: Yuta Okamoto Date: Fri, 14 Sep 2018 16:20:53 +0900 Subject: [PATCH] fix .gitignore to allow build*.sh --- .gitignore | 2 +- .travis/build-menoh.sh | 66 ++++++++++++++++++++++++++++++++++ .travis/linux-x86_64/build.sh | 33 +++++++++++++++++ .travis/macosx-x86_64/build.sh | 40 +++++++++++++++++++++ 4 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 .travis/build-menoh.sh create mode 100644 .travis/linux-x86_64/build.sh create mode 100644 .travis/macosx-x86_64/build.sh diff --git a/.gitignore b/.gitignore index 6425fde..69d2099 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -build* +build*/ data/* external/protobuf/ runx/onnx/onnx.pb.cc diff --git a/.travis/build-menoh.sh b/.travis/build-menoh.sh new file mode 100644 index 0000000..cf48239 --- /dev/null +++ b/.travis/build-menoh.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +# retrieve arguments +while [[ $# != 0 ]]; do + case $1 in + --) + shift + break + ;; + --source-dir) + ARG_SOURCE_DIR="$2" + shift 2 + ;; + --install-dir) + ARG_INSTALL_DIR="$2" + shift 2 + ;; + --link-static-libgcc) + ARG_LINK_STATIC_LIBGCC="$2" + shift 2 + ;; + --link-static-libstdcxx) + ARG_LINK_STATIC_LIBSTDCXX="$2" + shift 2 + ;; + --link-static-libprotobuf) + ARG_LINK_STATIC_LIBPROTOBUF="$2" + shift 2 + ;; + -*) + err Unknown option \"$1\" + exit + ;; + *) + break + ;; + + esac +done + +# validate the arguments +test -n "${ARG_SOURCE_DIR}" || { echo "--source-dir is not specified"; exit 1; } + +test -n "${ARG_LINK_STATIC_LIBGCC}" || ARG_LINK_STATIC_LIBGCC='OFF' +test -n "${ARG_LINK_STATIC_LIBSTDCXX}" || ARG_LINK_STATIC_LIBSTDCXX='OFF' +test -n "${ARG_LINK_STATIC_LIBPROTOBUF}" || ARG_LINK_STATIC_LIBPROTOBUF='OFF' + +echo -e "\e[33;1mBuilding Menoh\e[0m" + +cd ${ARG_SOURCE_DIR}/menoh +[ -d "build" ] || mkdir -p build + +cd build +if [ -n "${ARG_INSTALL_DIR}" ]; then + CMAKE_INSTALL_PREFIX="-DCMAKE_INSTALL_PREFIX=${ARG_INSTALL_DIR}" +fi +cmake \ + -DCMAKE_BUILD_TYPE=Release \ + ${CMAKE_INSTALL_PREFIX} \ + -DLINK_STATIC_LIBGCC=${ARG_LINK_STATIC_LIBGCC} \ + -DLINK_STATIC_LIBSTDCXX=${ARG_LINK_STATIC_LIBSTDCXX} \ + -DLINK_STATIC_LIBPROTOBUF=${ARG_LINK_STATIC_LIBPROTOBUF} \ + -DENABLE_TEST=ON \ + .. + +make diff --git a/.travis/linux-x86_64/build.sh b/.travis/linux-x86_64/build.sh new file mode 100644 index 0000000..0fa77a5 --- /dev/null +++ b/.travis/linux-x86_64/build.sh @@ -0,0 +1,33 @@ +#!/bin/bash -ex + +BASE_DIR=$(cd $(dirname $0) && pwd) + +# initialize this script +source ${BASE_DIR}/../init-build-linux.sh + +# check the environment +docker_exec "ls -l ${WORK_DIR}" +docker_exec "ls -l ${WORK_DIR}/build" +docker_exec "ls -l ${WORK_DIR}/build/${TRAVIS_REPO_SLUG}" + +docker_exec "(printenv | grep PATH) && make --version && cmake --version && g++ --version && ldd --version" + +# build and install prerequisites +install_protobuf +install_mkldnn + +docker_exec "pip3 install --user chainer" # for generating test data + +docker_exec "yum list installed" +docker_exec "pip list" + +# build and test menoh +prepare_menoh_data +build_menoh +test_menoh + +# check the artifact and release +check_menoh_artifact + +# release the artifact +# TODO diff --git a/.travis/macosx-x86_64/build.sh b/.travis/macosx-x86_64/build.sh new file mode 100644 index 0000000..8f840ea --- /dev/null +++ b/.travis/macosx-x86_64/build.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +BASE_DIR=$(cd $(dirname $0) && pwd) + +# initialize this script +source ${BASE_DIR}/../init-build-osx.sh + +# check the environment +ls -l ${WORK_DIR} +ls -l ${WORK_DIR}/build +ls -l ${WORK_DIR}/build/${TRAVIS_REPO_SLUG} + +printenv | grep PATH +make --version +cmake --version +g++ --version + +# install prerequisites +brew update +brew upgrade python + +export PATH=/usr/local/opt/python/libexec/bin:$PATH + +brew install numpy || true +brew install opencv mkl-dnn + +if [ "$LINK_STATIC" != "true" ]; then brew install protobuf; fi + +pip install --user chainer # for generating test data + +brew list --versions +pip list + +# build and test menoh +prepare_menoh_data +build_menoh +test_menoh + +# check the artifact and release +check_menoh_artifact