Only build fuzzers when fuzzing. (#822)
This commit is contained in:
parent
0e6ea76e88
commit
6ac47734c0
|
@ -42,10 +42,14 @@ if(ENABLE_FUZZING)
|
||||||
endif ()
|
endif ()
|
||||||
target_link_libraries(simdjson-fuzzer INTERFACE simdjson-flags)
|
target_link_libraries(simdjson-fuzzer INTERFACE simdjson-flags)
|
||||||
target_link_libraries(simdjson-fuzzer INTERFACE ${SIMDJSON_FUZZ_LDFLAGS})
|
target_link_libraries(simdjson-fuzzer INTERFACE ${SIMDJSON_FUZZ_LDFLAGS})
|
||||||
|
|
||||||
|
# Define the fuzzers
|
||||||
|
add_custom_target(all_fuzzers)
|
||||||
|
|
||||||
function(implement_fuzzer name)
|
function(implement_fuzzer name)
|
||||||
add_executable(${name} ${name}.cpp)
|
add_executable(${name} ${name}.cpp)
|
||||||
target_link_libraries(${name} PRIVATE simdjson-fuzzer)
|
target_link_libraries(${name} PRIVATE simdjson-fuzzer)
|
||||||
|
add_dependencies(all_fuzzers ${name})
|
||||||
add_test(${name} ${name})
|
add_test(${name} ${name})
|
||||||
set_property(TEST ${name} APPEND PROPERTY LABELS fuzz)
|
set_property(TEST ${name} APPEND PROPERTY LABELS fuzz)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -27,7 +27,7 @@ if [ ! -d build-$variant ] ; then
|
||||||
-DSIMDJSON_FUZZ_LINKMAIN=On \
|
-DSIMDJSON_FUZZ_LINKMAIN=On \
|
||||||
-DSIMDJSON_IMPLEMENTATION_HASWELL=0
|
-DSIMDJSON_IMPLEMENTATION_HASWELL=0
|
||||||
|
|
||||||
ninja
|
ninja all_fuzzers
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ if [ ! -d build-$variant ] ; then
|
||||||
-DENABLE_FUZZING=On \
|
-DENABLE_FUZZING=On \
|
||||||
-DSIMDJSON_FUZZ_LINKMAIN=On
|
-DSIMDJSON_FUZZ_LINKMAIN=On
|
||||||
|
|
||||||
ninja
|
ninja all_fuzzers
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ if [ ! -d build-$variant ] ; then
|
||||||
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE \
|
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE \
|
||||||
-DSIMDJSON_IMPLEMENTATION_HASWELL=0
|
-DSIMDJSON_IMPLEMENTATION_HASWELL=0
|
||||||
|
|
||||||
ninja
|
ninja all_fuzzers
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ if which clang++-9 >/dev/null 2>&1 ; then
|
||||||
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE \
|
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE \
|
||||||
-DSIMDJSON_IMPLEMENTATION_HASWELL=0
|
-DSIMDJSON_IMPLEMENTATION_HASWELL=0
|
||||||
|
|
||||||
ninja
|
ninja all_fuzzers
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -127,7 +127,7 @@ if [ ! -d build-$variant ] ; then
|
||||||
-DSIMDJSON_FUZZ_LINKMAIN=Off \
|
-DSIMDJSON_FUZZ_LINKMAIN=Off \
|
||||||
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE
|
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE
|
||||||
|
|
||||||
ninja
|
ninja all_fuzzers
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ if which clang++-9 >/dev/null 2>&1 ; then
|
||||||
-DSIMDJSON_FUZZ_LINKMAIN=Off \
|
-DSIMDJSON_FUZZ_LINKMAIN=Off \
|
||||||
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE
|
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE
|
||||||
|
|
||||||
ninja
|
ninja all_fuzzers
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -26,7 +26,7 @@ if [ ! -d $bdir ] ; then
|
||||||
-DSIMDJSON_BUILD_STATIC=On \
|
-DSIMDJSON_BUILD_STATIC=On \
|
||||||
-DENABLE_FUZZING=On \
|
-DENABLE_FUZZING=On \
|
||||||
-DSIMDJSON_FUZZ_LINKMAIN=On
|
-DSIMDJSON_FUZZ_LINKMAIN=On
|
||||||
ninja
|
ninja all_fuzzers
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ cmake .. \
|
||||||
-DSIMDJSON_FUZZ_LINKMAIN=Off \
|
-DSIMDJSON_FUZZ_LINKMAIN=Off \
|
||||||
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE
|
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE
|
||||||
|
|
||||||
cmake --build .
|
cmake --build . --target all_fuzzers
|
||||||
|
|
||||||
cp fuzz/fuzz_* $OUT
|
cp fuzz/fuzz_* $OUT
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue