Skip to content

Commit

Permalink
Merge pull request #442 from eseiler/infra/cmake_update
Browse files Browse the repository at this point in the history
[INFRA] Update CMake stuff
  • Loading branch information
eseiler authored Oct 17, 2024
2 parents 23770fa + 4d241ae commit da75ebe
Show file tree
Hide file tree
Showing 55 changed files with 181 additions and 390 deletions.
9 changes: 4 additions & 5 deletions .cmake-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ parse:
_help_additional_commands:
- Specify structure for custom cmake functions
additional_commands:
declare_internal_datasource:
declare_datasource:
kwargs:
FILE: '*'
URL: '*'
URL_HASH: '*'
CONFIGURE: '*'
FILE: 1
URL: +
URL_HASH: 1
cpmgetpackage:
pargs: 1
spelling: CPMGetPackage
Expand Down
11 changes: 0 additions & 11 deletions .reuse/dep5

This file was deleted.

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.25)
cmake_minimum_required (VERSION 3.25...3.30)

include (${CMAKE_CURRENT_LIST_DIR}/cmake/version.cmake)

Expand Down
2 changes: 1 addition & 1 deletion cmake/configuration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.25)
cmake_minimum_required (VERSION 3.25...3.30)

# ----------------------------------------------------------------------------
# Short-circuit if Raptor is already configured
Expand Down
2 changes: 1 addition & 1 deletion cmake/raptor-package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# This file describes how Sharg will be packaged.

cmake_minimum_required (VERSION 3.25)
cmake_minimum_required (VERSION 3.25...3.30)

set (CPACK_GENERATOR "TXZ")

Expand Down
17 changes: 11 additions & 6 deletions include/raptor/argument_parsing/validators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,19 @@ static inline std::vector<std::string> compression_extensions{[]()
static inline std::vector<std::string> combined_extensions{
[]()
{
if (compression_extensions.empty())
return sequence_extensions; // GCOVR_EXCL_LINE
std::vector<std::string> result;
for (auto && sequence_extension : sequence_extensions)
if (compression_extensions.empty())
{
result.push_back(sequence_extension);
for (auto && compression_extension : compression_extensions)
result.push_back(sequence_extension + std::string{'.'} + compression_extension);
result = sequence_extensions; // GCOVR_EXCL_LINE
}
else
{
for (auto && sequence_extension : sequence_extensions)
{
result.push_back(sequence_extension);
for (auto && compression_extension : compression_extensions)
result.push_back(sequence_extension + std::string{'.'} + compression_extension);
}
}
return result;
}()};
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.25)
cmake_minimum_required (VERSION 3.25...3.30)

if (TARGET raptor)
return ()
Expand Down
2 changes: 1 addition & 1 deletion src/argument_parsing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.25)
cmake_minimum_required (VERSION 3.25...3.30)

if (TARGET raptor::argument_parsing)
return ()
Expand Down
2 changes: 1 addition & 1 deletion src/build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.25)
cmake_minimum_required (VERSION 3.25...3.30)

if (TARGET raptor::build)
return ()
Expand Down
2 changes: 1 addition & 1 deletion src/layout/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.15)
cmake_minimum_required (VERSION 3.15...3.30)

if (TARGET raptor::layout)
return ()
Expand Down
2 changes: 1 addition & 1 deletion src/prepare/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.25)
cmake_minimum_required (VERSION 3.25...3.30)

if (TARGET raptor::prepare)
return ()
Expand Down
2 changes: 1 addition & 1 deletion src/search/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.25)
cmake_minimum_required (VERSION 3.25...3.30)

if (TARGET raptor::search)
return ()
Expand Down
2 changes: 1 addition & 1 deletion src/threshold/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.25)
cmake_minimum_required (VERSION 3.25...3.30)

if (TARGET raptor::threshold)
return ()
Expand Down
2 changes: 1 addition & 1 deletion src/upgrade/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.25)
cmake_minimum_required (VERSION 3.25...3.30)

if (TARGET raptor::upgrade)
return ()
Expand Down
24 changes: 24 additions & 0 deletions test/cmake/add_local_data.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: CC0-1.0

set (DATASOURCES_DATA_DIR "${Raptor_SOURCE_DIR}/test/data")

