From c42191b7f73b08185890389c30c92ee0042972cc Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Sat, 23 Dec 2023 14:22:40 +0100 Subject: [PATCH] [INFRA] Cleanup --- .cmake-format.yaml | 3 + .github/workflows/ci_macos.yml | 2 +- CMakeLists.txt | 31 +-- cmake/CPMGetSystemPackage.cmake | 30 +++ .../ccache.cmake | 30 +-- cmake/configuration.cmake | 96 +++++++++ cmake/raptor-config-version.cmake | 94 -------- cmake/raptor-config.cmake | 202 ------------------ cmake/raptor-install.cmake | 39 ---- cmake/raptor-package.cmake | 2 +- cmake/version.cmake | 16 ++ doc/setup/index.md | 2 +- src/CMakeLists.txt | 44 ++-- src/argument_parsing/CMakeLists.txt | 106 ++++----- src/build/CMakeLists.txt | 12 +- src/build/build_ibf.cpp | 7 + src/layout/CMakeLists.txt | 8 +- src/prepare/CMakeLists.txt | 12 +- src/search/CMakeLists.txt | 12 +- src/threshold/CMakeLists.txt | 28 +-- src/upgrade/CMakeLists.txt | 10 +- test/cmake/raptor_path_longest_stem.cmake | 11 +- test/cmake/raptor_test_component.cmake | 2 +- test/cmake/raptor_test_files.cmake | 2 +- test/coverage/CMakeLists.txt | 2 +- test/data/datasources.cmake | 2 +- test/documentation/CMakeLists.txt | 4 +- .../documentation/raptor-doxygen-layout.cmake | 2 +- test/documentation/raptor-doxygen.cmake | 2 +- test/header/CMakeLists.txt | 6 +- test/performance/CMakeLists.txt | 4 +- test/raptor-test.cmake | 128 ++++++----- test/snippet/CMakeLists.txt | 4 +- test/snippet/compare_snippet_output.cmake | 2 +- test/unit/CMakeLists.txt | 4 +- test/unit/api/CMakeLists.txt | 2 +- test/unit/cli/CMakeLists.txt | 2 +- test/unit/cli/argument_parsing/CMakeLists.txt | 2 +- test/unit/cli/build/CMakeLists.txt | 2 +- test/unit/cli/search/CMakeLists.txt | 2 +- test/unit/cli/upgrade/CMakeLists.txt | 2 +- util/applications/src/CMakeLists.txt | 35 ++- .../src/Genome_Biology/CMakeLists.txt | 2 +- util/applications/src/iScience/CMakeLists.txt | 16 +- .../src/iScience/apply_taxsbp.cpp | 2 +- util/iScience/CMakeLists.txt | 20 +- util/iScience/README.md | 2 +- util/iScience/thresholding/CMakeLists.txt | 6 +- util/test/CMakeLists.txt | 10 +- 49 files changed, 424 insertions(+), 642 deletions(-) create mode 100644 cmake/CPMGetSystemPackage.cmake rename test/cmake/raptor_require_ccache.cmake => cmake/ccache.cmake (57%) create mode 100644 cmake/configuration.cmake delete mode 100644 cmake/raptor-config-version.cmake delete mode 100644 cmake/raptor-config.cmake delete mode 100644 cmake/raptor-install.cmake create mode 100644 cmake/version.cmake diff --git a/.cmake-format.yaml b/.cmake-format.yaml index 15c1d6bf..eb64414c 100644 --- a/.cmake-format.yaml +++ b/.cmake-format.yaml @@ -13,6 +13,9 @@ parse: cpmgetpackage: pargs: 1 spelling: CPMGetPackage + cpmgetsystempackage: + pargs: 1 + spelling: CPMGetSystemPackage cpmaddpackage: pargs: nargs: '*' diff --git a/.github/workflows/ci_macos.yml b/.github/workflows/ci_macos.yml index 74cfe6ac..43f4ddb2 100644 --- a/.github/workflows/ci_macos.yml +++ b/.github/workflows/ci_macos.yml @@ -28,7 +28,7 @@ jobs: timeout-minutes: 120 if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint' strategy: - fail-fast: true + fail-fast: false matrix: include: - name: "gcc13" diff --git a/CMakeLists.txt b/CMakeLists.txt index 92d803be..7dd3309b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,31 +5,34 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) -find_path (RAPTOR_MODULE_PATH "raptor-config.cmake" HINTS "${CMAKE_CURRENT_LIST_DIR}/cmake/") +find_path (RAPTOR_MODULE_PATH "configuration.cmake" HINTS "${CMAKE_CURRENT_LIST_DIR}/cmake/") list (APPEND CMAKE_MODULE_PATH "${RAPTOR_MODULE_PATH}") -include (raptor-config-version) +include (version) -project (raptor - LANGUAGES CXX C +project (Raptor + LANGUAGES CXX VERSION "${RAPTOR_PROJECT_VERSION}" DESCRIPTION "Raptor -- A fast and space-efficient pre-filter for querying very large collections of nucleotide sequences" HOMEPAGE_URL "https://github.com/seqan/raptor" ) -find_package (Raptor REQUIRED HINTS ${RAPTOR_MODULE_PATH}) +if (NOT CMAKE_BUILD_TYPE) + set (CMAKE_BUILD_TYPE + Release + CACHE STRING "Choose the type of build, options are: Debug Coverage Release RelWithDebInfo MinSizeRel." FORCE + ) +endif () -option (BUILD_RAPTOR "Enable building of Raptor." ON) +include (configuration) -if (BUILD_RAPTOR) - add_subdirectory (src) -endif () +add_subdirectory (src) -option (INSTALL_RAPTOR_HEADERS "Enable installation of Raptor headers." OFF) +option (INSTALL_RAPTOR "Enable installation of Raptor." ON) -if (INSTALL_RAPTOR_HEADERS) - include (raptor-install) - include (raptor-package) +if (INSTALL_RAPTOR) + include (GNUInstallDirs) + install (TARGETS raptor RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") endif () diff --git a/cmake/CPMGetSystemPackage.cmake b/cmake/CPMGetSystemPackage.cmake new file mode 100644 index 00000000..dc1860af --- /dev/null +++ b/cmake/CPMGetSystemPackage.cmake @@ -0,0 +1,30 @@ +# SPDX-FileCopyrightText: 2006-2023, Knut Reinert & Freie Universität Berlin +# SPDX-FileCopyrightText: 2016-2023, Knut Reinert & MPI für molekulare Genetik +# SPDX-License-Identifier: BSD-3-Clause + +# SYSTEM property is only implemented with CMake 3.25 +macro (CPMGetSystemPackage package) + CPMGetPackage (${package}) + + if (CMAKE_VERSION VERSION_LESS 3.25) + set (target_name "${package}") + if ("${package}" STREQUAL "seqan3") + set (target_name "seqan3_seqan3") + elseif ("${package}" STREQUAL "sharg") + set (target_name "sharg_sharg") + endif () + + if (${package}_ADDED) + set (interface_include "$") + set (include "$") + set_target_properties (${target_name} + PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES + "$<$:${interface_include}>;$<$:${include}>" + ) + unset (interface_include) + unset (include) + endif () + + unset (target_name) + endif () +endmacro () diff --git a/test/cmake/raptor_require_ccache.cmake b/cmake/ccache.cmake similarity index 57% rename from test/cmake/raptor_require_ccache.cmake rename to cmake/ccache.cmake index 0eb11a22..16e8c42b 100644 --- a/test/cmake/raptor_require_ccache.cmake +++ b/cmake/ccache.cmake @@ -5,7 +5,7 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) include (FindPackageMessage) @@ -28,16 +28,9 @@ macro (raptor_require_ccache) else () find_package_message (CCACHE_PROGRAM " Ccache program: available" "[${CCACHE_PROGRAM}]") set (RAPTOR_FPROFILE_ABS_PATH "--ccache-skip -fprofile-abs-path") - # New option since cmake >= 3.4: - # https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_LAUNCHER.html - if (NOT CMAKE_VERSION VERSION_LESS 3.15) # cmake >= 3.15 - list (PREPEND CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") - list (PREPEND CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") - else () - # prepend ccache to CMAKE_CXX_COMPILER_LAUNCHER - list (INSERT CMAKE_CXX_COMPILER_LAUNCHER 0 "${CCACHE_PROGRAM}") - list (INSERT CMAKE_C_COMPILER_LAUNCHER 0 "${CCACHE_PROGRAM}") - endif () + + list (PREPEND CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + list (PREPEND CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") # use ccache in external cmake projects list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS @@ -45,16 +38,11 @@ macro (raptor_require_ccache) ) list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}") - if (NOT CMAKE_VERSION VERSION_LESS 3.21) # cmake >= 3.21 - list (PREPEND CMAKE_CXX_LINKER_LAUNCHER "${CCACHE_PROGRAM}") - list (PREPEND CMAKE_C_LINKER_LAUNCHER "${CCACHE_PROGRAM}") - list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS - "-DCMAKE_CXX_LINKER_LAUNCHER=${CMAKE_CXX_LINKER_LAUNCHER}" - ) - list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_C_LINKER_LAUNCHER=${CMAKE_C_LINKER_LAUNCHER}") - else () - set_property (GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_PROGRAM}") - endif () + list (PREPEND CMAKE_CXX_LINKER_LAUNCHER "${CCACHE_PROGRAM}") + list (PREPEND CMAKE_C_LINKER_LAUNCHER "${CCACHE_PROGRAM}") + list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_CXX_LINKER_LAUNCHER=${CMAKE_CXX_LINKER_LAUNCHER}") + list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_C_LINKER_LAUNCHER=${CMAKE_C_LINKER_LAUNCHER}") + endif () unset (CCACHE_PROGRAM) endif () diff --git a/cmake/configuration.cmake b/cmake/configuration.cmake new file mode 100644 index 00000000..d5f05100 --- /dev/null +++ b/cmake/configuration.cmake @@ -0,0 +1,96 @@ +# SPDX-FileCopyrightText: 2006-2023, Knut Reinert & Freie Universität Berlin +# SPDX-FileCopyrightText: 2016-2023, Knut Reinert & MPI für molekulare Genetik +# SPDX-License-Identifier: BSD-3-Clause + +cmake_minimum_required (VERSION 3.21) + +# ---------------------------------------------------------------------------- +# Short-circuit if Raptor is already configured +# ---------------------------------------------------------------------------- + +if (TARGET raptor::raptor) + return () +endif () + +# ---------------------------------------------------------------------------- +# Greeter +# ---------------------------------------------------------------------------- + +message (STATUS "Finding Raptor (${RAPTOR_VERSION}) and checking requirements") + +# ---------------------------------------------------------------------------- +# Pretty printing and error handling +# ---------------------------------------------------------------------------- + +macro (raptor_config_print text) + message (STATUS " ${text}") +endmacro () + +macro (raptor_config_error text) + message (FATAL_ERROR " ${text}") +endmacro () + +# ---------------------------------------------------------------------------- +# ccache +# ---------------------------------------------------------------------------- + +include (ccache) +raptor_require_ccache () + +# ---------------------------------------------------------------------------- +# CPM +# ---------------------------------------------------------------------------- + +set (CPM_INDENT " CMake Package Manager CPM: ") +include (CPM) +CPMUsePackageLock (${Raptor_SOURCE_DIR}/cmake/package-lock.cmake) + +# ---------------------------------------------------------------------------- +# Find or add dependencies +# ---------------------------------------------------------------------------- + +include (CPMGetSystemPackage) + +CPMGetSystemPackage (hibf) +CPMGetSystemPackage (sharg) +CPMGetSystemPackage (seqan3) +CPMGetSystemPackage (chopper) + +# ---------------------------------------------------------------------------- +# Find Raptor include path +# ---------------------------------------------------------------------------- + +find_path (RAPTOR_INCLUDE_DIR + NAMES raptor/version.hpp + HINTS "${Raptor_SOURCE_DIR}/include" +) + +if (RAPTOR_INCLUDE_DIR) + raptor_config_print ("Raptor include dir found: ${RAPTOR_INCLUDE_DIR}") +else () + raptor_config_error ("Raptor include directory could not be found (RAPTOR_INCLUDE_DIR: '${RAPTOR_INCLUDE_DIR}')") +endif () + +# ---------------------------------------------------------------------------- +# Export targets +# ---------------------------------------------------------------------------- + +add_library (raptor_raptor INTERFACE) +target_link_libraries (raptor_raptor INTERFACE seqan::hibf sharg::sharg seqan3::seqan3) +target_include_directories (raptor_raptor INTERFACE "${RAPTOR_INCLUDE_DIR}") + +# !Workaround: Get chopper include dir from chopper_shared target +find_path (CHOPPER_INCLUDE_DIR + NAMES chopper/configuration.hpp + HINTS "${chopper_SOURCE_DIR}/include" +) +target_include_directories (raptor_raptor SYSTEM INTERFACE "${CHOPPER_INCLUDE_DIR}") + +# !Workaround: Get seqan3 test include dir from seqan3 target +find_path (SEQAN3_TEST_INCLUDE_DIR + NAMES seqan3/test/tmp_directory.hpp + HINTS "${seqan3_SOURCE_DIR}/test/include" +) +target_include_directories (raptor_raptor SYSTEM INTERFACE "${SEQAN3_TEST_INCLUDE_DIR}") + +add_library (raptor::raptor ALIAS raptor_raptor) diff --git a/cmake/raptor-config-version.cmake b/cmake/raptor-config-version.cmake deleted file mode 100644 index 589057ca..00000000 --- a/cmake/raptor-config-version.cmake +++ /dev/null @@ -1,94 +0,0 @@ -# -------------------------------------------------------------------------------------------------------- -# Copyright (c) 2006-2023, Knut Reinert & Freie Universität Berlin -# Copyright (c) 2016-2023, Knut Reinert & MPI für molekulare Genetik -# This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License -# shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md -# -------------------------------------------------------------------------------------------------------- - -# This file adds version support for `find_package(RAPTOR 3.1)`. -# See https://cmake.org/cmake/help/v3.18/manual/cmake-packages.7.html#package-version-file for more information. -# -# This file was partially generated by -# https://cmake.org/cmake/help/v3.18/module/CMakePackageConfigHelpers.html#command:write_basic_package_version_file - -# Note that raptor-config.cmake can be standalone and thus RAPTOR_CLONE_DIR might be empty. -find_path (RAPTOR_CLONE_DIR - NAMES cmake/raptor-config.cmake - HINTS "${CMAKE_CURRENT_LIST_DIR}/.." -) -find_path (RAPTOR_INCLUDE_DIR - NAMES raptor/version.hpp - HINTS "${RAPTOR_CLONE_DIR}/include" -) - -# extract version from raptor/version.hpp header -file (STRINGS "${RAPTOR_INCLUDE_DIR}/raptor/version.hpp" RAPTOR_VERSION_HPP - REGEX "#define RAPTOR_VERSION_(MAJOR|MINOR|PATCH)" -) -string (REGEX REPLACE "#define RAPTOR_VERSION_(MAJOR|MINOR|PATCH) " "" PACKAGE_VERSION "${RAPTOR_VERSION_HPP}") -string (REGEX REPLACE ";" "." PACKAGE_VERSION "${PACKAGE_VERSION}") - -if (PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) - set (PACKAGE_VERSION_COMPATIBLE FALSE) -else () - - if (PACKAGE_VERSION MATCHES "^([0-9]+)\\.") - set (_PACKAGE_VERSION_MAJOR "${CMAKE_MATCH_1}") - endif () - - if (PACKAGE_FIND_VERSION_MAJOR STREQUAL _PACKAGE_VERSION_MAJOR) - set (PACKAGE_VERSION_COMPATIBLE TRUE) - else () - set (PACKAGE_VERSION_COMPATIBLE FALSE) - endif () - - if (PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) - set (PACKAGE_VERSION_EXACT TRUE) - endif () -endif () - -# extract release candidate and store in RAPTOR_RELEASE_CANDIDATE_VERSION -file (STRINGS "${RAPTOR_INCLUDE_DIR}/raptor/version.hpp" RAPTOR_RELEASE_CANDIDATE_HPP - REGEX "#define RAPTOR_RELEASE_CANDIDATE " -) -string (REGEX REPLACE "#define RAPTOR_RELEASE_CANDIDATE " "" RAPTOR_RELEASE_CANDIDATE_VERSION - "${RAPTOR_RELEASE_CANDIDATE_HPP}" -) - -# As of writing this (cmake 3.20): -# cmake does not allow to set a version containing a suffix via `project(... VERSION 3.0.3-rc.1)`. -# Version comparisons like VERSION_LESS, VERSION_GREATER do support comparing versions with a suffix (they just drop -# it), see https://cmake.org/cmake/help/latest/command/if.html#version-comparisons. -# -# If https://gitlab.kitware.com/cmake/cmake/-/issues/16716 is ever resolved, we can use RAPTOR_VERSION instead of -# RAPTOR_PROJECT_VERSION. -# -# RAPTOR_PROJECT_VERSION is intended to be used within `project (... VERSION "${RAPTOR_PROJECT_VERSION}")`. -set (RAPTOR_PROJECT_VERSION "${PACKAGE_VERSION}") -if (RAPTOR_RELEASE_CANDIDATE_VERSION VERSION_GREATER "0") - set (PACKAGE_VERSION "${PACKAGE_VERSION}-rc.${RAPTOR_RELEASE_CANDIDATE_VERSION}") -endif () - -if (NOT RAPTOR_PROJECT_VERSION VERSION_EQUAL PACKAGE_VERSION) - # Note: depending on how https://gitlab.kitware.com/cmake/cmake/-/issues/16716 is resolved (whether they use semver - # comparison semantics), (NOT "3.0.3" VERSION_GREATER_EQUAL "3.0.3-rc.1") might be the correct expression. - message (AUTHOR_WARNING "RAPTOR_PROJECT_VERSION and RAPTOR_VERSION mismatch, " - "please report this issue and mention your cmake version." - ) -endif () - -# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: -if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") - return () -endif () - -# check that the installed version has the same 32/64bit-ness as the one which is currently searching: -if (NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8") - math (EXPR installedBits "8 * 8") - # For some time we set these variables to show that we do not support 32 bit architectures, - # but it seems to hard to actively forbid them. Most of the library does build, but some parts - # might not. - # set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") - # set(PACKAGE_VERSION_UNSUITABLE TRUE) - message (AUTHOR_WARNING "Raptor does not support 32bit architectures; No guarantees; Patches are welcome.") -endif () diff --git a/cmake/raptor-config.cmake b/cmake/raptor-config.cmake deleted file mode 100644 index 0168e080..00000000 --- a/cmake/raptor-config.cmake +++ /dev/null @@ -1,202 +0,0 @@ -# -------------------------------------------------------------------------------------------------------- -# Copyright (c) 2006-2023, Knut Reinert & Freie Universität Berlin -# Copyright (c) 2016-2023, Knut Reinert & MPI für molekulare Genetik -# This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License -# shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md -# -------------------------------------------------------------------------------------------------------- -# -# This CMake module will try to find RAPTOR and its dependencies. You can use -# it the same way you would use any other CMake module. -# -# find_package (RAPTOR [REQUIRED] ...) -# -# Since this makes a difference for CMAKE, pay attention to the case -# ("RAPTOR", "RAPTOR" and "raptor" are all valid, but other names not). -# -# RAPTOR has the following platform requirements: -# -# C++20 -# pthread -# -# RAPTOR has the following optional dependencies: -# -# ZLIB -- zlib compression library -# BZip2 -- libbz2 compression library -# -# If you don't wish for these to be detected (and used), you may define RAPTOR_NO_ZLIB, -# RAPTOR_NO_BZIP2, and RAPTOR_NO_CEREAL, respectively. -# -# If you wish to require the presence of ZLIB or BZip2, just check for the module before -# finding RAPTOR, e.g. "find_package (ZLIB REQUIRED)". -# If you wish to require the presence of CEREAL, you may define RAPTOR_CEREAL. -# -# Once the search has been performed, the following variables will be set. -# -# RAPTOR_FOUND -- Indicate whether RAPTOR was found and requirements met. -# -# RAPTOR_VERSION -- The version as string, e.g. "3.0.0" -# RAPTOR_VERSION_MAJOR -- e.g. 3 -# RAPTOR_VERSION_MINOR -- e.g. 0 -# RAPTOR_VERSION_PATCH -- e.g. 0 -# -# RAPTOR_INCLUDE_DIRS -- to be passed to include_directories () -# RAPTOR_LIBRARIES -- to be passed to target_link_libraries () -# RAPTOR_DEFINITIONS -- to be passed to add_definitions () -# RAPTOR_CXX_FLAGS -- to be added to CMAKE_CXX_FLAGS -# -# Additionally, the following [IMPORTED][IMPORTED] targets are defined: -# -# raptor::raptor -- interface target where -# target_link_libraries(target raptor::raptor) -# automatically sets -# target_include_directories(target $RAPTOR_INCLUDE_DIRS), -# target_link_libraries(target $RAPTOR_LIBRARIES), -# target_compile_definitions(target $RAPTOR_DEFINITIONS) and -# target_compile_options(target $RAPTOR_CXX_FLAGS) -# for a target. -# -# [IMPORTED]: https://cmake.org/cmake/help/v3.10/prop_tgt/IMPORTED.html#prop_tgt:IMPORTED -# -# ============================================================================ - -cmake_minimum_required (VERSION 3.5...3.12) - -# ---------------------------------------------------------------------------- -# Greeter -# ---------------------------------------------------------------------------- - -message (STATUS "Finding Raptor and checking requirements") - -# ---------------------------------------------------------------------------- -# Includes -# ---------------------------------------------------------------------------- - -include (${RAPTOR_CLONE_DIR}/test/cmake/raptor_require_ccache.cmake) -raptor_require_ccache () - -set (CPM_INDENT " CMake Package Manager CPM: ") -include (${CMAKE_CURRENT_LIST_DIR}/CPM.cmake) -CPMUsePackageLock (${CMAKE_CURRENT_LIST_DIR}/package-lock.cmake) - -include (CheckIncludeFileCXX) -include (CheckCXXSourceCompiles) -include (FindPackageHandleStandardArgs) -include (CheckCXXCompilerFlag) - -# ---------------------------------------------------------------------------- -# Pretty printing and error handling -# ---------------------------------------------------------------------------- - -macro (raptor_config_print text) - message (STATUS " ${text}") -endmacro () - -macro (raptor_config_error text) - message (FATAL_ERROR " ${text}") - -endmacro () - -# ---------------------------------------------------------------------------- -# Find or add dependencies -# ---------------------------------------------------------------------------- - -CPMGetPackage (hibf) -CPMGetPackage (sharg) -CPMGetPackage (seqan3) -CPMGetPackage (chopper) - -# ---------------------------------------------------------------------------- -# Find RAPTOR include path -# ---------------------------------------------------------------------------- - -# Note that raptor-config.cmake can be standalone and thus RAPTOR_CLONE_DIR might be empty. -# * `RAPTOR_CLONE_DIR` was already found in raptor-config-version.cmake -# * `RAPTOR_INCLUDE_DIR` was already found in raptor-config-version.cmake -find_path (RAPTOR_SUBMODULES_DIR - NAMES seqan3 - HINTS "${RAPTOR_CLONE_DIR}/lib" "${RAPTOR_INCLUDE_DIR}/raptor" -) - -if (RAPTOR_INCLUDE_DIR) - raptor_config_print ("RAPTOR include dir found: ${RAPTOR_INCLUDE_DIR}") -else () - raptor_config_error ("RAPTOR include directory could not be found (RAPTOR_INCLUDE_DIR: '${RAPTOR_INCLUDE_DIR}')") -endif () - -# ---------------------------------------------------------------------------- -# Finish find_package call -# ---------------------------------------------------------------------------- - -find_package_handle_standard_args (${CMAKE_FIND_PACKAGE_NAME} REQUIRED_VARS RAPTOR_INCLUDE_DIR) - -# Set RAPTOR_* variables with the content of ${CMAKE_FIND_PACKAGE_NAME}_(FOUND|...|VERSION) -# This needs to be done, because `find_package(RAPTOR)` might be called in any case-sensitive way and we want to -# guarantee that RAPTOR_* are always set. -foreach (package_var - FOUND - DIR - ROOT - CONFIG - VERSION - VERSION_MAJOR - VERSION_MINOR - VERSION_PATCH - VERSION_TWEAK - VERSION_COUNT -) - set (RAPTOR_${package_var} "${${CMAKE_FIND_PACKAGE_NAME}_${package_var}}") -endforeach () - -# propagate RAPTOR_INCLUDE_DIR into RAPTOR_INCLUDE_DIRS -set (RAPTOR_INCLUDE_DIRS ${RAPTOR_INCLUDE_DIR} ${RAPTOR_DEPENDENCY_INCLUDE_DIRS}) - -# ---------------------------------------------------------------------------- -# Export targets -# ---------------------------------------------------------------------------- - -if (RAPTOR_FOUND AND NOT TARGET raptor::raptor) - separate_arguments (RAPTOR_CXX_FLAGS_LIST UNIX_COMMAND "${RAPTOR_CXX_FLAGS}") - - add_library (raptor_raptor INTERFACE) - target_compile_definitions (raptor_raptor INTERFACE ${RAPTOR_DEFINITIONS}) - target_compile_options (raptor_raptor INTERFACE ${RAPTOR_CXX_FLAGS_LIST}) - target_link_options (raptor_raptor INTERFACE ${RAPTOR_CXX_FLAGS_LIST}) - target_link_libraries (raptor_raptor INTERFACE "${RAPTOR_LIBRARIES}" seqan::hibf sharg::sharg seqan3::seqan3) - # include raptor/include/ as -I, because raptor should never produce warnings. - target_include_directories (raptor_raptor INTERFACE "${RAPTOR_INCLUDE_DIR}") - # include everything except raptor/include/ as -isystem, i.e. - # a system header which suppresses warnings of external libraries. - get_target_property (chopper_include_dir chopper_shared INCLUDE_DIRECTORIES) - target_include_directories (raptor_raptor SYSTEM INTERFACE "${chopper_include_dir}") - find_path (seqan3_test_include_dir - NAMES seqan3/test/tmp_directory.hpp - HINTS "${seqan3_SOURCE_DIR}/test/include" - ) - target_include_directories (raptor_raptor SYSTEM INTERFACE "${seqan3_test_include_dir}") - add_library (raptor::raptor ALIAS raptor_raptor) -endif () - -set (CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) - -if (RAPTOR_FIND_DEBUG) - message ("Result for ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt") - message ("") - message (" CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}") - message (" CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}") - message (" CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH}") - message (" RAPTOR_INCLUDE_DIR ${RAPTOR_INCLUDE_DIR}") - message ("") - message (" ${CMAKE_FIND_PACKAGE_NAME}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_FOUND}") - message (" RAPTOR_HAS_ZLIB ${ZLIB_FOUND}") - message (" RAPTOR_HAS_BZIP2 ${BZIP2_FOUND}") - message ("") - message (" RAPTOR_INCLUDE_DIRS ${RAPTOR_INCLUDE_DIRS}") - message (" RAPTOR_LIBRARIES ${RAPTOR_LIBRARIES}") - message (" RAPTOR_DEFINITIONS ${RAPTOR_DEFINITIONS}") - message (" RAPTOR_CXX_FLAGS ${RAPTOR_CXX_FLAGS}") - message ("") - message (" RAPTOR_VERSION ${RAPTOR_VERSION}") - message (" RAPTOR_VERSION_MAJOR ${RAPTOR_VERSION_MAJOR}") - message (" RAPTOR_VERSION_MINOR ${RAPTOR_VERSION_MINOR}") - message (" RAPTOR_VERSION_PATCH ${RAPTOR_VERSION_PATCH}") -endif () diff --git a/cmake/raptor-install.cmake b/cmake/raptor-install.cmake deleted file mode 100644 index daa9ffa3..00000000 --- a/cmake/raptor-install.cmake +++ /dev/null @@ -1,39 +0,0 @@ -# -------------------------------------------------------------------------------------------------------- -# Copyright (c) 2006-2023, Knut Reinert & Freie Universität Berlin -# Copyright (c) 2016-2023, Knut Reinert & MPI für molekulare Genetik -# This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License -# shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md -# -------------------------------------------------------------------------------------------------------- - -# This file describes where and which parts of Sharg should be installed to. - -cmake_minimum_required (VERSION 3.14) - -include (GNUInstallDirs) - -# install documentation files in /share/doc -install (FILES "${RAPTOR_CLONE_DIR}/CHANGELOG.md" # - "${RAPTOR_CLONE_DIR}/LICENSE.md" # - "${RAPTOR_CLONE_DIR}/README.md" TYPE DOC -) - -# install cmake files in /share/cmake -install (FILES "${RAPTOR_CLONE_DIR}/cmake/raptor-config.cmake" "${RAPTOR_CLONE_DIR}/cmake/raptor-config-version.cmake" - DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/raptor" -) - -# install raptor header files in /include/raptor -install (DIRECTORY "${RAPTOR_INCLUDE_DIR}/raptor" TYPE INCLUDE) - -# install submodule header files, e.g. all external dependencies in /home/user/seqan3/submodules/*, -# in /include/seqan3/submodules//include -foreach (submodule_dir ${RAPTOR_DEPENDENCY_INCLUDE_DIRS}) - # e.g. submodule_dir: (1) /home/user/seqan3/submodules/sdsl-lite/include or (2) /usr/include - # strip /home/user/seqan3/submodules/ and /include part. - file (RELATIVE_PATH submodule "${RAPTOR_SUBMODULES_DIR}/lib" "${submodule_dir}/..") - # submodule is either a single module name, like sdsl-lite or a relative path to a folder ../../../usr - # skip relative folders and only keep submodules that reside in the submodules folder - if (NOT submodule MATCHES "^\\.\\.") # skip relative folders - install (DIRECTORY "${submodule_dir}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/raptor/lib/${submodule}") - endif () -endforeach () diff --git a/cmake/raptor-package.cmake b/cmake/raptor-package.cmake index a4966270..827c61ca 100644 --- a/cmake/raptor-package.cmake +++ b/cmake/raptor-package.cmake @@ -7,7 +7,7 @@ # This file describes how Sharg will be packaged. -cmake_minimum_required (VERSION 3.7) +cmake_minimum_required (VERSION 3.21) set (CPACK_GENERATOR "TXZ") diff --git a/cmake/version.cmake b/cmake/version.cmake new file mode 100644 index 00000000..a41c60db --- /dev/null +++ b/cmake/version.cmake @@ -0,0 +1,16 @@ +# SPDX-FileCopyrightText: 2006-2023, Knut Reinert & Freie Universität Berlin +# SPDX-FileCopyrightText: 2016-2023, Knut Reinert & MPI für molekulare Genetik +# SPDX-License-Identifier: BSD-3-Clause + +file (STRINGS "${CMAKE_CURRENT_LIST_DIR}/../include/raptor/version.hpp" RAPTOR_VERSION_HPP + REGEX "#define RAPTOR_VERSION_(MAJOR|MINOR|PATCH)" +) +string (REGEX REPLACE "#define RAPTOR_VERSION_(MAJOR|MINOR|PATCH) " "" RAPTOR_VERSION "${RAPTOR_VERSION_HPP}") +string (REGEX REPLACE ";" "." RAPTOR_VERSION "${RAPTOR_VERSION}") + +file (STRINGS "${CMAKE_CURRENT_LIST_DIR}/../include/raptor/version.hpp" RAPTOR_RELEASE_CANDIDATE_HPP + REGEX "#define RAPTOR_RELEASE_CANDIDATE " +) +string (REGEX REPLACE "#define RAPTOR_RELEASE_CANDIDATE " "" RAPTOR_RELEASE_CANDIDATE_VERSION + "${RAPTOR_RELEASE_CANDIDATE_HPP}" +) diff --git a/doc/setup/index.md b/doc/setup/index.md index ac638904..a3a6c91f 100644 --- a/doc/setup/index.md +++ b/doc/setup/index.md @@ -13,7 +13,7 @@ conda install -c bioconda -c conda-forge raptor ## Compile from source ### Prerequisites -* CMake >= 3.18 +* CMake >= 3.21 * GCC 11, 12 or 13 (most recent minor version) * git diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 880c11fa..cb38a1af 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,38 +1,24 @@ -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) -set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") -set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") -set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") -set (CMAKE_INSTALL_BINDIR "bin") # For chopper - -# Shared interface -if (NOT TARGET raptor_interface) - add_library ("raptor_interface" INTERFACE) - target_link_libraries ("raptor_interface" INTERFACE raptor::raptor) - target_compile_options ("raptor_interface" INTERFACE "-pedantic" "-Wall" "-Wextra") +if (TARGET raptor) + return () endif () # Raptor library -if (NOT TARGET raptor_lib) - add_library ("raptor_lib" INTERFACE) - target_link_libraries ("raptor_lib" - INTERFACE "raptor_argument_parsing" - "raptor_build" - "raptor_prepare" - "raptor_search" - "raptor_threshold" - "raptor_upgrade" - "raptor_layout" - ) -endif () +add_library ("raptor_lib" INTERFACE) +target_link_libraries ("raptor_lib" + INTERFACE "raptor_argument_parsing" + "raptor_build" + "raptor_prepare" + "raptor_search" + "raptor_threshold" + "raptor_upgrade" + "raptor_layout" +) # Raptor executable -if (NOT TARGET raptor) - add_executable ("raptor" raptor.cpp) - target_link_libraries ("raptor" PUBLIC "raptor_lib") -endif () - -install (TARGETS raptor RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +add_executable ("raptor" raptor.cpp) +target_link_libraries ("raptor" PUBLIC "raptor_lib") add_subdirectory (argument_parsing) add_subdirectory (build) diff --git a/src/argument_parsing/CMakeLists.txt b/src/argument_parsing/CMakeLists.txt index cc412dcc..ea7768f4 100644 --- a/src/argument_parsing/CMakeLists.txt +++ b/src/argument_parsing/CMakeLists.txt @@ -1,59 +1,61 @@ -cmake_minimum_required (VERSION 3.18) - -if (NOT TARGET raptor_argument_parsing) - # Fallback to these values if there is no git or no git repository - set (RAPTOR_COMMIT_DATE - "Unavailable" - CACHE STRING - "Set to provide a commit date if git is not available or the source directory is not a git repository." - ) - set (RAPTOR_COMMIT_HASH - "commit unavailable" - CACHE STRING - "Set to provide a commit hash if git is not available or the source directory is not a git repository." - ) +cmake_minimum_required (VERSION 3.21) - # Extract git commit hash and date - find_package (Git QUIET) +if (TARGET raptor_argument_parsing) + return () +endif () - if (GIT_FOUND) - execute_process (COMMAND "${GIT_EXECUTABLE}" -C "${CMAKE_CURRENT_LIST_DIR}" rev-parse +# Fallback to these values if there is no git or no git repository +set (RAPTOR_COMMIT_DATE + "Unavailable" + CACHE STRING + "Set to provide a commit date if git is not available or the source directory is not a git repository." +) +set (RAPTOR_COMMIT_HASH + "commit unavailable" + CACHE STRING + "Set to provide a commit hash if git is not available or the source directory is not a git repository." +) + +# Extract git commit hash and date +find_package (Git QUIET) + +if (GIT_FOUND) + execute_process (COMMAND "${GIT_EXECUTABLE}" -C "${CMAKE_CURRENT_LIST_DIR}" rev-parse + WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" + RESULT_VARIABLE is_no_git_repository + ERROR_QUIET + ) + + if (NOT is_no_git_repository) + execute_process (COMMAND "${GIT_EXECUTABLE}" describe --always --abbrev=40 --dirty WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" - RESULT_VARIABLE is_no_git_repository - ERROR_QUIET + OUTPUT_VARIABLE RAPTOR_COMMIT_HASH + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ) - if (NOT is_no_git_repository) - execute_process (COMMAND "${GIT_EXECUTABLE}" describe --always --abbrev=40 --dirty - WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" - OUTPUT_VARIABLE RAPTOR_COMMIT_HASH - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - execute_process (COMMAND "${GIT_EXECUTABLE}" log -1 --format=%ad --date=short - WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" - OUTPUT_VARIABLE RAPTOR_COMMIT_DATE - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE - ) - endif () + execute_process (COMMAND "${GIT_EXECUTABLE}" log -1 --format=%ad --date=short + WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" + OUTPUT_VARIABLE RAPTOR_COMMIT_DATE + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE + ) endif () - - add_library ("raptor_argument_parsing" STATIC - build_arguments.cpp - build_parsing.cpp - compute_bin_size.cpp - init_shared_meta.cpp - parse_bin_path.cpp - prepare_parsing.cpp - search_arguments.cpp - search_parsing.cpp - upgrade_parsing.cpp - ) - - set_source_files_properties (init_shared_meta.cpp - PROPERTIES COMPILE_DEFINITIONS - "RAPTOR_VERSION=\"${PACKAGE_VERSION} (${RAPTOR_COMMIT_HASH})\";RAPTOR_DATE=\"${RAPTOR_COMMIT_DATE}\"" - ) - - target_link_libraries ("raptor_argument_parsing" PUBLIC "raptor_interface") endif () + +add_library ("raptor_argument_parsing" STATIC + build_arguments.cpp + build_parsing.cpp + compute_bin_size.cpp + init_shared_meta.cpp + parse_bin_path.cpp + prepare_parsing.cpp + search_arguments.cpp + search_parsing.cpp + upgrade_parsing.cpp +) + +set_source_files_properties (init_shared_meta.cpp + PROPERTIES COMPILE_DEFINITIONS + "RAPTOR_VERSION=\"${PACKAGE_VERSION} (${RAPTOR_COMMIT_HASH})\";RAPTOR_DATE=\"${RAPTOR_COMMIT_DATE}\"" +) + +target_link_libraries ("raptor_argument_parsing" PUBLIC "raptor::raptor") diff --git a/src/build/CMakeLists.txt b/src/build/CMakeLists.txt index f63b5fe2..568d0271 100644 --- a/src/build/CMakeLists.txt +++ b/src/build/CMakeLists.txt @@ -1,9 +1,9 @@ -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) -if (NOT TARGET raptor_build) - add_library ("raptor_build" STATIC build_hibf.cpp build_ibf.cpp max_count_per_partition.cpp raptor_build.cpp) +if (TARGET raptor_build) + return () +endif () - target_link_libraries ("raptor_build" PUBLIC "raptor_interface" "raptor_prepare" "seqan::hibf") +add_library ("raptor_build" STATIC build_hibf.cpp build_ibf.cpp max_count_per_partition.cpp raptor_build.cpp) - # add_subdirectory (hibf) -endif () +target_link_libraries ("raptor_build" PUBLIC "raptor::raptor" "raptor_prepare" "seqan::hibf") diff --git a/src/build/build_ibf.cpp b/src/build/build_ibf.cpp index 0b044c6e..3a141666 100644 --- a/src/build/build_ibf.cpp +++ b/src/build/build_ibf.cpp @@ -42,7 +42,14 @@ void build_ibf(build_arguments const & arguments) {.fpr = arguments.fpr, .hash_count = arguments.hash, .elements = kmers_per_partition[part]}); auto index = factory(part); std::filesystem::path out_path{arguments.out_path}; +#if HIBF_WORKAROUND_GCC_BOGUS_MEMCPY +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wrestrict" +#endif // HIBF_WORKAROUND_GCC_BOGUS_MEMCPY out_path += "_" + std::to_string(part); +#if HIBF_WORKAROUND_GCC_BOGUS_MEMCPY +# pragma GCC diagnostic pop +#endif // HIBF_WORKAROUND_GCC_BOGUS_MEMCPY arguments.store_index_timer.start(); store_index(out_path, std::move(index)); arguments.store_index_timer.stop(); diff --git a/src/layout/CMakeLists.txt b/src/layout/CMakeLists.txt index f7175200..32459c9e 100644 --- a/src/layout/CMakeLists.txt +++ b/src/layout/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required (VERSION 3.15) -if (NOT TARGET raptor_layout) - add_library ("raptor_layout" STATIC raptor_layout.cpp) - target_link_libraries ("raptor_layout" PUBLIC "raptor_interface" "chopper_lib") +if (TARGET raptor_layout) + return () endif () + +add_library ("raptor_layout" STATIC raptor_layout.cpp) +target_link_libraries ("raptor_layout" PUBLIC "raptor::raptor" "chopper_lib") diff --git a/src/prepare/CMakeLists.txt b/src/prepare/CMakeLists.txt index 4ed04847..9e9d1f42 100644 --- a/src/prepare/CMakeLists.txt +++ b/src/prepare/CMakeLists.txt @@ -1,7 +1,9 @@ -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) -if (NOT TARGET raptor_prepare) - add_library ("raptor_prepare" STATIC compute_minimiser.cpp) - - target_link_libraries ("raptor_prepare" PUBLIC "raptor_interface") +if (TARGET raptor_prepare) + return () endif () + +add_library ("raptor_prepare" STATIC compute_minimiser.cpp) + +target_link_libraries ("raptor_prepare" PUBLIC "raptor::raptor") diff --git a/src/search/CMakeLists.txt b/src/search/CMakeLists.txt index 119f6719..36b1adbe 100644 --- a/src/search/CMakeLists.txt +++ b/src/search/CMakeLists.txt @@ -1,7 +1,9 @@ -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) -if (NOT TARGET raptor_search) - add_library ("raptor_search" STATIC raptor_search.cpp search_hibf.cpp search_ibf.cpp search_partitioned_ibf.cpp) - - target_link_libraries ("raptor_search" PUBLIC "raptor_interface") +if (TARGET raptor_search) + return () endif () + +add_library ("raptor_search" STATIC raptor_search.cpp search_hibf.cpp search_ibf.cpp search_partitioned_ibf.cpp) + +target_link_libraries ("raptor_search" PUBLIC "raptor::raptor") diff --git a/src/threshold/CMakeLists.txt b/src/threshold/CMakeLists.txt index 65905f1d..be87dc79 100644 --- a/src/threshold/CMakeLists.txt +++ b/src/threshold/CMakeLists.txt @@ -1,15 +1,17 @@ -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) -if (NOT TARGET raptor_threshold) - add_library ("raptor_threshold" STATIC - multiple_error_model.cpp - one_error_model.cpp - one_indirect_error_model.cpp - pascal_row.cpp - precompute_correction.cpp - precompute_threshold.cpp - threshold.cpp - ) - - target_link_libraries ("raptor_threshold" PUBLIC "raptor_interface") +if (TARGET raptor_threshold) + return () endif () + +add_library ("raptor_threshold" STATIC + multiple_error_model.cpp + one_error_model.cpp + one_indirect_error_model.cpp + pascal_row.cpp + precompute_correction.cpp + precompute_threshold.cpp + threshold.cpp +) + +target_link_libraries ("raptor_threshold" PUBLIC "raptor::raptor") diff --git a/src/upgrade/CMakeLists.txt b/src/upgrade/CMakeLists.txt index 087ccdf9..1748c658 100644 --- a/src/upgrade/CMakeLists.txt +++ b/src/upgrade/CMakeLists.txt @@ -1,6 +1,8 @@ -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) -if (NOT TARGET raptor_upgrade) - add_library ("raptor_upgrade" STATIC raptor_upgrade.cpp) - target_link_libraries ("raptor_upgrade" PUBLIC "raptor_interface") +if (TARGET raptor_upgrade) + return () endif () + +add_library ("raptor_upgrade" STATIC raptor_upgrade.cpp) +target_link_libraries ("raptor_upgrade" PUBLIC "raptor::raptor") diff --git a/test/cmake/raptor_path_longest_stem.cmake b/test/cmake/raptor_path_longest_stem.cmake index 2c73f25d..283ebae8 100644 --- a/test/cmake/raptor_path_longest_stem.cmake +++ b/test/cmake/raptor_path_longest_stem.cmake @@ -5,18 +5,11 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.21) # A compatible function for cmake < 3.20 that basically returns `cmake_path (GET STEM LAST_ONLY )` function (raptor_path_longest_stem out_var filename) - if (CMAKE_VERSION VERSION_LESS 3.20) # cmake < 3.20 - get_filename_component (result "${filename}" NAME) - if (result MATCHES "\\.") - string (REGEX REPLACE "(.+)[.].*" "\\1" result "${result}") - endif () - else () # cmake >= 3.20 - cmake_path (GET filename STEM LAST_ONLY result) - endif () + cmake_path (GET filename STEM LAST_ONLY result) set ("${out_var}" "${result}" diff --git a/test/cmake/raptor_test_component.cmake b/test/cmake/raptor_test_component.cmake index bebd8424..ecd82589 100644 --- a/test/cmake/raptor_test_component.cmake +++ b/test/cmake/raptor_test_component.cmake @@ -5,7 +5,7 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.21) include (raptor_path_longest_stem) diff --git a/test/cmake/raptor_test_files.cmake b/test/cmake/raptor_test_files.cmake index ada72888..27b62091 100644 --- a/test/cmake/raptor_test_files.cmake +++ b/test/cmake/raptor_test_files.cmake @@ -5,7 +5,7 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.17) # Finds all files relative to the `test_base_path_` which satisfy the given file pattern. # diff --git a/test/coverage/CMakeLists.txt b/test/coverage/CMakeLists.txt index 30e98b09..9dfc6671 100644 --- a/test/coverage/CMakeLists.txt +++ b/test/coverage/CMakeLists.txt @@ -5,7 +5,7 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) project (raptor_test_coverage LANGUAGES CXX C) diff --git a/test/data/datasources.cmake b/test/data/datasources.cmake index fee02f7e..ab2cf528 100644 --- a/test/data/datasources.cmake +++ b/test/data/datasources.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) declare_internal_datasource (FILE bin1.fa URL ${CMAKE_CURRENT_LIST_DIR}/bin1.fa diff --git a/test/documentation/CMakeLists.txt b/test/documentation/CMakeLists.txt index 67709690..2aaae147 100644 --- a/test/documentation/CMakeLists.txt +++ b/test/documentation/CMakeLists.txt @@ -6,12 +6,12 @@ # -------------------------------------------------------------------------------------------------------- # Minimum cmake version -cmake_minimum_required (VERSION 3.7) +cmake_minimum_required (VERSION 3.17) set (RAPTOR_DOXYGEN_INPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") get_filename_component (RAPTOR_CLONE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../.." ABSOLUTE) -include (${RAPTOR_CLONE_DIR}/cmake/raptor-config-version.cmake) +include (${RAPTOR_CLONE_DIR}/cmake/version.cmake) project (docs LANGUAGES NONE diff --git a/test/documentation/raptor-doxygen-layout.cmake b/test/documentation/raptor-doxygen-layout.cmake index 07facecd..fb0d51c8 100644 --- a/test/documentation/raptor-doxygen-layout.cmake +++ b/test/documentation/raptor-doxygen-layout.cmake @@ -5,7 +5,7 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.17) include (${CMAKE_CURRENT_LIST_DIR}/../cmake/raptor_test_files.cmake) diff --git a/test/documentation/raptor-doxygen.cmake b/test/documentation/raptor-doxygen.cmake index 7ff06512..79506bba 100644 --- a/test/documentation/raptor-doxygen.cmake +++ b/test/documentation/raptor-doxygen.cmake @@ -5,7 +5,7 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.17) ### Find doxygen and dependency to DOT tool message (STATUS "Searching for doxygen.") diff --git a/test/header/CMakeLists.txt b/test/header/CMakeLists.txt index b7b393fb..651fbb9f 100644 --- a/test/header/CMakeLists.txt +++ b/test/header/CMakeLists.txt @@ -5,15 +5,15 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.21) project (raptor_test_header LANGUAGES CXX C) include (../raptor-test.cmake) include (GoogleTest OPTIONAL) -CPMGetPackage (benchmark) -CPMGetPackage (googletest) +CPMGetSystemPackage (benchmark) +CPMGetSystemPackage (googletest) find_path (SEQAN3_TEST_CMAKE_MODULE_DIR NAMES seqan3_test_files.cmake diff --git a/test/performance/CMakeLists.txt b/test/performance/CMakeLists.txt index 08ef1f42..ecac661e 100644 --- a/test/performance/CMakeLists.txt +++ b/test/performance/CMakeLists.txt @@ -5,12 +5,12 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.21) project (raptor_test_performance LANGUAGES CXX C) include (../raptor-test.cmake) -CPMGetPackage (benchmark) +CPMGetSystemPackage (benchmark) raptor_add_benchmark (bin_influence_benchmark.cpp) diff --git a/test/raptor-test.cmake b/test/raptor-test.cmake index be1b39ac..54962f87 100644 --- a/test/raptor-test.cmake +++ b/test/raptor-test.cmake @@ -5,96 +5,97 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------------- -# This file provides functionality common to the different test modules used by -# SeqAn3. To build tests, run cmake on one of the sub-folders in this directory -# which contain a CMakeLists.txt. +cmake_minimum_required (VERSION 3.21) -cmake_minimum_required (VERSION 3.10) +# ---------------------------------------------------------------------------- +# Short-circuit if tests are already configured +# ---------------------------------------------------------------------------- -# require Raptor package -find_package (Raptor REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../cmake) -include (${CMAKE_CURRENT_LIST_DIR}/../cmake/raptor-config-version.cmake) +if (TARGET raptor::test) + return () +endif () -include (CheckCXXSourceCompiles) -include (FindPackageHandleStandardArgs) -include (FindPackageMessage) +message (STATUS "${ColourBold}Configuring tests${ColourReset}") -option (RAPTOR_TEST_BUILD_OFFLINE "Skip the update step of external projects." OFF) +# ---------------------------------------------------------------------------- +# Add Raptor +# ---------------------------------------------------------------------------- -message (STATUS "${ColourBold}Configuring tests${ColourReset}") +get_filename_component (RAPTOR_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) +add_subdirectory ("${RAPTOR_ROOT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/raptor") +set_property (TARGET raptor PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +target_compile_options (raptor_raptor INTERFACE "-pedantic" "-Wall" "-Wextra" "-Werror") + +# ---------------------------------------------------------------------------- +# CPM +# ---------------------------------------------------------------------------- set (CPM_INDENT " CMake Package Manager CPM: ") CPMUsePackageLock ("${CMAKE_CURRENT_LIST_DIR}/../cmake/package-lock.cmake") # ---------------------------------------------------------------------------- -# Paths to folders. +# Paths to cmake modules # ---------------------------------------------------------------------------- find_path (RAPTOR_TEST_CMAKE_MODULE_DIR - NAMES raptor_require_ccache.cmake + NAMES app_datasources.cmake HINTS "${CMAKE_CURRENT_LIST_DIR}/cmake/" ) list (APPEND CMAKE_MODULE_PATH "${RAPTOR_TEST_CMAKE_MODULE_DIR}") # ---------------------------------------------------------------------------- -# Interface targets for the different test modules in seqan3. +# Interface targets for the different test modules # ---------------------------------------------------------------------------- enable_testing () -# raptor::test exposes a base set of required flags, includes, definitions and -# libraries which are in common for **all** seqan3 tests -if (NOT TARGET raptor::test) - add_library (raptor_test INTERFACE) - target_compile_options (raptor_test INTERFACE "-pedantic" "-Wall" "-Wextra" "-Werror") - - # GCC12 and above: Disable warning about std::hardware_destructive_interference_size not being ABI-stable. - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12) - target_compile_options (raptor_test INTERFACE "-Wno-interference-size") - endif () - endif () +# ---------------------------------------------------------------------------- +# raptor::test +# ---------------------------------------------------------------------------- - target_link_libraries (raptor_test INTERFACE "raptor_lib") +add_library (raptor_test INTERFACE) +target_compile_options (raptor_test INTERFACE "-pedantic" "-Wall" "-Wextra" "-Werror") +# GCC12 and above: Disable warning about std::hardware_destructive_interference_size not being ABI-stable. +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12) + target_compile_options (raptor_test INTERFACE "-Wno-interference-size") + endif () +endif () +target_link_libraries (raptor_test INTERFACE "raptor_lib") +target_include_directories (raptor_test INTERFACE "${CMAKE_CURRENT_LIST_DIR}/include") +add_library (raptor::test ALIAS raptor_test) - target_include_directories (raptor_test INTERFACE "${CMAKE_CURRENT_LIST_DIR}/include") +# ---------------------------------------------------------------------------- +# raptor::test::performance +# ---------------------------------------------------------------------------- - add_library (raptor::test ALIAS raptor_test) -endif () +add_library (raptor_test_performance INTERFACE) +target_link_libraries (raptor_test_performance INTERFACE "raptor::test" "benchmark::benchmark_main") +add_library (raptor::test::performance ALIAS raptor_test_performance) -# raptor::test::performance specifies required flags, includes and libraries -# needed for performance test cases in raptor/test/performance -if (NOT TARGET raptor::test::performance) - add_library (raptor_test_performance INTERFACE) - target_link_libraries (raptor_test_performance INTERFACE "raptor::test" "benchmark::benchmark_main") - add_library (raptor::test::performance ALIAS raptor_test_performance) -endif () +# ---------------------------------------------------------------------------- +# raptor::test::unit +# ---------------------------------------------------------------------------- -# raptor::test::unit specifies required flags, includes and libraries -# needed for unit test cases in raptor/test/unit -if (NOT TARGET raptor::test::unit) - add_library (raptor_test_unit INTERFACE) - - # GCC12 has some bogus warnings. They will not be fixed in googletest. - # https://github.com/google/googletest/issues/4232 - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) - target_compile_options (raptor_test INTERFACE "-Wno-restrict") - endif () +add_library (raptor_test_unit INTERFACE) +# GCC12 has some bogus warnings. They will not be fixed in googletest. +# https://github.com/google/googletest/issues/4232 +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) + target_compile_options (raptor_test INTERFACE "-Wno-restrict") endif () - - target_link_libraries (raptor_test_unit INTERFACE "raptor::test" "GTest::gtest_main") - add_library (raptor::test::unit ALIAS raptor_test_unit) endif () +target_link_libraries (raptor_test_unit INTERFACE "raptor::test" "GTest::gtest_main") +add_library (raptor::test::unit ALIAS raptor_test_unit) -# raptor::test::header specifies required flags, includes and libraries -# needed for header test cases in raptor/test/header -if (NOT TARGET raptor::test::header) - add_library (raptor_test_header INTERFACE) - target_link_libraries (raptor_test_header INTERFACE "raptor::test::unit") - target_link_libraries (raptor_test_header INTERFACE "raptor::test::performance") - add_library (raptor::test::header ALIAS raptor_test_header) -endif () +# ---------------------------------------------------------------------------- +# raptor::test::header +# ---------------------------------------------------------------------------- + +add_library (raptor_test_header INTERFACE) +target_link_libraries (raptor_test_header INTERFACE "raptor::test::unit") +target_link_libraries (raptor_test_header INTERFACE "raptor::test::performance") +add_library (raptor::test::header ALIAS raptor_test_header) # ---------------------------------------------------------------------------- # Commonly used macros for the different test modules in seqan3. @@ -106,13 +107,6 @@ include (raptor_add_benchmark) include (raptor_add_unit_test) include (${CMAKE_CURRENT_LIST_DIR}/data/datasources.cmake) -# ---------------------------------------------------------------------------- -# Add app. -# ---------------------------------------------------------------------------- - -get_filename_component (RAPTOR_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../src" ABSOLUTE) -add_subdirectory ("${RAPTOR_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/src") - # ---------------------------------------------------------------------------- # Set directories for test output files, input data and binaries. # ---------------------------------------------------------------------------- diff --git a/test/snippet/CMakeLists.txt b/test/snippet/CMakeLists.txt index a887ab38..d46d64bd 100644 --- a/test/snippet/CMakeLists.txt +++ b/test/snippet/CMakeLists.txt @@ -5,7 +5,7 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.10...3.22) +cmake_minimum_required (VERSION 3.21) project (raptor_test_snippet LANGUAGES CXX C) include (../raptor-test.cmake) @@ -57,7 +57,7 @@ macro (raptor_snippets test_name_prefix snippet_base_path) endforeach () endmacro () -CPMGetPackage (googletest) +CPMGetSystemPackage (googletest) raptor_snippets ("snippet" "${CMAKE_CURRENT_SOURCE_DIR}") raptor_snippets ("doc/snippet" "${CMAKE_CURRENT_SOURCE_DIR}/../../doc") diff --git a/test/snippet/compare_snippet_output.cmake b/test/snippet/compare_snippet_output.cmake index 9e8395e6..4e397418 100644 --- a/test/snippet/compare_snippet_output.cmake +++ b/test/snippet/compare_snippet_output.cmake @@ -5,7 +5,7 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.21) include ("${CMAKE_CURRENT_LIST_DIR}/../cmake/raptor_path_longest_stem.cmake") diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 5d12b01c..1e94da2e 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -5,14 +5,14 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.21) project (raptor_test_unit LANGUAGES CXX C) include (../raptor-test.cmake) include (GoogleTest OPTIONAL) -CPMGetPackage (googletest) +CPMGetSystemPackage (googletest) add_subdirectory (api) add_subdirectory (cli) diff --git a/test/unit/api/CMakeLists.txt b/test/unit/api/CMakeLists.txt index f13589d3..9d75b77e 100644 --- a/test/unit/api/CMakeLists.txt +++ b/test/unit/api/CMakeLists.txt @@ -5,7 +5,7 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.21) raptor_add_unit_test (issue_142.cpp) raptor_add_unit_test (formatted_bytes.cpp) diff --git a/test/unit/cli/CMakeLists.txt b/test/unit/cli/CMakeLists.txt index ce9a686c..269031d6 100644 --- a/test/unit/cli/CMakeLists.txt +++ b/test/unit/cli/CMakeLists.txt @@ -5,7 +5,7 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) add_subdirectory (argument_parsing) add_subdirectory (build) diff --git a/test/unit/cli/argument_parsing/CMakeLists.txt b/test/unit/cli/argument_parsing/CMakeLists.txt index 9e20cbb3..612f0dee 100644 --- a/test/unit/cli/argument_parsing/CMakeLists.txt +++ b/test/unit/cli/argument_parsing/CMakeLists.txt @@ -5,6 +5,6 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) raptor_add_unit_test (options_test.cpp) diff --git a/test/unit/cli/build/CMakeLists.txt b/test/unit/cli/build/CMakeLists.txt index 80d15116..433c817d 100644 --- a/test/unit/cli/build/CMakeLists.txt +++ b/test/unit/cli/build/CMakeLists.txt @@ -5,7 +5,7 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) raptor_add_unit_test (build_hibf_chopper_test.cpp) raptor_add_unit_test (build_hibf_test.cpp) diff --git a/test/unit/cli/search/CMakeLists.txt b/test/unit/cli/search/CMakeLists.txt index 2b69b37f..dc49b9c7 100644 --- a/test/unit/cli/search/CMakeLists.txt +++ b/test/unit/cli/search/CMakeLists.txt @@ -5,7 +5,7 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) raptor_add_unit_test (search_hibf_test.cpp) raptor_add_unit_test (search_hibf_preprocessing_test.cpp) diff --git a/test/unit/cli/upgrade/CMakeLists.txt b/test/unit/cli/upgrade/CMakeLists.txt index efddb8b6..daf7e63e 100644 --- a/test/unit/cli/upgrade/CMakeLists.txt +++ b/test/unit/cli/upgrade/CMakeLists.txt @@ -5,6 +5,6 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) # raptor_add_unit_test (upgrade_test.cpp) diff --git a/util/applications/src/CMakeLists.txt b/util/applications/src/CMakeLists.txt index f7fbc6f6..9547174c 100644 --- a/util/applications/src/CMakeLists.txt +++ b/util/applications/src/CMakeLists.txt @@ -1,33 +1,24 @@ -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) -find_path (RAPTOR_CLONE_DIR - NAMES cmake/raptor-config.cmake - HINTS "${CMAKE_CURRENT_LIST_DIR}/../../.." -) +project (raptor_utility_common LANGUAGES CXX) -list (APPEND CMAKE_MODULE_PATH "${RAPTOR_CLONE_DIR}/cmake") - -include (raptor-config-version) - -project (raptor_utility_common LANGUAGES CXX C) - -find_package (Raptor REQUIRED HINTS ${RAPTOR_CLONE_DIR}/cmake) +if (TARGET utility_common) + return () +endif () set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") -if (NOT TARGET utility_common) - add_library (utility_common INTERFACE) - target_link_libraries ("utility_common" INTERFACE raptor::raptor) - target_include_directories ("utility_common" INTERFACE "../include") - target_compile_options ("utility_common" INTERFACE "-pedantic" "-Wall" "-Wextra") -endif () +get_filename_component (RAPTOR_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE) +add_subdirectory ("${RAPTOR_ROOT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/raptor") -if (NOT TARGET hibf_sizes) - add_executable ("hibf_sizes" hibf_sizes.cpp) - target_link_libraries ("hibf_sizes" "utility_common") -endif () +add_library (utility_common INTERFACE) +target_link_libraries ("utility_common" INTERFACE raptor::raptor) +target_include_directories ("utility_common" INTERFACE "../include") + +add_executable ("hibf_sizes" hibf_sizes.cpp) +target_link_libraries ("hibf_sizes" "utility_common") add_subdirectory (Genome_Biology) diff --git a/util/applications/src/Genome_Biology/CMakeLists.txt b/util/applications/src/Genome_Biology/CMakeLists.txt index e9344767..5362c061 100644 --- a/util/applications/src/Genome_Biology/CMakeLists.txt +++ b/util/applications/src/Genome_Biology/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) if (NOT TARGET fasta_to_fastq) add_executable ("fasta_to_fastq" fasta_to_fastq.cpp) diff --git a/util/applications/src/iScience/CMakeLists.txt b/util/applications/src/iScience/CMakeLists.txt index b1dbc71b..8ee7044e 100644 --- a/util/applications/src/iScience/CMakeLists.txt +++ b/util/applications/src/iScience/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) if (NOT TARGET generate_reads) add_executable ("generate_reads" generate_reads.cpp) @@ -11,18 +11,18 @@ if (NOT TARGET split_sequence) endif () if (NOT TARGET count_minimiser) - add_executable ("count_minimiser" ${RAPTOR_CLONE_DIR}/src/argument_parsing/parse_bin_path.cpp count_minimiser.cpp) + add_executable ("count_minimiser" ${RAPTOR_ROOT_DIR}/src/argument_parsing/parse_bin_path.cpp count_minimiser.cpp) target_link_libraries ("count_minimiser" "utility_common") endif () if (NOT TARGET threshold_info) add_executable ("threshold_info" - ${RAPTOR_CLONE_DIR}/src/threshold/multiple_error_model.cpp - ${RAPTOR_CLONE_DIR}/src/threshold/one_error_model.cpp - ${RAPTOR_CLONE_DIR}/src/threshold/one_indirect_error_model.cpp - ${RAPTOR_CLONE_DIR}/src/threshold/pascal_row.cpp - ${RAPTOR_CLONE_DIR}/src/threshold/precompute_correction.cpp - ${RAPTOR_CLONE_DIR}/src/threshold/precompute_threshold.cpp + ${RAPTOR_ROOT_DIR}/src/threshold/multiple_error_model.cpp + ${RAPTOR_ROOT_DIR}/src/threshold/one_error_model.cpp + ${RAPTOR_ROOT_DIR}/src/threshold/one_indirect_error_model.cpp + ${RAPTOR_ROOT_DIR}/src/threshold/pascal_row.cpp + ${RAPTOR_ROOT_DIR}/src/threshold/precompute_correction.cpp + ${RAPTOR_ROOT_DIR}/src/threshold/precompute_threshold.cpp threshold_info.cpp ) target_link_libraries ("threshold_info" "utility_common") diff --git a/util/applications/src/iScience/apply_taxsbp.cpp b/util/applications/src/iScience/apply_taxsbp.cpp index 1d95cfd0..40e54936 100644 --- a/util/applications/src/iScience/apply_taxsbp.cpp +++ b/util/applications/src/iScience/apply_taxsbp.cpp @@ -158,7 +158,7 @@ inline std::unordered_map> parse_sbp_binning( { std::string line; std::string refseq_accession; - uint64_t bin_index; + uint64_t bin_index{}; while (std::getline(file, line)) { diff --git a/util/iScience/CMakeLists.txt b/util/iScience/CMakeLists.txt index 5942853c..15e74c52 100644 --- a/util/iScience/CMakeLists.txt +++ b/util/iScience/CMakeLists.txt @@ -5,25 +5,15 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.18) - -find_path (RAPTOR_CLONE_DIR - NAMES cmake/raptor-config.cmake - HINTS "${CMAKE_CURRENT_LIST_DIR}/../.." -) - -list (APPEND CMAKE_MODULE_PATH "${RAPTOR_CLONE_DIR}/cmake") - -include (raptor-config-version) - -project (raptor_utility_common LANGUAGES CXX) - -find_package (Raptor REQUIRED HINTS ${RAPTOR_CLONE_DIR}/cmake) +cmake_minimum_required (VERSION 3.21) set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +get_filename_component (RAPTOR_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE) +add_subdirectory ("${RAPTOR_ROOT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/raptor") + # Define cmake configuration flags to configure and build external projects with the same flags as specified for # this project. set (SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "") @@ -58,4 +48,4 @@ else () message ("-- DREAM-Yara will not be built. Enable via 'cmake -DRAPTOR_UTILITY_BUILD_DREAM_YARA=1 .'") endif () -add_subdirectory ("${RAPTOR_CLONE_DIR}/util/applications/src" "${CMAKE_CURRENT_BINARY_DIR}/applications") +add_subdirectory ("${RAPTOR_ROOT_DIR}/util/applications/src" "${CMAKE_CURRENT_BINARY_DIR}/applications") diff --git a/util/iScience/README.md b/util/iScience/README.md index 1c5cc22d..b5c58266 100644 --- a/util/iScience/README.md +++ b/util/iScience/README.md @@ -6,7 +6,7 @@ This subfolder contains scripts and documentation related to the experiments run The base requirements are the same as for the main Raptor application: -* CMake >= 3.18 +* CMake >= 3.21 * GCC 11, 12 or 13 (most recent minor version) * git diff --git a/util/iScience/thresholding/CMakeLists.txt b/util/iScience/thresholding/CMakeLists.txt index 0b636bcf..f6f8e4bf 100644 --- a/util/iScience/thresholding/CMakeLists.txt +++ b/util/iScience/thresholding/CMakeLists.txt @@ -5,7 +5,7 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) # Define the application name. project (minimizer_thresholds LANGUAGES CXX C) @@ -27,8 +27,8 @@ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") include (${CMAKE_CURRENT_LIST_DIR}/../../../cmake/CPM.cmake) CPMUsePackageLock (${CMAKE_CURRENT_LIST_DIR}/../../../cmake/package-lock.cmake) -CPMGetPackage (sharg) -CPMGetPackage (seqan3) +CPMGetSystemPackage (sharg) +CPMGetSystemPackage (seqan3) add_library (common_thresholding INTERFACE) target_link_libraries ("common_thresholding" INTERFACE seqan3::seqan3 sharg::sharg) diff --git a/util/test/CMakeLists.txt b/util/test/CMakeLists.txt index c96cf059..9fad48f6 100644 --- a/util/test/CMakeLists.txt +++ b/util/test/CMakeLists.txt @@ -5,10 +5,18 @@ # shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md # -------------------------------------------------------------------------------------------------- -cmake_minimum_required (VERSION 3.18) +cmake_minimum_required (VERSION 3.21) project (raptor_utility_test) +set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") +set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") +set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +get_filename_component (RAPTOR_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE) +add_subdirectory ("${RAPTOR_ROOT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/raptor") +target_compile_options (raptor_raptor INTERFACE "-pedantic" "-Wall" "-Wextra" "-Werror") + get_filename_component (RAPTOR_UTIL_ROOT "${CMAKE_CURRENT_LIST_DIR}/../dummy" DIRECTORY) message (STATUS "Adding applications...")