-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Single test script for windows and mac.
Diffs= a35883508 Single test script for windows and mac. (#6642) Co-authored-by: Luigi Rosso <[email protected]>
- Loading branch information
1 parent
0de33c0
commit b1d54ea
Showing
3 changed files
with
98 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
37ce9aaea0cac79be8be140a3b9d13e3f2a4aa98 | ||
a358835081a47fba704a5ff13f2dd1c71ef1ffa6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,107 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
source ../dependencies/config_directories.sh | ||
source setup_premake.sh | ||
unameOut="$(uname -s)" | ||
case "${unameOut}" in | ||
Linux*) machine=linux ;; | ||
Darwin*) machine=macosx ;; | ||
MINGW*) machine=windows ;; | ||
*) machine="unhandled:${unameOut}" ;; | ||
esac | ||
|
||
CONFIG=debug | ||
|
||
for var in "$@"; do | ||
if [[ $var = "release" ]]; then | ||
CONFIG=release | ||
elif [ "$var" = "memory" ]; then | ||
echo Will perform memory checks... | ||
UTILITY='leaks --atExit --' | ||
shift | ||
elif [ "$var" = "lldb" ]; then | ||
echo Starting debugger... | ||
UTILITY='lldb' | ||
shift | ||
fi | ||
done | ||
|
||
if [[ ! -f "dependencies/bin/premake5" ]]; then | ||
mkdir -p dependencies/bin | ||
pushd dependencies | ||
if [[ $machine = "macosx" ]]; then | ||
# v5.0.0-beta2 doesn't support apple silicon properly, update the branch | ||
# once a stable one is avaialble that supports it | ||
git clone --depth 1 --branch master https://github.com/premake/premake-core.git | ||
pushd premake-core | ||
if [[ $LOCAL_ARCH == "arm64" ]]; then | ||
PREMAKE_MAKE_ARCH=ARM | ||
else | ||
PREMAKE_MAKE_ARCH=x86 | ||
fi | ||
make -f Bootstrap.mak osx PLATFORM=$PREMAKE_MAKE_ARCH | ||
cp bin/release/* ../bin | ||
popd | ||
elif [[ $machine = "windows" ]]; then | ||
pushd bin | ||
curl https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-windows.zip -L -o premake_windows.zip | ||
unzip premake_windows.zip | ||
rm premake_windows.zip | ||
popd | ||
fi | ||
popd | ||
fi | ||
|
||
export PREMAKE=$PWD/dependencies/bin/premake5 | ||
|
||
pushd test &>/dev/null | ||
|
||
OPTION=$1 | ||
UTILITY= | ||
|
||
if [ "$OPTION" = "help" ]; then | ||
echo test.sh - run the tests | ||
echo test.sh clean - clean and run the tests | ||
exit | ||
elif [ "$OPTION" = "clean" ]; then | ||
echo Cleaning project ... | ||
rm -fR out | ||
shift | ||
elif [ "$OPTION" = "memory" ]; then | ||
echo Will perform memory checks... | ||
UTILITY='leaks --atExit --' | ||
shift | ||
elif [ "$OPTION" = "debug" ]; then | ||
echo Starting debugger... | ||
UTILITY='lldb' | ||
shift | ||
for var in "$@"; do | ||
if [[ $var = "clean" ]]; then | ||
echo 'Cleaning...' | ||
rm -fR out | ||
fi | ||
done | ||
|
||
mkdir -p out | ||
|
||
if [[ $machine = "macosx" ]]; then | ||
TARGET=gmake2 | ||
elif [[ $machine = "windows" ]]; then | ||
TARGET=vs2022 | ||
fi | ||
|
||
unameOut="$(uname -s)" | ||
case "${unameOut}" in | ||
Linux*) NUM_CORES=$(grep -c processor /proc/cpuinfo) ;; | ||
Darwin*) NUM_CORES=$(($(sysctl -n hw.physicalcpu) + 1)) ;; | ||
MINGW*) NUM_CORES=$NUMBER_OF_PROCESSORS ;; | ||
*) NUM_CORES=4 ;; | ||
esac | ||
pushd ../../../ | ||
PACKAGES=$PWD | ||
popd | ||
|
||
export PREMAKE_PATH="$PACKAGES/runtime/dependencies/export-compile-commands":"$PACKAGES/runtime/build":"$PREMAKE_PATH" | ||
|
||
$PREMAKE --scripts=../../build gmake2 --with_rive_tools --with_rive_text --with_rive_audio=external --config=debug --out=out/debug | ||
make -C out/debug -j$NUM_CORES | ||
PREMAKE_COMMANDS="--with_rive_text --with_rive_audio=external --config=$CONFIG" | ||
|
||
$UTILITY out/debug/tests "$1" | ||
out_dir() { | ||
echo "out/$CONFIG" | ||
} | ||
if [[ $machine = "macosx" ]]; then | ||
OUT_DIR="$(out_dir)" | ||
$PREMAKE $TARGET $PREMAKE_COMMANDS --out=$OUT_DIR | ||
pushd $OUT_DIR | ||
make -j$(($(sysctl -n hw.physicalcpu) + 1)) | ||
popd | ||
$UTILITY $OUT_DIR/tests | ||
elif [[ $machine = "windows" ]]; then | ||
if [[ -f "$PROGRAMFILES/Microsoft Visual Studio/2022/Enterprise/Msbuild/Current/Bin/MSBuild.exe" ]]; then | ||
export MSBUILD="$PROGRAMFILES/Microsoft Visual Studio/2022/Enterprise/Msbuild/Current/Bin/MSBuild.exe" | ||
elif [[ -f "$PROGRAMFILES/Microsoft Visual Studio/2022/Community/Msbuild/Current/Bin/MSBuild.exe" ]]; then | ||
export MSBUILD="$PROGRAMFILES/Microsoft Visual Studio/2022/Community/Msbuild/Current/Bin/MSBuild.exe" | ||
fi | ||
OUT_DIR="$(out_dir)" | ||
echo $PREMAKE $TARGET $PREMAKE_COMMANDS --out=$OUT_DIR | ||
ls -l | ||
$PREMAKE $TARGET $PREMAKE_COMMANDS --out=$OUT_DIR | ||
pushd $OUT_DIR | ||
"$MSBUILD" rive.sln -m:$NUMBER_OF_PROCESSORS | ||
popd | ||
$OUT_DIR/tests.exe | ||
fi | ||
|
||
popd &>/dev/null |