Implement WAMR-IDE with vscode extension (#943)
Implement WAMR-IDE with vscode extension to enable developing WebAssembly applications with coding, building, running and debugging support. Support both Linux and Windows, and only support putting all the tools in a docker image, e.g. wasi-sdk, wamrc, iwasm and so on. Co-authored-by: Wang Ning <justdoitwn@163.com>
This commit is contained in:
@ -0,0 +1,40 @@
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
cmake_minimum_required (VERSION 2.9)
|
||||
|
||||
project(Main)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/project.cmake)
|
||||
|
||||
set (CMAKE_SYSROOT /opt/wamr-sdk/app/libc-builtin-sysroot)
|
||||
|
||||
set (CMAKE_C_FLAGS " -nostdlib -g -Wno-unused-command-line-argument " CACHE INTERNAL "")
|
||||
|
||||
set (CMAKE_CXX_FLAGS " -nostdlib -g" CACHE INTERNAL "")
|
||||
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -z stack-size=${STACK_SIZE}")
|
||||
|
||||
set (CMAKE_EXE_LINKER_FLAGS
|
||||
"-Wl,--initial-memory=${INIT_MEM_SIZE},--max-memory=${MAX_MEM_SIZE}, \
|
||||
-Wl,--no-entry,")
|
||||
|
||||
set (CMAKE_EXE_LINKER_FLAGS
|
||||
"${CMAKE_EXE_LINKER_FLAGS} \
|
||||
${EXPORTED_SYMBOLS},")
|
||||
|
||||
set (CMAKE_EXE_LINKER_FLAGS
|
||||
"${CMAKE_EXE_LINKER_FLAGS} \
|
||||
-Wl,--allow-undefined-file=${CMAKE_SYSROOT}/share/defined-symbols.txt" CACHE INTERNAL "")
|
||||
|
||||
set (SRC_LIST
|
||||
${PROJECT_SRC_LIST})
|
||||
|
||||
set (HEADER_LIST
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
||||
${PROJECT_INCLUDES})
|
||||
|
||||
include_directories(${HEADER_LIST})
|
||||
|
||||
add_executable (${OUTPUT_FILE_NAME} ${SRC_LIST})
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
@REM Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
@REM SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
@echo off
|
||||
set target_name=%1
|
||||
|
||||
docker run -it --name=wasm-debug-server-ctr ^
|
||||
-v "%cd%":/mnt ^
|
||||
-p 1234:1234 ^
|
||||
wasm-debug-server:1.0 ^
|
||||
/bin/bash -c "./debug.sh %target_name%"
|
||||
|
||||
@REM stop and remove wasm-debug-server-container
|
||||
docker stop wasm-debug-server-ctr && docker rm wasm-debug-server-ctr
|
||||
@ -0,0 +1,14 @@
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
target_name=$1
|
||||
|
||||
docker run -it --name=wasm-debug-server-ctr \
|
||||
-v $(pwd):/mnt \
|
||||
-p 1234:1234 \
|
||||
wasm-debug-server:1.0 \
|
||||
/bin/bash -c "./debug.sh ${target_name}"
|
||||
|
||||
docker stop wasm-debug-server-ctr && docker rm wasm-debug-server-ctr
|
||||
@ -0,0 +1,14 @@
|
||||
@REM Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
@REM SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
@echo off
|
||||
set AoT_Binary_Name=%1
|
||||
|
||||
@REM start a container, mount current project path to container/mnt
|
||||
docker run --name=wasm-toolchain-provider-ctr ^
|
||||
-it -v %cd%:/mnt ^
|
||||
wasm-toolchain-provider:1.0 ^
|
||||
/bin/bash -c "./build_wasm.sh %AoT_Binary_Name%"
|
||||
|
||||
@REM stop and remove wasm-toolchain-ctr container
|
||||
docker stop wasm-toolchain-provider-ctr && docker rm wasm-toolchain-provider-ctr
|
||||
@ -0,0 +1,19 @@
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
AoT_Binary_Name=$1
|
||||
|
||||
# start & run docker image and build wasm
|
||||
if test ! -z "$(docker ps -a | grep wasm-toolchain-ctr)"; then
|
||||
sudo docker rm wasm-toolchain-ctr
|
||||
fi
|
||||
|
||||
sudo docker run --name=wasm-toolchain-provider-ctr \
|
||||
-it -v $(pwd):/mnt \
|
||||
wasm-toolchain-provider:1.0 \
|
||||
/bin/bash -c "./build_wasm.sh $AoT_Binary_Name"
|
||||
|
||||
# stop and remove wasm-toolchain-ctr container
|
||||
sudo docker stop wasm-toolchain-provider-ctr && sudo docker rm wasm-toolchain-provider-ctr
|
||||
@ -0,0 +1,17 @@
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
set (OUTPUT_FILE_NAME)
|
||||
|
||||
set (INIT_MEM_SIZE)
|
||||
|
||||
set (MAX_MEM_SIZE)
|
||||
|
||||
set (STACK_SIZE)
|
||||
|
||||
set (EXPORTED_SYMBOLS)
|
||||
|
||||
set (PROJECT_SRC_LIST)
|
||||
|
||||
set (PROJECT_INCLUDES)
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
@REM Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
@REM SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
@echo off
|
||||
set target_name=%1
|
||||
|
||||
docker run -it --name=wasm-executor-ctr ^
|
||||
-v "%cd%":/mnt ^
|
||||
wasm-debug-server:1.0 ^
|
||||
/bin/bash -c "./run.sh %target_name%"
|
||||
|
||||
@REM stop and remove wasm-executor-ctr
|
||||
docker stop wasm-executor-ctr && docker rm wasm-executor-ctr
|
||||
12
test-tools/wamr-ide/VSCode-Extension/resource/scripts/run.sh
Normal file
12
test-tools/wamr-ide/VSCode-Extension/resource/scripts/run.sh
Normal file
@ -0,0 +1,12 @@
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#!/bin/bash
|
||||
target_name=$1
|
||||
|
||||
docker run -it --name=wasm-debug-server-ctr \
|
||||
-v $(pwd):/mnt \
|
||||
wasm-debug-server:1.0 \
|
||||
/bin/bash -c "./run.sh ${target_name}"
|
||||
|
||||
docker stop wasm-debug-server-ctr && docker rm wasm-debug-server-ctr
|
||||
Reference in New Issue
Block a user