Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions core/shared/platform/windows/win_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ uint64
os_time_get_boot_microsecond()
{
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);
#endif

return ((uint64)ts.tv_sec) * 1000 * 1000 + ((uint64)ts.tv_nsec) / 1000;
}
5 changes: 5 additions & 0 deletions core/shared/utils/uncommon/bh_read_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
#endif

#if defined(_WIN32) || defined(_WIN32_)

#if defined(__MINGW32__) && !defined(_SH_DENYNO)
#define _SH_DENYNO 0x40
#endif

char *
bh_read_file_to_buffer(const char *filename, uint32 *ret_size)
{
Expand Down
22 changes: 22 additions & 0 deletions doc/build_wamr.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

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 7 SR0620 release is validated.
Expand Down
15 changes: 12 additions & 3 deletions product-mini/platforms/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
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_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN -D_WINSOCK_DEPRECATED_NO_WARNINGS")
if (NOT MINGW)
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} -Wconversion -Wsign-conversion")
Expand All @@ -132,6 +134,10 @@ install (TARGETS iwasm DESTINATION bin)

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})

install (TARGETS libiwasm DESTINATION lib)
Expand All @@ -140,3 +146,6 @@ set_target_properties (libiwasm PROPERTIES OUTPUT_NAME libiwasm)

target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS})

if (MINGW)
target_link_libraries (libiwasm ws2_32)
endif ()