Fix the build issues on mac for some samples (#358)
Fix the build issues on mac for basic/multi-module/multi-thread/ simple/spawn-thread/wasm-c-api under samples. And all these samples could be run as expected. Signed-off-by: Xiaokang Qin <xiaokang.qxk@antgroup.com>
This commit is contained in:
@ -5,7 +5,10 @@ cmake_minimum_required(VERSION 2.8)
|
||||
project(pthread)
|
||||
|
||||
################ runtime settings ################
|
||||
set(WAMR_BUILD_PLATFORM "linux")
|
||||
string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
|
||||
if (APPLE)
|
||||
add_definitions(-DBH_PLATFORM_DARWIN)
|
||||
endif ()
|
||||
|
||||
# Resetdefault linker flags
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
||||
@ -21,7 +24,10 @@ set(WAMR_BUILD_FAST_INTERP 1)
|
||||
set(WAMR_BUILD_LIB_PTHREAD 1)
|
||||
|
||||
# compiling and linking flags
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE")
|
||||
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")
|
||||
|
||||
# build out vmlib
|
||||
|
||||
@ -6,7 +6,11 @@ project(wasm-apps)
|
||||
|
||||
set(WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
if (APPLE)
|
||||
set (HAVE_FLAG_SEARCH_PATHS_FIRST 0)
|
||||
set (CMAKE_C_LINK_FLAGS "")
|
||||
set (CMAKE_CXX_LINK_FLAGS "")
|
||||
endif ()
|
||||
set(CMAKE_SYSTEM_PROCESSOR wasm32)
|
||||
set (CMAKE_SYSROOT ${WAMR_ROOT_DIR}/wamr-sdk/app/libc-builtin-sysroot)
|
||||
|
||||
@ -31,4 +35,4 @@ set (CMAKE_EXE_LINKER_FLAGS
|
||||
)
|
||||
|
||||
add_executable(test.wasm main.c)
|
||||
target_link_libraries(test.wasm)
|
||||
target_link_libraries(test.wasm)
|
||||
|
||||
Reference in New Issue
Block a user