mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
4f200de591
Change-Id: I75afb65058690585bbf2671c27d6a99a87bcaab7
62 lines
2.0 KiB
CMake
62 lines
2.0 KiB
CMake
# Copyright (c) 2024 Google LLC
|
|
#
|
|
# Use of this source code is governed by a BSD-style license
|
|
# that can be found in the LICENSE file in the root of the source
|
|
# tree. An additional intellectual property rights grant can be found
|
|
# in the file PATENTS. All contributing project authors may
|
|
# be found in the AUTHORS file in the root of the source tree.
|
|
|
|
# Adds a fuzztest from file TEST_NAME.cc located in the gtest folder. Extra
|
|
# arguments are considered as extra source files.
|
|
|
|
if(CMAKE_VERSION VERSION_LESS "3.19.0")
|
|
return()
|
|
endif()
|
|
|
|
macro(add_webp_fuzztest TEST_NAME)
|
|
add_executable(${TEST_NAME} ${TEST_NAME}.cc)
|
|
# FuzzTest bundles GoogleTest so no need to link to gtest libraries.
|
|
target_link_libraries(${TEST_NAME} PRIVATE fuzz_utils webp ${ARGN})
|
|
link_fuzztest(${TEST_NAME})
|
|
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
|
|
set_property(
|
|
TEST ${TEST_NAME}
|
|
PROPERTY ENVIRONMENT "TEST_DATA_DIRS=${CMAKE_CURRENT_SOURCE_DIR}/data/")
|
|
endmacro()
|
|
|
|
enable_language(CXX)
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
include(FetchContent)
|
|
|
|
set(FETCHCONTENT_QUIET FALSE)
|
|
set(fuzztest_SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/fuzztest-src)
|
|
FetchContent_Declare(
|
|
fuzztest
|
|
GIT_REPOSITORY https://github.com/google/fuzztest.git
|
|
GIT_TAG a40caf40aaf621dd0e04f9d8b47d1153fd2682d2
|
|
GIT_PROGRESS TRUE
|
|
PATCH_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/patch.sh)
|
|
|
|
FetchContent_MakeAvailable(fuzztest)
|
|
|
|
fuzztest_setup_fuzzing_flags()
|
|
|
|
add_library(fuzz_utils fuzz_utils.h fuzz_utils.cc img_alpha.h img_grid.h
|
|
img_peak.h)
|
|
target_link_libraries(fuzz_utils PUBLIC webpdecoder)
|
|
link_fuzztest(fuzz_utils)
|
|
|
|
add_webp_fuzztest(advanced_api_fuzzer)
|
|
add_webp_fuzztest(enc_dec_fuzzer)
|
|
add_webp_fuzztest(huffman_fuzzer)
|
|
add_webp_fuzztest(simple_api_fuzzer)
|
|
|
|
if(WEBP_BUILD_LIBWEBPMUX)
|
|
add_webp_fuzztest(animation_api_fuzzer webpdemux)
|
|
add_webp_fuzztest(animdecoder_fuzzer imageioutil webpdemux)
|
|
add_webp_fuzztest(animencoder_fuzzer libwebpmux)
|
|
add_webp_fuzztest(mux_demux_api_fuzzer libwebpmux webpdemux)
|
|
endif()
|