mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-07-15 08:48:33 +00:00
Allow compilation on MinGW
See build_wamr.md for more details
This commit is contained in:
parent
770ca8c90c
commit
5aa9b4a34c
|
@ -9,7 +9,12 @@ uint64
|
||||||
os_time_get_boot_microsecond()
|
os_time_get_boot_microsecond()
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
#if defined(__MINGW32__)
|
||||||
|
// https://www.mail-archive.com/mingw-w64-public@lists.sourceforge.net/msg18361.html
|
||||||
|
clock_gettime(CLOCK_REALTIME, &ts);
|
||||||
|
#else
|
||||||
timespec_get(&ts, TIME_UTC);
|
timespec_get(&ts, TIME_UTC);
|
||||||
|
#endif
|
||||||
|
|
||||||
return ((uint64)ts.tv_sec) * 1000 * 1000 + ((uint64)ts.tv_nsec) / 1000;
|
return ((uint64)ts.tv_sec) * 1000 * 1000 + ((uint64)ts.tv_nsec) / 1000;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(_WIN32_)
|
#if defined(_WIN32) || defined(_WIN32_)
|
||||||
|
|
||||||
|
#if defined(__MINGW32__) && !defined(_SH_DENYNO)
|
||||||
|
#define _SH_DENYNO 0x40
|
||||||
|
#endif
|
||||||
|
|
||||||
char *
|
char *
|
||||||
bh_read_file_to_buffer(const char *filename, uint32 *ret_size)
|
bh_read_file_to_buffer(const char *filename, uint32 *ret_size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -324,6 +324,28 @@ For how to build the `JIT` mode and `classic interpreter` mode, please refer to
|
||||||
|
|
||||||
WAMR provides some features which can be easily configured by passing options to cmake, please see [WAMR vmcore cmake building configurations](./build_wamr.md#wamr-vmcore-cmake-building-configurations) for details. Currently in Windows, interpreter, AOT, and builtin libc are enabled by default.
|
WAMR provides some features which can be easily configured by passing options to cmake, please see [WAMR vmcore cmake building configurations](./build_wamr.md#wamr-vmcore-cmake-building-configurations) for details. Currently in Windows, interpreter, AOT, and builtin libc are enabled by default.
|
||||||
|
|
||||||
|
MinGW
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
Follow build instructions for Windows minus cloning uvwasi and adding the
|
||||||
|
following arguments for cmake:
|
||||||
|
|
||||||
|
```Bash
|
||||||
|
cmake .. -G"Unix Makefiles" \
|
||||||
|
-DWAMR_BUILD_LIBC_UVWASI=0 \
|
||||||
|
-DWAMR_BUILD_INVOKE_NATIVE_GENERAL=1 \
|
||||||
|
-DWAMR_DISABLE_HW_BOUND_CHECK=1
|
||||||
|
````
|
||||||
|
|
||||||
|
Note that WASI will be disabled until further work is done towards MinGW support.
|
||||||
|
|
||||||
|
- uvwasi not building out of the box, though it reportedly supports MinGW.
|
||||||
|
- Failing compilation of assembler files, the C version of `invokeNative()` will
|
||||||
|
be used instead.
|
||||||
|
- Compiler complaining about missing `UnwindInfoAddress` field in `RUNTIME_FUNCTION`
|
||||||
|
struct (winnt.h).
|
||||||
|
|
||||||
|
|
||||||
VxWorks
|
VxWorks
|
||||||
-------------------------
|
-------------------------
|
||||||
VxWorks 7 SR0620 release is validated.
|
VxWorks 7 SR0620 release is validated.
|
||||||
|
|
|
@ -103,9 +103,11 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
|
||||||
include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
|
include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
|
||||||
add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
|
add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
|
||||||
|
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN -D_WINSOCK_DEPRECATED_NO_WARNINGS")
|
#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN -D_WINSOCK_DEPRECATED_NO_WARNINGS")
|
||||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
|
if (NOT MINGW)
|
||||||
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
|
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
|
||||||
|
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
|
||||||
|
endif ()
|
||||||
|
|
||||||
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||||
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion")
|
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion")
|
||||||
|
@ -132,6 +134,10 @@ install (TARGETS iwasm DESTINATION bin)
|
||||||
|
|
||||||
target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS})
|
target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS})
|
||||||
|
|
||||||
|
if (MINGW)
|
||||||
|
target_link_libraries (iwasm ws2_32)
|
||||||
|
endif ()
|
||||||
|
|
||||||
add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE})
|
add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE})
|
||||||
|
|
||||||
install (TARGETS libiwasm DESTINATION lib)
|
install (TARGETS libiwasm DESTINATION lib)
|
||||||
|
@ -140,3 +146,6 @@ set_target_properties (libiwasm PROPERTIES OUTPUT_NAME libiwasm)
|
||||||
|
|
||||||
target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS})
|
target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS})
|
||||||
|
|
||||||
|
if (MINGW)
|
||||||
|
target_link_libraries (libiwasm ws2_32)
|
||||||
|
endif ()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user