Skip to content

Commit 42ad472

Browse files
authored
wasm-mutator-fuzz: Fix build errors and warnings for macOS (bytecodealliance#3519)
Tested with the homebrew version of LLVM 15. (xcode doesn't seem to ship the fuzzer runtime.)
1 parent 54b0e73 commit 42ad472

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/fuzz/wasm-mutator-fuzz/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ set (CMAKE_BUILD_TYPE Debug)
1010
set (CMAKE_C_COMPILER "clang")
1111
set (CMAKE_CXX_COMPILER "clang++")
1212

13-
set (WAMR_BUILD_PLATFORM "linux")
13+
string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
1414

1515
# Reset default linker flags
1616
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
1717
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
1818

19-
set (CMAKE_C_STANDARD 99)
19+
set (CMAKE_C_STANDARD 11)
20+
set (CMAKE_CXX_STANDARD 17)
2021

2122
# Set WAMR_BUILD_TARGET, currently values supported:
2223
# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
@@ -37,6 +38,10 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
3738
endif ()
3839
endif ()
3940

41+
if (APPLE)
42+
add_definitions(-DBH_PLATFORM_DARWIN)
43+
endif ()
44+
4045
if(CUSTOM_MUTATOR EQUAL 1)
4146
add_compile_definitions(CUSTOM_MUTATOR)
4247
endif()
@@ -130,7 +135,7 @@ if (IN_OSS_FUZZ EQUAL -1)
130135
-fprofile-instr-generate -fcoverage-mapping
131136
-fsanitize=address,undefined
132137
)
133-
add_link_options(-fsanitize=address)
138+
add_link_options(-fsanitize=address -fprofile-instr-generate)
134139
endif ()
135140

136141
include(${REPO_ROOT_DIR}/core/shared/utils/uncommon/shared_uncommon.cmake)

0 commit comments

Comments
 (0)