From 60d6388e06a79e290cf727be7d65408e4d74922c Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Thu, 20 Aug 2020 00:06:47 +0200 Subject: [PATCH] Update build.sh, install_dependencies.sh, and setup_variables.sh --- travis/build.sh | 10 +++++----- travis/install_dependencies.sh | 7 +++++++ travis/setup_variables.sh | 8 +++----- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/travis/build.sh b/travis/build.sh index a177335..7b69c68 100755 --- a/travis/build.sh +++ b/travis/build.sh @@ -9,7 +9,7 @@ source ./travis/setup_variables.sh cd $TD_BUILD_DIR if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} ${TD_SRC_DIR} - cmake --build $TD_BUILD_DIR --target prepare_cross_compiling -- -j4 + cmake --build $TD_BUILD_DIR --target prepare_cross_compiling -- -j${TRAVIS_CPU_CORES} elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake ${TD_SRC_DIR} cmake --build $TD_BUILD_DIR --target prepare_cross_compiling -- -m @@ -22,9 +22,9 @@ php SplitSource.php # Build cd $TD_BUILD_DIR if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - #cmake --build $TD_BUILD_DIR --target tdjson -- -j2 - #cmake --build $TD_BUILD_DIR --target tdjson_static -- -j2 - cmake --build $TD_BUILD_DIR --target install --config Release -- -j2 + #cmake --build $TD_BUILD_DIR --target tdjson -- -j${TRAVIS_CPU_CORES} + #cmake --build $TD_BUILD_DIR --target tdjson_static -- -j${TRAVIS_CPU_CORES} + cmake --build $TD_BUILD_DIR --target install --config Release -- -j${TRAVIS_CPU_CORES} elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then #cmake --build $TD_BUILD_DIR --target tdjson -- -m #cmake --build $TD_BUILD_DIR --target tdjson_static -- -m @@ -39,7 +39,7 @@ php SplitSource.php --undo cd $TDNATIVES_CPP_BUILD_DIR if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DTD_BIN_DIR=${TD_BIN_DIR} -DTDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR} -DTDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR} -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DTDNATIVES_CPP_SRC_DIR:PATH=$TDNATIVES_CPP_SRC_DIR $TDNATIVES_CPP_SRC_DIR - cmake --build $TDNATIVES_CPP_BUILD_DIR --target install -- -j2 + cmake --build $TDNATIVES_CPP_BUILD_DIR --target install -- -j${TRAVIS_CPU_CORES} elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DTD_BIN_DIR=${TD_BIN_DIR} -DTDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR} -DTDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR} -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DTDNATIVES_CPP_SRC_DIR:PATH=$TDNATIVES_CPP_SRC_DIR -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake $TDNATIVES_CPP_SRC_DIR cmake --build $TDNATIVES_CPP_BUILD_DIR --target install --config Release -- -m diff --git a/travis/install_dependencies.sh b/travis/install_dependencies.sh index c5e2b31..b635c2c 100755 --- a/travis/install_dependencies.sh +++ b/travis/install_dependencies.sh @@ -15,6 +15,13 @@ source ./travis/setup_variables.sh if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo "Linux" + if [ "$TRAVIS_CPU_ARCH" = "arm64" ]; then + fallocate l- 4G /myswap.img + mkswap swap.img + chmod 0600 myswap.img + sudo chown root:root /myswap.img + swapon swap.img + fi elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then echo "Windows" choco install ccache diff --git a/travis/setup_variables.sh b/travis/setup_variables.sh index b90b06f..03989ec 100755 --- a/travis/setup_variables.sh +++ b/travis/setup_variables.sh @@ -12,15 +12,13 @@ export TDNATIVES_CPP_BUILD_DIR=${PWD}/build-tdnatives export JAVA_SRC_DIR=${PWD}/src/tdnatives-java export TDLIB_SERIALIZER_DIR=${PWD}/dependencies/tdlib-serializer export MAVEN_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/javax.crypto=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED" -if [ "$TRAVIS_CPU_ARCH" = "aarch64" ]; then - export TRAVIS_CPU_ARCH_JAVA="arm64" -else - export TRAVIS_CPU_ARCH_JAVA="${TRAVIS_CPU_ARCH,,}" -fi +export TRAVIS_CPU_ARCH_JAVA="${TRAVIS_CPU_ARCH,,}" if [ "$TRAVIS_CPU_ARCH" = "arm64" ]; then export TRAVIS_CPU_ARCH_STANDARD="aarch64" + export TRAVIS_CPU_CORES="1" else export TRAVIS_CPU_ARCH_STANDARD="${TRAVIS_CPU_ARCH,,}" + export TRAVIS_CPU_CORES="2" fi export TRAVIS_OS_NAME_STANDARD="${TRAVIS_OS_NAME,,}" if [ "$TRAVIS_OS_NAME_STANDARD" = "windows" ]; then