Add BUILD_TARGET setting in makefile (#135)

This commit is contained in:
wenyongh 2019-11-01 00:38:45 -05:00 committed by GitHub
parent 2a8b1ef454
commit 28993946ad
19 changed files with 432 additions and 138 deletions

View File

@ -22,32 +22,59 @@ set (PLATFORM "darwin")
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
# Enable repl mode if want to test spec cases
# add_definitions(-DWASM_ENABLE_REPL)
if (NOT ("$ENV{VALGRIND}" STREQUAL "YES"))
add_definitions(-DNVALGRIND)
endif ()
# Currently build as 64-bit by default.
set (BUILD_AS_64BIT_SUPPORT "YES")
# Set BUILD_TARGET, currently values supported:
# "X86_64", "AMD_64", "X86_32", "ARM_32", "MIPS_32", "XTENSA_32"
if (NOT BUILD_TARGET)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
# Build as X86_64 by default in 64-bit platform
set (BUILD_TARGET "X86_64")
else ()
# Build as X86_32 by default in 32-bit platform
set (BUILD_TARGET "X86_32")
endif ()
endif ()
string(TOUPPER ${BUILD_TARGET} BUILD_TARGET)
# Add definitions for the build target
if (BUILD_TARGET STREQUAL "X86_64")
add_definitions(-DBUILD_TARGET_X86_64)
elseif (BUILD_TARGET STREQUAL "AMD_64")
add_definitions(-DBUILD_TARGET_AMD_64)
elseif (BUILD_TARGET STREQUAL "X86_32")
add_definitions(-DBUILD_TARGET_X86_32)
elseif (BUILD_TARGET STREQUAL "ARM_32")
add_definitions(-DBUILD_TARGET_ARM_32)
elseif (BUILD_TARGET STREQUAL "MIPS_32")
add_definitions(-DBUILD_TARGET_MIPS_32)
elseif (BUILD_TARGET STREQUAL "XTENSA_32")
add_definitions(-DBUILD_TARGET_XTENSA_32)
else ()
message (FATAL_ERROR "-- Build target isn't set")
endif ()
message ("-- Build as target ${BUILD_TARGET}")
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 ()
if (BUILD_TARGET STREQUAL "X86_64" OR BUILD_TARGET STREQUAL "AMD_64")
# 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 ()
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif (NOT CMAKE_BUILD_TYPE)
message ("CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE})
message ("-- CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE})
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections -Wall -Wno-unused-parameter -Wno-pedantic")

View File

@ -28,32 +28,50 @@ add_definitions(-DOPS_UNSAFE_BUFFERS=0)
add_definitions(-DWASM_ENABLE_LOG=0)
add_definitions(-Dbh_printf=bh_printf_sgx)
# Enable repl mode if want to test spec cases
# add_definitions(-DWASM_ENABLE_REPL)
if (NOT ("$ENV{VALGRIND}" STREQUAL "YES"))
add_definitions(-DNVALGRIND)
endif ()
# Currently build as 64-bit by default.
set (BUILD_AS_64BIT_SUPPORT "YES")
# Set BUILD_TARGET, currently values supported:
if (NOT BUILD_TARGET)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
# Build as X86_64 by default in 64-bit platform
set (BUILD_TARGET "X86_64")
else ()
# Build as X86_32 by default in 32-bit platform
set (BUILD_TARGET "X86_32")
endif ()
endif ()
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")
string(TOUPPER ${BUILD_TARGET} BUILD_TARGET)
# Add definitions for the build target
if (BUILD_TARGET STREQUAL "X86_64")
add_definitions(-DBUILD_TARGET_X86_64)
elseif (BUILD_TARGET STREQUAL "X86_32")
add_definitions(-DBUILD_TARGET_X86_32)
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 ()
message (FATAL_ERROR "-- Build target isn't set")
endif ()
message ("-- Build as target ${BUILD_TARGET}")
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif (NOT CMAKE_BUILD_TYPE)
message ("CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE})
message ("-- CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE})
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
if (BUILD_TARGET STREQUAL "X86_64")
# 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 (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections -Wall -Wno-unused-parameter -Wno-pedantic")

View File

@ -22,32 +22,59 @@ set (PLATFORM "linux")
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
# Enable repl mode if want to test spec cases
# add_definitions(-DWASM_ENABLE_REPL)
if (NOT ("$ENV{VALGRIND}" STREQUAL "YES"))
add_definitions(-DNVALGRIND)
endif ()
# Currently build as 64-bit by default.
set (BUILD_AS_64BIT_SUPPORT "YES")
# Set BUILD_TARGET, currently values supported:
# "X86_64", "AMD_64", "X86_32", "ARM_32", "MIPS_32", "XTENSA_32"
if (NOT BUILD_TARGET)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
# Build as X86_64 by default in 64-bit platform
set (BUILD_TARGET "X86_64")
else ()
# Build as X86_32 by default in 32-bit platform
set (BUILD_TARGET "X86_32")
endif ()
endif ()
string(TOUPPER ${BUILD_TARGET} BUILD_TARGET)
# Add definitions for the build target
if (BUILD_TARGET STREQUAL "X86_64")
add_definitions(-DBUILD_TARGET_X86_64)
elseif (BUILD_TARGET STREQUAL "AMD_64")
add_definitions(-DBUILD_TARGET_AMD_64)
elseif (BUILD_TARGET STREQUAL "X86_32")
add_definitions(-DBUILD_TARGET_X86_32)
elseif (BUILD_TARGET STREQUAL "ARM_32")
add_definitions(-DBUILD_TARGET_ARM_32)
elseif (BUILD_TARGET STREQUAL "MIPS_32")
add_definitions(-DBUILD_TARGET_MIPS_32)
elseif (BUILD_TARGET STREQUAL "XTENSA_32")
add_definitions(-DBUILD_TARGET_XTENSA_32)
else ()
message (FATAL_ERROR "-- Build target isn't set")
endif ()
message ("-- Build as target ${BUILD_TARGET}")
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 ()
if (BUILD_TARGET STREQUAL "X86_64" OR BUILD_TARGET STREQUAL "AMD_64")
# 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 ()
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif (NOT CMAKE_BUILD_TYPE)
message ("CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE})
message ("-- CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE})
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections -Wall -Wno-unused-parameter -Wno-pedantic")

View File

@ -27,32 +27,59 @@ SET(CMAKE_RANLIB vx-ranlib)
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
# Enable repl mode if want to test spec cases
# add_definitions(-DWASM_ENABLE_REPL)
if (NOT ("$ENV{VALGRIND}" STREQUAL "YES"))
add_definitions(-DNVALGRIND)
endif ()
# Currently build as 64-bit by default.
set (BUILD_AS_64BIT_SUPPORT "YES")
# Set BUILD_TARGET, currently values supported:
# "X86_64", "AMD_64", "X86_32", "ARM_32", "MIPS_32", "XTENSA_32"
if (NOT BUILD_TARGET)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
# Build as X86_64 by default in 64-bit platform
set (BUILD_TARGET "X86_64")
else ()
# Build as X86_32 by default in 32-bit platform
set (BUILD_TARGET "X86_32")
endif ()
endif ()
string(TOUPPER ${BUILD_TARGET} BUILD_TARGET)
# Add definitions for the build target
if (BUILD_TARGET STREQUAL "X86_64")
add_definitions(-DBUILD_TARGET_X86_64)
elseif (BUILD_TARGET STREQUAL "AMD_64")
add_definitions(-DBUILD_TARGET_AMD_64)
elseif (BUILD_TARGET STREQUAL "X86_32")
add_definitions(-DBUILD_TARGET_X86_32)
elseif (BUILD_TARGET STREQUAL "ARM_32")
add_definitions(-DBUILD_TARGET_ARM_32)
elseif (BUILD_TARGET STREQUAL "MIPS_32")
add_definitions(-DBUILD_TARGET_MIPS_32)
elseif (BUILD_TARGET STREQUAL "XTENSA_32")
add_definitions(-DBUILD_TARGET_XTENSA_32)
else ()
message (FATAL_ERROR "-- Build target isn't set")
endif ()
message ("-- Build as target ${BUILD_TARGET}")
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 ()
if (BUILD_TARGET STREQUAL "X86_64" OR BUILD_TARGET STREQUAL "AMD_64")
# 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 ()
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif (NOT CMAKE_BUILD_TYPE)
message ("CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE})
message ("-- CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE})
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections -Wall -Wno-unused-parameter -Wno-pedantic")

View File

@ -21,6 +21,28 @@ enable_language (ASM)
add_definitions (-DNVALGRIND)
# Build as X86_32 by default, change to "ARM_32", "MIPS_32" or "XTENSA_32"
# if we want to support arm, mips or xtensa
if (NOT BUILD_TARGET)
set (BUILD_TARGET "X86_32")
endif ()
string(TOUPPER ${BUILD_TARGET} BUILD_TARGET)
if (BUILD_TARGET STREQUAL "X86_32")
add_definitions(-DBUILD_TARGET_X86_32)
elseif (BUILD_TARGET STREQUAL "ARM_32")
add_definitions(-DBUILD_TARGET_ARM_32)
elseif (BUILD_TARGET STREQUAL "MIPS_32")
add_definitions(-DBUILD_TARGET_MIPS_32)
elseif (BUILD_TARGET STREQUAL "XTENSA_32")
add_definitions(-DBUILD_TARGET_XTENSA_32)
else ()
message (FATAL_ERROR "-- Build target isn't set")
endif ()
message ("-- Build as target ${BUILD_TARGET}")
set (IWASM_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/iwasm)
set (SHARED_LIB_ROOT ${IWASM_ROOT}/../shared-lib)

View File

@ -52,7 +52,7 @@ extend_vector(Vector *vector, uint32 length)
}
memcpy(data, vector->data, vector->size_elem * vector->max_elements);
free(vector->data);
wasm_free(vector->data);
vector->data = data;
vector->max_elements = length;
return true;

View File

@ -15,9 +15,14 @@
*/
.text
.align 2
#ifndef OS_MACOSX
.globl invokeNative
.type invokeNative, @function
invokeNative:
#else
.globl _invokeNative
_invokeNative:
#endif /* end of OS_MACOSX */
/* rdi - function ptr */
/* rsi - argv */
/* rdx - n_stacks */

View File

@ -16,9 +16,14 @@
.text
.align 2
#ifndef OS_MACOSX
.globl invokeNative
.type invokeNative, @function
invokeNative:
#else
.globl _invokeNative
_invokeNative:
#endif /* end of OS_MACOSX */
push %ebp
movl %esp, %ebp
movl 16(%ebp), %ecx /* ecx = argc */

View File

@ -20,10 +20,18 @@ include_directories(${VMCORE_LIB_DIR}/../include)
file (GLOB_RECURSE c_source_all ${VMCORE_LIB_DIR}/*.c)
list (REMOVE_ITEM c_source_all ${VMCORE_LIB_DIR}/invokeNative_general.c)
if (${BUILD_AS_64BIT_SUPPORT} STREQUAL "YES")
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_em64.s)
if (${BUILD_TARGET} STREQUAL "X86_64" OR ${BUILD_TARGET} STREQUAL "AMD_64")
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_em64.s)
elseif (${BUILD_TARGET} STREQUAL "X86_32")
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_ia32.s)
elseif (${BUILD_TARGET} STREQUAL "ARM_32")
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_arm.s)
elseif (${BUILD_TARGET} STREQUAL "MIPS_32")
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_mips.s)
elseif (${BUILD_TARGET} STREQUAL "XTENSA_32")
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_xtensa.s)
else ()
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_ia32.s)
message (FATAL_ERROR "Build target isn't set")
endif ()
set (VMCORE_LIB_SOURCE ${source_all})

View File

@ -1458,7 +1458,7 @@ word_copy(uint32 *dest, uint32 *src, unsigned num)
(addr)[1] = u.parts[1]; \
} while (0)
#if !defined(__x86_64__) && !defined(__amd_64__)
#if !defined(BUILD_TARGET_X86_64) && !defined(BUILD_TARGET_AMD_64)
typedef void (*GenericFunctionPointer)();
int64 invokeNative(GenericFunctionPointer f, uint32 *args, uint32 sz);
@ -1483,7 +1483,7 @@ wasm_runtime_invoke_native(void *func_ptr, WASMType *func_type,
uint32 argv_buf[32], *argv1 = argv_buf, argc1, i, j = 0;
uint64 size;
#if !defined(__arm__) && !defined(__mips__)
#if !defined(BUILD_TARGET_ARM_32) && !defined(BUILD_TARGET_MIPS_32)
argc1 = argc + 2;
#else
argc1 = func_type->param_count * 2 + 2;
@ -1501,7 +1501,7 @@ wasm_runtime_invoke_native(void *func_ptr, WASMType *func_type,
for (i = 0; i < sizeof(WASMModuleInstance*) / sizeof(uint32); i++)
argv1[j++] = ((uint32*)&module_inst)[i];
#if !defined(__arm__) && !defined(__mips__)
#if !defined(BUILD_TARGET_ARM_32) && !defined(BUILD_TARGET_MIPS_32)
word_copy(argv1 + j, argv, argc);
j += argc;
#else
@ -1526,7 +1526,7 @@ wasm_runtime_invoke_native(void *func_ptr, WASMType *func_type,
break;
}
}
#endif
#endif /* end of !defined(BUILD_TARGET_ARM_32) && !defined(BUILD_TARGET_MIPS_32) */
argc1 = j;
if (func_type->result_count == 0) {
@ -1557,7 +1557,7 @@ wasm_runtime_invoke_native(void *func_ptr, WASMType *func_type,
return true;
}
#else /* else of !defined(__x86_64__) && !defined(__amd_64__) */
#else /* else of !defined(BUILD_TARGET_X86_64) && !defined(BUILD_TARGET_AMD_64) */
typedef void (*GenericFunctionPointer)();
int64 invokeNative(GenericFunctionPointer f, uint64 *args, uint64 n_stacks);
@ -1675,5 +1675,5 @@ wasm_runtime_invoke_native(void *func_ptr, WASMType *func_type,
return true;
}
#endif /* end of !defined(__x86_64__) && !defined(__amd_64__) */
#endif /* end of !defined(BUILD_TARGET_X86_64) && !defined(BUILD_TARGET_AMD_64) */

View File

@ -16,6 +16,29 @@
#ifndef _CONFIG_H_
#if !defined(BUILD_TARGET_X86_64) \
&& !defined(BUILD_TARGET_AMD_64) \
&& !defined(BUILD_TARGET_X86_32) \
&& !defined(BUILD_TARGET_ARM_32) \
&& !defined(BUILD_TARGET_MIPS_32) \
&& !defined(BUILD_TARGET_XTENSA_32)
#if defined(__x86_64__) || defined(__x86_64)
#define BUILD_TARGET_X86_64
#elif defined(__amd64__) || defined(__amd64)
#define BUILD_TARGET_AMD_64
#elif defined(__i386__) || defined(__i386) || defined(i386)
#define BUILD_TARGET_X86_32
#elif defined(__arm__)
#define BUILD_TARGET_ARM_32
#elif defined(__mips__) || defined(__mips) || defined(mips)
#define BUILD_TARGET_MIPS_32
#elif defined(__XTENSA__)
#define BUILD_TARGET_XTENSA
#else
#error "Build target isn't set"
#endif
#endif
/* Memory allocator ems */
#define MEM_ALLOCATOR_EMS 0
@ -100,7 +123,7 @@
#define APP_HEAP_SIZE_MAX (1024 * 1024)
/* Default wasm stack size of each app */
#ifdef __x86_64__
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)
#define DEFAULT_WASM_STACK_SIZE (12 * 1024)
#else
#define DEFAULT_WASM_STACK_SIZE (8 * 1024)
@ -116,7 +139,6 @@
#define APP_THREAD_STACK_SIZE_MIN (2 * 1024)
#define APP_THREAD_STACK_SIZE_MAX (256 * 1024)
#endif
#endif
/* External memory space provided by user,
but not wasm memory space and app heap space */
@ -134,3 +156,6 @@
#ifndef WASM_ENABLE_GUI
#define WASM_ENABLE_GUI 0
#endif
#endif /* end of _CONFIG_H_ */

View File

@ -22,15 +22,15 @@ project (lvgl_native_ui_app)
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 ()
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(THIRDPARTY_DIR ../../../core/iwasm/lib/3rdparty)

View File

@ -18,37 +18,64 @@ set (TARGET_PLATFORM "linux")
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
# Enable repl mode if want to test spec cases
# add_definitions(-DWASM_ENABLE_REPL)
if (NOT ("$ENV{VALGRIND}" STREQUAL "YES"))
add_definitions(-DNVALGRIND)
endif ()
# Currently build as 64-bit by default.
set (BUILD_AS_64BIT_SUPPORT "YES")
# Set BUILD_TARGET, currently values supported:
# "X86_64", "AMD_64", "X86_32", "ARM_32", "MIPS_32", "XTENSA_32"
if (NOT BUILD_TARGET)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
# Build as X86_64 by default in 64-bit platform
set (BUILD_TARGET "X86_64")
else ()
# Build as X86_32 by default in 32-bit platform
set (BUILD_TARGET "X86_32")
endif ()
endif ()
string(TOUPPER ${BUILD_TARGET} BUILD_TARGET)
# Add definitions for the build target
if (BUILD_TARGET STREQUAL "X86_64")
add_definitions(-DBUILD_TARGET_X86_64)
elseif (BUILD_TARGET STREQUAL "AMD_64")
add_definitions(-DBUILD_TARGET_AMD_64)
elseif (BUILD_TARGET STREQUAL "X86_32")
add_definitions(-DBUILD_TARGET_X86_32)
elseif (BUILD_TARGET STREQUAL "ARM_32")
add_definitions(-DBUILD_TARGET_ARM_32)
elseif (BUILD_TARGET STREQUAL "MIPS_32")
add_definitions(-DBUILD_TARGET_MIPS_32)
elseif (BUILD_TARGET STREQUAL "XTENSA_32")
add_definitions(-DBUILD_TARGET_XTENSA_32)
else ()
message (FATAL_ERROR "-- Build target isn't set")
endif ()
message ("-- Build as target ${BUILD_TARGET}")
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 ()
if (BUILD_TARGET STREQUAL "X86_64" OR BUILD_TARGET STREQUAL "AMD_64")
# 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 ()
if (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Debug)
endif (NOT CMAKE_BUILD_TYPE)
message ("CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE})
message ("-- CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE})
if (NOT PLATFORM)
SET(PLATFORM linux)
endif (NOT PLATFORM)
message ("PLATFORM = " ${PLATFORM})
message ("-- PLATFORM = " ${PLATFORM})
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections -Wall -Wno-unused-parameter -Wno-pedantic")

View File

@ -27,6 +27,28 @@ zephyr_compile_definitions (-DNVALGRIND
-Dattr_container_free=bh_free
-DWASM_ENABLE_GUI=1)
# Build as ARM_32 by default, change to "X86_32", "MIPS_32" or "XTENSA_32"
# if we want to support x86, mips or xtensa
if (NOT BUILD_TARGET)
set (BUILD_TARGET "ARM_32")
endif ()
string(TOUPPER ${BUILD_TARGET} BUILD_TARGET)
if (BUILD_TARGET STREQUAL "X86_32")
add_definitions(-DBUILD_TARGET_X86_32)
elseif (BUILD_TARGET STREQUAL "ARM_32")
add_definitions(-DBUILD_TARGET_ARM_32)
elseif (BUILD_TARGET STREQUAL "MIPS_32")
add_definitions(-DBUILD_TARGET_MIPS_32)
elseif (BUILD_TARGET STREQUAL "XTENSA_32")
add_definitions(-DBUILD_TARGET_XTENSA_32)
else ()
message (FATAL_ERROR "-- Build target isn't set")
endif ()
message ("-- Build as target ${BUILD_TARGET}")
set (IWASM_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/core/iwasm)
set (APP_MGR_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/core/app-mgr)
set (SHARED_LIB_ROOT ${IWASM_ROOT}/../shared-lib)

View File

@ -23,15 +23,15 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLV_CONF_INCLUDE_SIMPLE -DPLATFORM_NATIVE_L
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 ()
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)

View File

@ -8,37 +8,64 @@ set (TARGET_PLATFORM "linux")
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
# Enable repl mode if want to test spec cases
# add_definitions(-DWASM_ENABLE_REPL)
if (NOT ("$ENV{VALGRIND}" STREQUAL "YES"))
add_definitions(-DNVALGRIND)
endif ()
# Currently build as 64-bit by default.
set (BUILD_AS_64BIT_SUPPORT "YES")
# Set BUILD_TARGET, currently values supported:
# "X86_64", "AMD_64", "X86_32", "ARM_32", "MIPS_32", "XTENSA_32"
if (NOT BUILD_TARGET)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
# Build as X86_64 by default in 64-bit platform
set (BUILD_TARGET "X86_64")
else ()
# Build as X86_32 by default in 32-bit platform
set (BUILD_TARGET "X86_32")
endif ()
endif ()
string(TOUPPER ${BUILD_TARGET} BUILD_TARGET)
# Add definitions for the build target
if (BUILD_TARGET STREQUAL "X86_64")
add_definitions(-DBUILD_TARGET_X86_64)
elseif (BUILD_TARGET STREQUAL "AMD_64")
add_definitions(-DBUILD_TARGET_AMD_64)
elseif (BUILD_TARGET STREQUAL "X86_32")
add_definitions(-DBUILD_TARGET_X86_32)
elseif (BUILD_TARGET STREQUAL "ARM_32")
add_definitions(-DBUILD_TARGET_ARM_32)
elseif (BUILD_TARGET STREQUAL "MIPS_32")
add_definitions(-DBUILD_TARGET_MIPS_32)
elseif (BUILD_TARGET STREQUAL "XTENSA_32")
add_definitions(-DBUILD_TARGET_XTENSA_32)
else ()
message (FATAL_ERROR "-- Build target isn't set")
endif ()
message ("-- Build as target ${BUILD_TARGET}")
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 ()
if (BUILD_TARGET STREQUAL "X86_64" OR BUILD_TARGET STREQUAL "AMD_64")
# 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 ()
if (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Debug)
endif (NOT CMAKE_BUILD_TYPE)
message ("CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE})
message ("-- CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE})
if (NOT PLATFORM)
SET(PLATFORM linux)
endif (NOT PLATFORM)
message ("PLATFORM = " ${PLATFORM})
message ("-- PLATFORM = " ${PLATFORM})
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections -Wall -Wno-unused-parameter -Wno-pedantic")

View File

@ -26,6 +26,27 @@ zephyr_compile_definitions (-DNVALGRIND
-Dattr_container_malloc=bh_malloc
-Dattr_container_free=bh_free)
# Build as ARM_32 by default, change to "X86_32", "MIPS_32" or "XTENSA_32"
# if we want to support x86, mips or xtensa
if (NOT BUILD_TARGET)
set (BUILD_TARGET "ARM_32")
endif ()
string(TOUPPER ${BUILD_TARGET} BUILD_TARGET)
if (BUILD_TARGET STREQUAL "X86_32")
add_definitions(-DBUILD_TARGET_X86_32)
elseif (BUILD_TARGET STREQUAL "ARM_32")
add_definitions(-DBUILD_TARGET_ARM_32)
elseif (BUILD_TARGET STREQUAL "MIPS_32")
add_definitions(-DBUILD_TARGET_MIPS_32)
elseif (BUILD_TARGET STREQUAL "XTENSA_32")
add_definitions(-DBUILD_TARGET_XTENSA_32)
else ()
message (FATAL_ERROR "-- Build target isn't set")
endif ()
message ("-- Build as target ${BUILD_TARGET}")
set (IWASM_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/core/iwasm)
set (APP_MGR_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/core/app-mgr)
set (SHARED_LIB_ROOT ${IWASM_ROOT}/../shared-lib)

View File

@ -47,7 +47,7 @@ SRCS += lvgl/lv_misc/lv_task.c lvgl/lv_misc/lv_circ.c lvgl/lv_misc/lv_anim.c
SRCS += lvgl/lv_misc/lv_color.c lvgl/lv_misc/lv_txt.c lvgl/lv_misc/lv_math.c
SRCS += lvgl/lv_misc/lv_mem.c lvgl/lv_misc/lv_font.c lvgl/lv_misc/lv_ll.c
SRCS += lvgl/lv_misc/lv_area.c lvgl/lv_misc/lv_templ.c lvgl/lv_misc/lv_ufs.c
SRCS += lvgl/lv_misc/lv_area.c lvgl/lv_misc/lv_templ.c lvgl/lv_misc/lv_gc.c
SRCS += lvgl/lv_misc/lv_gc.c
SRCS += lvgl/lv_hal/lv_hal_tick.c lvgl/lv_hal/lv_hal_indev.c lvgl/lv_hal/lv_hal_disp.c
SRCS += lvgl/lv_themes/lv_theme_mono.c lvgl/lv_themes/lv_theme_templ.c
SRCS += lvgl/lv_themes/lv_theme_material.c lvgl/lv_themes/lv_theme.c

View File

@ -8,37 +8,70 @@ set (TARGET_PLATFORM "linux")
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
# Enable repl mode if want to test spec cases
# add_definitions(-DWASM_ENABLE_REPL)
if (NOT ("$ENV{VALGRIND}" STREQUAL "YES"))
add_definitions(-DNVALGRIND)
endif ()
# 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")
# 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")
# Set BUILD_TARGET, currently values supported:
# "X86_64", "AMD_64", "X86_32", "ARM_32", "MIPS_32", "XTENSA_32"
if (NOT BUILD_TARGET)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
if (BUILD_AS_64BIT_SUPPORT STREQUAL "YES")
# Build as X86_64 by default in 64-bit platform
set (BUILD_TARGET "X86_64")
else ()
set (BUILD_TARGET "X86_32")
endif ()
else ()
# Build as X86_32 by default in 32-bit platform
set (BUILD_TARGET "X86_32")
endif ()
endif ()
string(TOUPPER ${BUILD_TARGET} BUILD_TARGET)
# Add definitions for the build target
if (BUILD_TARGET STREQUAL "X86_64")
add_definitions(-DBUILD_TARGET_X86_64)
elseif (BUILD_TARGET STREQUAL "AMD_64")
add_definitions(-DBUILD_TARGET_AMD_64)
elseif (BUILD_TARGET STREQUAL "X86_32")
add_definitions(-DBUILD_TARGET_X86_32)
elseif (BUILD_TARGET STREQUAL "ARM_32")
add_definitions(-DBUILD_TARGET_ARM_32)
elseif (BUILD_TARGET STREQUAL "MIPS_32")
add_definitions(-DBUILD_TARGET_MIPS_32)
elseif (BUILD_TARGET STREQUAL "XTENSA_32")
add_definitions(-DBUILD_TARGET_XTENSA_32)
else ()
message (FATAL_ERROR "-- Build target isn't set")
endif ()
message ("-- Build as target ${BUILD_TARGET}")
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
if (BUILD_TARGET STREQUAL "X86_64" OR BUILD_TARGET STREQUAL "AMD_64")
# 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 ()
if (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Debug)
endif (NOT CMAKE_BUILD_TYPE)
message ("CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE})
message ("-- CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE})
if (NOT PLATFORM)
SET(PLATFORM linux)
endif (NOT PLATFORM)
message ("PLATFORM = " ${PLATFORM})
message ("-- PLATFORM = " ${PLATFORM})
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections -Wall -Wno-unused-parameter -Wno-pedantic")