Skip to content

Commit

Permalink
Add cmake code to retarget fuzzing engine for oss-fuzz support
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-eves committed Sep 18, 2018
1 parent 06013e4 commit 2011627
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ option(GRAPHITE2_NFILEFACE "Compile out the gr_make_file_face* APIs")
option(GRAPHITE2_NTRACING "Compile out log segment tracing capability" ON)
option(GRAPHITE2_TELEMETRY "Add memory usage telemetry")
set(GRAPHITE2_SANITIZERS "" CACHE STRING "Set compiler sanitizers passed to -fsanitize")
set(GRAPHITE2_FUZZING_ENGINE libFuzzer.a CACHE STRING "Fuzzing engine to link against for the fuzzers")

message(STATUS "Build: " ${CMAKE_BUILD_TYPE})
string(REPLACE "ON" "shared" _LIB_OBJECT_TYPE ${BUILD_SHARED_LIBS})
Expand Down
4 changes: 2 additions & 2 deletions tests/fuzz-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ if (GRAPHITE2_SANITIZERS MATCHES "fuzzer")
LINKER_LANGUAGE C
COMPILE_FLAGS "-fsanitize=address,${GRAPHITE2_SANITIZERS} -g -O1 -Wall -Wextra -Wno-unknown-pragmas -Wendif-labels -Wctor-dtor-privacy -Wnon-virtual-dtor"
LINK_FLAGS "-fsanitize=address,${GRAPHITE2_SANITIZERS}")
target_link_libraries(gr-fuzzer-segment graphite2 graphite2-base libFuzzer.a)
target_link_libraries(gr-fuzzer-segment graphite2 graphite2-base ${GRAPHITE2_FUZZING_ENGINE})

add_executable(gr-fuzzer-font gr-fuzzer-font.cpp)
set_target_properties(gr-fuzzer-font PROPERTIES
LINKER_LANGUAGE C
COMPILE_FLAGS "-fsanitize=address,${GRAPHITE2_SANITIZERS} -g -O1 -Wall -Wextra -Wno-unknown-pragmas -Wendif-labels -Wctor-dtor-privacy -Wnon-virtual-dtor "
LINK_FLAGS "-fsanitize=address,${GRAPHITE2_SANITIZERS}")
target_link_libraries(gr-fuzzer-font graphite2 graphite2-base libFuzzer.a)
target_link_libraries(gr-fuzzer-font graphite2 graphite2-base ${GRAPHITE2_FUZZING_ENGINE})
endif ()

#add_test(NAME graphite-fuzzer COMMAND $<TARGET_FILE:${TESTNAME}> ${ARGN})
Expand Down

0 comments on commit 2011627

Please sign in to comment.