diff --git a/CMakeLists.txt b/CMakeLists.txt index c0b6cfc8b589..309e3b8fbd0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -559,7 +559,7 @@ else() unset(CMAKE_REQUIRED_FLAGS) endif() - if(NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten" AND NCNN_COMPILER_SUPPORT_X86_AVX) + if(NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten|WASI" AND NCNN_COMPILER_SUPPORT_X86_AVX) option(NCNN_AVX "optimize x86 platform with avx extension" ON) if(NCNN_COMPILER_SUPPORT_X86_FMA) if(NCNN_AVX) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 35e46535a3b7..d3f55ce77900 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -395,8 +395,10 @@ if(NCNN_TARGET_ARCH STREQUAL "x86") endif() target_compile_options(ncnn PRIVATE /D__SSE2__) else() - target_compile_options(ncnn PRIVATE -msse2 -msse) - if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + if(NOT CMAKE_SYSTEM_NAME MATCHES "WASI") + target_compile_options(ncnn PRIVATE -msse2 -msse) + endif () + if(CMAKE_SYSTEM_NAME MATCHES "Emscripten|WASI") target_compile_options(ncnn PRIVATE -msimd128) endif() endif() diff --git a/src/cpu.cpp b/src/cpu.cpp index 370aeeb610c7..b1afbba3f651 100644 --- a/src/cpu.cpp +++ b/src/cpu.cpp @@ -17,8 +17,10 @@ #include "platform.h" #include +#ifndef __wasi__ #include #include +#endif // __wasi__ #include #include