Fix selection of default WASI implementation

extensions
Volodymyr Shymanskyy 3 years ago
parent 348031ec9d
commit f3594be2df

@ -77,14 +77,14 @@ jobs:
pip3 --version
- name: Install Wasienv
env:
WASMER_RELEASE_TAG: "1.0.1"
WASMER_RELEASE_TAG: "1.0.2"
run: curl https://raw.githubusercontent.com/wasienv/wasienv/master/install.sh | sh
- name: Configure
run: |
source $HOME/.wasienv/wasienv.sh
mkdir build
cd build
wasimake cmake -DBUILD_WASI=metawasi ..
wasimake cmake ..
- name: Build
run: |
source $HOME/.wasienv/wasienv.sh

@ -144,14 +144,14 @@ jobs:
pip3 --version
- name: Install Wasienv
env:
WASMER_RELEASE_TAG: "1.0.1"
WASMER_RELEASE_TAG: "1.0.2"
run: curl https://raw.githubusercontent.com/wasienv/wasienv/master/install.sh | sh
- name: Configure
run: |
source $HOME/.wasienv/wasienv.sh
mkdir build-wasi
cd build-wasi
wasimake cmake -DBUILD_WASI=metawasi ..
wasimake cmake ..
- name: Build
run: |
source $HOME/.wasienv/wasienv.sh

@ -1,17 +1,40 @@
cmake_minimum_required(VERSION 3.11)
set(BUILD_WASI "uvwasi" CACHE STRING "WASI implementation")
# Detect WasiEnv
if(DEFINED ENV{WASI_CC})
set(WASIENV 1)
endif()
# Detect MinGW
if(WIN32 AND CMAKE_C_COMPILER_ID MATCHES "GNU")
set(MINGW 1)
endif()
# Set options
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "set build type to Release")
endif()
if(WASIENV)
set(BUILD_WASI "metawasi" CACHE STRING "WASI implementation")
elseif(EMSCRIPTEN OR EMSCRIPTEN_LIB)
set(BUILD_WASI "none" CACHE STRING "WASI implementation")
else()
set(BUILD_WASI "uvwasi" CACHE STRING "WASI implementation")
endif()
set_property(CACHE BUILD_WASI PROPERTY STRINGS none simple uvwasi metawasi)
set(BUILD_NATIVE "Build with machine-specific optimisations" ON)
set(OUT_FILE "wasm3")
set(APP_DIR "platforms/app")
if(HARDCODED) # Bundle a wasm binary and run a hard-coded func
set(APP_DIR "platforms/emscripten")
if(NOT APP_DIR)
set(APP_DIR "platforms/app")
endif()
# Configure the toolchain
if(CLANG OR CLANG_SUFFIX)
set(CMAKE_C_COMPILER "clang${CLANG_SUFFIX}")
set(CMAKE_CXX_COMPILER "clang++${CLANG_SUFFIX}")
@ -36,8 +59,6 @@ if(EMSCRIPTEN OR EMSCRIPTEN_LIB)
set(CMAKE_C_COMPILER "emcc")
set(CMAKE_CXX_COMPILER "em++")
set(BUILD_WASI "none")
if (EMSCRIPTEN_LIB)
set(APP_DIR "platforms/emscripten_lib")
set(OUT_FILE "wasm3.wasm")
@ -48,23 +69,11 @@ if(EMSCRIPTEN OR EMSCRIPTEN_LIB)
endif()
endif()
# Detect WasiEnv
if(DEFINED ENV{WASI_CC})
set(WASIENV 1)
endif()
# Detect MinGW
if(WIN32 AND CMAKE_C_COMPILER_ID MATCHES "GNU")
set(MINGW 1)
endif()
if(BUILD_32BIT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "set build type to Release")
endif()
project(wasm3)
@ -101,7 +110,7 @@ if(EMSCRIPTEN OR EMSCRIPTEN_LIB)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} --strip-all --gc-sections")
if(WASM_EXT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mbulk-memory -mnontrapping-fptoint -msign-ext -mtail-call")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mbulk-memory -mnontrapping-fptoint -msign-ext -mtail-call")
endif()
elseif(WASIENV)
@ -113,7 +122,7 @@ elseif(WASIENV)
# https://www.mail-archive.com/llvm-bugs@lists.llvm.org/msg36273.html
#-flto -Wl,--lto-O3
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,stack-size=8388608")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,stack-size=8388608")
elseif(WIN32 AND NOT MINGW)

Loading…
Cancel
Save