2020-10-10 03:26:24 +02:00
|
|
|
#!/bin/bash -e
|
2020-12-28 19:52:17 +01:00
|
|
|
# MAIN REQUIRED ENVIRONMENT VARIABLES:
|
|
|
|
# OPERATING_SYSTEM_NAME = <windows | linux | osx>
|
2021-09-14 13:32:20 +02:00
|
|
|
# CPU_ARCHITECTURE_NAME = <amd64 | aarch64 | 386 | s390x | armhf | ppc64le>
|
2020-12-28 19:52:17 +01:00
|
|
|
# IMPLEMENTATION_NAME = <tdlib | tdlight>
|
2021-01-05 12:34:21 +01:00
|
|
|
# BUILD_TYPE = <Debug | Release | RelWithDebInfo | MinSizeRel>
|
2020-12-28 19:52:17 +01:00
|
|
|
# CPU_CORES = "-- -j<cores>" or "-m" on Windows
|
|
|
|
# OTHER REQUIRED ENVIRONMENT VARIABLES:
|
|
|
|
# CMAKE_EXTRA_ARGUMENTS = <args>
|
2020-10-10 03:26:24 +02:00
|
|
|
|
|
|
|
# Check variables correctness
|
|
|
|
if [ -z "${OPERATING_SYSTEM_NAME}" ]; then
|
|
|
|
echo "Missing parameter: OPERATING_SYSTEM_NAME"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -z "${CPU_ARCHITECTURE_NAME}" ]; then
|
|
|
|
echo "Missing parameter: CPU_ARCHITECTURE_NAME"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -z "${IMPLEMENTATION_NAME}" ]; then
|
|
|
|
echo "Missing parameter: IMPLEMENTATION_NAME"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-01-05 12:34:21 +01:00
|
|
|
if [ -z "${BUILD_TYPE}" ]; then
|
|
|
|
echo "Missing parameter: BUILD_TYPE"
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-10-10 03:26:24 +02:00
|
|
|
if [ -z "${CPU_CORES}" ]; then
|
|
|
|
echo "Missing parameter: CPU_CORES"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-09-11 12:27:22 +02:00
|
|
|
source ./setup-variables.sh
|
|
|
|
|
2020-12-28 19:52:17 +01:00
|
|
|
cd ../../
|
2020-10-10 03:26:24 +02:00
|
|
|
|
|
|
|
# Print details
|
|
|
|
echo "Compiling td..."
|
|
|
|
echo "Current directory: $(pwd)"
|
|
|
|
echo "Operating system: ${OPERATING_SYSTEM_NAME}"
|
|
|
|
echo "Architecture: ${CPU_ARCHITECTURE_NAME}"
|
|
|
|
echo "Td implementation: ${IMPLEMENTATION_NAME}"
|
2021-01-05 12:34:21 +01:00
|
|
|
echo "Build type: ${BUILD_TYPE}"
|
2020-10-10 15:08:26 +02:00
|
|
|
echo "CPU cores count: ${CPU_CORES}"
|
|
|
|
echo "CMake extra arguments: '${CMAKE_EXTRA_ARGUMENTS}'"
|
2020-10-10 03:26:24 +02:00
|
|
|
|
|
|
|
# Delete old data
|
|
|
|
echo "Deleting old data..."
|
|
|
|
[ -d ./generated/td_bin/ ] && rm -r ./generated/td_bin/
|
|
|
|
|
|
|
|
# Create missing folders
|
|
|
|
echo "Creating missing folders..."
|
|
|
|
[ -d ./generated/td_bin/ ] || mkdir ./generated/td_bin/
|
|
|
|
|
|
|
|
|
|
|
|
# Build
|
|
|
|
echo "Compiling ${IMPLEMENTATION_NAME} td..."
|
2020-12-29 19:33:21 +01:00
|
|
|
cd ./generated/td_build/
|
2021-01-05 12:34:21 +01:00
|
|
|
cmake --build . --target install --config "${BUILD_TYPE}" ${CPU_CORES}
|
2020-10-10 03:26:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
echo "Done."
|
|
|
|
exit 0
|