mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-19 21:32:23 +00:00
parent
abaed6f474
commit
f03c507cf0
1 changed files with 10 additions and 9 deletions
|
|
@ -7,8 +7,7 @@ if (onnxruntime_FUZZ_ENABLED)
|
|||
message(STATUS "Building dependency protobuf-mutator and libfuzzer")
|
||||
|
||||
# set the options used to control the protobuf-mutator build
|
||||
set(PROTOBUF_LIBRARIES "$<TARGET_FILE:libprotobuf>")
|
||||
set(PROTOBUF_INCLUDE_DIRS "$<TARGET_PROPERTY:libprotobuf,INCLUDE_DIRECTORIES>")
|
||||
set(PROTOBUF_LIBRARIES ${PROTOBUF_LIB})
|
||||
set(LIB_PROTO_MUTATOR_TESTING OFF)
|
||||
|
||||
# include the protobuf-mutator CMakeLists.txt rather than the projects CMakeLists.txt to avoid target clashes
|
||||
|
|
@ -18,8 +17,10 @@ if (onnxruntime_FUZZ_ENABLED)
|
|||
# add the appropriate include directory and compilation flags
|
||||
# needed by the protobuf-mutator target and the libfuzzer
|
||||
set(PROTOBUF_MUT_INCLUDE_DIRS "external/libprotobuf-mutator")
|
||||
target_include_directories(protobuf-mutator PRIVATE ${PROTOBUF_INCLUDE_DIRS} ${PROTOBUF_MUT_INCLUDE_DIRS})
|
||||
target_include_directories(protobuf-mutator-libfuzzer PRIVATE ${PROTOBUF_INCLUDE_DIRS} ${PROTOBUF_MUT_INCLUDE_DIRS})
|
||||
onnxruntime_add_include_to_target(protobuf-mutator ${PROTOBUF_LIB})
|
||||
onnxruntime_add_include_to_target(protobuf-mutator-libfuzzer ${PROTOBUF_LIB})
|
||||
target_include_directories(protobuf-mutator PRIVATE ${INCLUDE_DIRECTORIES} ${PROTOBUF_MUT_INCLUDE_DIRS})
|
||||
target_include_directories(protobuf-mutator-libfuzzer PRIVATE ${INCLUDE_DIRECTORIES} ${PROTOBUF_MUT_INCLUDE_DIRS})
|
||||
target_compile_options(protobuf-mutator PRIVATE "/wd4244" "/wd4245" "/wd4267" "/wd4100" "/wd4456")
|
||||
target_compile_options(protobuf-mutator-libfuzzer PRIVATE "/wd4146" "/wd4267")
|
||||
|
||||
|
|
@ -31,7 +32,7 @@ if (onnxruntime_FUZZ_ENABLED)
|
|||
|
||||
# Security fuzzing engine src file reference
|
||||
set(SEC_FUZ_SRC "${SEC_FUZZ_ROOT}/src/BetaDistribution.cpp"
|
||||
"${SEC_FUZZ_ROOT}/src/OnnxPrediction"
|
||||
"${SEC_FUZZ_ROOT}/src/OnnxPrediction.cpp"
|
||||
"${SEC_FUZZ_ROOT}/src/testlog.cpp"
|
||||
"${SEC_FUZZ_ROOT}/src/test.cpp")
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ if (onnxruntime_FUZZ_ENABLED)
|
|||
target_compile_features(onnxruntime_security_fuzz PUBLIC cxx_std_17)
|
||||
|
||||
# Security fuzzing engine header file reference
|
||||
onnxruntime_add_include_to_target(onnxruntime_security_fuzz libprotobuf onnx onnxruntime)
|
||||
onnxruntime_add_include_to_target(onnxruntime_security_fuzz onnx onnxruntime)
|
||||
|
||||
# Assign all include to one variable
|
||||
set(SEC_FUZ_INC "${SEC_FUZZ_ROOT}/include")
|
||||
|
|
@ -52,13 +53,13 @@ if (onnxruntime_FUZZ_ENABLED)
|
|||
target_include_directories(onnxruntime_security_fuzz PRIVATE ${INCLUDE_FILES})
|
||||
|
||||
# add link libraries the project
|
||||
target_link_libraries(onnxruntime_security_fuzz libprotobuf onnx_proto onnxruntime protobuf-mutator)
|
||||
target_link_libraries(onnxruntime_security_fuzz onnx_proto onnxruntime protobuf-mutator ${PROTOBUF_LIB})
|
||||
|
||||
# add the dependencies
|
||||
add_dependencies(onnxruntime_security_fuzz libprotobuf onnx_proto onnxruntime protobuf-mutator)
|
||||
add_dependencies(onnxruntime_security_fuzz onnx_proto onnxruntime protobuf-mutator ${PROTOBUF_LIB})
|
||||
|
||||
# copy the dlls to the execution directory
|
||||
add_custom_command(TARGET onnxruntime_security_fuzz POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:onnxruntime> $<TARGET_FILE_DIR:onnxruntime_security_fuzz>
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:libprotobuf> $<TARGET_FILE_DIR:onnxruntime_security_fuzz>)
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${PROTOBUF_LIB}> $<TARGET_FILE_DIR:onnxruntime_security_fuzz>)
|
||||
endif()
|
||||
Loading…
Reference in a new issue