Browse Source

Merge pull request #1 from xujuntwt95329/master

update menuconfig.sh
Wang Xin 6 years ago
parent
commit
d886f1a4d0
4 changed files with 74 additions and 103 deletions
  1. 4 0
      core/app-framework/wgl/app/wasm_app.cmake
  2. 6 27
      wamr-sdk/Kconfig
  3. 23 5
      wamr-sdk/build_sdk.sh
  4. 41 71
      wamr-sdk/menuconfig.sh

+ 4 - 0
core/app-framework/wgl/app/wasm_app.cmake

@@ -5,6 +5,10 @@ set (WASM_APP_GUI_DIR ${CMAKE_CURRENT_LIST_DIR})
 
 
 set (DEPS_DIR ${WASM_APP_GUI_DIR}/../../../deps)
 set (DEPS_DIR ${WASM_APP_GUI_DIR}/../../../deps)
 
 
+if (NOT EXISTS "${DEPS_DIR}/lvgl")
+    message (FATAL_ERROR "Can not find third party dependency: ${DEPS_DIR}/lvgl")
+endif ()
+
 include_directories(${WASM_APP_GUI_DIR}
 include_directories(${WASM_APP_GUI_DIR}
                     ${DEPS_DIR}
                     ${DEPS_DIR}
                     ${DEPS_DIR}/lvgl
                     ${DEPS_DIR}/lvgl

+ 6 - 27
wamr-sdk/Kconfig

@@ -1,12 +1,5 @@
 mainmenu "WebAssembly Micro Runtime Configuration"
 mainmenu "WebAssembly Micro Runtime Configuration"
 
 
-config WAMR_SDK_PROFILE
-    string "wamr SDK profile name"
-    default "default"
-    help
-        create a new SDK by giving a name or overwrite
-        the "default" profile
-
 choice
 choice
     prompt "select a build target"
     prompt "select a build target"
 
 
@@ -64,9 +57,7 @@ choice
 
 
 endchoice
 endchoice
 
 
- 
-
-choice 
+choice
     prompt "application framework"
     prompt "application framework"
     config APP_FRAMEWORK_DISABLE
     config APP_FRAMEWORK_DISABLE
         bool "Disable app framework"
         bool "Disable app framework"
@@ -77,29 +68,17 @@ choice
         bool "Default components"
         bool "Default components"
         help
         help
             Default components
             Default components
-            
-    config TRI_CHOICE_SYM_2
-         tristate "Tristate choice sym 2"
 
 
-    config APP_BUILD_CUSTOM
+    config APP_FRAMEWORK_ALL
+        bool "All components"
+
+    config APP_FRAMEWORK_CUSTOM
         bool "customized module config"
         bool "customized module config"
 
 
     menu "modules:"
     menu "modules:"
-        depends on APP_BUILD_CUSTOM
+        depends on APP_FRAMEWORK_CUSTOM
 
 
         source ".wamr_modules"
         source ".wamr_modules"
 
 
     endmenu
     endmenu
 endchoice
 endchoice
-
-config EXTRA_INCLUDE_ENABLE
-    bool "enable extra include dir"
-
-config EXTRA_INCLUDE_PATH
-    string "external include path"
-    depends on EXTRA_INCLUDE_ENABLE
-    help
-        Pass external include path to be added in the SDK
-        This is useful when your app modules need some external
-        header files, such as the wgl modules which need some config
-        file when building the runtime library

+ 23 - 5
wamr-sdk/build_sdk.sh

@@ -95,7 +95,7 @@ fi
 
 
 # cmake config file for wamr runtime:
 # cmake config file for wamr runtime:
 # 1. use the users provided the config cmake file path.
 # 1. use the users provided the config cmake file path.
-# 2. if user set MENU CONFIG, enter menu config to generate 
+# 2. if user set MENU CONFIG, enter menu config to generate
 #    menu_config.cmake in the profile output folder
 #    menu_config.cmake in the profile output folder
 # 3. If the menu_config.cmake is already in the profile folder, use it
 # 3. If the menu_config.cmake is already in the profile folder, use it
 # 4. Use the default config cmake file
 # 4. Use the default config cmake file
@@ -105,16 +105,16 @@ if [[ -n "$wamr_config_cmake_file" ]]; then
 	   echo "user given file not exist: ${wamr_config_cmake_file}"
 	   echo "user given file not exist: ${wamr_config_cmake_file}"
 	   exit 1
 	   exit 1
 	fi
 	fi
-	
+
 	echo "User config file: [${wamr_config_cmake_file}]"
 	echo "User config file: [${wamr_config_cmake_file}]"
-	
+
 else
 else
 	wamr_config_cmake_file=${out_dir}/wamr_config_${PROFILE}.cmake
 	wamr_config_cmake_file=${out_dir}/wamr_config_${PROFILE}.cmake
-    # always rebuilt the sdk if user is not giving the config file	
+    # always rebuilt the sdk if user is not giving the config file
 	if [ -d ${curr_profile_dir} ]; then
 	if [ -d ${curr_profile_dir} ]; then
 	   rm -rf ${curr_profile_dir}
 	   rm -rf ${curr_profile_dir}
 	fi
 	fi
-	
+
 	if [[ "$MENUCONFIG" = "TRUE" ]] || [[ ! -f $wamr_config_cmake_file ]]; then
 	if [[ "$MENUCONFIG" = "TRUE" ]] || [[ ! -f $wamr_config_cmake_file ]]; then
 		echo "MENUCONFIG: [${wamr_config_cmake_file}]"
 		echo "MENUCONFIG: [${wamr_config_cmake_file}]"
 		./menuconfig.sh -x ${wamr_config_cmake_file}
 		./menuconfig.sh -x ${wamr_config_cmake_file}
@@ -146,6 +146,24 @@ cd ${sdk_root}/app
 rm -fr build && mkdir build
 rm -fr build && mkdir build
 cd build
 cd build
 
 
+# If wgl module is selected, check if the extra SDK include dir is passed by the args, prompt user to input if not.
+app_all_selected=`cat ${wamr_config_cmake_file} | grep WAMR_APP_BUILD_ALL`
+app_wgl_selected=`cat ${wamr_config_cmake_file} | grep WAMR_APP_BUILD_WGL`
+
+if [[ -n "${app_wgl_selected}" ]] || [[ -n "${app_all_selected}" ]]; then
+    if [ -z "${CMAKE_DEXTRA_SDK_INCLUDE_PATH}" ]; then
+        echo -e "\033[31mWGL module require lvgl config files, please input the path to the lvgl SDK include path:\033[0m"
+        read -a extra_file_path
+
+        if [[ -z "${extra_file_path}" ]] || [[ ! -d "${extra_file_path}" ]]; then
+            echo -e "\033[31mThe extra SDK path is invalid, exiting\033[0m"
+            exit 1
+        else
+            CMAKE_DEXTRA_SDK_INCLUDE_PATH="-DEXTRA_SDK_INCLUDE_PATH=${extra_file_path}"
+        fi
+    fi
+fi
+
 out=`grep WAMR_BUILD_LIBC_WASI ${wamr_config_cmake_file} |grep 1`
 out=`grep WAMR_BUILD_LIBC_WASI ${wamr_config_cmake_file} |grep 1`
 if [ -n "$out" ]; then
 if [ -n "$out" ]; then
     LIBC_SUPPORT="WASI"
     LIBC_SUPPORT="WASI"

+ 41 - 71
wamr-sdk/menuconfig.sh

@@ -146,104 +146,74 @@ if [ ! -e ".config" ]; then
     exit 0
     exit 0
 fi
 fi
 
 
-
-args=""
-function args_add_bool()
-{
-    args="${args} -$1"
-}
-
-function args_add_one()
-{
-    args="${args} -$1 $2"
-}
-
-function args_add_array()
-{
-    args="${args} -$1 ${2#,}"
-}
-
-source .config
-
-profile=`cat .config | grep "^CONFIG_WAMR_SDK_PROFILE"`
-profile=${profile#CONFIG_WAMR_SDK_PROFILE=\"}
-profile=${profile%*\"}
-args_add_one n ${profile}
-
+# parse platform
 platform=`cat .config | grep "^CONFIG_PLATFORM"`
 platform=`cat .config | grep "^CONFIG_PLATFORM"`
 platform=${platform%*=y}
 platform=${platform%*=y}
 platform=${platform,,}
 platform=${platform,,}
 platform=${platform#config_platform_}
 platform=${platform#config_platform_}
-if [ -n "${platform}" ]; then
-    args_add_one p ${platform#config_platform_}
-fi
 
 
+# parse target
 target=`cat .config | grep "^CONFIG_TARGET"`
 target=`cat .config | grep "^CONFIG_TARGET"`
 target=${target%*=y}
 target=${target%*=y}
 target=${target#CONFIG_TARGET_}
 target=${target#CONFIG_TARGET_}
-if [ -n "${target}" ]; then
-    args_add_one t ${target#CONFIG_TARGET_}
-fi
-
 
 
+# parse execution mode
 modes=`cat .config | grep "^CONFIG_EXEC"`
 modes=`cat .config | grep "^CONFIG_EXEC"`
-arg_mode=""
+mode_list=""
 for mode in ${modes}
 for mode in ${modes}
 do
 do
     mode=${mode%*=y}
     mode=${mode%*=y}
     mode=${mode#CONFIG_EXEC_}
     mode=${mode#CONFIG_EXEC_}
-    arg_mode="${arg_mode},${mode,,}"
+    mode_list="${mode_list} ${mode,,}"
 done
 done
-if [ -z "${arg_mode}" ]; then
+if [ -z "${mode_list}" ]; then
     echo "execution mode are not selected"
     echo "execution mode are not selected"
     exit 1
     exit 1
 fi
 fi
-args_add_array m "${arg_mode}"
 
 
+# parse libc support
 libc=`cat .config | grep "^CONFIG_LIBC"`
 libc=`cat .config | grep "^CONFIG_LIBC"`
 libc=${libc%*=y}
 libc=${libc%*=y}
 if [ "${libc}" = "CONFIG_LIBC_WASI" ]; then
 if [ "${libc}" = "CONFIG_LIBC_WASI" ]; then
-    args_add_bool w
-fi
-
-app_en=`cat .config | grep "^CONFIG_APP_FRAMEWORK"`
-app_en=${app_en%*=y}
-app_en=${app_en,,}
-if [ -n "${app_en}" ]; then
-    args_add_bool a
-fi
-
-apps=`cat .config | grep "^CONFIG_APP_BUILD"`
-arg_app=""
-for app in ${apps}
-do
-    app=${app%*=y}
-    app=${app#CONFIG_APP_BUILD_}
-    arg_app="${arg_app},${app,,}"
-done
-
-if [ -n "${app_en}" ]; then
-    arg_app="${arg_app},base"
-    args_add_array l "${arg_app}"
+    libc_support="WASI"
+else
+    libc_support="BUILTIN"
 fi
 fi
 
 
-extra_path=`cat .config | grep "^CONFIG_EXTRA_INCLUDE_PATH"`
-if [ -n "${extra_path}" ]; then
-    extra_path=${extra_path#CONFIG_EXTRA_INCLUDE_PATH=\"}
-    extra_path=${extra_path%*\"}
-    args_add_one e ${extra_path}
+# parse application framework options
+app_option=`cat .config | grep "^CONFIG_APP_FRAMEWORK"`
+app_option=${app_option%*=y}
+app_option=${app_option#CONFIG_APP_FRAMEWORK_}
+
+if [ "${app_option}" != "DISABLE" ]; then
+    app_enable="TRUE"
+
+    # Default components
+    if [ "${app_option}" = "DEFAULT" ]; then
+        app_list="base connection sensor"
+    # All components
+    elif [ "${app_option}" = "ALL" ]; then
+        app_list="all"
+    # Customize
+    elif [ "${app_option}" = "CUSTOM" ]; then
+        app_option=`cat .config | grep "^CONFIG_APP_BUILD"`
+        app_list="base"
+        for app in ${app_option}
+        do
+            app=${app%*=y}
+            app=${app#CONFIG_APP_BUILD_}
+            app_list="${app_list} ${app,,}"
+        done
+    fi
 fi
 fi
 
 
-args="-g ${args}"
-
-
 if  [[ -f $wamr_config_cmake_file ]]; then
 if  [[ -f $wamr_config_cmake_file ]]; then
     rm  $wamr_config_cmake_file
     rm  $wamr_config_cmake_file
 fi
 fi
 
 
-set_build_target        ${TARGET}
-set_build_platform      ${PLATFORM}
-set_exec_mode           "${MODES[*]}"
-set_libc_support        ${LIBC_SUPPORT}
-set_app_module          "${APP_LIST[*]}"
-set_app_framework       ${APP}
+set_build_target        ${target}
+set_build_platform      ${platform}
+set_exec_mode           "${mode_list[*]}"
+set_libc_support        ${libc_support}
+set_app_module          "${app_list[*]}"
+set_app_framework       ${app_enable}