Updated the opus build and enforced as emscripten web build

canary
WolverinDEV 2020-03-30 18:16:03 +02:00
parent 0e3a415983
commit 8f80ba42e8
5 changed files with 54 additions and 11 deletions

4
asm/.gitignore vendored
View File

@ -1,2 +1,4 @@
generated/
build/
build_/
libraries/opus/build_
libraries/opus/out

View File

@ -8,7 +8,7 @@ set(CMAKE_C_COMPILER "emcc")
set(CMAKE_C_LINK_EXECUTABLE "emcc")
set(CMAKE_CXX_FLAGS "-O3 --llvm-lto 1 --memory-init-file 0 -s WASM=1 -s ASSERTIONS=1") # -s ALLOW_MEMORY_GROWTH=1 -O3
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_EXE_LINKER_FLAGS "-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\", \"Pointer_stringify\"]'") #
set(CMAKE_EXE_LINKER_FLAGS "-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\", \"Pointer_stringify\"]' -s ENVIRONMENT='web'") #
#add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/generated/")
@ -18,4 +18,4 @@ include_directories(libraries/opus/include/)
add_definitions(-DLTM_DESC)
add_executable(TeaWeb-Worker-Codec-Opus src/opus.cpp)
target_link_libraries(TeaWeb-Worker-Codec-Opus ${CMAKE_CURRENT_SOURCE_DIR}/libraries/opus/.libs/libopus.a)
target_link_libraries(TeaWeb-Worker-Codec-Opus ${CMAKE_CURRENT_SOURCE_DIR}/libraries/opus/out/lib/libopus.a)

20
asm/build.sh Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash
[[ ! -d libraries/opus/out/ ]] && { echo "Missing opus build. Please build it before!"; exit 1; }
[[ ! -f libraries/opus/out/lib/libopus.a ]] && { echo "Missing opus static library. Please unsure your opus build was successfull."; exit 1; }
[[ -d build_ ]] && {
rm -r build_ || { echo "failed to remove old build directory"; exit 1; }
}
mkdir build_ || exit 1
cd build_ || exit 1
emcmake cmake .. || {
echo "Failed to execute cmake"
exit 1
}
emmake make || {
echo "Failed to build file"
exit 1
}

@ -1 +1 @@
Subproject commit 655cc54c564b84ef2827f0b2152ce3811046201e
Subproject commit 923bebde197f42ba8e55cb055dce3ff22bbea54d

View File

@ -1,11 +1,32 @@
#!/usr/bin/env bash
base_dir=`pwd`
cd "$(dirname $0)/libraries/opus/"
cd "$(dirname $0)/libraries/opus/" || { echo "Failed to enter the opus directory."; exit 1; }
git checkout v1.1.2
./autogen.sh
emconfigure ./configure --disable-extra-programs --disable-doc --disable-rtcd
emmake make
[[ -d build_ ]] && {
rm -r build_ || { echo "failed to remove old build directory"; exit 1; }
}
mkdir build_ || exit 1
cd build_ || exit 1
cd ${base_dir}
# Native SIMD isn't supported yet by most browsers (only experimental)
# So there is no need to build with that, it will make stuff even worse
simd_flags="-DOPUS_X86_MAY_HAVE_AVX=OFF -DOPUS_X86_MAY_HAVE_SSE4_1=OFF -DOPUS_X86_MAY_HAVE_SSE2=OFF -DOPUS_X86_MAY_HAVE_SSE=OFF"
emcmake cmake .. -DCMAKE_INSTALL_PREFIX="$(pwd)/../out/" -DOPUS_STACK_PROTECTOR=OFF ${simd_flags} || {
echo "failed to execute cmake"
exit 1
}
emmake make || {
echo "failed to build opus"
exit 1
}
emmake make install || {
echo "failed to \"install\" opus"
exit 1
}
# Old:
#git checkout v1.1.2
#./autogen.sh
#emconfigure ./configure --disable-extra-programs --disable-doc --disable-rtcd
#emmake make