Fix some compile issues of samples (#690)

Fix compile errors of workloads due to emsdk version upgrade,
enable BUILD_TARGET auto set for some samples,
and call wasm_runtime_init_thread_env() for in thread routine which
was created by pthread_create but not runtime in spawn-thread sample.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-08-06 18:12:21 +08:00
committed by GitHub
parent 541f577164
commit 0db04e0b8f
23 changed files with 902 additions and 304 deletions

View File

@ -5,52 +5,7 @@ cmake_minimum_required (VERSION 3.0)
project(bench-meshoptimizer)
################ WASI-SDK ################
find_path(WASI_SDK_HOME
NAMES wasi-sdk
PATHS /opt/
REQUIRED
)
if (NOT WASI_SDK_HOME)
message(FATAL_ERROR
"can not find wasi-sdk. "
"please download it from "
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz "
"and install it under /opt/wasi-sdk"
)
endif()
#
# check clang version
execute_process(COMMAND
${WASI_SDK_HOME}/wasi-sdk/bin/clang --version
OUTPUT_VARIABLE clang_full_version_string
)
string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1"
CLANG_VERSION_STRING ${clang_full_version_string}
)
message("cur clang version is ${CLANG_VERSION_STRING}")
if(CLANG_VERSION_STRING VERSION_LESS 11.0)
message(FATAL_ERROR
"please install latest wai-sdk to get a clang-11 at least"
)
endif()
################ BINARYEN ################
find_program(WASM_OPT
NAMES wasm-opt
PATHS /opt/binaryen-version_97/bin /opt/binaryen/bin
)
if (NOT WASM_OPT)
message(FATAL_ERROR
"can not find wasm-opt. "
"please download it from "
"https://github.com/WebAssembly/binaryen/releases/download/version_97/binaryen-version_97-x86_64-linux.tar.gz "
"and install it under /opt"
)
endif()
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/preparation.cmake)
################ MESHOPTIMIZER ################
include(ExternalProject)

View File

@ -32,7 +32,7 @@ $ em++ tools/codecbench.cpp src/vertexcodec.cpp src/vertexfilter.cpp \
src/spatialorder.cpp src/allocator.cpp src/vcacheanalyzer.cpp \
src/vfetchoptimizer.cpp src/overdrawoptimizer.cpp src/simplifier.cpp \
src/stripifier.cpp -O3 -msimd128 \
-s TOTAL_MEMORY=268435456 -s "EXPORTED_FUNCTIONS=['_main']" \
-s TOTAL_MEMORY=268435456 \
-o codecbench.wasm
$ ls -l codecbench.wasm
```