tdlight-java/travis/build.sh

46 lines
2.2 KiB
Bash
Raw Normal View History

#!/bin/bash -e
set -e
# ====== Setup environment variables
source ./travis/setup_variables.sh
# ====== Build Td
2020-08-19 21:55:03 +02:00
# Prepare build
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}
2020-08-19 23:41:17 +02:00
cmake --build $TD_BUILD_DIR --target prepare_cross_compiling -- -j4
2020-08-19 21:55:03 +02:00
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}
2020-08-19 23:41:17 +02:00
cmake --build $TD_BUILD_DIR --target prepare_cross_compiling -- -m
2020-08-19 21:55:03 +02:00
fi
# Split sources
cd $TD_SRC_DIR
php SplitSource.php
2020-08-19 21:55:03 +02:00
# Build
cd $TD_BUILD_DIR
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
2020-08-19 23:41:17 +02:00
#cmake --build $TD_BUILD_DIR --target tdjson -- -j2
#cmake --build $TD_BUILD_DIR --target tdjson_static -- -j2
2020-08-19 22:20:17 +02:00
cmake --build $TD_BUILD_DIR --target install --config Release -- -j2
elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
2020-08-19 23:41:17 +02:00
#cmake --build $TD_BUILD_DIR --target tdjson -- -m
#cmake --build $TD_BUILD_DIR --target tdjson_static -- -m
cmake --build $TD_BUILD_DIR --target install --config Release -- -m
fi
2020-08-19 21:55:03 +02:00
# After build
cd $TD_SRC_DIR
php SplitSource.php --undo
# ====== Build TdNatives
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
2020-08-19 21:55:03 +02:00
cmake --build $TDNATIVES_CPP_BUILD_DIR --target install -- -j2
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
2020-08-19 23:41:17 +02:00
cmake --build $TDNATIVES_CPP_BUILD_DIR --target install --config Release -- -m
fi