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:
@ -21,19 +21,38 @@ The sample also provides the native Linux version of application without the run
|
||||
|
||||
The number on top will plus one each second, and the number on the bottom will plus one when clicked.
|
||||
|
||||
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 `./vgl-native-ui-app/CMakeLists.txt` and/or `./vgl-wasm-runtime/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 and Run
|
||||
==============
|
||||
|
||||
@ -18,6 +18,12 @@ 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
|
||||
|
||||
|
||||
echo "##################### 1. build native-ui-app start#####################"
|
||||
cd $BUILD_DIR
|
||||
mkdir -p vgl-native-ui-app
|
||||
|
||||
@ -17,7 +17,22 @@ message ("vgl_native_ui_app...")
|
||||
project (vgl_native_ui_app)
|
||||
|
||||
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -g -DLV_CONF_INCLUDE_SIMPLE -DPLATFORM_NATIVE_LINUX -DUSE_MONITOR -DUSE_MOUSE=1")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLV_CONF_INCLUDE_SIMPLE -DPLATFORM_NATIVE_LINUX -DUSE_MONITOR -DUSE_MOUSE=1")
|
||||
|
||||
# Currently build as 64-bit by default. Set to "NO" to build 32-bit binaries.
|
||||
set (BUILD_AS_64BIT_SUPPORT "YES")
|
||||
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
if (${BUILD_AS_64BIT_SUPPORT} STREQUAL "YES")
|
||||
# Add -fPIC flag if build as 64-bit
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -fPIC")
|
||||
else ()
|
||||
add_definitions (-m32)
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set(lv_name lvgl)
|
||||
set(LVGL_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/${lv_name})
|
||||
|
||||
@ -15,8 +15,8 @@ if (NOT ("$ENV{VALGRIND}" STREQUAL "YES"))
|
||||
add_definitions(-DNVALGRIND)
|
||||
endif ()
|
||||
|
||||
# Currently build as 32-bit by default.
|
||||
set (BUILD_AS_64BIT_SUPPORT "NO")
|
||||
# Currently build as 64-bit by default.
|
||||
set (BUILD_AS_64BIT_SUPPORT "YES")
|
||||
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
if (${BUILD_AS_64BIT_SUPPORT} STREQUAL "YES")
|
||||
|
||||
@ -186,12 +186,29 @@ void display_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
||||
|
||||
bool display_input_read(int32 data_p_offset)
|
||||
{
|
||||
bool ret;
|
||||
wasm_module_inst_t module_inst = wasm_runtime_get_current_module_inst();
|
||||
if (!wasm_runtime_validate_app_addr(module_inst, data_p_offset, 1))
|
||||
return false;
|
||||
lv_indev_data_t * data = wasm_runtime_addr_app_to_native(module_inst,
|
||||
data_p_offset);
|
||||
return mouse_read(data);
|
||||
|
||||
struct {
|
||||
lv_point_t point;
|
||||
int32 user_data_offset;
|
||||
uint8 state;
|
||||
} *data_app;
|
||||
|
||||
lv_indev_data_t data;
|
||||
|
||||
ret = mouse_read(&data);
|
||||
|
||||
data_app = wasm_runtime_addr_app_to_native(module_inst,
|
||||
data_p_offset);
|
||||
|
||||
data_app->point = data.point;
|
||||
data_app->user_data_offset = (int32_t)data.user_data;
|
||||
data_app->state = data.state;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void display_deinit(void)
|
||||
|
||||
@ -343,7 +343,11 @@ static host_interface interface = { .send = uart_send, .destroy = uart_destroy }
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __x86_64__
|
||||
static char global_heap_buf[300 * 1024] = { 0 };
|
||||
#else
|
||||
static char global_heap_buf[270 * 1024] = { 0 };
|
||||
#endif
|
||||
|
||||
static void showUsage()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user