summaryrefslogtreecommitdiffstats
path: root/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource
diff options
context:
space:
mode:
Diffstat (limited to 'fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource')
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/build_wasm.sh25
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/wamr_toolchain.cmake33
2 files changed, 58 insertions, 0 deletions
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/build_wasm.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/build_wasm.sh
new file mode 100755
index 000000000..3d8c06c4d
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/build_wasm.sh
@@ -0,0 +1,25 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+#!/bin/bash
+export CC=/opt/wasi-sdk/bin/clang
+export CXX=/opt/wasi-sdk/bin/clang++
+
+cd /mnt
+if [ -d build ];then
+ rm -fr build
+fi
+
+mkdir -p build && cd build
+echo "========> compile wasm with wasi-sdk"
+cmake -DWASI_SDK_DIR=/opt/wasi-sdk -DCMAKE_TOOLCHAIN_FILE=/opt/wamr-sdk/app/wamr_toolchain.cmake ../.wamr && make
+
+if [ $? -eq 0 ]; then
+ echo "========> compile wasm to AoT with wamrc"
+ # target name will be provided:
+ # - user input the target name in IDE
+ # - generated wasm binary name will be set as user's input target name
+ # - aot binary name should be the same as wasm binary name
+ # - target name will be provided through 1st parameter
+ wamrc -o $1.aot $1.wasm
+fi \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/wamr_toolchain.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/wamr_toolchain.cmake
new file mode 100755
index 000000000..97b82cc90
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/wamr_toolchain.cmake
@@ -0,0 +1,33 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+SET (CMAKE_SYSTEM_NAME Linux)
+SET (CMAKE_SYSTEM_PROCESSOR wasm32)
+SET (CMAKE_SYSROOT ${CMAKE_CURRENT_LIST_DIR}/libc-builtin-sysroot)
+
+IF (NOT (DEFINED WASI_SDK_DIR OR DEFINED CACHE{WASI_SDK_DIR}))
+ SET (WASI_SDK_DIR "/opt/wasi-sdk")
+ELSE ()
+ MESSAGE (STATUS "WASI_SDK_DIR=${WASI_SDK_DIR}")
+ LIST (APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES "WASI_SDK_DIR")
+ENDIF ()
+
+
+SET (CMAKE_C_FLAGS "-nostdlib" CACHE INTERNAL "")
+SET (CMAKE_C_COMPILER_TARGET "wasm32")
+SET (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
+
+SET (CMAKE_CXX_FLAGS "-nostdlib" CACHE INTERNAL "")
+SET (CMAKE_CXX_COMPILER_TARGET "wasm32")
+SET (CMAKE_CXX_COMPILER "${WASI_SDK_DIR}/bin/clang++")
+
+SET (CMAKE_EXE_LINKER_FLAGS
+ "-Wl,--no-entry,--fatal-warnings" CACHE INTERNAL "")
+
+SET (CMAKE_LINKER "${WASI_SDK_DIR}/bin/wasm-ld" CACHE INTERNAL "")
+SET (CMAKE_AR "${WASI_SDK_DIR}/bin/llvm-ar" CACHE INTERNAL "")
+SET (CMAKE_NM "${WASI_SDK_DIR}/bin/llvm-nm" CACHE INTERNAL "")
+SET (CMAKE_OBJDUMP "${WASI_SDK_DIR}/bin/llvm-dwarfdump" CACHE INTERNAL "")
+SET (CMAKE_RANLIB "${WASI_SDK_DIR}/bin/llvm-ranlib" CACHE INTERNAL "")
+SET (CMAKE_EXE_LINKER_FLAGS
+ "${CMAKE_EXE_LINKER_FLAGS},--allow-undefined-file=${CMAKE_SYSROOT}/share/defined-symbols.txt" CACHE INTERNAL "") \ No newline at end of file