From 975937fb819909b5cd8ab4f0afcfef3b33c4aa61 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Tue, 5 Jan 2021 12:34:21 +0100 Subject: [PATCH] Add build type option --- implementations/tdlight | 2 +- .../github-workflows/setup-variables.sh | 2 ++ scripts/core/compile_td.sh | 8 +++++++- scripts/core/compile_tdjni.sh | 10 ++++++++-- scripts/core/configure_td.sh | 8 +++++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/implementations/tdlight b/implementations/tdlight index 5fddef3..af4693e 160000 --- a/implementations/tdlight +++ b/implementations/tdlight @@ -1 +1 @@ -Subproject commit 5fddef3857e4d620f4c50c86cf93ac6cd9635bfd +Subproject commit af4693eac7318ac485334ab84ddc44f05d2fd952 diff --git a/scripts/continuous-integration/github-workflows/setup-variables.sh b/scripts/continuous-integration/github-workflows/setup-variables.sh index 01902a5..b0bff13 100644 --- a/scripts/continuous-integration/github-workflows/setup-variables.sh +++ b/scripts/continuous-integration/github-workflows/setup-variables.sh @@ -1,5 +1,6 @@ #!/bin/bash -e set -e +export BUILD_TYPE=Release 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" echo "MATRIX_OS: $GH_MATRIX_OS" @@ -91,6 +92,7 @@ fi # ====== Print variables echo "REVISION=${REVISION}" +echo "BUILD_TYPE=${BUILD_TYPE}" echo "TD_SRC_DIR=${TD_SRC_DIR}" echo "TD_BIN_DIR=${TD_BIN_DIR}" echo "TDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR}" diff --git a/scripts/core/compile_td.sh b/scripts/core/compile_td.sh index 1b5645f..7251951 100755 --- a/scripts/core/compile_td.sh +++ b/scripts/core/compile_td.sh @@ -3,6 +3,7 @@ # OPERATING_SYSTEM_NAME = # CPU_ARCHITECTURE_NAME = # IMPLEMENTATION_NAME = +# BUILD_TYPE = # CPU_CORES = "-- -j" or "-m" on Windows # OTHER REQUIRED ENVIRONMENT VARIABLES: # CMAKE_EXTRA_ARGUMENTS = @@ -20,6 +21,10 @@ if [ -z "${IMPLEMENTATION_NAME}" ]; then echo "Missing parameter: IMPLEMENTATION_NAME" exit 1 fi +if [ -z "${BUILD_TYPE}" ]; then + echo "Missing parameter: BUILD_TYPE" + exit 1 +fi if [ -z "${CPU_CORES}" ]; then echo "Missing parameter: CPU_CORES" exit 1 @@ -33,6 +38,7 @@ echo "Current directory: $(pwd)" echo "Operating system: ${OPERATING_SYSTEM_NAME}" echo "Architecture: ${CPU_ARCHITECTURE_NAME}" echo "Td implementation: ${IMPLEMENTATION_NAME}" +echo "Build type: ${BUILD_TYPE}" echo "CPU cores count: ${CPU_CORES}" echo "CMake extra arguments: '${CMAKE_EXTRA_ARGUMENTS}'" @@ -48,7 +54,7 @@ echo "Creating missing folders..." # Build echo "Compiling ${IMPLEMENTATION_NAME} td..." cd ./generated/td_build/ -cmake --build . --target install --config Release ${CPU_CORES} +cmake --build . --target install --config "${BUILD_TYPE}" ${CPU_CORES} echo "Done." diff --git a/scripts/core/compile_tdjni.sh b/scripts/core/compile_tdjni.sh index cf6e6ad..6f9d7b2 100755 --- a/scripts/core/compile_tdjni.sh +++ b/scripts/core/compile_tdjni.sh @@ -4,6 +4,7 @@ # OPERATING_SYSTEM_NAME_SHORT = # CPU_ARCHITECTURE_NAME = # IMPLEMENTATION_NAME = +# BUILD_TYPE = # CPU_CORES = "-- -j" or "-m" on Windows # OTHER REQUIRED ENVIRONMENT VARIABLES: # CMAKE_EXTRA_ARGUMENTS = @@ -25,6 +26,10 @@ if [ -z "${IMPLEMENTATION_NAME}" ]; then echo "Missing parameter: IMPLEMENTATION_NAME" exit 1 fi +if [ -z "${BUILD_TYPE}" ]; then + echo "Missing parameter: BUILD_TYPE" + exit 1 +fi if [ -z "${CPU_CORES}" ]; then echo "Missing parameter: CPU_CORES" exit 1 @@ -38,6 +43,7 @@ echo "Current directory: $(pwd)" echo "Operating system: ${OPERATING_SYSTEM_NAME}" echo "Architecture: ${CPU_ARCHITECTURE_NAME}" echo "Td implementation: ${IMPLEMENTATION_NAME}" +echo "Build type: ${BUILD_TYPE}" echo "CPU cores count: ${CPU_CORES}" echo "CMake extra arguments: '${CMAKE_EXTRA_ARGUMENTS}'" @@ -73,7 +79,7 @@ fi echo "Configuring CMake..." cd ./generated/tdjni_build/ cmake \ - -DCMAKE_BUILD_TYPE=Release \ + "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" \ -DTD_GENERATED_BINARIES_DIR=${TD_GENERATED_BINARIES_DIR} \ -DTD_SRC_DIR=$(realpath -m ../implementation/) \ -DTDNATIVES_BIN_DIR=$(realpath -m ../tdjni_bin/) \ @@ -87,7 +93,7 @@ cmake \ # Build echo "Compiling ${IMPLEMENTATION_NAME} jni..." -cmake --build . --target install --config Release ${CPU_CORES} +cmake --build . --target install --config "${BUILD_TYPE}" ${CPU_CORES} cd .. # Copy to resources diff --git a/scripts/core/configure_td.sh b/scripts/core/configure_td.sh index 52c48c5..938e7ef 100755 --- a/scripts/core/configure_td.sh +++ b/scripts/core/configure_td.sh @@ -3,6 +3,7 @@ # OPERATING_SYSTEM_NAME = # CPU_ARCHITECTURE_NAME = # IMPLEMENTATION_NAME = +# BUILD_TYPE = # CPU_CORES = "-- -j" or "-m" on Windows # OTHER REQUIRED ENVIRONMENT VARIABLES: # CMAKE_EXTRA_ARGUMENTS = @@ -20,6 +21,10 @@ if [ -z "${IMPLEMENTATION_NAME}" ]; then echo "Missing parameter: IMPLEMENTATION_NAME" exit 1 fi +if [ -z "${BUILD_TYPE}" ]; then + echo "Missing parameter: BUILD_TYPE" + exit 1 +fi if [ -z "${CPU_CORES}" ]; then echo "Missing parameter: CPU_CORES" exit 1 @@ -33,6 +38,7 @@ echo "Current directory: $(pwd)" echo "Operating system: ${OPERATING_SYSTEM_NAME}" echo "Architecture: ${CPU_ARCHITECTURE_NAME}" echo "Td implementation: ${IMPLEMENTATION_NAME}" +echo "Build type: ${BUILD_TYPE}" echo "CPU cores count: ${CPU_CORES}" echo "CMake extra arguments: '${CMAKE_EXTRA_ARGUMENTS}'" @@ -57,7 +63,7 @@ INSTALL_PREFIX="$(realpath -m ../td_bin/)" INSTALL_BINDIR="$(realpath -m ../td_bin/bin)" echo "Install prefix: $INSTALL_PREFIX" echo "Install bindir: $INSTALL_BINDIR" -cmake -DCMAKE_BUILD_TYPE=Release \ +cmake "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" \ -DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX" \ -DCMAKE_INSTALL_BINDIR:PATH="$INSTALL_BINDIR" \ -DTD_ENABLE_JNI=ON \