file (GLOB_RECURSE datasources
LIST_DIRECTORIES false
RELATIVE ${DATASOURCES_DATA_DIR}
CONFIGURE_DEPENDS ${DATASOURCES_DATA_DIR}/*
)
list (REMOVE_ITEM datasources datasources.cmake README.md REUSE.toml)

foreach (datasource IN LISTS datasources)
get_filename_component (datasource_name "${datasource}" NAME)
set (data_dir "${CMAKE_CURRENT_BINARY_DIR}/data")
file (MAKE_DIRECTORY "${data_dir}")

if (datasource_name MATCHES ".*\.layout$")
configure_file ("${DATASOURCES_DATA_DIR}/${datasource}" "${data_dir}/${datasource_name}")
else ()
configure_file ("${DATASOURCES_DATA_DIR}/${datasource}" "${data_dir}/${datasource_name}" COPYONLY)
endif ()
endforeach ()
57 changes: 0 additions & 57 deletions test/cmake/app_internal_datasources.cmake

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-License-Identifier: CC0-1.0

include (ExternalProject)
include (FetchContent)

# Example call:
#
Expand Down Expand Up @@ -50,46 +50,15 @@ function (declare_datasource)
# create data folder
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data)

ExternalProject_Add ("${datasource_name}"
URL "${ARG_URL}"
URL_HASH "${ARG_URL_HASH}"
DOWNLOAD_NAME "${ARG_FILE}"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E create_symlink <DOWNLOADED_FILE>
${CMAKE_CURRENT_BINARY_DIR}/data/${ARG_FILE}
TEST_COMMAND ""
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/_datasources"
DOWNLOAD_NO_EXTRACT TRUE # don't extract archive files like .tar.gz.
${ARG_UNPARSED_ARGUMENTS}
FetchContent_Populate ("${datasource_name}"
URL "${ARG_URL}"
URL_HASH "${ARG_URL_HASH}"
DOWNLOAD_NAME "${ARG_FILE}"
DOWNLOAD_NO_EXTRACT TRUE # don't extract archive files like .tar.gz.
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/data/"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/data/"
EXCLUDE_FROM_ALL TRUE ${ARG_UNPARSED_ARGUMENTS}
)
endfunction ()

# Example call:
#
# ```cmake
# # my_app uses and needs the files RF00001.fa.gz, pdb100d.ent.gz, and GRCh38_latest_clinvar.vcf.gz.
# target_use_datasources (my_app FILES RF00001.fa.gz pdb100d.ent.gz GRCh38_latest_clinvar.vcf.gz)
# ```
#
# Options:
#
# target_use_datasources (<target> FILES <file1> [<file2>...])
#
# It declares that a <target> uses and depends on the following files.
#
# This also sets the build requirement that the files must be downloaded before the <target> will be build.
#
# The named <target> must have been created by a command such as add_executable () or add_library ().
function (target_use_datasources target)
set (options "")
set (one_value_args)
set (multi_value_args "FILES")

cmake_parse_arguments (ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})

foreach (filename ${ARG_FILES})
string (TOLOWER "datasource--${filename}" datasource_name)
add_dependencies ("${target}" "${datasource_name}")
endforeach ()
add_dependencies (raptor_test "${datasource_name}")
endfunction ()
2 changes: 1 addition & 1 deletion test/cmake/raptor_path_longest_stem.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.25)
cmake_minimum_required (VERSION 3.25...3.30)

# A compatible function for cmake < 3.20 that basically returns `cmake_path (GET <filename> STEM LAST_ONLY <out_var>)`
function (raptor_path_longest_stem out_var filename)
Expand Down
2 changes: 1 addition & 1 deletion test/cmake/raptor_test_component.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.25)
cmake_minimum_required (VERSION 3.25...3.30)

include (raptor_path_longest_stem)

Expand Down
2 changes: 1 addition & 1 deletion test/cmake/raptor_test_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.17)
cmake_minimum_required (VERSION 3.17...3.30)

# Finds all files relative to the `test_base_path_` which satisfy the given file pattern.
#
Expand Down
2 changes: 1 addition & 1 deletion test/coverage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.25)
cmake_minimum_required (VERSION 3.25...3.30)

project (raptor_test_coverage LANGUAGES CXX C)

Expand Down
5 changes: 0 additions & 5 deletions test/data/README.md

This file was deleted.

14 changes: 14 additions & 0 deletions test/data/REUSE.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: CC0-1.0

version = 1
SPDX-PackageName = "Raptor"
SPDX-PackageDownloadLocation = "https://github.com/seqan/raptor/"

[[annotations]]
path = "**"
precedence = "aggregate"
SPDX-FileCopyrightText = ["2006-2024, Knut Reinert & Freie Universität Berlin", "2016-2024, Knut Reinert & MPI für molekulare Genetik"]
SPDX-License-Identifier = "CC0-1.0"

Loading

0 comments on commit da75ebe

Please sign in to comment.