Files
basis_universal/contrib/single_file_transcoder/create_transcoder.sh
Carl Woffenden 2b08ab7248 Added a test to confirm amalgamation worked
Added 'simple.cpp' which does the bare mimimum to confirm the amalgamation worked (compiled and run after the combine step). Split the embedded .basis files from the Emscripten test so they can be shared. Fixed an error in the creation script (which caused it to always fail). Corrected the syntax for the unused functions (tested with older, less forgiving compilers).
2019-10-03 17:25:32 +02:00

38 lines
973 B
Bash
Executable File

#!/bin/sh
# Temporary compiled binary
OUT_FILE="tempbin"
echo "Amalgamating files... this can take a while"
echo "Note: basisu_transcoder_tables_bc7_m6.inc is excluded"
./combine.sh -r ../../transcoder -x basisu_transcoder_tables_bc7_m6.inc -o basisu_transcoder.cpp basisu_transcoder-in.cpp
# Did combining work?
if [ $? -ne 0 ]; then
echo "Combine script: FAILED"
exit 1
fi
echo "Combine script: PASSED"
# Compile the generated output
which cc > /dev/null
if [ $? -ne 0 ]; then
echo "(Skipping compile test)"
else
cc -std=c++11 -lstdc++ -Wall -Wextra -Werror -Os -g0 -fno-exceptions -fno-rtti -o $OUT_FILE examples/simple.cpp
# Did compilation work?
if [ $? -ne 0 ]; then
echo "Compiling simple.cpp: FAILED"
exit 1
fi
# Run then delete the compiled output
./$OUT_FILE
retVal=$?
rm -f $OUT_FILE
# Did the test work?
if [ $retVal -ne 0 ]; then
echo "Running simple.cpp: FAILED"
exit 1
fi
echo "Running simple.cpp: PASSED"
fi