Skip to content

Commit

Permalink
build: add ValveFileVDF library to cmake project (#21)
Browse files Browse the repository at this point in the history
* build: add ValveFileVDF library to cmake project

* chore: cosmetic changes

* build: alias `ValveFileVDF::ValveFileVDF` to `ValveFileVDF`

* build: add `_LIBCPP_DISABLE_DEPRECATION_WARNINGS`
  • Loading branch information
es3n1n authored Jun 14, 2024
1 parent c8adfc2 commit d3e2815
Show file tree
Hide file tree
Showing 8 changed files with 840 additions and 833 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
cmake_minimum_required (VERSION 3.6)
project (vdf-Parser)

add_library(ValveFileVDF INTERFACE)
add_library(ValveFileVDF::ValveFileVDF ALIAS ValveFileVDF)
target_include_directories(ValveFileVDF INTERFACE "include")

include(CTest)
add_subdirectory(./tests)

Expand All @@ -13,4 +17,4 @@ endif()

if (${ENABLE_FUZZING})
add_subdirectory(fuzzing)
endif()
endif()
5 changes: 4 additions & 1 deletion fuzzing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ target_link_libraries(fuzzing PRIVATE -coverage -fsanitize=fuzzer)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
target_compile_options(fuzzing PRIVATE -fsanitize=fuzzer)
target_link_libraries(fuzzing PUBLIC -fsanitize=address,undefined)
target_compile_definitions(fuzzing PRIVATE "-D_LIBCPP_DISABLE_DEPRECATION_WARNINGS")
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
target_compile_options(fuzzing PRIVATE /fsanitize=fuzzer)
target_compile_definitions(fuzzing PRIVATE "-D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS")
endif()

add_test(NAME fuzzing_run COMMAND fuzzing -max_total_time=${FUZZ_RUNTIME} -timeout=${FUZZ_RUNTIME})
target_link_libraries(fuzzing PRIVATE ValveFileVDF)

add_test(NAME fuzzing_run COMMAND fuzzing -max_total_time=${FUZZ_RUNTIME} -timeout=${FUZZ_RUNTIME})
2 changes: 1 addition & 1 deletion fuzzing/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <cstdint>
#include <string_view>

#include "../vdf_parser.hpp"
#include <vdf_parser.hpp>
#include <iostream>

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
Expand Down
Loading

0 comments on commit d3e2815

Please sign in to comment.