File tree Expand file tree Collapse file tree 7 files changed +77
-48
lines changed Expand file tree Collapse file tree 7 files changed +77
-48
lines changed Original file line number Diff line number Diff line change @@ -329,12 +329,13 @@ jobs:
329
329
cmake --build . --config Release --parallel 4
330
330
working-directory : wamr-compiler
331
331
332
+ # cmake --build . --config Debug --parallel 4
332
333
- name : Build Sample [wasi-threads]
333
334
run : |
334
335
cd samples/wasi-threads
335
336
mkdir build && cd build
336
337
cmake ..
337
- cmake --build . --config Debug --parallel 4
338
+ cmake --build . --config Debug --verbose
338
339
./iwasm wasm-apps/no_pthread.wasm
339
340
340
341
../../../wamr-compiler/build/wamrc --size-level=0 --enable-multi-thread -o wasm-apps/no_pthread.aot wasm-apps/no_pthread.wasm
Original file line number Diff line number Diff line change @@ -229,27 +229,28 @@ jobs:
229
229
cp wamrc `pwd`/../../product-mini/platforms/${{ matrix.platform }}/enclave-sample
230
230
working-directory : wamr-compiler
231
231
232
+ # cmake --build . --config Debug --parallel 4
232
233
- name : Build Sample [file]
233
234
run : |
234
235
cd samples/file
235
236
mkdir build && cd build
236
237
cmake ..
237
- cmake --build . --config Debug --parallel 4
238
+ cmake --build . --config Debug --verbose
238
239
cp wasm-app/file.wasm `pwd`/../../../product-mini/platforms/${{ matrix.platform }}/enclave-sample
239
240
240
241
- name : Test Sample [file] in non-aot mode
241
242
if : matrix.iwasm_make_options_run_mode != '$AOT_BUILD_OPTIONS'
242
243
run : |
243
244
source /opt/intel/sgxsdk/environment
244
- ./iwasm --dir=. file.wasm
245
+ ./iwasm -f file.wasm -d .
245
246
working-directory : product-mini/platforms/${{ matrix.platform }}/enclave-sample
246
247
247
248
- name : Test Sample [file] in aot mode
248
249
if : matrix.iwasm_make_options_run_mode == '$AOT_BUILD_OPTIONS'
249
250
run : |
250
251
source /opt/intel/sgxsdk/environment
251
252
./wamrc -sgx -o file.aot file.wasm
252
- ./iwasm --dir=. file.aot
253
+ ./iwasm -f file.aot -d .
253
254
working-directory : product-mini/platforms/${{ matrix.platform }}/enclave-sample
254
255
255
256
spec_test_default :
Original file line number Diff line number Diff line change
1
+ # Copyright (C) 2019 Intel Corporation. All rights reserved.
2
+ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3
+
4
+ include (FindPackageHandleStandardArgs )
5
+
6
+ file (GLOB WASISDK_SEARCH_PATH "/opt/wasi-sdk-*" )
7
+ find_path (WASISDK_HOME
8
+ NAMES share/wasi-sysroot
9
+ PATHS ${WASISDK_SEARCH_PATH}
10
+ NO_DEFAULT_PATH
11
+ REQUIRED
12
+ )
13
+
14
+ string (REGEX MATCH [0-9]+\. [0-9]+\. *[0-9]* WASISDK_VERSION ${WASISDK_HOME} )
15
+
16
+ find_package_handle_standard_args (WASISDK REQUIRED_VARS WASISDK_HOME VERSION_VAR WASISDK_VERSION )
17
+
18
+ if (WASISDK_FOUND )
19
+ set (WASISDK_CC_COMMAND ${WASISDK_HOME} /bin/clang )
20
+ set (WASISDK_CXX_COMMAND ${WASISDK_HOME} /bin/clang++ )
21
+ set (WASISDK_TOOLCHAIN ${WASISDK_HOME} /share/cmake/wasi-sdk.cmake )
22
+ set (WASISDK_PTHREAD_TOOLCHAIN ${WASISDK_HOME} /share/cmake/wasi-sdk-pthread.cmake )
23
+ set (WASISDK_SYSROOT ${WASISDK_HOME} /share/wasi-sysroot )
24
+ endif ()
25
+ mark_as_advanced (WASISDK_CC_COMMAND WASISDK_CXX_COMMAND WASISDK_TOOLCHAIN WASISDK_PTHREAD_TOOLCHAIN WASISDK_SYSROOT WASISDK_HOME )
Original file line number Diff line number Diff line change @@ -6,4 +6,20 @@ project(file)
6
6
7
7
################ wasm application ###############
8
8
add_subdirectory (src )
9
- add_subdirectory (wasm-app )
9
+
10
+ # Use ExternalProject to avoid incorporating WAMR library compilation flags into the
11
+ # compilation of the wasm application, which could lead to compatibility
12
+ # issues due to different targets.
13
+ # Like: clang: error: unsupported option '-arch' for target 'wasm32-wasi'
14
+ list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} /../cmake )
15
+ find_package (WASISDK REQUIRED )
16
+
17
+ include (ExternalProject )
18
+ ExternalProject_Add (wasm-app
19
+ SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /wasm-app"
20
+ CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_SOURCE_DIR} /wasm-app -B build
21
+ -DWASI_SDK_PREFIX=${WASISDK_HOME}
22
+ -DCMAKE_TOOLCHAIN_FILE=${WASISDK_TOOLCHAIN}
23
+ BUILD_COMMAND ${CMAKE_COMMAND} --build build
24
+ INSTALL_COMMAND ${CMAKE_COMMAND} --install build --prefix ${CMAKE_CURRENT_BINARY_DIR}
25
+ )
Original file line number Diff line number Diff line change 2
2
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3
3
4
4
cmake_minimum_required (VERSION 3.14 )
5
- project (wasm-app )
5
+ project (file_wasm )
6
6
7
- set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR} /../../.. )
7
+ set (CMAKE_BUILD_TYPE Debug ) # Otherwise no debug symbols (addr2line )
8
8
9
- if (APPLE )
10
- set (HAVE_FLAG_SEARCH_PATHS_FIRST 0 )
11
- set (CMAKE_C_LINK_FLAGS "" )
12
- set (CMAKE_CXX_LINK_FLAGS "" )
13
- endif ()
14
-
15
- set (CMAKE_SYSTEM_PROCESSOR wasm32 )
16
-
17
- if (NOT DEFINED WASI_SDK_DIR )
18
- set (WASI_SDK_DIR "/opt/wasi-sdk" )
19
- endif ()
20
-
21
- set (CMAKE_C_COMPILER_TARGET "wasm32-wasi" )
22
- set (CMAKE_C_COMPILER "${WASI_SDK_DIR} /bin/clang" )
23
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wno-unused-command-line-argument" )
24
-
25
- add_executable (file .wasm main.c )
26
- target_link_libraries (file .wasm )
9
+ add_executable (file main.c )
10
+ set_target_properties (file PROPERTIES SUFFIX .wasm )
11
+ install (FILES ${CMAKE_CURRENT_BINARY_DIR} /file.wasm DESTINATION wasm-app )
Original file line number Diff line number Diff line change @@ -66,7 +66,24 @@ add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
66
66
67
67
68
68
################ wasm application ################
69
- add_subdirectory (wasm-apps )
69
+ # Use ExternalProject to avoid incorporating WAMR library compilation flags into the
70
+ # compilation of the wasm application, which could lead to compatibility
71
+ # issues due to different targets.
72
+ # Like: clang: error: unsupported option '-arch' for target 'wasm32-wasi'
73
+
74
+ list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} /../cmake )
75
+ find_package (WASISDK REQUIRED )
76
+
77
+ include (ExternalProject )
78
+ ExternalProject_Add (wasm-apps
79
+ SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /wasm-apps"
80
+ CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_SOURCE_DIR} /wasm-apps -B build
81
+ -DWASI_SDK_PREFIX=${WASISDK_HOME}
82
+ -DCMAKE_TOOLCHAIN_FILE=${WASISDK_PTHREAD_TOOLCHAIN}
83
+ BUILD_COMMAND ${CMAKE_COMMAND} --build build
84
+ INSTALL_COMMAND ${CMAKE_COMMAND} --install build --prefix ${CMAKE_CURRENT_BINARY_DIR}
85
+ )
86
+
70
87
71
88
################ wamr runtime ################
72
89
include (${SHARED_DIR} /utils/uncommon/shared_uncommon.cmake )
Original file line number Diff line number Diff line change 1
1
# Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3
3
4
- if (APPLE )
5
- set (HAVE_FLAG_SEARCH_PATHS_FIRST 0 )
6
- set (CMAKE_C_LINK_FLAGS "" )
7
- set (CMAKE_CXX_LINK_FLAGS "" )
8
- endif ()
4
+ cmake_minimum_required (VERSION 3.14 )
5
+ project (wasi_threads_wasm )
9
6
10
- if (NOT DEFINED WASI_SDK_DIR )
11
- set (WASI_SDK_DIR "/opt/wasi-sdk" )
12
- endif ()
13
-
14
- if (DEFINED WASI_SYSROOT )
15
- set (CMAKE_SYSROOT "${WASI_SYSROOT} " )
16
- endif ()
17
-
18
- set (CMAKE_C_COMPILER "${WASI_SDK_DIR} /bin/clang" )
19
- set (CMAKE_ASM_COMPILER "${WASI_SDK_DIR} /bin/clang" )
20
- set (CMAKE_EXE_LINKER_FLAGS "-target wasm32-wasi-threads" )
21
-
22
- if ("$ENV{COLLECT_CODE_COVERAGE} " STREQUAL "1" OR COLLECT_CODE_COVERAGE EQUAL 1 )
23
- set (CMAKE_C_FLAGS "" )
24
- set (CMAKE_CXX_FLAGS "" )
25
- endif ()
7
+ set (CMAKE_BUILD_TYPE Debug ) # Otherwise no debug symbols (addr2line)
26
8
27
9
function (compile_sample SOURCE_FILE )
28
10
get_filename_component (FILE_NAME ${SOURCE_FILE} NAME_WLE )
@@ -41,6 +23,8 @@ function (compile_sample SOURCE_FILE)
41
23
LINKER:--export=malloc
42
24
LINKER:--export=free
43
25
)
26
+
27
+ install (FILES ${CMAKE_CURRENT_BINARY_DIR} /${WASM_MODULE} DESTINATION wasm-apps )
44
28
endfunction ()
45
29
46
- compile_sample (no_pthread.c wasi_thread_start.S )
30
+ compile_sample (no_pthread.c wasi_thread_start.S )
You can’t perform that action at this time.
0 commit comments