Skip to content

Commit b4d8f59

Browse files
authored
allow disabling linters
1 parent 47f180f commit b4d8f59

4 files changed

Lines changed: 46 additions & 38 deletions

File tree

.github/workflows/cmake.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/checkout@v2
1818

1919
- name: Configure CMake
20-
run: cmake -B build -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} -DRAPIDFUZZ_BUILD_TESTING=1 -DRAPIDFUZZ_BUILD_FUZZERS=1 -DCMAKE_CXX_COMPILER=clang++
20+
run: cmake -B build -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} -DRAPIDFUZZ_BUILD_TESTING=1 -DRAPIDFUZZ_ENABLE_LINTERS=1 -DRAPIDFUZZ_BUILD_FUZZERS=1 -DCMAKE_CXX_COMPILER=clang++
2121

2222
- name: Build
2323
run: cmake --build build --config ${{matrix.BUILD_TYPE}}
@@ -48,7 +48,7 @@ jobs:
4848
- uses: actions/checkout@v2
4949

5050
- name: Configure CMake
51-
run: cmake -B build -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} -DRAPIDFUZZ_BUILD_TESTING=1 -DCMAKE_CXX_COMPILER=g++
51+
run: cmake -B build -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} -DRAPIDFUZZ_BUILD_TESTING=1 -DRAPIDFUZZ_ENABLE_LINTERS=1 -DCMAKE_CXX_COMPILER=g++
5252

5353
- name: Build
5454
run: cmake --build build --config ${{matrix.BUILD_TYPE}}
@@ -68,7 +68,7 @@ jobs:
6868
- uses: actions/checkout@v2
6969

7070
- name: Configure CMake
71-
run: cmake -B build -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} -DRAPIDFUZZ_BUILD_TESTING=1
71+
run: cmake -B build -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} -DRAPIDFUZZ_BUILD_TESTING=1 -DRAPIDFUZZ_ENABLE_LINTERS=1
7272

7373
- name: Build
7474
run: cmake --build build --config ${{matrix.BUILD_TYPE}}

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ else()
1414
endif()
1515

1616
option(RAPIDFUZZ_BUILD_TESTING "Build tests" OFF)
17+
option(RAPIDFUZZ_ENABLE_LINTERS "Enable Linters for the test builds" OFF)
1718
option(RAPIDFUZZ_BUILD_BENCHMARKS "Build benchmarks" OFF)
1819
option(RAPIDFUZZ_BUILD_FUZZERS "Build fuzzers" OFF)
1920

test/CMakeLists.txt

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,50 @@ else()
1212
FetchContent_MakeAvailable(Catch2)
1313
endif()
1414

15-
# include aminya & jason turner's C++ best practices recommended cmake project utilities
16-
include(FetchContent)
15+
if (RAPIDFUZZ_ENABLE_LINTERS)
16+
# include aminya & jason turner's C++ best practices recommended cmake project utilities
17+
message("Enable Linters on test build")
18+
include(FetchContent)
1719

18-
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
19-
FetchContent_Declare(_project_options URL https://github.com/aminya/project_options/archive/refs/tags/v0.26.2.zip)
20-
else()
21-
FetchContent_Declare(_project_options URL https://github.com/aminya/project_options/archive/refs/tags/v0.25.2.zip)
22-
endif()
23-
FetchContent_MakeAvailable(_project_options)
24-
include(${_project_options_SOURCE_DIR}/Index.cmake)
20+
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
21+
FetchContent_Declare(_project_options URL https://github.com/aminya/project_options/archive/refs/tags/v0.26.2.zip)
22+
else()
23+
FetchContent_Declare(_project_options URL https://github.com/aminya/project_options/archive/refs/tags/v0.25.2.zip)
24+
endif()
25+
FetchContent_MakeAvailable(_project_options)
26+
include(${_project_options_SOURCE_DIR}/Index.cmake)
2527

26-
project_options(
27-
# ENABLE_CACHE
28-
# ENABLE_CONAN
29-
WARNINGS_AS_ERRORS
30-
# ENABLE_CPPCHECK
31-
# ENABLE_CLANG_TIDY
32-
# ENABLE_INCLUDE_WHAT_YOU_USE
33-
# ENABLE_COVERAGE
34-
# ENABLE_PCH
35-
# PCH_HEADERS <Eigen/Dense> <fmt/core.h> <vector> <utility> <string> <string_view>
36-
# ENABLE_DOXYGEN
37-
# ENABLE_IPO
38-
# ENABLE_USER_LINKER
39-
# ENABLE_BUILD_WITH_TIME_TRACE
40-
# ENABLE_UNITY
41-
# ENABLE_SANITIZER_ADDRESS
42-
# ENABLE_SANITIZER_LEAK
43-
# ENABLE_SANITIZER_UNDEFINED_BEHAVIOR
44-
# ENABLE_SANITIZER_THREAD
45-
# ENABLE_SANITIZER_MEMORY
46-
# CLANG_WARNINGS "-Weverything"
47-
)
28+
project_options(
29+
# ENABLE_CACHE
30+
# ENABLE_CONAN
31+
WARNINGS_AS_ERRORS
32+
# ENABLE_CPPCHECK
33+
# ENABLE_CLANG_TIDY
34+
# ENABLE_INCLUDE_WHAT_YOU_USE
35+
# ENABLE_COVERAGE
36+
# ENABLE_PCH
37+
# PCH_HEADERS <Eigen/Dense> <fmt/core.h> <vector> <utility> <string> <string_view>
38+
# ENABLE_DOXYGEN
39+
# ENABLE_IPO
40+
# ENABLE_USER_LINKER
41+
# ENABLE_BUILD_WITH_TIME_TRACE
42+
# ENABLE_UNITY
43+
# ENABLE_SANITIZER_ADDRESS
44+
# ENABLE_SANITIZER_LEAK
45+
# ENABLE_SANITIZER_UNDEFINED_BEHAVIOR
46+
# ENABLE_SANITIZER_THREAD
47+
# ENABLE_SANITIZER_MEMORY
48+
# CLANG_WARNINGS "-Weverything"
49+
)
50+
endif()
4851

4952
function(rapidfuzz_add_test test)
5053
add_executable(test_${test} tests-${test}.cpp)
5154
target_link_libraries(test_${test} ${PROJECT_NAME})
52-
target_link_libraries(test_${test} Catch2::Catch2WithMain project_warnings)
55+
target_link_libraries(test_${test} Catch2::Catch2WithMain)
56+
if (RAPIDFUZZ_ENABLE_LINTERS)
57+
target_link_libraries(test_${test} project_warnings)
58+
endif()
5359
add_test(NAME ${test} COMMAND test_${test})
5460
endfunction()
5561

test/distance/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
2-
31
function(rapidfuzz_add_test test)
42
add_executable(test_${test} tests-${test}.cpp examples/ocr.cpp)
53
target_link_libraries(test_${test} ${PROJECT_NAME})
6-
target_link_libraries(test_${test} Catch2::Catch2WithMain project_warnings)
4+
target_link_libraries(test_${test} Catch2::Catch2WithMain)
5+
if (RAPIDFUZZ_ENABLE_LINTERS)
6+
target_link_libraries(test_${test} project_warnings)
7+
endif()
78
add_test(NAME ${test} COMMAND test_${test})
89
endfunction()
910

0 commit comments

Comments
 (0)