diff --git a/.github/workflows/ci_coverage.yml b/.github/workflows/ci_coverage.yml index 4a27f69d6b..6653f655b6 100644 --- a/.github/workflows/ci_coverage.yml +++ b/.github/workflows/ci_coverage.yml @@ -86,6 +86,7 @@ jobs: --exclude-unreachable-branches \ --exclude-throw-branches \ --exclude-noncode-lines \ + --merge-mode-functions separate \ -j \ --cobertura \ --output ${GITHUB_WORKSPACE}/build/coverage_report.xml diff --git a/.github/workflows/cron_no_optional_libraries.yml b/.github/workflows/cron_no_optional_libraries.yml new file mode 100644 index 0000000000..57792e8111 --- /dev/null +++ b/.github/workflows/cron_no_optional_libraries.yml @@ -0,0 +1,90 @@ +# SPDX-FileCopyrightText: 2006-2025, Knut Reinert & Freie Universität Berlin +# SPDX-FileCopyrightText: 2016-2025, Knut Reinert & MPI für molekulare Genetik +# SPDX-License-Identifier: CC0-1.0 + +name: No Optional Libraries + +on: + schedule: + - cron: "0 10 * * SUN" + workflow_dispatch: + +concurrency: + group: no-optional-libraries-actions + cancel-in-progress: true + +env: + SEQAN3_NO_VERSION_CHECK: 1 + TZ: Europe/Berlin + +defaults: + run: + shell: bash -Eeuxo pipefail {0} + +jobs: + build: + name: ${{ matrix.build_type }} ${{ matrix.os }} (${{ matrix.zlib }}, ${{ matrix.bzip2 }}, ${{ matrix.cereal }}) + runs-on: ${{ matrix.os }} + if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' + strategy: + fail-fast: false + # Either all optional dependencies are disabled (true, true, true) + # Or only Bzip2 is disabled (false, true, false) + matrix: + os: [ubuntu-latest, macos-14] + build_type: [Release, Debug] + zlib: [true, false] + include: + - zlib: true + bzip2: true + cereal: true + - zlib: false + bzip2: true + cereal: false + - os: macos-14 + compiler: clang-19 + - os: ubuntu-latest + compiler: gcc-14 + image: ghcr.io/seqan/gcc-14 + + container: + # If an image is defined for a matrix entry, use it. + # Otherwise, use the "empty"/'' image which means do not use a container at all. + image: ${{ matrix.image || '' }} + volumes: + - /home/runner:/home/runner + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup compiler + if: contains(matrix.os, 'macos') + uses: seqan/actions/setup-compiler@main + with: + compiler: ${{ matrix.compiler }} + + - name: Configure tests + run: | + mkdir build && cd build + cmake ../test/analyse -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=${{ matrix.zlib }} \ + -DCMAKE_DISABLE_FIND_PACKAGE_BZip2=${{ matrix.bzip2 }} \ + -DCMAKE_DISABLE_FIND_PACKAGE_cereal=${{ matrix.cereal }} \ + -DSEQAN3_BENCHMARK_MIN_TIME=0.01s + make gtest_main benchmark_main + + - name: Build tests + working-directory: build + run: make -k + + - name: Run tests + working-directory: build + continue-on-error: true + id: test + run: ctest . -j --output-on-failure --no-tests=error + + # Rerun failed tests with **one** thread. Some snippets touch the same file and fail in parallel. + - name: Rerun failed tests + if: steps.test.outcome == 'failure' + working-directory: build + run: ctest . -j1 --output-on-failure --no-tests=error --rerun-failed diff --git a/cmake/cpack_install.cmake.in b/cmake/cpack_install.cmake.in index 97c2635355..f0d2d935fc 100644 --- a/cmake/cpack_install.cmake.in +++ b/cmake/cpack_install.cmake.in @@ -5,7 +5,6 @@ # Only if creating the source package (`make package_source`): # Copy dependency include directories into package's staging folder if (CPACK_SOURCE_INSTALLED_DIRECTORIES) - file (COPY "@SEQAN3_CEREAL_INCLUDE_DIR@/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/include/seqan3/vendor") configure_file ("@CPM_DOWNLOAD_LOCATION@" "${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake" COPYONLY) if ("@use_ccache_ADDED@" STREQUAL "YES") configure_file ("@use_ccache_SOURCE_DIR@/ccache/CMakeLists.txt" diff --git a/cmake/package-lock.cmake b/cmake/package-lock.cmake index 253c288e63..298c1038de 100644 --- a/cmake/package-lock.cmake +++ b/cmake/package-lock.cmake @@ -21,8 +21,8 @@ CPMDeclarePackage (cereal NAME cereal VERSION ${SEQAN3_CEREAL_VERSION} GITHUB_REPOSITORY USCiLab/cereal - DOWNLOAD_ONLY TRUE - QUIET YES) + SYSTEM TRUE + OPTIONS "JUST_INSTALL_CEREAL ON" "CMAKE_MESSAGE_LOG_LEVEL WARNING") # benchmark set (SEQAN3_BENCHMARK_VERSION 1.9.1 CACHE STRING "" FORCE) CPMDeclarePackage (benchmark diff --git a/cmake/seqan3-config.cmake b/cmake/seqan3-config.cmake index 0470eea9b5..82edde12ff 100644 --- a/cmake/seqan3-config.cmake +++ b/cmake/seqan3-config.cmake @@ -134,32 +134,21 @@ else () endif () # ---------------------------------------------------------------------------- -# Force-deactivate optional dependencies +# Force-(de)activate optional dependencies # ---------------------------------------------------------------------------- -# Cereal is auto-detected by default, i.e. used if found, not used if not found. -# You can optionally set a hard requirement so a build fails without cereal, -# or you can force-disable cereal even if present on the system. -option (SEQAN3_CEREAL "Require cereal and fail if not present." OFF) -option (SEQAN3_NO_CEREAL "Don't use cereal, even if present." OFF) +# https://cmake.org/cmake/help/latest/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.html +# https://cmake.org/cmake/help/latest/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.html -if (SEQAN3_CEREAL AND SEQAN3_NO_CEREAL) - # this is always a user error, therefore we always error-out, even if SeqAn is not required - message (FATAL_ERROR "You may not specify SEQAN3_CEREAL and SEQAN3_NO_CEREAL at the same time.\n\ - You can specify neither (use auto-detection), or specify either to force on/off.") - return () -endif () - -if (SEQAN3_CEREAL) - set (SEQAN3_DEFINITIONS ${SEQAN3_DEFINITIONS} "-DSEQAN3_WITH_CEREAL=1") -elseif (SEQAN3_NO_CEREAL) - set (SEQAN3_DEFINITIONS ${SEQAN3_DEFINITIONS} "-DSEQAN3_WITH_CEREAL=0") -endif () +## Example for deactivating +# cmake -DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=TRUE +# -DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE +# -DCMAKE_DISABLE_FIND_PACKAGE_cereal=TRUE -# These two are "opt-in", because detected by CMake -# If you want to force-require these, just do find_package (zlib REQUIRED) before find_package (seqan3) -option (SEQAN3_NO_ZLIB "Don't use ZLIB, even if present." OFF) -option (SEQAN3_NO_BZIP2 "Don't use BZip2, even if present." OFF) +## Example for requiring +# cmake -DCMAKE_REQUIRE_FIND_PACKAGE_ZLIB=TRUE +# -DCMAKE_REQUIRE_FIND_PACKAGE_BZip2=TRUE +# -DCMAKE_REQUIRE_FIND_PACKAGE_cereal=TRUE # ---------------------------------------------------------------------------- # Check supported compilers @@ -180,8 +169,8 @@ endif () set (THREADS_PREFER_PTHREAD_FLAG TRUE) find_package (Threads QUIET) -if (Threads_FOUND) - set (SEQAN3_LIBRARIES ${SEQAN3_LIBRARIES} Threads::Threads) +if (TARGET Threads::Threads) + list (APPEND SEQAN3_LIBRARIES Threads::Threads) if ("${CMAKE_THREAD_LIBS_INIT}" STREQUAL "") seqan3_config_print ("Thread support: builtin.") else () @@ -192,67 +181,34 @@ else () endif () # ---------------------------------------------------------------------------- -# Cereal dependency is optional, but may set as required +# Cereal dependency # ---------------------------------------------------------------------------- -if (NOT SEQAN3_NO_CEREAL) - find_path (SEQAN3_CEREAL_INCLUDE_DIR - NAMES cereal/version.hpp - HINTS "${SEQAN3_INCLUDE_DIR}/seqan3/vendor") +if (SEQAN3_HAS_CPM AND NOT CMAKE_DISABLE_FIND_PACKAGE_cereal) + CPMGetPackage (cereal) +else () + find_package (cereal CONFIG QUIET) +endif () - # 1) Check the vendor directory of SeqAn3. This directory exists for source packages and installed packages. - if (SEQAN3_CEREAL_INCLUDE_DIR) - if (SEQAN3_CEREAL) - seqan3_config_print ("Required dependency: Cereal found.") - else () - seqan3_config_print ("Optional dependency: Cereal found.") - endif () - set (SEQAN3_DEPENDENCY_INCLUDE_DIRS ${SEQAN3_CEREAL_INCLUDE_DIR} ${SEQAN3_DEPENDENCY_INCLUDE_DIRS}) - # 2) Get package via CPM. - elseif (SEQAN3_HAS_CPM) - CPMGetPackage (cereal) - - find_path (SEQAN3_CEREAL_INCLUDE_DIR - NAMES cereal/version.hpp - HINTS "${cereal_SOURCE_DIR}/include") - - if (SEQAN3_CEREAL_INCLUDE_DIR) - if (SEQAN3_CEREAL) - seqan3_config_print ("Required dependency: Cereal found.") - else () - seqan3_config_print ("Optional dependency: Cereal found.") - endif () - set (SEQAN3_DEPENDENCY_INCLUDE_DIRS ${SEQAN3_CEREAL_INCLUDE_DIR} ${SEQAN3_DEPENDENCY_INCLUDE_DIRS}) - else () - if (SEQAN3_CEREAL) - seqan3_config_error ("The (optional) cereal library was marked as required, but wasn't found.") - else () - seqan3_config_print ("Optional dependency: Cereal not found.") - endif () - endif () - else () - if (SEQAN3_CEREAL) - seqan3_config_error ("The (optional) cereal library was marked as required, but wasn't found.") - else () - seqan3_config_print ("Optional dependency: Cereal not found.") - endif () - endif () +if (TARGET cereal::cereal) + list (APPEND SEQAN3_LIBRARIES cereal::cereal) + seqan3_config_print ("Optional dependency: Cereal found.") +else () + set (SEQAN3_DEFINITIONS ${SEQAN3_DEFINITIONS} "-DSEQAN3_HAS_CEREAL=0") + seqan3_config_print ("Optional dependency: Cereal not found.") endif () # ---------------------------------------------------------------------------- # ZLIB dependency # ---------------------------------------------------------------------------- -if (NOT SEQAN3_NO_ZLIB) - find_package (ZLIB QUIET) -endif () +find_package (ZLIB QUIET) -if (ZLIB_FOUND) - set (SEQAN3_LIBRARIES ${SEQAN3_LIBRARIES} ${ZLIB_LIBRARIES}) - set (SEQAN3_DEPENDENCY_INCLUDE_DIRS ${SEQAN3_DEPENDENCY_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}) - set (SEQAN3_DEFINITIONS ${SEQAN3_DEFINITIONS} "-DSEQAN3_HAS_ZLIB=1") +if (TARGET ZLIB::ZLIB) + list (APPEND SEQAN3_LIBRARIES ZLIB::ZLIB) seqan3_config_print ("Optional dependency: ZLIB-${ZLIB_VERSION_STRING} found.") else () + set (SEQAN3_DEFINITIONS ${SEQAN3_DEFINITIONS} "-DSEQAN3_HAS_ZLIB=0") seqan3_config_print ("Optional dependency: ZLIB not found.") endif () @@ -260,46 +216,35 @@ endif () # BZip2 dependency # ---------------------------------------------------------------------------- -if (NOT SEQAN3_NO_BZIP2) - find_package (BZip2 QUIET) -endif () +find_package (BZip2 QUIET) -if (NOT ZLIB_FOUND AND BZIP2_FOUND) - # NOTE (marehr): iostream_bzip2 uses the type `uInt`, which is defined by - # `zlib`. Therefore, `bzip2` will cause a ton of errors without `zlib`. - message (AUTHOR_WARNING "Disabling BZip2 [which was successfully found], " - "because ZLIB was not found. BZip2 depends on ZLIB.") - unset (BZIP2_FOUND) -endif () - -if (BZIP2_FOUND) - set (SEQAN3_LIBRARIES ${SEQAN3_LIBRARIES} ${BZIP2_LIBRARIES}) - set (SEQAN3_DEPENDENCY_INCLUDE_DIRS ${SEQAN3_DEPENDENCY_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIRS}) - set (SEQAN3_DEFINITIONS ${SEQAN3_DEFINITIONS} "-DSEQAN3_HAS_BZIP2=1") +if (TARGET ZLIB::ZLIB AND TARGET BZip2::BZip2) + list (APPEND SEQAN3_LIBRARIES BZip2::BZip2) seqan3_config_print ("Optional dependency: BZip2-${BZIP2_VERSION_STRING} found.") else () + set (SEQAN3_DEFINITIONS ${SEQAN3_DEFINITIONS} "-DSEQAN3_HAS_BZIP2=0") seqan3_config_print ("Optional dependency: BZip2 not found.") endif () +if (NOT TARGET ZLIB::ZLIB AND TARGET BZip2::BZip2) + message (AUTHOR_WARNING "BZip2 was found but ZLIB was not found. BZip2 requires ZLIB.") +endif () + # ---------------------------------------------------------------------------- # System dependencies # ---------------------------------------------------------------------------- # librt -if ((${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - OR (${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") - OR (${CMAKE_SYSTEM_NAME} STREQUAL "GNU")) - set (SEQAN3_LIBRARIES ${SEQAN3_LIBRARIES} rt) +find_library (SEQAN3_RT_LIB rt) +if (SEQAN3_RT_LIB) + list (APPEND SEQAN3_LIBRARIES ${SEQAN3_RT_LIB}) endif () # libexecinfo -- implicit -check_include_file_cxx (execinfo.h _SEQAN3_HAVE_EXECINFO) -mark_as_advanced (_SEQAN3_HAVE_EXECINFO) -if (_SEQAN3_HAVE_EXECINFO) +find_package (Backtrace QUIET) +if (TARGET Backtrace::Backtrace) + list (APPEND SEQAN3_LIBRARIES Backtrace::Backtrace) seqan3_config_print ("Optional dependency: libexecinfo found.") - if ((${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") OR (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")) - set (SEQAN3_LIBRARIES ${SEQAN3_LIBRARIES} execinfo elf) - endif () else () seqan3_config_print ("Optional dependency: libexecinfo not found.") endif () @@ -308,19 +253,17 @@ endif () # Perform compilability test of platform.hpp (tests some requirements) # ---------------------------------------------------------------------------- -set (CXXSTD_TEST_SOURCE "#include - int main() {}") - -# using try_compile instead of check_cxx_source_compiles to capture output in case of failure -file (WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" "${CXXSTD_TEST_SOURCE}\n") - # cmake-format: off +# Note: With CMake >= 3.25, the file WRITE can be removed, the second and third line in try_compile can be replaced by +# SOURCE_FROM_CONTENT "platform_test.cpp" "#include \nint main() {}" +file (WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/platform_test.cpp" + "#include \nint main() {}") + try_compile (SEQAN3_PLATFORM_TEST ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx - CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_INCLUDE_PATH};${SEQAN3_INCLUDE_DIR};${SEQAN3_DEPENDENCY_INCLUDE_DIRS}" + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/platform_test.cpp + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${SEQAN3_INCLUDE_DIR}" COMPILE_DEFINITIONS ${SEQAN3_DEFINITIONS} - LINK_LIBRARIES ${SEQAN3_LIBRARIES} CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF @@ -358,7 +301,7 @@ foreach (package_var endforeach () # propagate SEQAN3_INCLUDE_DIR into SEQAN3_INCLUDE_DIRS -set (SEQAN3_INCLUDE_DIRS ${SEQAN3_INCLUDE_DIR} ${SEQAN3_DEPENDENCY_INCLUDE_DIRS}) +set (SEQAN3_INCLUDE_DIRS ${SEQAN3_INCLUDE_DIR}) # ---------------------------------------------------------------------------- # Export targets @@ -371,9 +314,6 @@ if (SEQAN3_FOUND AND NOT TARGET seqan3::seqan3) target_link_libraries (seqan3_seqan3 INTERFACE "${SEQAN3_LIBRARIES}") # include seqan3/include/ as -I, because seqan3 should never produce warnings. target_include_directories (seqan3_seqan3 INTERFACE "${SEQAN3_INCLUDE_DIR}") - # include everything except seqan3/include/ as -isystem, i.e. - # a system header which suppresses warnings of external libraries. - target_include_directories (seqan3_seqan3 SYSTEM INTERFACE "${SEQAN3_DEPENDENCY_INCLUDE_DIRS}") add_library (seqan3::seqan3 ALIAS seqan3_seqan3) endif () diff --git a/cmake/seqan3-install.cmake b/cmake/seqan3-install.cmake index 9514a17a5b..77843ae156 100644 --- a/cmake/seqan3-install.cmake +++ b/cmake/seqan3-install.cmake @@ -20,5 +20,3 @@ install (FILES "${SEQAN3_CLONE_DIR}/cmake/seqan3-config.cmake" "${SEQAN3_CLONE_D # install seqan3 header files in /include/seqan3 install (DIRECTORY "${SEQAN3_INCLUDE_DIR}/seqan3" TYPE INCLUDE) - -install (DIRECTORY "${SEQAN3_CEREAL_INCLUDE_DIR}/cereal" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/seqan3/vendor") diff --git a/doc/cookbook/compression_threads.cpp b/doc/cookbook/compression_threads.cpp index fbdbf88709..63ed34f096 100644 --- a/doc/cookbook/compression_threads.cpp +++ b/doc/cookbook/compression_threads.cpp @@ -2,7 +2,7 @@ // SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik // SPDX-License-Identifier: CC0-1.0 -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB //![example] # include @@ -24,4 +24,4 @@ int main() return 0; } //![example] -#endif // defined(SEQAN3_HAS_ZLIB) +#endif // SEQAN3_HAS_ZLIB diff --git a/doc/howto/write_an_alphabet/dna2_semialphabet.cpp b/doc/howto/write_an_alphabet/dna2_semialphabet.cpp index b35e8f76a7..a277af4b50 100644 --- a/doc/howto/write_an_alphabet/dna2_semialphabet.cpp +++ b/doc/howto/write_an_alphabet/dna2_semialphabet.cpp @@ -4,6 +4,7 @@ //! [semialphabet] #include +#include #include // alphabet concept checks diff --git a/doc/tutorial/09_search/search_small_snippets.cpp b/doc/tutorial/09_search/search_small_snippets.cpp index 23b59487ff..ecb6edfd55 100644 --- a/doc/tutorial/09_search/search_small_snippets.cpp +++ b/doc/tutorial/09_search/search_small_snippets.cpp @@ -5,11 +5,11 @@ #include "cleanup.hpp" seqan3::cleanup index_file{"index.file"}; -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL # include # include -#endif //SEQAN3_WITH_CEREAL +#endif //SEQAN3_HAS_CEREAL #include @@ -33,7 +33,7 @@ int main() //![text_collection] } -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL { //![store] # include // for writing/reading files @@ -61,7 +61,7 @@ int main() } //![load] } -#endif //SEQAN3_WITH_CEREAL +#endif //SEQAN3_HAS_CEREAL { //![error_search] diff --git a/doc/tutorial/09_search/search_solution1.cpp b/doc/tutorial/09_search/search_solution1.cpp index b98883d9c9..fdfbef1064 100644 --- a/doc/tutorial/09_search/search_solution1.cpp +++ b/doc/tutorial/09_search/search_solution1.cpp @@ -2,7 +2,7 @@ // SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik // SPDX-License-Identifier: CC0-1.0 -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL # include "cleanup.hpp" seqan3::cleanup index_file{"index.file"}; @@ -42,4 +42,4 @@ int main() std::cout << "The indices differ!\n"; } //![solution] -#endif //SEQAN3_WITH_CEREAL +#endif //SEQAN3_HAS_CEREAL diff --git a/doc/tutorial/11_read_mapper/read_mapper_indexer_step3.cpp b/doc/tutorial/11_read_mapper/read_mapper_indexer_step3.cpp index 5c62c9d5e8..d256d71e53 100644 --- a/doc/tutorial/11_read_mapper/read_mapper_indexer_step3.cpp +++ b/doc/tutorial/11_read_mapper/read_mapper_indexer_step3.cpp @@ -3,7 +3,7 @@ // SPDX-License-Identifier: CC0-1.0 #include -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL //![complete] # include @@ -97,4 +97,4 @@ int main(int argc, char const ** argv) return 0; } //![complete] -#endif //SEQAN3_WITH_CEREAL +#endif //SEQAN3_HAS_CEREAL diff --git a/doc/tutorial/11_read_mapper/read_mapper_step2.cpp b/doc/tutorial/11_read_mapper/read_mapper_step2.cpp index 3d74497313..ffe976e03c 100644 --- a/doc/tutorial/11_read_mapper/read_mapper_step2.cpp +++ b/doc/tutorial/11_read_mapper/read_mapper_step2.cpp @@ -3,7 +3,7 @@ // SPDX-License-Identifier: CC0-1.0 #include -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL //![complete] # include @@ -147,4 +147,4 @@ int main(int argc, char const ** argv) return 0; } //![complete] -#endif //SEQAN3_WITH_CEREAL +#endif //SEQAN3_HAS_CEREAL diff --git a/doc/tutorial/11_read_mapper/read_mapper_step3.cpp b/doc/tutorial/11_read_mapper/read_mapper_step3.cpp index 14d5460f60..8bbe28bee2 100644 --- a/doc/tutorial/11_read_mapper/read_mapper_step3.cpp +++ b/doc/tutorial/11_read_mapper/read_mapper_step3.cpp @@ -3,7 +3,7 @@ // SPDX-License-Identifier: CC0-1.0 #include -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL //![complete] # include # include @@ -167,4 +167,4 @@ int main(int argc, char const ** argv) return 0; } //![complete] -#endif //SEQAN3_WITH_CEREAL +#endif //SEQAN3_HAS_CEREAL diff --git a/doc/tutorial/11_read_mapper/read_mapper_step4.cpp b/doc/tutorial/11_read_mapper/read_mapper_step4.cpp index 316591d7bc..b5ebd5fa91 100644 --- a/doc/tutorial/11_read_mapper/read_mapper_step4.cpp +++ b/doc/tutorial/11_read_mapper/read_mapper_step4.cpp @@ -3,7 +3,7 @@ // SPDX-License-Identifier: CC0-1.0 #include -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL //![complete] # include # include @@ -181,4 +181,4 @@ int main(int argc, char const ** argv) return 0; } //![complete] -#endif //SEQAN3_WITH_CEREAL +#endif //SEQAN3_HAS_CEREAL diff --git a/include/seqan3/alignment/matrix/detail/debug_matrix.hpp b/include/seqan3/alignment/matrix/detail/debug_matrix.hpp index d026a4d8df..1a1b365b76 100644 --- a/include/seqan3/alignment/matrix/detail/debug_matrix.hpp +++ b/include/seqan3/alignment/matrix/detail/debug_matrix.hpp @@ -10,6 +10,7 @@ #pragma once #include +#include #include #include diff --git a/include/seqan3/alignment/scoring/scoring_scheme_base.hpp b/include/seqan3/alignment/scoring/scoring_scheme_base.hpp index 3cf06f42bf..19276271ac 100644 --- a/include/seqan3/alignment/scoring/scoring_scheme_base.hpp +++ b/include/seqan3/alignment/scoring/scoring_scheme_base.hpp @@ -17,9 +17,9 @@ #include #include -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL # include -#endif // SEQAN3_WITH_CEREAL +#endif // SEQAN3_HAS_CEREAL namespace seqan3 { diff --git a/include/seqan3/alphabet/container/concatenated_sequences.hpp b/include/seqan3/alphabet/container/concatenated_sequences.hpp index dfdc0d7f00..bfdb1b7502 100644 --- a/include/seqan3/alphabet/container/concatenated_sequences.hpp +++ b/include/seqan3/alphabet/container/concatenated_sequences.hpp @@ -19,9 +19,9 @@ #include #include -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL # include -#endif +#endif // SEQAN3_HAS_CEREAL namespace seqan3 { diff --git a/include/seqan3/contrib/stream/bgzf.hpp b/include/seqan3/contrib/stream/bgzf.hpp index f6372b3a63..877c5d11ad 100644 --- a/include/seqan3/contrib/stream/bgzf.hpp +++ b/include/seqan3/contrib/stream/bgzf.hpp @@ -11,6 +11,8 @@ #include +#include + namespace seqan3::contrib { diff --git a/include/seqan3/contrib/stream/bgzf_istream.hpp b/include/seqan3/contrib/stream/bgzf_istream.hpp index b82cd5445c..05e34e7ba0 100644 --- a/include/seqan3/contrib/stream/bgzf_istream.hpp +++ b/include/seqan3/contrib/stream/bgzf_istream.hpp @@ -30,11 +30,7 @@ #include #include -#if !defined(SEQAN3_HAS_ZLIB) && !defined(SEQAN3_HEADER_TEST) -# error "This file cannot be used when building without GZip-support." -#endif // !defined(SEQAN3_HAS_ZLIB) && !defined(SEQAN3_HEADER_TEST) - -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB namespace seqan3::contrib { @@ -625,6 +621,6 @@ typedef basic_bgzf_istream bgzf_istream; // A typedef for basic_bgzf_istream typedef basic_bgzf_istream bgzf_wistream; -} // namespace seqan3::conrib +} // namespace seqan3::contrib -#endif // defined(SEQAN3_HAS_ZLIB) +#endif // SEQAN3_HAS_ZLIB diff --git a/include/seqan3/contrib/stream/bgzf_ostream.hpp b/include/seqan3/contrib/stream/bgzf_ostream.hpp index aa0309a95e..3a442337ba 100644 --- a/include/seqan3/contrib/stream/bgzf_ostream.hpp +++ b/include/seqan3/contrib/stream/bgzf_ostream.hpp @@ -29,11 +29,7 @@ #include #include -#if !defined(SEQAN3_HAS_ZLIB) && !defined(SEQAN3_HEADER_TEST) -# error "This file cannot be used when building without GZip-support." -#endif // !defined(SEQAN3_HAS_ZLIB) && !defined(SEQAN3_HEADER_TEST) - -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB namespace seqan3::contrib { @@ -392,4 +388,4 @@ typedef basic_bgzf_ostream bgzf_wostream; } // namespace seqan3::contrib -#endif // defined(SEQAN3_HAS_ZLIB) +#endif // SEQAN3_HAS_ZLIB diff --git a/include/seqan3/contrib/stream/bgzf_stream_util.hpp b/include/seqan3/contrib/stream/bgzf_stream_util.hpp index 37e6c66174..d608a71f14 100644 --- a/include/seqan3/contrib/stream/bgzf_stream_util.hpp +++ b/include/seqan3/contrib/stream/bgzf_stream_util.hpp @@ -23,11 +23,7 @@ #include #include -#if !defined(SEQAN3_HAS_ZLIB) && !defined(SEQAN3_HEADER_TEST) -# error "This file cannot be used when building without GZip-support." -#endif // !defined(SEQAN3_HAS_ZLIB) && !defined(SEQAN3_HEADER_TEST) - -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB // Zlib headers # include @@ -308,4 +304,4 @@ inline TDestCapacity _decompressBlock(TDestValue * dstBegin, } // namespace seqan3::contrib -#endif // defined(SEQAN3_HAS_ZLIB) +#endif // SEQAN3_HAS_ZLIB diff --git a/include/seqan3/contrib/stream/bz2_istream.hpp b/include/seqan3/contrib/stream/bz2_istream.hpp index 4195a23336..40dcebbe08 100644 --- a/include/seqan3/contrib/stream/bz2_istream.hpp +++ b/include/seqan3/contrib/stream/bz2_istream.hpp @@ -26,11 +26,9 @@ #include #include -#if !defined(SEQAN3_HAS_BZIP2) && !defined(SEQAN3_HEADER_TEST) -#error "This file cannot be used when building without BZIP2-support." -#endif // !defined(SEQAN3_HAS_BZIP2) && !defined(SEQAN3_HEADER_TEST) +#include -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 #define BZ_NO_STDIO #include @@ -366,4 +364,4 @@ typedef basic_bz2_istream bz2_wistream; } // namespace seqan3::contrib -#endif // defined(SEQAN3_HAS_BZIP2) +#endif // SEQAN3_HAS_BZIP2 diff --git a/include/seqan3/contrib/stream/bz2_ostream.hpp b/include/seqan3/contrib/stream/bz2_ostream.hpp index 2c3eb4623f..113ec6a5df 100644 --- a/include/seqan3/contrib/stream/bz2_ostream.hpp +++ b/include/seqan3/contrib/stream/bz2_ostream.hpp @@ -27,11 +27,9 @@ #include #include -#if !defined(SEQAN3_HAS_BZIP2) && !defined(SEQAN3_HEADER_TEST) -#error "This file cannot be used when building without BZIP2-support." -#endif // !defined(SEQAN3_HAS_BZIP2) && !defined(SEQAN3_HEADER_TEST) +#include -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 #define BZ_NO_STDIO #include @@ -426,4 +424,4 @@ typedef basic_bz2_ostream bz2_wostream; } // namespace seqan3::contrib -#endif // defined(SEQAN3_HAS_BZIP2) +#endif // SEQAN3_HAS_BZIP2 diff --git a/include/seqan3/contrib/stream/gz_istream.hpp b/include/seqan3/contrib/stream/gz_istream.hpp index 32323dfcbd..165b1a068f 100644 --- a/include/seqan3/contrib/stream/gz_istream.hpp +++ b/include/seqan3/contrib/stream/gz_istream.hpp @@ -28,11 +28,9 @@ #include #include -#if !defined(SEQAN3_HAS_ZLIB) && !defined(SEQAN3_HEADER_TEST) -#error "This file cannot be used when building without ZLIB-support." -#endif // !defined(SEQAN3_HAS_ZLIB) && !defined(SEQAN3_HEADER_TEST) +#include -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB #include @@ -342,4 +340,4 @@ typedef basic_gz_istream gz_wistream; } // namespace seqan3::contrib -#endif // defined(SEQAN3_HAS_ZLIB) +#endif // SEQAN3_HAS_ZLIB diff --git a/include/seqan3/contrib/stream/gz_ostream.hpp b/include/seqan3/contrib/stream/gz_ostream.hpp index c03c4c5d64..1f4d036a22 100644 --- a/include/seqan3/contrib/stream/gz_ostream.hpp +++ b/include/seqan3/contrib/stream/gz_ostream.hpp @@ -27,11 +27,9 @@ #include #include -#if !defined(SEQAN3_HAS_ZLIB) && !defined(SEQAN3_HEADER_TEST) -#error "This file cannot be used when building without ZLIB-support." -#endif // !defined(SEQAN3_HAS_ZLIB) && !defined(SEQAN3_HEADER_TEST) +#include -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB #include @@ -454,4 +452,4 @@ typedef basic_gz_ostream gz_wostream; } // namespace seqan3::contrib -#endif // defined(SEQAN3_HAS_ZLIB) +#endif // SEQAN3_HAS_ZLIB diff --git a/include/seqan3/core/concept/cereal.hpp b/include/seqan3/core/concept/cereal.hpp index 5c4315b27f..69510489a6 100644 --- a/include/seqan3/core/concept/cereal.hpp +++ b/include/seqan3/core/concept/cereal.hpp @@ -13,10 +13,10 @@ #include -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL # include # include -#endif +#endif // SEQAN3_HAS_CEREAL namespace seqan3 { @@ -35,13 +35,13 @@ namespace seqan3 * \see core_concept */ //!\cond -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL template concept cereal_output_archive = std::is_base_of_v; #else template concept cereal_output_archive = false; -#endif +#endif // SEQAN3_HAS_CEREAL //!\endcond /*!\interface seqan3::cereal_input_archive <> @@ -58,13 +58,13 @@ concept cereal_output_archive = false; * \see core_concept */ //!\cond -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL template concept cereal_input_archive = std::is_base_of_v; #else template concept cereal_input_archive = false; -#endif +#endif // SEQAN3_HAS_CEREAL //!\endcond /*!\interface seqan3::cereal_archive <> @@ -77,13 +77,13 @@ concept cereal_input_archive = false; * \see core_concept */ //!\cond -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL template concept cereal_archive = cereal_output_archive || cereal_input_archive; #else template concept cereal_archive = false; -#endif +#endif // SEQAN3_HAS_CEREAL //!\endcond /*!\interface seqan3::cereal_text_archive <> @@ -100,13 +100,13 @@ concept cereal_archive = false; * \see core_concept */ //!\cond -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL template concept cereal_text_archive = std::is_base_of_v; #else template concept cereal_text_archive = false; -#endif +#endif // SEQAN3_HAS_CEREAL //!\endcond /*!\interface seqan3::cerealisable <> @@ -142,7 +142,7 @@ concept cereal_text_archive = false; * The cereal library is an optional dependency of SeqAn, if it is not found **no types** satisfy this concept. */ //!\cond -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL template @@ -151,7 +151,7 @@ concept cerealisable = cereal::traits::is_input_serializable concept cerealisable = false; -#endif +#endif // SEQAN3_HAS_CEREAL //!\endcond } // namespace seqan3 @@ -163,12 +163,12 @@ namespace seqan3::detail * \details Helpful when defining templatised save/load/serialize functions. * \ingroup core_concept */ -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL template using strip_cereal_wrapper_t = typename cereal::traits::strip_minimal>::type; #else template using strip_cereal_wrapper_t = type; -#endif +#endif // SEQAN3_HAS_CEREAL } // namespace seqan3::detail diff --git a/include/seqan3/core/platform.hpp b/include/seqan3/core/platform.hpp index e2e929ec59..5bc97f7942 100644 --- a/include/seqan3/core/platform.hpp +++ b/include/seqan3/core/platform.hpp @@ -105,25 +105,47 @@ # error SeqAn3 include directory not set correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS? #endif +// zlib [optional] +/*!\def SEQAN3_HAS_ZLIB + * \brief Whether ZLIB support is available or not. + * \ingroup core + */ +#ifndef SEQAN3_HAS_ZLIB +# if __has_include() +# define SEQAN3_HAS_ZLIB 1 +# else +# define SEQAN3_HAS_ZLIB 0 +# endif +#endif + +// bzip2 [optional] +/*!\def SEQAN3_HAS_BZIP2 + * \brief Whether BZIP2 support is available or not. + * \ingroup core + */ +#ifndef SEQAN3_HAS_BZIP2 +# if SEQAN3_HAS_ZLIB && __has_include() +# define SEQAN3_HAS_BZIP2 1 +# else +# define SEQAN3_HAS_BZIP2 0 +# endif +#endif + // Cereal [optional] -/*!\def SEQAN3_WITH_CEREAL +/*!\def SEQAN3_HAS_CEREAL * \brief Whether CEREAL support is available or not. * \ingroup core */ -#ifndef SEQAN3_WITH_CEREAL +#ifndef SEQAN3_HAS_CEREAL # if __has_include() -# define SEQAN3_WITH_CEREAL 1 +# define SEQAN3_HAS_CEREAL 1 # else -# define SEQAN3_WITH_CEREAL 0 -# endif -#elif SEQAN3_WITH_CEREAL != 0 -# if !__has_include() -# error Cereal was marked as required, but not found! +# define SEQAN3_HAS_CEREAL 0 # endif #endif //!\cond DEV -#if !SEQAN3_WITH_CEREAL +#if !SEQAN3_HAS_CEREAL /*!\name Cereal function macros * \ingroup core * \brief These can be changed by apps so we used the macros instead of the values internally. @@ -168,6 +190,27 @@ # endif #endif +//!\cond +// clang-format off +#if defined(SEQAN3_WITH_CEREAL) && defined(SEQAN3_HAS_CEREAL) && SEQAN3_WITH_CEREAL != SEQAN3_HAS_CEREAL +# error "SEQAN3_WITH_CEREAL is deprecated and has been replaced by SEQAN3_HAS_CEREAL. These two macros do not expand to the same value. Please use SEQAN3_HAS_CEREAL." +#endif +#ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS +# ifdef SEQAN3_WITH_CEREAL +# pragma GCC warning "SEQAN3_WITH_CEREAL is deprecated and will be removed in the next version; please use SEQAN3_HAS_CEREAL instead." +# else +# define SEQAN3_WITH_CEREAL \ + SEQAN3_PRAGMA(GCC warning "SEQAN3_WITH_CEREAL is deprecated and will be removed in the next version; please use SEQAN3_HAS_CEREAL instead.") \ + SEQAN3_HAS_CEREAL +# endif +#else +# ifndef SEQAN3_WITH_CEREAL +# define SEQAN3_WITH_CEREAL SEQAN3_HAS_CEREAL +# endif +#endif +// clang-format on +//!\endcond + // ============================================================================ // Workarounds // ============================================================================ diff --git a/include/seqan3/io/detail/magic_header.hpp b/include/seqan3/io/detail/magic_header.hpp index 623a8b94a5..1845722e7f 100644 --- a/include/seqan3/io/detail/magic_header.hpp +++ b/include/seqan3/io/detail/magic_header.hpp @@ -114,15 +114,15 @@ struct bgzf_compression * \ingroup io */ using compression_formats = pack_traits::drop_front #include -#if defined(SEQAN3_HAS_BZIP2) -# include -#endif -#if defined(SEQAN3_HAS_ZLIB) -# include -# include -# include -#endif #include +#include +#include +#include +#include #include #include #include @@ -120,36 +116,36 @@ inline auto make_secondary_istream(std::basic_istream & primary_stream, // set return value appropriately if (read_chars == magic_number.size() && bgzf_compression::validate_header(std::span{magic_number})) // BGZF { -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB if (contains_extension(gz_compression{}, extension) || contains_extension(bgzf_compression{}, extension)) filename.replace_extension(); return {new contrib::basic_bgzf_istream{primary_stream}, stream_deleter_default}; #else throw file_open_error{"Trying to read from a bgzf file, but no ZLIB available."}; -#endif +#endif // SEQAN3_HAS_ZLIB } else if (starts_with(magic_number, gz_compression::magic_header)) // GZIP { -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB if (contains_extension(gz_compression{}, extension) || contains_extension(bgzf_compression{}, extension)) filename.replace_extension(); return {new contrib::basic_gz_istream{primary_stream}, stream_deleter_default}; #else throw file_open_error{"Trying to read from a gzipped file, but no ZLIB available."}; -#endif +#endif // SEQAN3_HAS_ZLIB } else if (starts_with(magic_number, bz2_compression::magic_header)) // BZip2 { -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 if (contains_extension(bz2_compression{}, extension)) filename.replace_extension(); return {new contrib::basic_bz2_istream{primary_stream}, stream_deleter_default}; #else throw file_open_error{"Trying to read from a bzipped file, but no libbz2 available."}; -#endif +#endif // SEQAN3_HAS_BZIP2 } else if (starts_with(magic_number, zstd_compression::magic_header)) // ZStd { diff --git a/include/seqan3/io/detail/misc_output.hpp b/include/seqan3/io/detail/misc_output.hpp index 45cf14062d..da883c57b1 100644 --- a/include/seqan3/io/detail/misc_output.hpp +++ b/include/seqan3/io/detail/misc_output.hpp @@ -15,14 +15,10 @@ #include #include -#if defined(SEQAN3_HAS_BZIP2) -# include -#endif -#if defined(SEQAN3_HAS_ZLIB) -# include -# include -#endif #include +#include +#include +#include #include #include @@ -52,32 +48,32 @@ inline auto make_secondary_ostream(std::basic_ostream & primary_stream, if (extension == ".gz") { -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB filename.replace_extension(""); return {new contrib::basic_gz_ostream{primary_stream}, stream_deleter_default}; #else throw file_open_error{"Trying to write a gzipped file, but no ZLIB available."}; -#endif +#endif // SEQAN3_HAS_ZLIB } else if ((extension == ".bgzf") || (extension == ".bam")) { -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB if (extension != ".bam") // remove extension except for bam filename.replace_extension(""); return {new contrib::basic_bgzf_ostream{primary_stream}, stream_deleter_default}; #else throw file_open_error{"Trying to write a bgzf'ed file, but no ZLIB available."}; -#endif +#endif // SEQAN3_HAS_ZLIB } else if (extension == ".bz2") { -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 filename.replace_extension(""); return {new contrib::basic_bz2_ostream{primary_stream}, stream_deleter_default}; #else throw file_open_error{"Trying to write a bzipped file, but no libbz2 available."}; -#endif +#endif // SEQAN3_HAS_BZIP2 } else if (extension == ".zst") { diff --git a/include/seqan3/utility/container/dynamic_bitset.hpp b/include/seqan3/utility/container/dynamic_bitset.hpp index 37dee3ee07..b25159fd66 100644 --- a/include/seqan3/utility/container/dynamic_bitset.hpp +++ b/include/seqan3/utility/container/dynamic_bitset.hpp @@ -10,6 +10,7 @@ #pragma once #include +#include #include #include diff --git a/include/seqan3/utility/container/small_string.hpp b/include/seqan3/utility/container/small_string.hpp index a95ff5acb0..bf1ab2966c 100644 --- a/include/seqan3/utility/container/small_string.hpp +++ b/include/seqan3/utility/container/small_string.hpp @@ -9,6 +9,8 @@ #pragma once +#include + #include namespace seqan3 diff --git a/include/seqan3/utility/container/small_vector.hpp b/include/seqan3/utility/container/small_vector.hpp index df1ffd1f7e..302b941795 100644 --- a/include/seqan3/utility/container/small_vector.hpp +++ b/include/seqan3/utility/container/small_vector.hpp @@ -12,9 +12,9 @@ #include #include -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL # include -#endif // SEQAN3_WITH_CEREAL +#endif // SEQAN3_HAS_CEREAL #include #include diff --git a/test/header/generate_header_source.cmake b/test/header/generate_header_source.cmake index 177a8bbd73..1cfc0b08b4 100644 --- a/test/header/generate_header_source.cmake +++ b/test/header/generate_header_source.cmake @@ -43,8 +43,8 @@ file (APPEND "${HEADER_TARGET_SOURCE}" # # test that seqan3 headers include platform.hpp if ("${HEADER_COMPONENT}" MATCHES "seqan3") - # exclude seqan3/std/* and seqan3/contrib/* from platform test - if (NOT HEADER_FILE_INCLUDE MATCHES "seqan3/(std|contrib)/") + # exclude seqan3/std/* and seqan3/contrib/sdsl-lite.hpp from platform test + if (NOT HEADER_FILE_INCLUDE MATCHES "seqan3/(std/|contrib/sdsl-lite.hpp)") file (APPEND "${HEADER_TARGET_SOURCE}" # "// seqan3-header-test-platform-start\n" "#ifndef SEQAN3_DOXYGEN_ONLY\n" # diff --git a/test/include/seqan3/test/cereal.hpp b/test/include/seqan3/test/cereal.hpp index 6f3b22db86..86a6d43fb2 100644 --- a/test/include/seqan3/test/cereal.hpp +++ b/test/include/seqan3/test/cereal.hpp @@ -18,13 +18,13 @@ #include #include -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL # include # include # include # include # include -#endif // SEQAN3_WITH_CEREAL +#endif // SEQAN3_HAS_CEREAL namespace seqan3 { @@ -70,12 +70,12 @@ void do_cerealisation(value_t && value) template void do_serialisation([[maybe_unused]] value_t && value) { -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL do_cerealisation(value); do_cerealisation(value); do_cerealisation(value); do_cerealisation(value); -#endif // SEQAN3_WITH_CEREAL +#endif // SEQAN3_HAS_CEREAL } //!\endcond diff --git a/test/include/seqan3/test/zlib_skip.hpp b/test/include/seqan3/test/zlib_skip.hpp index 688c014685..650f9a8e69 100644 --- a/test/include/seqan3/test/zlib_skip.hpp +++ b/test/include/seqan3/test/zlib_skip.hpp @@ -13,9 +13,9 @@ #include -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB # include -#endif +#endif // SEQAN3_HAS_ZLIB // Some of our tests check the binary compressed output of zlib. This is not guaranteed to be the same for all zlib // implementations. diff --git a/test/performance/alignment/CMakeLists.txt b/test/performance/alignment/CMakeLists.txt index 789f23289a..ff1404923b 100644 --- a/test/performance/alignment/CMakeLists.txt +++ b/test/performance/alignment/CMakeLists.txt @@ -10,7 +10,7 @@ seqan3_benchmark (global_affine_alignment_simd_benchmark.cpp) seqan3_benchmark (local_affine_alignment_benchmark.cpp) seqan3_benchmark (edit_distance_unbanded_benchmark.cpp) -find_package (OpenMP) +find_package (OpenMP QUIET COMPONENTS CXX) if (TARGET OpenMP::OpenMP_CXX) target_link_libraries (global_affine_alignment_parallel_benchmark OpenMP::OpenMP_CXX) diff --git a/test/performance/io/stream_input_benchmark.cpp b/test/performance/io/stream_input_benchmark.cpp index dba7aeb539..e0dfb1d955 100644 --- a/test/performance/io/stream_input_benchmark.cpp +++ b/test/performance/io/stream_input_benchmark.cpp @@ -10,34 +10,34 @@ #include -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB # include # include # include # include -#endif +#endif // SEQAN3_HAS_ZLIB // only benchmark BZIP2 if explicitly requested, because slow setup -#if !defined(SEQAN3_BENCH_BZIP2) && defined(SEQAN3_HAS_BZIP2) +#if !defined(SEQAN3_BENCH_BZIP2) && SEQAN3_HAS_BZIP2 # undef SEQAN3_HAS_BZIP2 #endif -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 # include # include -#endif +#endif // SEQAN3_HAS_BZIP2 // SEQAN2 #if __has_include() # define SEQAN3_HAS_SEQAN2 1 -# if defined(SEQAN3_HAS_ZLIB) +# if SEQAN3_HAS_ZLIB # define SEQAN_HAS_ZLIB 1 -# endif +# endif // SEQAN3_HAS_ZLIB -# if defined(SEQAN3_HAS_BZIP2) +# if SEQAN3_HAS_BZIP2 # define SEQAN_HAS_BZIP2 1 -# endif +# endif // SEQAN3_HAS_BZIP2 # include #endif @@ -65,7 +65,7 @@ template <> std::string const & input_comp = input; #endif -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB template <> std::string const input_comp{ []() @@ -96,9 +96,9 @@ std::string const & input_comp = input_comp std::string const & input_comp = input_comp; # endif -#endif +#endif // SEQAN3_HAS_ZLIB -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 template <> std::string const input_comp{ []() @@ -114,7 +114,7 @@ std::string const input_comp{ template <> std::string const & input_comp = input_comp; # endif -#endif +#endif // SEQAN3_HAS_BZIP2 // ============================================================================ // plain benchmark of ostringstream @@ -166,14 +166,14 @@ void compressed(benchmark::State & state) state.counters["iterations_per_run"] = i; } -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB BENCHMARK_TEMPLATE(compressed, seqan3::contrib::gz_istream); BENCHMARK_TEMPLATE(compressed, seqan3::contrib::bgzf_istream); -#endif +#endif // SEQAN3_HAS_ZLIB -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 BENCHMARK_TEMPLATE(compressed, seqan3::contrib::bz2_istream); -#endif +#endif // SEQAN3_HAS_BZIP2 // ============================================================================ // compression applied, but stuffed into plain istream @@ -201,13 +201,13 @@ void compressed_type_erased(benchmark::State & state) state.counters["iterations_per_run"] = i; } -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB BENCHMARK_TEMPLATE(compressed_type_erased, seqan3::contrib::gz_istream); BENCHMARK_TEMPLATE(compressed_type_erased, seqan3::contrib::bgzf_istream); -#endif -#if defined(SEQAN3_HAS_BZIP2) +#endif // SEQAN3_HAS_ZLIB +#if SEQAN3_HAS_BZIP2 BENCHMARK_TEMPLATE(compressed_type_erased, seqan3::contrib::bz2_istream); -#endif +#endif // SEQAN3_HAS_BZIP2 // ============================================================================ // compression applied, but stuffed into plain istream, also stringstream erased @@ -235,13 +235,13 @@ void compressed_type_erased2(benchmark::State & state) state.counters["iterations_per_run"] = i; } -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB BENCHMARK_TEMPLATE(compressed_type_erased2, seqan3::contrib::gz_istream); BENCHMARK_TEMPLATE(compressed_type_erased2, seqan3::contrib::bgzf_istream); -#endif -#if defined(SEQAN3_HAS_BZIP2) +#endif // SEQAN3_HAS_ZLIB +#if SEQAN3_HAS_BZIP2 BENCHMARK_TEMPLATE(compressed_type_erased2, seqan3::contrib::bz2_istream); -#endif +#endif // SEQAN3_HAS_BZIP2 // ============================================================================ // seqan2 virtual stream diff --git a/test/performance/io/stream_output_benchmark.cpp b/test/performance/io/stream_output_benchmark.cpp index ec3ec6792e..7f6f91cb1a 100644 --- a/test/performance/io/stream_output_benchmark.cpp +++ b/test/performance/io/stream_output_benchmark.cpp @@ -8,26 +8,26 @@ #include #include -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB # include # include -#endif +#endif // SEQAN3_HAS_ZLIB -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 # include -#endif +#endif // SEQAN3_HAS_BZIP2 // SEQAN2 #if __has_include() # define SEQAN3_HAS_SEQAN2 1 -# if defined(SEQAN3_HAS_ZLIB) +# if SEQAN3_HAS_ZLIB # define SEQAN_HAS_ZLIB 1 -# endif +# endif // SEQAN3_HAS_ZLIB -# if defined(SEQAN3_HAS_BZIP2) +# if SEQAN3_HAS_BZIP2 # define SEQAN_HAS_BZIP2 1 -# endif +# endif // SEQAN3_HAS_BZIP2 # include #endif @@ -66,13 +66,13 @@ void compressed(benchmark::State & state) oit = static_cast(i++ % 128); } -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB BENCHMARK_TEMPLATE(compressed, seqan3::contrib::gz_ostream); BENCHMARK_TEMPLATE(compressed, seqan3::contrib::bgzf_ostream); -#endif -#if defined(SEQAN3_HAS_BZIP2) +#endif // SEQAN3_HAS_ZLIB +#if SEQAN3_HAS_BZIP2 BENCHMARK_TEMPLATE(compressed, seqan3::contrib::bz2_ostream); -#endif +#endif // SEQAN3_HAS_BZIP2 // ============================================================================ // compression applied, but stuffed into plain ostream @@ -92,13 +92,13 @@ void compressed_type_erased(benchmark::State & state) oit = static_cast(i++ % 128); } -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB BENCHMARK_TEMPLATE(compressed_type_erased, seqan3::contrib::gz_ostream); BENCHMARK_TEMPLATE(compressed_type_erased, seqan3::contrib::bgzf_ostream); -#endif -#if defined(SEQAN3_HAS_BZIP2) +#endif // SEQAN3_HAS_ZLIB +#if SEQAN3_HAS_BZIP2 BENCHMARK_TEMPLATE(compressed_type_erased, seqan3::contrib::bz2_ostream); -#endif +#endif // SEQAN3_HAS_BZIP2 // ============================================================================ // compression applied, but stuffed into plain ostream, also stringstream erased @@ -118,13 +118,13 @@ void compressed_type_erased2(benchmark::State & state) oit = static_cast(i++ % 128); } -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB BENCHMARK_TEMPLATE(compressed_type_erased2, seqan3::contrib::gz_ostream); BENCHMARK_TEMPLATE(compressed_type_erased2, seqan3::contrib::bgzf_ostream); -#endif -#if defined(SEQAN3_HAS_BZIP2) +#endif // SEQAN3_HAS_ZLIB +#if SEQAN3_HAS_BZIP2 BENCHMARK_TEMPLATE(compressed_type_erased2, seqan3::contrib::bz2_ostream); -#endif +#endif // SEQAN3_HAS_BZIP2 // ============================================================================ // seqan2 virtual stream diff --git a/test/snippet/CMakeLists.txt b/test/snippet/CMakeLists.txt index 657d7bb653..55f8b26e76 100644 --- a/test/snippet/CMakeLists.txt +++ b/test/snippet/CMakeLists.txt @@ -69,6 +69,16 @@ set_tests_properties ( "snippet/utility/container/aligned_allocator_snippet_cmp_output" PROPERTIES SKIP_RETURN_CODE 1) +# These tests do not produce output if cereal is not available. +if (NOT TARGET cereal::cereal) + set_tests_properties ( + "doc/snippet/tutorial/11_read_mapper/read_mapper_indexer_step3_snippet_cmp_output" + "doc/snippet/tutorial/11_read_mapper/read_mapper_step2_snippet_cmp_output" + "doc/snippet/tutorial/11_read_mapper/read_mapper_step3_snippet_cmp_output" + "doc/snippet/tutorial/11_read_mapper/read_mapper_step4_snippet_cmp_output" + PROPERTIES SKIP_RETURN_CODE 1) +endif () + list_unused_snippets ("${CMAKE_CURRENT_SOURCE_DIR}") list_unused_snippets ("${CMAKE_CURRENT_SOURCE_DIR}/../../doc") diff --git a/test/snippet/alphabet/char_is_valid_for.cpp b/test/snippet/alphabet/char_is_valid_for.cpp index 1cbfb13e4b..2729c6fc69 100644 --- a/test/snippet/alphabet/char_is_valid_for.cpp +++ b/test/snippet/alphabet/char_is_valid_for.cpp @@ -2,6 +2,8 @@ // SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik // SPDX-License-Identifier: CC0-1.0 +#include + #include #include diff --git a/test/snippet/core/cereal_example.cpp b/test/snippet/core/cereal_example.cpp index 3a3d60251c..fc6ca42322 100644 --- a/test/snippet/core/cereal_example.cpp +++ b/test/snippet/core/cereal_example.cpp @@ -2,7 +2,7 @@ // SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik // SPDX-License-Identifier: CC0-1.0 -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL # include # include @@ -45,4 +45,4 @@ int main() return 0; } -#endif +#endif // SEQAN3_HAS_CEREAL diff --git a/test/snippet/range/views/range_view_all_notation.cpp b/test/snippet/range/views/range_view_all_notation.cpp index 455d4f83cf..56dabcde00 100644 --- a/test/snippet/range/views/range_view_all_notation.cpp +++ b/test/snippet/range/views/range_view_all_notation.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: CC0-1.0 #include +#include #include #include diff --git a/test/unit/contrib/stream/CMakeLists.txt b/test/unit/contrib/stream/CMakeLists.txt index 6177ae9faf..6eef9c940c 100644 --- a/test/unit/contrib/stream/CMakeLists.txt +++ b/test/unit/contrib/stream/CMakeLists.txt @@ -2,15 +2,11 @@ # SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik # SPDX-License-Identifier: CC0-1.0 -if (BZIP2_FOUND) - seqan3_test (bz2_istream_test.cpp) - seqan3_test (bz2_ostream_test.cpp) -endif () +seqan3_test (bz2_istream_test.cpp) +seqan3_test (bz2_ostream_test.cpp) -if (ZLIB_FOUND) - seqan3_test (gz_istream_test.cpp) - seqan3_test (gz_ostream_test.cpp) +seqan3_test (gz_istream_test.cpp) +seqan3_test (gz_ostream_test.cpp) - seqan3_test (bgzf_istream_test.cpp) - seqan3_test (bgzf_ostream_test.cpp) -endif () +seqan3_test (bgzf_istream_test.cpp) +seqan3_test (bgzf_ostream_test.cpp) diff --git a/test/unit/contrib/stream/bgzf_istream_test.cpp b/test/unit/contrib/stream/bgzf_istream_test.cpp index 3ac9d644d3..9b61634cd3 100644 --- a/test/unit/contrib/stream/bgzf_istream_test.cpp +++ b/test/unit/contrib/stream/bgzf_istream_test.cpp @@ -6,7 +6,9 @@ #include -#include "../../io/stream/istream_test_template.hpp" +#if SEQAN3_HAS_ZLIB + +# include "../../io/stream/istream_test_template.hpp" template <> class istream : public ::testing::Test @@ -27,3 +29,12 @@ class istream : public ::testing::Test using test_types = ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(contrib_streams, istream, test_types, ); + +#else + +TEST(bgzf_istream_test, skipped) +{ + GTEST_SKIP() << "ZLIB is missing. Not running bgzf_istream_test."; +} + +#endif // SEQAN3_HAS_ZLIB diff --git a/test/unit/contrib/stream/bgzf_ostream_test.cpp b/test/unit/contrib/stream/bgzf_ostream_test.cpp index 142222ab51..41fe9e52df 100644 --- a/test/unit/contrib/stream/bgzf_ostream_test.cpp +++ b/test/unit/contrib/stream/bgzf_ostream_test.cpp @@ -6,7 +6,9 @@ #include -#include "../../io/stream/ostream_test_template.hpp" +#if SEQAN3_HAS_ZLIB + +# include "../../io/stream/ostream_test_template.hpp" template <> class ostream : public ::testing::Test @@ -29,3 +31,12 @@ class ostream : public ::testing::Test using test_types = ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(contrib_streams, ostream, test_types, ); + +#else + +TEST(bgzf_ostream_test, skipped) +{ + GTEST_SKIP() << "ZLIB is missing. Not running bgzf_ostream_test."; +} + +#endif // SEQAN3_HAS_ZLIB diff --git a/test/unit/contrib/stream/bz2_istream_test.cpp b/test/unit/contrib/stream/bz2_istream_test.cpp index 2846290f82..9d76c1eff5 100644 --- a/test/unit/contrib/stream/bz2_istream_test.cpp +++ b/test/unit/contrib/stream/bz2_istream_test.cpp @@ -6,7 +6,9 @@ #include -#include "../../io/stream/istream_test_template.hpp" +#if SEQAN3_HAS_BZIP2 + +# include "../../io/stream/istream_test_template.hpp" template <> class istream : public ::testing::Test @@ -27,3 +29,12 @@ class istream : public ::testing::Test using test_types = ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(contrib_streams, istream, test_types, ); + +#else + +TEST(bz2_istream_test, skipped) +{ + GTEST_SKIP() << "BZip2 is missing. Not running bz2_istream_test."; +} + +#endif // SEQAN3_HAS_BZIP2 diff --git a/test/unit/contrib/stream/bz2_ostream_test.cpp b/test/unit/contrib/stream/bz2_ostream_test.cpp index 9080e4cd4c..bfa450be7a 100644 --- a/test/unit/contrib/stream/bz2_ostream_test.cpp +++ b/test/unit/contrib/stream/bz2_ostream_test.cpp @@ -6,7 +6,9 @@ #include -#include "../../io/stream/ostream_test_template.hpp" +#if SEQAN3_HAS_BZIP2 + +# include "../../io/stream/ostream_test_template.hpp" template <> class ostream : public ::testing::Test @@ -27,3 +29,12 @@ class ostream : public ::testing::Test using test_types = ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(contrib_streams, ostream, test_types, ); + +#else + +TEST(bz2_ostream_test, skipped) +{ + GTEST_SKIP() << "BZip2 is missing. Not running bz2_ostream_test."; +} + +#endif // SEQAN3_HAS_BZIP2 diff --git a/test/unit/contrib/stream/gz_istream_test.cpp b/test/unit/contrib/stream/gz_istream_test.cpp index 613208172a..0faf4e70b2 100644 --- a/test/unit/contrib/stream/gz_istream_test.cpp +++ b/test/unit/contrib/stream/gz_istream_test.cpp @@ -6,7 +6,9 @@ #include -#include "../../io/stream/istream_test_template.hpp" +#if SEQAN3_HAS_ZLIB + +# include "../../io/stream/istream_test_template.hpp" template <> class istream : public ::testing::Test @@ -25,3 +27,12 @@ class istream : public ::testing::Test using test_types = ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(contrib_streams, istream, test_types, ); + +#else + +TEST(gz_istream_test, skipped) +{ + GTEST_SKIP() << "ZLIB is missing. Not running gz_istream_test."; +} + +#endif // SEQAN3_HAS_ZLIB diff --git a/test/unit/contrib/stream/gz_ostream_test.cpp b/test/unit/contrib/stream/gz_ostream_test.cpp index 8c924feb64..8932185ca7 100644 --- a/test/unit/contrib/stream/gz_ostream_test.cpp +++ b/test/unit/contrib/stream/gz_ostream_test.cpp @@ -6,7 +6,9 @@ #include -#include "../../io/stream/ostream_test_template.hpp" +#if SEQAN3_HAS_ZLIB + +# include "../../io/stream/ostream_test_template.hpp" template <> class ostream : public ::testing::Test @@ -27,3 +29,12 @@ class ostream : public ::testing::Test using test_types = ::testing::Types; INSTANTIATE_TYPED_TEST_SUITE_P(contrib_streams, ostream, test_types, ); + +#else + +TEST(gz_ostream_test, skipped) +{ + GTEST_SKIP() << "ZLIB is missing. Not running gz_ostream_test."; +} + +#endif // SEQAN3_HAS_ZLIB diff --git a/test/unit/core/concept/cereal_test.cpp b/test/unit/core/concept/cereal_test.cpp index 7ea364e43a..8eaf02bde1 100644 --- a/test/unit/core/concept/cereal_test.cpp +++ b/test/unit/core/concept/cereal_test.cpp @@ -9,15 +9,15 @@ #include -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL # include # include # include # include # include -#endif +#endif // SEQAN3_HAS_CEREAL -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL TEST(cereal, cereal_output_archive) { @@ -87,4 +87,4 @@ TEST(cereal, cerealisable) EXPECT_TRUE((seqan3::cerealisable, 10>>)); } -#endif +#endif // SEQAN3_HAS_CEREAL diff --git a/test/unit/io/detail/magic_header_test.cpp b/test/unit/io/detail/magic_header_test.cpp index f011ada413..8f50b72ee0 100644 --- a/test/unit/io/detail/magic_header_test.cpp +++ b/test/unit/io/detail/magic_header_test.cpp @@ -15,15 +15,15 @@ TEST(misc, valid_compression_extensions) using string_vector = std::vector; string_vector valid_compression = seqan3::detail::valid_file_extensions(); -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB // expect gz and bgzf EXPECT_TRUE(std::find(valid_compression.begin(), valid_compression.end(), "gz") != valid_compression.end()); EXPECT_TRUE(std::find(valid_compression.begin(), valid_compression.end(), "bgzf") != valid_compression.end()); -#endif +#endif // SEQAN3_HAS_ZLIB -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 EXPECT_TRUE(std::find(valid_compression.begin(), valid_compression.end(), "bz2") != valid_compression.end()); -#endif +#endif // SEQAN3_HAS_BZIP2 #if defined(SEQAN3_HAS_ZSTD) EXPECT_TRUE(std::find(valid_compression.begin(), valid_compression.end(), "zst") != valid_compression.end()); diff --git a/test/unit/io/detail/misc_output_test.cpp b/test/unit/io/detail/misc_output_test.cpp index f1555bb6b6..3b98d34648 100644 --- a/test/unit/io/detail/misc_output_test.cpp +++ b/test/unit/io/detail/misc_output_test.cpp @@ -27,7 +27,7 @@ inline std::vector read_file_content(std::filesystem::path const & path) return {std::istreambuf_iterator{filestream}, std::istreambuf_iterator{}}; } -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB TEST(misc_output, issue2455_gz) { seqan3::test::tmp_directory tmp; @@ -49,9 +49,9 @@ TEST(misc_output, issue2455_bgzf) EXPECT_TRUE(seqan3::detail::bgzf_compression::validate_header(std::span{file_content})); } -#endif +#endif // SEQAN3_HAS_ZLIB -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 TEST(misc_output, issue2455_bz) { seqan3::test::tmp_directory tmp; @@ -61,4 +61,4 @@ TEST(misc_output, issue2455_bz) EXPECT_TRUE(seqan3::detail::starts_with(file_content, seqan3::detail::bz2_compression::magic_header)); } -#endif +#endif // SEQAN3_HAS_BZIP2 diff --git a/test/unit/io/sam_file/sam_file_input_test.cpp b/test/unit/io/sam_file/sam_file_input_test.cpp index 5a1a3b5c0b..069af1abdc 100644 --- a/test/unit/io/sam_file/sam_file_input_test.cpp +++ b/test/unit/io/sam_file/sam_file_input_test.cpp @@ -318,7 +318,7 @@ void decompression_impl(fixture_t & fix, input_file_t & fin) EXPECT_EQ(counter, 3u); } -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB std::string input_gz{ '\x1F', '\x8B', '\x08', '\x08', '\x9D', '\x5B', '\x38', '\x5C', '\x00', '\x03', '\x74', '\x65', '\x73', '\x74', @@ -422,9 +422,9 @@ TEST_F(sam_file_input_f, read_empty_bgzf_file) EXPECT_TRUE(fin.begin() == fin.end()); } -#endif +#endif // SEQAN3_HAS_ZLIB -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 std::string input_bz2{ '\x42', '\x5A', '\x68', '\x39', '\x31', '\x41', '\x59', '\x26', '\x53', '\x59', '\x7B', '\xE2', '\xE1', '\x92', '\x00', '\x00', '\x5C', '\x5F', '\x80', '\x00', '\x30', '\x2D', '\xFF', '\xFF', '\x90', '\x3C', @@ -483,7 +483,7 @@ TEST_F(sam_file_input_f, read_empty_bz2_file) EXPECT_TRUE(fin.begin() == fin.end()); } -#endif +#endif // SEQAN3_HAS_BZIP2 // ---------------------------------------------------------------------------- // BAM format specificities @@ -522,7 +522,7 @@ struct sam_file_input_bam_format_f : public sam_file_input_f '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00'}; }; -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB TEST_F(sam_file_input_bam_format_f, construct_by_filename) { seqan3::test::tmp_directory tmp{}; @@ -578,4 +578,4 @@ TEST_F(sam_file_input_bam_format_f, construct_by_stream) EXPECT_EQ(counter, 3u); } -#endif // defined(SEQAN3_HAS_ZLIB) +#endif // SEQAN3_HAS_ZLIB diff --git a/test/unit/io/sam_file/sam_file_output_test.cpp b/test/unit/io/sam_file/sam_file_output_test.cpp index 0a6e21fe92..ec5eaf0542 100644 --- a/test/unit/io/sam_file/sam_file_output_test.cpp +++ b/test/unit/io/sam_file/sam_file_output_test.cpp @@ -586,7 +586,7 @@ read3 43 ref 3 63 1S1M1D1M1I1M1I1D1M1S ref 10 300 GGAGTATA !!*+,-./ EXPECT_EQ(reinterpret_cast(fout.get_stream()).str(), comp); } -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB TEST(rows, write_bam_file) { seqan3::test::tmp_directory tmp{}; @@ -620,7 +620,7 @@ read3 43 ref 3 63 1S1M1D1M1I1M1I1D1M1S ref 10 300 GGAGTATA !!*+,-./ EXPECT_EQ(reinterpret_cast(fout2.get_stream()).str(), comp); } -#endif // defined(SEQAN3_HAS_ZLIB) +#endif // SEQAN3_HAS_ZLIB TEST(rows, convert_sam_to_blast) { @@ -676,7 +676,7 @@ void compression_by_stream_impl(comp_stream_t & stream) } } -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB std::string expected_gz{'\x1F', '\x8B', '\x08', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x2B', '\x4A', '\x4D', '\x4C', '\x31', '\xE4', '\x34', '\xE0', '\xD4', '\x02', '\x62', '\x10', '\x09', '\xA1', '\x1D', '\x9D', '\xDD', '\x43', '\x38', '\xB5', '\xB8', '\x8A', '\x80', @@ -745,9 +745,9 @@ TEST(compression, by_stream_bgzf) SEQAN3_TEST_GTEST_SKIP_ZLIB_DEFLATE; EXPECT_EQ(buffer, expected_bgzf); } -#endif +#endif // SEQAN3_HAS_ZLIB -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 std::string expected_bz2{'\x42', '\x5A', '\x68', '\x39', '\x31', '\x41', '\x59', '\x26', '\x53', '\x59', '\xEA', '\x2B', '\x97', '\x64', '\x00', '\x00', '\x39', '\xDF', '\x80', '\x00', '\x30', '\x00', '\x10', '\x78', '\x00', '\x28', '\x81', '\x04', '\x00', '\x26', '\x00', '\x10', '\x00', @@ -777,4 +777,4 @@ TEST(compression, by_stream_bz2) EXPECT_EQ(out.str(), expected_bz2); } -#endif +#endif // SEQAN3_HAS_BZIP2 diff --git a/test/unit/io/sam_file/sam_file_seek_test.cpp b/test/unit/io/sam_file/sam_file_seek_test.cpp index d6f48f6cb3..c3f2492405 100644 --- a/test/unit/io/sam_file/sam_file_seek_test.cpp +++ b/test/unit/io/sam_file/sam_file_seek_test.cpp @@ -87,10 +87,12 @@ TEST_P(sam_file_seek_test, seek_to) EXPECT_TRUE(it == fin.end()); } +#if SEQAN3_HAS_ZLIB INSTANTIATE_TEST_SUITE_P(bam_file, sam_file_seek_test, ::testing::Values(sam_file_seek_test_fixture{"simple_three_verbose_reads.bam", {4'915'200, 11'730'944, 23'134'208}})); +#endif // SEQAN3_HAS_ZLIB INSTANTIATE_TEST_SUITE_P(sam_file, sam_file_seek_test, diff --git a/test/unit/io/sequence_file/sequence_file_input_test.cpp b/test/unit/io/sequence_file/sequence_file_input_test.cpp index 446010f41d..567bf9a4de 100644 --- a/test/unit/io/sequence_file/sequence_file_input_test.cpp +++ b/test/unit/io/sequence_file/sequence_file_input_test.cpp @@ -313,7 +313,7 @@ void decompression_impl(fixture_t & fix, input_file_t & fin) EXPECT_EQ(counter, 3u); } -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB std::string input_gz{ '\x1F', '\x8B', '\x08', '\x00', '\x33', '\xBF', '\x13', '\x5C', '\x00', '\x03', '\xB3', '\x53', '\x08', '\x71', '\x0D', '\x0E', '\x51', '\x30', '\xE4', '\x72', '\x74', '\x76', '\x0F', '\xE1', '\xB2', '\x0B', '\x49', '\x2D', @@ -412,9 +412,9 @@ TEST_F(sequence_file_input_f, read_empty_bgzf_file) EXPECT_TRUE(fin.begin() == fin.end()); } -#endif +#endif // SEQAN3_HAS_ZLIB -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 std::string input_bz2{'\x42', '\x5A', '\x68', '\x39', '\x31', '\x41', '\x59', '\x26', '\x53', '\x59', '\x8D', '\xD7', '\xE7', '\xD6', '\x00', '\x00', '\x06', '\x5F', '\x80', '\x00', '\x10', '\x40', '\x00', '\x38', '\x01', '\x2A', '\x81', '\x0C', '\x00', '\x02', '\x00', '\x0C', '\x00', '\x20', '\x00', '\x54', @@ -466,4 +466,4 @@ TEST_F(sequence_file_input_f, read_empty_bz2_file) EXPECT_TRUE(fin.begin() == fin.end()); } -#endif +#endif // SEQAN3_HAS_BZIP2 diff --git a/test/unit/io/sequence_file/sequence_file_output_test.cpp b/test/unit/io/sequence_file/sequence_file_output_test.cpp index 599a401bcb..d79ffc88d7 100644 --- a/test/unit/io/sequence_file/sequence_file_output_test.cpp +++ b/test/unit/io/sequence_file/sequence_file_output_test.cpp @@ -459,7 +459,7 @@ void compression_by_stream_impl(comp_stream_t & stream) } } -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB std::string expected_gz{'\x1F', '\x8B', '\x08', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\xB3', '\x53', '\x08', '\x71', '\x0D', '\x0E', '\x51', '\x30', '\xE4', '\x72', '\x74', '\x76', '\x0F', '\xE1', '\xB2', '\x53', '\x08', '\x49', '\x2D', '\x2E', '\x31', '\xE2', '\x72', '\x74', '\x77', '\x77', @@ -529,9 +529,9 @@ TEST(compression, by_stream_bgzf) EXPECT_EQ(buffer, expected_bgzf); } -#endif +#endif // SEQAN3_HAS_ZLIB -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 std::string expected_bz2{'\x42', '\x5A', '\x68', '\x39', '\x31', '\x41', '\x59', '\x26', '\x53', '\x59', '\xB4', '\x68', '\xEA', '\xE3', '\x00', '\x00', '\x06', '\xDF', '\x80', '\x00', '\x10', '\x40', '\x00', '\x38', '\x01', '\x2A', '\x81', '\x0C', '\x00', '\x02', '\x00', '\x0C', '\x00', @@ -561,4 +561,4 @@ TEST(compression, by_stream_bz2) EXPECT_EQ(out.str(), expected_bz2); } -#endif +#endif // SEQAN3_HAS_BZIP2 diff --git a/test/unit/io/structure_file/structure_file_input_test.cpp b/test/unit/io/structure_file/structure_file_input_test.cpp index a95c236c8d..30952b2a06 100644 --- a/test/unit/io/structure_file/structure_file_input_test.cpp +++ b/test/unit/io/structure_file/structure_file_input_test.cpp @@ -243,7 +243,7 @@ struct structure_file_input_read : public ::testing::Test EXPECT_EQ(idx, bpp_comp.size()); } -#if defined(SEQAN3_HAS_ZLIB) || defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_ZLIB || SEQAN3_HAS_BZIP2 template void decompression_impl(input_file_t & fin) { @@ -373,7 +373,7 @@ TEST_F(structure_file_input_read, record_file_view) // decompression // ---------------------------------------------------------------------------- -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB std::string input_gz{ '\x1F', '\x8B', '\x08', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x03', '\x55', '\x8E', '\xC1', '\x0A', '\xC2', '\x40', '\x0C', '\x44', '\xEF', '\xF9', '\x8A', '\x3D', '\x76', '\x0F', '\x5D', '\x5B', '\x14', '\x7A', @@ -472,9 +472,9 @@ TEST_F(structure_file_input_read, read_empty_bgzf_file) EXPECT_TRUE(fin.begin() == fin.end()); } -#endif +#endif // SEQAN3_HAS_ZLIB -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 std::string input_bz2{ '\x42', '\x5A', '\x68', '\x39', '\x31', '\x41', '\x59', '\x26', '\x53', '\x59', '\xC7', '\x0B', '\xB5', '\x7F', '\x00', '\x00', '\x36', '\x5F', '\x80', '\x6E', '\x50', '\x40', '\x63', '\xEC', '\x81', '\x2A', '\xC3', '\x5A', @@ -534,4 +534,4 @@ TEST_F(structure_file_input_read, read_empty_bz2_file) EXPECT_TRUE(fin.begin() == fin.end()); } -#endif +#endif // SEQAN3_HAS_BZIP2 diff --git a/test/unit/io/structure_file/structure_file_output_test.cpp b/test/unit/io/structure_file/structure_file_output_test.cpp index c5ac64711e..9030601060 100644 --- a/test/unit/io/structure_file/structure_file_output_test.cpp +++ b/test/unit/io/structure_file/structure_file_output_test.cpp @@ -397,7 +397,7 @@ TEST_F(structure_file_output_columns, assign_columns) // compression // ---------------------------------------------------------------------------- -#if defined(SEQAN3_HAS_ZLIB) || defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_ZLIB || SEQAN3_HAS_BZIP2 struct structure_file_output_compression : public structure_file_output_write { std::string compression_by_filename_impl(seqan3::test::sandboxed_path const & filename) @@ -436,7 +436,7 @@ struct structure_file_output_compression : public structure_file_output_write }; #endif -#if defined(SEQAN3_HAS_ZLIB) +#if SEQAN3_HAS_ZLIB std::string expected_gz{ '\x1F', '\x8B', '\x08', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x55', '\x8E', '\xC1', '\x0A', '\xC2', '\x40', '\x0C', '\x44', '\xEF', '\xF9', '\x8A', '\x3D', '\x76', '\x0F', '\x5D', '\x5B', '\x14', '\x7A', @@ -514,9 +514,9 @@ TEST_F(structure_file_output_compression, by_stream_bgzf) SEQAN3_TEST_GTEST_SKIP_ZLIB_DEFLATE; EXPECT_EQ(buffer, expected_bgzf); } -#endif +#endif // SEQAN3_HAS_ZLIB -#if defined(SEQAN3_HAS_BZIP2) +#if SEQAN3_HAS_BZIP2 std::string expected_bz2{ '\x42', '\x5A', '\x68', '\x39', '\x31', '\x41', '\x59', '\x26', '\x53', '\x59', '\xC7', '\x0B', '\xB5', '\x7F', '\x00', '\x00', '\x36', '\x5F', '\x80', '\x6E', '\x50', '\x40', '\x63', '\xEC', '\x81', '\x2A', '\xC3', '\x5A', @@ -550,4 +550,4 @@ TEST_F(structure_file_output_compression, by_stream_bz2) } EXPECT_EQ(out.str(), expected_bz2); } -#endif +#endif // SEQAN3_HAS_BZIP2 diff --git a/test/unit/search/fm_index/fm_index_dna4_test.cpp b/test/unit/search/fm_index/fm_index_dna4_test.cpp index ca9a63668d..4e4d6e4def 100644 --- a/test/unit/search/fm_index/fm_index_dna4_test.cpp +++ b/test/unit/search/fm_index/fm_index_dna4_test.cpp @@ -21,7 +21,7 @@ TEST(fm_index_test, additional_concepts) TEST(fm_index_test, cerealisation_errors) { -#if SEQAN3_WITH_CEREAL +#if SEQAN3_HAS_CEREAL using seqan3::operator""_dna4; @@ -49,5 +49,5 @@ TEST(fm_index_test, cerealisation_errors) cereal::BinaryInputArchive iarchive{is}; EXPECT_THROW(iarchive(in), std::logic_error); } -#endif +#endif // SEQAN3_HAS_CEREAL }