diff --git a/contrib/single_file_transcoder/basisutranslib-in.cpp b/contrib/single_file_transcoder/basisutranslib-in.cpp index 5a50ed0..219667f 100644 --- a/contrib/single_file_transcoder/basisutranslib-in.cpp +++ b/contrib/single_file_transcoder/basisutranslib-in.cpp @@ -3,20 +3,19 @@ * \code * ./combine.sh -r ../../transcoder -o basisutranslib.cpp basisutranslib-in.cpp * \endcode - * - * \todo remove the need for -Wno-pragma-once-outside-header when compiling standalone */ /* - * Build options for known platforms. + * Transcoder build options for known platforms (iOS has ETC, ASTC and PVRTC; + * Emscripten same as iOS plus DXT; other platforms build all). * - * Note: BASISD_SUPPORT_DXT5A needs enabling for BC3 + * Note: BC3 needs BASISD_SUPPORT_DXT5A enabling */ #ifdef __APPLE__ #include #endif #if TARGET_OS_IPHONE -#define BASISD_SUPPORT_DXT1 0 +#define BASISD_SUPPORT_DXT1 0 #define BASISD_SUPPORT_DXT5A 0 #endif #if TARGET_OS_IPHONE || defined(__EMSCRIPTEN__) diff --git a/contrib/single_file_transcoder/combine.sh b/contrib/single_file_transcoder/combine.sh index 00b7b26..ccf11cc 100755 --- a/contrib/single_file_transcoder/combine.sh +++ b/contrib/single_file_transcoder/combine.sh @@ -7,7 +7,7 @@ # # TODO: ROOTS and FOUND as arrays (since they fail on paths with spaces) # -# Released under a CC0 license. +# Script released under a CC0 license. # Common file roots ROOTS="./" @@ -29,10 +29,10 @@ usage() { # Tests that the grep implementation works as expected (older OSX grep fails) test_grep() { - if ! echo '#include "foo"' | grep -Eq '^\s*#\s*include\s*".+"'; then - echo "Aborting: the grep implementation fails to parse include lines" - exit 1 - fi + if ! echo '#include "foo"' | grep -Eq '^\s*#\s*include\s*".+"'; then + echo "Aborting: the grep implementation fails to parse include lines" + exit 1 + fi } # Tests if list $1 has item $2 (returning zero on a match) @@ -83,8 +83,10 @@ add_file() { write_line "/**** skipping file: $inc ****/" fi else - # Otherwise write the source line - write_line "$line" + # Skip any 'pragma once' directives, otherwise write the source line + if echo "$line" | grep -Eqv '^\s*#\s*pragma\s*once\s*'; then + write_line "$line" + fi fi done < "$file" else diff --git a/contrib/single_file_transcoder/examples/emscripten.cpp b/contrib/single_file_transcoder/examples/emscripten.cpp index 19eb8c3..08bd9f4 100644 --- a/contrib/single_file_transcoder/examples/emscripten.cpp +++ b/contrib/single_file_transcoder/examples/emscripten.cpp @@ -9,10 +9,17 @@ * export EM_FLAGS="-s ENVIRONMENT=web -s WASM=1 --shell-file shell.html --closure 1" * emcc $CC_FLAGS $EM_FLAGS -o out.html emscripten.cpp * \endcode - * Alternatively include the transcoder header and build \c basisutranslib - * separately (the resulting binary is exactly the same size). + * Alternatively include \c basisu_transcoder.h and build \c basisutranslib + * separately (the resulting binary is exactly the same size): + * \code + * emcc $CC_FLAGS $EM_FLAGS -o out.html ../basisutranslib.cpp emscripten.cpp + * \encode + * To determine the WebAssembly size without the transcoder comment the \c + * basisutranslib.cpp include (which stubs the texture creation). * \n * Example code released under a CC0 license. + * + * \todo add mipmap support to the example */ #include @@ -25,7 +32,7 @@ #include #include -#include "../basisutranslib.cpp" //<-- can be built without to determine the size +#include "../basisutranslib.cpp" //********************************* Test Data ********************************/