Raise wasi-sdk to 25 and wabt to 1.0.37 (#4187)
Raise wasi-sdk to 25 and wabt to 1.0.37. It includes - Refactor CI workflow to install WASI-SDK and WABT from a composite action - Use ExternalProject to bring wasm-apps for few samples. file/ wasi-threads/ - Refactor sample build and test steps in SGX compilation workflow for improved clarity and efficiency (workaround) Add CMake support for EMSCRIPTEN and WAMRC, update module paths
This commit is contained in:
@ -6,4 +6,20 @@ project(file)
|
||||
|
||||
################ wasm application ###############
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(wasm-app)
|
||||
|
||||
# Use ExternalProject to avoid incorporating WAMR library compilation flags into the
|
||||
# compilation of the wasm application, which could lead to compatibility
|
||||
# issues due to different targets.
|
||||
# Like: clang: error: unsupported option '-arch' for target 'wasm32-wasi'
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake)
|
||||
find_package(WASISDK REQUIRED)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(wasm-app
|
||||
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/wasm-app"
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_SOURCE_DIR}/wasm-app -B build
|
||||
-DWASI_SDK_PREFIX=${WASISDK_HOME}
|
||||
-DCMAKE_TOOLCHAIN_FILE=${WASISDK_TOOLCHAIN}
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} --build build
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} --install build --prefix ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
@ -2,25 +2,10 @@
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project(wasm-app)
|
||||
project(file_wasm)
|
||||
|
||||
set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
|
||||
set (CMAKE_BUILD_TYPE Debug) # Otherwise no debug symbols (addr2line)
|
||||
|
||||
if (APPLE)
|
||||
set (HAVE_FLAG_SEARCH_PATHS_FIRST 0)
|
||||
set (CMAKE_C_LINK_FLAGS "")
|
||||
set (CMAKE_CXX_LINK_FLAGS "")
|
||||
endif ()
|
||||
|
||||
set (CMAKE_SYSTEM_PROCESSOR wasm32)
|
||||
|
||||
if (NOT DEFINED WASI_SDK_DIR)
|
||||
set (WASI_SDK_DIR "/opt/wasi-sdk")
|
||||
endif ()
|
||||
|
||||
set (CMAKE_C_COMPILER_TARGET "wasm32-wasi")
|
||||
set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wno-unused-command-line-argument")
|
||||
|
||||
add_executable(file.wasm main.c)
|
||||
target_link_libraries(file.wasm)
|
||||
add_executable(file main.c)
|
||||
set_target_properties (file PROPERTIES SUFFIX .wasm)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/file.wasm DESTINATION wasm-app)
|
||||
|
||||
Reference in New Issue
Block a user