Optimize samples build process and build 64 bit binaries by default (#90)

* Optimize samples build process

* Samples: build 64 bit version by default
This commit is contained in:
Weining
2019-08-02 14:00:35 +08:00
committed by wenyongh
parent 09d5149081
commit 3b19306869
17 changed files with 177 additions and 220 deletions

View File

@ -48,27 +48,8 @@ set(WASM_DIR ${WAMR_ROOT_DIR}/core/iwasm)
set(APP_MGR_DIR ${WAMR_ROOT_DIR}/core/app-mgr)
set(SHARED_DIR ${WAMR_ROOT_DIR}/core/shared-lib)
set (lv_drivers_name lv_drivers)
set (lv_name lvgl)
set (LV_DRIVERS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/${lv_drivers_name})
set (LVGL_DIR ${WASM_DIR}/lib/3rdparty/${lv_name})
if ((NOT EXISTS ${LVGL_DIR}) OR (NOT EXISTS ${LV_DRIVERS_DIR}))
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/download_lvgl_drivers/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/download_lvgl_drivers )
if(result)
message(FATAL_ERROR "CMake step for lvgl drivers failed: ${result}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/download_lvgl_drivers )
if(result)
message(FATAL_ERROR "Build step for lvgl drivers failed: ${result}")
endif()
endif()
set (LV_DRIVERS_DIR ${WASM_DIR}/lib/3rdparty/lv_drivers)
set (LVGL_DIR ${WASM_DIR}/lib/3rdparty/lvgl)
file(GLOB_RECURSE LV_DRIVERS_SOURCES "${LV_DRIVERS_DIR}/*.c" )
@ -93,12 +74,14 @@ include (${SHARED_DIR}/coap/lib_coap.cmake)
include_directories(${SHARED_DIR}/include)
include_directories(${CMAKE_CURRENT_LIST_DIR}/src)
#Note: uncomment below line to use UART mode
#add_definitions (-DCONNECTION_UART)
add_definitions (-DWASM_ENABLE_BASE_LIB)
add_definitions (-Dattr_container_malloc=bh_malloc)
add_definitions (-Dattr_container_free=bh_free)
add_definitions (-DLV_CONF_INCLUDE_SIMPLE)
add_library (vmlib
${WASM_PLATFORM_LIB_SOURCE}

View File

@ -1,41 +0,0 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 2.8.2)
project(lvgl_download NONE)
include(ExternalProject)
ExternalProject_Add(${lv_name}
GIT_REPOSITORY https://github.com/littlevgl/lvgl.git
GIT_TAG ""
BINARY_DIR ""
SOURCE_DIR "${LVGL_DIR}"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
ExternalProject_Add(${lv_drivers_name}
GIT_REPOSITORY https://github.com/littlevgl/lv_drivers.git
GIT_TAG ""
BINARY_DIR ""
SOURCE_DIR "${LV_DRIVERS_DIR}"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)

View File

@ -64,19 +64,37 @@ The `host_init_func` is called when the application manager starts up. And `host
- wasm-apps<br/>
Source files of sample wasm applications.
Configure 32 bit or 64 bit build
==============
On 64 bit operating system, there is an option to build 32 bit or 64 bit binaries. In file `CMakeLists.txt`, modify the line:
`set (BUILD_AS_64BIT_SUPPORT "YES")`
where `YES` means 64 bit build while `NO` means 32 bit build.
Install required SDK and libraries
==============
- 32 bit SDL(simple directmedia layer)
Use apt-get</br>
`sudo apt-get install libsdl2-dev:i386`</br>
Or download source from www.libsdl.org</br>
`./configure C_FLAGS=-m32 CXX_FLAGS=-m32 LD_FLAGS=-m32`</br>
`make`</br>
`sudo make install`</br>
- 32 bit SDL(simple directmedia layer) (Note: only necessary when `BUILD_AS_64BIT_SUPPORT` is set to `NO`)
Use apt-get:
`sudo apt-get install libsdl2-dev:i386`
Or download source from www.libsdl.org:
```
./configure C_FLAGS=-m32 CXX_FLAGS=-m32 LD_FLAGS=-m32
make
sudo make install
```
- 64 bit SDL(simple directmedia layer) (Note: only necessary when `BUILD_AS_64BIT_SUPPORT` is set to `YES`)
Use apt-get:
`sudo apt-get install libsdl2-dev`
Or download source from www.libsdl.org:
```
./configure
make
sudo make install
```
- Install EMSDK
<pre>
```
https://emscripten.org/docs/tools_reference/emsdk.html
</pre>
```
Build all binaries
==============

View File

@ -20,6 +20,14 @@ if [ ! -d "tlsf" ]; then
git clone https://github.com/mattconte/tlsf
fi
cd ${WAMR_DIR}/core/iwasm/lib/3rdparty
if [ ! -d "lvgl" ]; then
git clone https://github.com/littlevgl/lvgl.git --branch v6.0.1
fi
if [ ! -d "lv_drivers" ]; then
git clone https://github.com/littlevgl/lv_drivers.git
fi
echo "#####################build simple project"
cd ${CURR_DIR}
mkdir -p cmake_build