@@ -5,8 +5,6 @@ cmake_minimum_required (VERSION 2.8)
5
5
6
6
project (wasm_mutator )
7
7
8
- add_definitions (-DUNIT_TEST )
9
-
10
8
set (CMAKE_BUILD_TYPE Debug )
11
9
12
10
set (CMAKE_C_COMPILER "clang" )
@@ -43,10 +41,6 @@ if(CUSTOM_MUTATOR EQUAL 1)
43
41
add_compile_definitions (CUSTOM_MUTATOR )
44
42
endif ()
45
43
46
- if (NOT CMAKE_BUILD_TYPE )
47
- set (CMAKE_BUILD_TYPE Release )
48
- endif ()
49
-
50
44
if (NOT DEFINED WAMR_BUILD_INTERP )
51
45
# Enable Interpreter by default
52
46
set (WAMR_BUILD_INTERP 1 )
@@ -120,13 +114,22 @@ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
120
114
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} " )
121
115
122
116
add_definitions (-DWAMR_USE_MEM_POOL=0 )
123
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fsanitize=signed-integer-overflow \
124
- -fprofile-instr-generate -fcoverage-mapping \
125
- -fsanitize=address,undefined,fuzzer" )
126
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=signed-integer-overflow \
127
- -fprofile-instr-generate -fcoverage-mapping \
128
- -fsanitize=address,undefined,fuzzer" )
129
-
117
+
118
+ # Enable fuzzer
119
+ add_compile_options (-fsanitize=fuzzer )
120
+ add_link_options (-fsanitize=fuzzer )
121
+
122
+ # if not calling from oss-fuzz helper, enable all support sanitizers
123
+ # oss-fuzz always defines `HELPER=True`
124
+ if (NOT "$ENV{HELPER} " STREQUAL "True" )
125
+ add_compile_options (
126
+ -fsanitize=signed-integer-overflow
127
+ -fprofile-instr-generate -fcoverage-mapping
128
+ -fsanitize=address,undefined
129
+ )
130
+ add_link_options (-fsanitize=address )
131
+ endif ()
132
+
130
133
include (${REPO_ROOT_DIR} /core/shared/utils/uncommon/shared_uncommon.cmake )
131
134
include (${REPO_ROOT_DIR} /build-scripts/runtime_lib.cmake )
132
135
@@ -135,4 +138,4 @@ add_library(vmlib
135
138
)
136
139
137
140
add_executable (wasm_mutator_fuzz wasm_mutator_fuzz.cc )
138
- target_link_libraries (wasm_mutator_fuzz vmlib -lm )
141
+ target_link_libraries (wasm_mutator_fuzz vmlib -lm )
0 commit comments