Add out of source build functions for TF-PSA-Crypto

This commit adds helper functions to build TF-PSA-Crypto out of source
using CMake.

Signed-off-by: Harry Ramsey <[email protected]>
This commit is contained in:
Harry Ramsey
2024-12-24 14:25:03 +00:00
parent 6b28ced815
commit 974b4137cf
+20
View File
@@ -165,6 +165,7 @@ pre_initialize_variables () {
PSA_CORE_PATH='tf-psa-crypto/core'
BUILTIN_SRC_PATH='tf-psa-crypto/drivers/builtin/src'
CONFIG_TEST_DRIVER_H='tf-psa-crypto/tests/configs/crypto_config_test_driver.h'
TF_PSA_CRYPTO_ROOT_DIR="$PWD/tf-psa-crypto"
fi
config_files="$CONFIG_H $CRYPTO_CONFIG_H $CONFIG_TEST_DRIVER_H"
else
@@ -172,6 +173,7 @@ pre_initialize_variables () {
PSA_CORE_PATH='core'
BUILTIN_SRC_PATH='drivers/builtin/src'
CONFIG_TEST_DRIVER_H='tests/configs/config_test_driver.h'
TF_PSA_CRYPTO_ROOT_DIR="$PWD"
config_files="$CRYPTO_CONFIG_H $CONFIG_TEST_DRIVER_H"
fi
@@ -937,6 +939,10 @@ run_component () {
"${dd_cmd[@]}"
fi
if in_tf_psa_crypto_repo; then
pre_create_tf_psa_crypto_out_of_source_directory
fi
# Run the component in a subshell, with error trapping and output
# redirection set up based on the relevant options.
if [ $KEEP_GOING -eq 1 ]; then
@@ -971,10 +977,24 @@ run_component () {
fi
# Restore the build tree to a clean state.
if in_tf_psa_crypto_repo; then
cleanup_tf_psa_crypto_out_of_source_directory
fi
cleanup
unset current_component
}
pre_create_tf_psa_crypto_out_of_source_directory () {
rm -rf "$OUT_OF_SOURCE_DIR"
mkdir "$OUT_OF_SOURCE_DIR"
cd "$OUT_OF_SOURCE_DIR"
}
cleanup_tf_psa_crypto_out_of_source_directory () {
cd "$TF_PSA_CRYPTO_ROOT_DIR"
rm -rf "$OUT_OF_SOURCE_DIR"
}
################################################################
#### Main
################################################################