mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 05:45:38 +01:00
Allow cmake 'out-of-source' builds
Allow mbed TLS to be build in a subdirectory. Also add a test in all.sh
This commit is contained in:
parent
9a5398f71b
commit
dc192215f4
@ -31,7 +31,7 @@ find_package(Perl)
|
|||||||
if(PERL_FOUND)
|
if(PERL_FOUND)
|
||||||
|
|
||||||
# If NULL Entropy is configured, display an appropriate warning
|
# If NULL Entropy is configured, display an appropriate warning
|
||||||
execute_process(COMMAND ${PERL_EXECUTABLE} scripts/config.pl get MBEDTLS_TEST_NULL_ENTROPY
|
execute_process(COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/config.pl -f ${CMAKE_SOURCE_DIR}/include/mbedtls/config.h get MBEDTLS_TEST_NULL_ENTROPY
|
||||||
RESULT_VARIABLE result)
|
RESULT_VARIABLE result)
|
||||||
if(${result} EQUAL 0)
|
if(${result} EQUAL 0)
|
||||||
message(WARNING ${NULL_ENTROPY_WARNING})
|
message(WARNING ${NULL_ENTROPY_WARNING})
|
||||||
|
@ -34,6 +34,8 @@ MEMORY=0
|
|||||||
SHORT=0
|
SHORT=0
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
|
||||||
|
: ${OUT_OF_SOURCE_DIR:=./mbedtls_out_of_source_build}
|
||||||
|
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
echo "Usage: $0"
|
echo "Usage: $0"
|
||||||
@ -41,6 +43,7 @@ usage()
|
|||||||
echo -e " -m|--memory\t\tAdditional optional memory tests."
|
echo -e " -m|--memory\t\tAdditional optional memory tests."
|
||||||
echo -e " -s|--short\t\tSubset of tests."
|
echo -e " -s|--short\t\tSubset of tests."
|
||||||
echo -e " -f|--force\t\tForce the tests to overwrite any modified files."
|
echo -e " -f|--force\t\tForce the tests to overwrite any modified files."
|
||||||
|
echo -e " --out-of-source-dir\t\tDirectory used for CMake out-of-source build tests."
|
||||||
}
|
}
|
||||||
|
|
||||||
# remove built files as well as the cmake cache/config
|
# remove built files as well as the cmake cache/config
|
||||||
@ -80,6 +83,10 @@ while [ $# -gt 0 ]; do
|
|||||||
--force|-f)
|
--force|-f)
|
||||||
FORCE=1
|
FORCE=1
|
||||||
;;
|
;;
|
||||||
|
--out-of-source-dir)
|
||||||
|
shift
|
||||||
|
OUT_OF_SOURCE_DIR="$1"
|
||||||
|
;;
|
||||||
--help|-h|*)
|
--help|-h|*)
|
||||||
usage()
|
usage()
|
||||||
exit 1
|
exit 1
|
||||||
@ -89,7 +96,7 @@ while [ $# -gt 0 ]; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ $FORCE -eq 1 ]; then
|
if [ $FORCE -eq 1 ]; then
|
||||||
rm -rf yotta/module
|
rm -rf yotta/module "$OUT_OF_SOURCE_DIR"
|
||||||
git checkout-index -f -q $CONFIG_H
|
git checkout-index -f -q $CONFIG_H
|
||||||
cleanup
|
cleanup
|
||||||
else
|
else
|
||||||
@ -101,6 +108,13 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -d "$OUT_OF_SOURCE_DIR" ]; then
|
||||||
|
echo "Warning - there is an existing directory at '$OUT_OF_SOURCE_DIR'" >&2
|
||||||
|
echo "You can either delete this directory manually, or force the test by rerunning"
|
||||||
|
echo "the script as: $0 --force --out-of-source-dir $OUT_OF_SOURCE_DIR"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if ! git diff-files --quiet include/mbedtls/config.h; then
|
if ! git diff-files --quiet include/mbedtls/config.h; then
|
||||||
echo $?
|
echo $?
|
||||||
echo "Warning - the configuration file 'include/mbedtls/config.h' has been edited. " >&2
|
echo "Warning - the configuration file 'include/mbedtls/config.h' has been edited. " >&2
|
||||||
@ -400,6 +414,19 @@ fi
|
|||||||
|
|
||||||
fi # MemSan
|
fi # MemSan
|
||||||
|
|
||||||
|
msg "build: cmake 'out-of-source' build"
|
||||||
|
cleanup
|
||||||
|
MBEDTLS_ROOT_DIR="$PWD"
|
||||||
|
mkdir "$OUT_OF_SOURCE_DIR"
|
||||||
|
cd "$OUT_OF_SOURCE_DIR"
|
||||||
|
cmake "$MBEDTLS_ROOT_DIR"
|
||||||
|
make
|
||||||
|
|
||||||
|
msg "test: cmake 'out-of-source' build"
|
||||||
|
make test
|
||||||
|
cd "$MBEDTLS_ROOT_DIR"
|
||||||
|
rm -rf "$OUT_OF_SOURCE_DIR"
|
||||||
|
|
||||||
msg "Done, cleaning up"
|
msg "Done, cleaning up"
|
||||||
cleanup
|
cleanup
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user