From d312a6d85594566158a40826eb5a7eee1feba4cf Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Tue, 18 Aug 2020 14:40:21 +0200 Subject: [PATCH] Added travis --- travis/linux.sh | 35 +++++++++++++++++++++++++++ travis/mac.sh | 1 + travis/win.sh | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 travis/linux.sh create mode 100644 travis/mac.sh create mode 100644 travis/win.sh diff --git a/travis/linux.sh b/travis/linux.sh new file mode 100644 index 0000000..bb25956 --- /dev/null +++ b/travis/linux.sh @@ -0,0 +1,35 @@ +#!/bin/bash -e + +cd src/main/jni +mkdir $TRAVIS_BUILD_DIR/out + +export TD_SRC_DIR=${PWD}/td +export TD_BIN_DIR=${PWD}/jtdlib/td +export JAVA_SRC_DIR=$(dirname `pwd`)/java +cd jtdlib +mkdir jnibuild || true +mkdir build || true +echo "TD_SRC_DIR=${TD_SRC_DIR}" +echo "TD_BIN_DIR=${TD_BIN_DIR}" +echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}" +cd jnibuild +#export OPENSSL_ROOT_DIR=/snap/gitkraken/143/lib/x86_64-linux-gnu +#export JAVA_HOME=/usr/lib/jvm/java-1.13.0-openjdk-amd64 +#export JAVA_INCLUDE_PATH=/usr/lib/jvm/java-1.13.0-openjdk-amd64/include/ +cmake -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} ${TD_SRC_DIR} +cmake --build . --target install -- -j1 + +cd ../../../../../ +#mvn install -X + +cd src/main/jni/jtdlib/build +cmake -DCMAKE_BUILD_TYPE=Release -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DCMAKE_INSTALL_PREFIX:PATH=.. .. +cmake --build . --target install -- -j1 +cd .. +#rm -r jnibuild +#rm -r build +rm -r td +[ -e ../bin ] && rm -r ../bin +mkdir ../bin +mv docs ../bin +mv bin/libtdjni.so $TRAVIS_BUILD_DIR/out diff --git a/travis/mac.sh b/travis/mac.sh new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/travis/mac.sh @@ -0,0 +1 @@ + diff --git a/travis/win.sh b/travis/win.sh new file mode 100644 index 0000000..9f53014 --- /dev/null +++ b/travis/win.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# Build deps +choco install gperf +choco install strawberryperl +choco install jdk11 -params 'installdir=c:\\java11' + +# openssl +mkdir $TRAVIS_BUILD_DIR/openssl-root +git clone https://github.com/openssl/openssl.git -b OpenSSL_1_1_1-stable +cd openssl +perl Configure enable-static-engine enable-capieng no-ssl2 -utf-8 VC-WIN64A --prefix=$TRAVIS_BUILD_DIR/openssl-root --openssldir=$TRAVIS_BUILD_DIR/openssl-root no-shared +nmake +nmake install +cd .. + +# zlib +mkdir $TRAVIS_BUILD_DIR/zlib-root +git clone https://github.com/madler/zlib.git -b v1.2.11 +cd zlib +cmake -DCMAKE_INSTALL_PREFIX:PATH=$TRAVIS_BUILD_DIR/zlib-root -DSKIP_BUILD_EXAMPLES=ON . +cmake --build . --target install +cd .. + +ls $TRAVIS_BUILD_DIR/openssl-root +ls $TRAVIS_BUILD_DIR/zlib-root + +# Dirs +cd src/main/jni + +export TD_SRC_DIR=${PWD}/td +export TD_BIN_DIR=${PWD}/jtdlib/td +export JAVA_SRC_DIR=$(dirname `pwd`)/java +cd jtdlib +mkdir build +mkdir jnibuild +echo "TD_SRC_DIR=${TD_SRC_DIR}" +echo "TD_BIN_DIR=${TD_BIN_DIR}" +echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}" +mkdir $TRAVIS_BUILD_DIR/out +cd jnibuild + +# Setup env +export JAVA_HOME="c:\\java11" + +# Build +cmake -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} -DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR\vcpkg\scripts\buildsystems\vcpkg.cmake ${TD_SRC_DIR} +cmake --build . --target install -- -j4 + + +cd ../../../../../ +#mvn install -X + +cd src/main/jni/jtdlib/build +cmake -DCMAKE_BUILD_TYPE=Release -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DCMAKE_INSTALL_PREFIX:PATH=.. -DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR\vcpkg\scripts\buildsystems\vcpkg.cmake .. +cmake --build . --target install -- -j4 + +cd .. +rm -r td + + +# Copy artifacts +cp bin/libtdjni.dll $TRAVIS_BUILD_DIR/out