Add Windows support for C-API and Runtime API libraries and examples. (#379)
* Add Windows support for C-API and Runtime API libraries and examples. Signed-off-by: Wu Zhongmin <vwzm@live.com> Signed-off-by: Xiaokang Qin <xiaokang.qxk@antgroup.com> * Address the review comments Signed-off-by: Xiaokang Qin <xiaokang.qxk@antgroup.com> * Rewrite the the bh_getopt to make it avaliable for more kinds of options Signed-off-by: Wu Zhongmin <vwzm@live.com> Signed-off-by: Xiaokang Qin <xiaokang.qxk@antgroup.com> * Add the license header Signed-off-by: Xiaokang Qin <xiaokang.qxk@antgroup.com> Co-authored-by: Zhongmin Wu <vwzm@live.com>
This commit is contained in:
@ -3,7 +3,12 @@
|
||||
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
|
||||
project (basic)
|
||||
if (NOT WAMR_BUILD_PLATFORM STREQUAL "windows")
|
||||
project (basic)
|
||||
else()
|
||||
project (basic C ASM)
|
||||
enable_language (ASM_MASM)
|
||||
endif()
|
||||
|
||||
################ runtime settings ################
|
||||
string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
|
||||
@ -22,18 +27,22 @@ set (WAMR_BUILD_INTERP 1)
|
||||
set (WAMR_BUILD_AOT 1)
|
||||
set (WAMR_BUILD_JIT 0)
|
||||
set (WAMR_BUILD_LIBC_BUILTIN 1)
|
||||
set (WAMR_BUILD_LIBC_WASI 1)
|
||||
if (NOT MSVC)
|
||||
set (WAMR_BUILD_LIBC_WASI 1)
|
||||
endif ()
|
||||
set (WAMR_BUILD_FAST_INTERP 0)
|
||||
|
||||
# linker flags
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -fPIE")
|
||||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
|
||||
if (NOT MSVC)
|
||||
# linker flags
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -fPIE")
|
||||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
|
||||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
|
||||
#include "wasm_export.h"
|
||||
#include "bh_read_file.h"
|
||||
#include "bh_getopt.h"
|
||||
|
||||
int intToStr(int x, char* str, int str_len, int digit);
|
||||
int get_pow(int x, int y);
|
||||
|
||||
Reference in New Issue
Block a user