re-org platform APIs, simplify porting process (#201)

Co-authored-by: Xu Jun <jun1.xu@intel.com>
This commit is contained in:
Xu Jun
2020-03-16 16:43:57 +08:00
committed by GitHub
parent ef5ceffe71
commit f1a0e75ab7
177 changed files with 2954 additions and 7904 deletions

View File

@ -3,24 +3,6 @@
string(TOUPPER ${WAMR_BUILD_TARGET} WAMR_BUILD_TARGET)
# Add definitions for the build platform
if (WAMR_BUILD_PLATFORM STREQUAL "linux")
add_definitions(-DBH_PLATFORM_LINUX)
elseif (WAMR_BUILD_PLATFORM STREQUAL "linux-sgx")
add_definitions(-DBH_PLATFORM_LINUX_SGX)
elseif (WAMR_BUILD_PLATFORM STREQUAL "zephyr")
add_definitions(-DBH_PLATFORM_ZEPHYR)
elseif (WAMR_BUILD_PLATFORM STREQUAL "vxworks")
add_definitions(-DBH_PLATFORM_VXWORKS)
elseif (WAMR_BUILD_PLATFORM STREQUAL "darwin")
add_definitions(-DBH_PLATFORM_DARWIN)
elseif (WAMR_BUILD_PLATFORM STREQUAL "alios-things")
add_definitions(-DBH_PLATFORM_ALIOS_THINGS)
elseif (WAMR_BUILD_PLATFORM STREQUAL "android")
add_definitions(-DBH_PLATFORM_ANDROID)
else ()
message (WARNING "-- WAMR build platform isn't set")
endif ()
# Add definitions for the build target
if (WAMR_BUILD_TARGET STREQUAL "X86_64")
@ -53,6 +35,10 @@ else ()
message (FATAL_ERROR "-- WAMR build target isn't set")
endif ()
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DBH_DEBUG=1)
endif ()
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
# Add -fPIC flag if build as 64-bit