Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the wasm graphic layer (wgl) and the gui sample #231

Merged
merged 22 commits into from
Apr 12, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
build.sdk.
  • Loading branch information
xwang98 committed Feb 21, 2020
commit ef611452cee67b5c83b5d23b54253960dbbfb572
14 changes: 14 additions & 0 deletions core/app-framework/base/native/base_lib.inl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/

EXPORT_WASM_API(wasm_register_resource),
EXPORT_WASM_API(wasm_response_send),
EXPORT_WASM_API(wasm_post_request),
EXPORT_WASM_API(wasm_sub_event),
EXPORT_WASM_API(wasm_create_timer),
EXPORT_WASM_API(wasm_timer_destroy),
EXPORT_WASM_API(wasm_timer_cancel),
EXPORT_WASM_API(wasm_timer_restart),
EXPORT_WASM_API(wasm_get_sys_tick_ms),
10 changes: 1 addition & 9 deletions core/app-framework/base/native/base_lib_export.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@
static NativeSymbol extended_native_symbol_defs[] = {
/* TODO: use macro EXPORT_WASM_API() or EXPORT_WASM_API2() to
add functions to register. */
EXPORT_WASM_API(wasm_register_resource),
EXPORT_WASM_API(wasm_response_send),
EXPORT_WASM_API(wasm_post_request),
EXPORT_WASM_API(wasm_sub_event),
EXPORT_WASM_API(wasm_create_timer),
EXPORT_WASM_API(wasm_timer_destroy),
EXPORT_WASM_API(wasm_timer_cancel),
EXPORT_WASM_API(wasm_timer_restart),
EXPORT_WASM_API(wasm_get_sys_tick_ms),
#include "base_lib.inl"
};

int get_base_lib_export_apis(NativeSymbol **p_base_lib_apis)
Expand Down
53 changes: 31 additions & 22 deletions wamr-sdk/build_sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ usage ()
echo " -x [config file path name]"
echo " -e [extra include path], files under this path will be copied into SDK package"
echo " -c, clean"
echo " -i, enter interactive config setting"
echo " -i, enter menu config settings"
exit 1
}

Expand Down Expand Up @@ -65,6 +65,14 @@ if [ ! -f "/opt/wasi-sdk/bin/clang" ]; then
exit 1
fi

if [ -z "$PROFILE" ]; then
PROFILE="default"
echo "PROFILE argument not set, using DEFAULT"
if [[ -z "$wamr_config_cmake_file" ]]; then
wamr_config_cmake_file=${sdk_root}/wamr_config_default.cmake
echo "use default config file: [$wamr_config_cmake_file]"
fi
fi


if [ ! -d "${out_dir}" ]; then
Expand Down Expand Up @@ -102,17 +110,17 @@ if [[ -n "$wamr_config_cmake_file" ]]; then

else
wamr_config_cmake_file=${out_dir}/wamr_config_${PROFILE}.cmake
# always rebuilt the sdk if user is not giving the config file
if [ -d ${curr_profile_dir} ]; then
rm -rf ${curr_profile_dir}
fi

if [[ "$MENUCONFIG" = "TRUE" ]]; then
if [[ "$MENUCONFIG" = "TRUE" ]] || [[ ! -f $wamr_config_cmake_file ]]; then
echo "MENUCONFIG: [${wamr_config_cmake_file}]"
./menuconfig.sh -x ${wamr_config_cmake_file}
[ $? -eq 0 ] || exit $?

elif [[ -f $wamr_config_cmake_file ]]; then
else
echo "use existing config file: [$wamr_config_cmake_file]"
else
wamr_config_cmake_file=${sdk_root}/wamr_config_default.cmake
echo "use default config file: [$wamr_config_cmake_file]"
fi
fi

Expand All @@ -137,6 +145,11 @@ echo "############## Start to build wasm app sdk ###############"
cd ${sdk_root}/app
rm -fr build && mkdir build
cd build

out=`grep WAMR_BUILD_LIBC_WASI ${wamr_config_cmake_file} |grep 1`
if [ -n "$out" ]; then
LIBC_SUPPORT="WASI"
fi
if [ "${LIBC_SUPPORT}" = "WASI" ]; then
echo "using wasi toolchain"
cmake .. $CMAKE_DEXTRA_SDK_INCLUDE_PATH -DWAMR_BUILD_SDK_PROFILE=${PROFILE} -DCONFIG_PATH=${wamr_config_cmake_file} -DCMAKE_TOOLCHAIN_FILE=../wasi_toolchain.cmake
Expand All @@ -145,8 +158,8 @@ else
cmake .. $CMAKE_DEXTRA_SDK_INCLUDE_PATH -DWAMR_BUILD_SDK_PROFILE=${PROFILE} -DCONFIG_PATH=${wamr_config_cmake_file} -DCMAKE_TOOLCHAIN_FILE=../wamr_toolchain.cmake
fi
[ $? -eq 0 ] || exit $?
make

make
if (( $? == 0 )); then
echo -e "\033[32mSuccessfully built app-sdk under ${curr_profile_dir}/app-sdk\033[0m"
else
Expand All @@ -156,8 +169,10 @@ fi

cd ..
rm -fr build

echo -e "\n\n"



echo "############## Start to build runtime sdk ###############"
cd ${sdk_root}/runtime
rm -fr build_runtime_sdk && mkdir build_runtime_sdk
Expand All @@ -173,21 +188,15 @@ else
exit 1
fi

cd ..
rm -fr build_runtime_sdk

if [ "$APP" = "TRUE" ]; then
APP=`grep WAMR_BUILD_APP_FRAMEWORK ${wamr_config_cmake_file} |grep 1`
if [ -n "$APP" ]; then
# Generate defined-symbol list for app-sdk
cd ${wamr_app_out_dir}/share
cat ${curr_profile_dir}/runtime-sdk/include/*.inl | egrep "^ *EXPORT_WASM_API *[(] *[a-zA-Z_][a-zA-Z0-9_]* *?[)]" | cut -d '(' -f2 | cut -d ')' -f1 > defined-symbols.txt
echo "wasm_register_resource" >> defined-symbols.txt
echo "wasm_response_send" >> defined-symbols.txt
echo "wasm_post_request" >> defined-symbols.txt
echo "wasm_sub_event" >> defined-symbols.txt
echo "wasm_create_timer" >> defined-symbols.txt
echo "wasm_timer_destroy" >> defined-symbols.txt
echo "wasm_timer_cancel" >> defined-symbols.txt
echo "wasm_timer_restart" >> defined-symbols.txt
echo "wasm_get_sys_tick_ms" >> defined-symbols.txt
fi


cd ..
rm -fr build_runtime_sdk

exit 0