Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/ci_readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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: Update README

on:
push:
branches:
- 'main'
workflow_dispatch:

concurrency:
group: readme-${{ github.ref }}
cancel-in-progress: true

env:
TZ: Europe/Berlin

defaults:
run:
shell: bash -Eeuxo pipefail {0}

jobs:
readme:
name: Update README
runs-on: ubuntu-latest
timeout-minutes: 15
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout
uses: actions/checkout@v5
with:
token: ${{ secrets.SEQAN_ACTIONS_PAT }}

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.SEQAN_ACTIONS_GPG_KEY }}
passphrase: ${{ secrets.SEQAN_ACTIONS_GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true

- name: Update README
uses: dineshsonachalam/markdown-autodocs@v1.0.7
with:
commit_author: seqan-actions[bot]
commit_user_email: seqan-actions@users.noreply.github.com
commit_message: "[MISC] Update README.md"
output_file_paths: '[./README.md]'
categories: '[code-block]'
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ project (SEQAN_STD
DESCRIPTION "Implementation of several C++23/26 views"
)

if (TARGET seqan::std)
return ()
endif ()

add_library (seqan-std INTERFACE)
target_sources (seqan-std INTERFACE
FILE_SET HEADERS
Expand Down
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,69 @@ SPDX-License-Identifier: CC-BY-4.0
-->

# seqan-std

Implementation of several C++23 views

## Quick start

### CMake with CPM

<!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./test/CPM/CMakeLists.txt&syntax=cmake) -->
<!-- The below code snippet is automatically added from ./test/CPM/CMakeLists.txt -->
```cmake
# 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

cmake_minimum_required (VERSION 3.25)

project (example
LANGUAGES CXX)

# CPM Documentation:
# Adding CPM: https://github.com/cpm-cmake/CPM.cmake?tab=readme-ov-file#adding-cpm
# Example : https://github.com/cpm-cmake/CPM.cmake?tab=readme-ov-file#full-cmakelists-example
# For CPM's example, "${CPM_FILE}" would be "cmake/CPM.cmake"
include (${CPM_FILE})
CPMAddPackage ("gh:seqan/seqan-std#main")

add_executable (example example.cpp)
target_link_libraries (example seqan::std)
```
<!-- MARKDOWN-AUTO-DOCS:END -->

### Example

<!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./test/CPM/example.cpp) -->
<!-- The below code snippet is automatically added from ./test/CPM/example.cpp -->
```cpp
// 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

#include <iostream>
#include <string_view>
#include <vector>

#include <seqan-std/enumerate_view.hpp>

int main()
{
std::vector<std::string_view> vec{"Hello", "World", "!"};

for (auto const [index, str] : seqan::stl::views::enumerate(vec))
std::cout << index << ": " << str << '\n';
}
```
<!-- MARKDOWN-AUTO-DOCS:END -->

### Output

<!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./test/CPM/example.expected&syntax=txt) -->
<!-- The below code snippet is automatically added from ./test/CPM/example.expected -->
```txt
0: Hello
1: World
2: !
```
<!-- MARKDOWN-AUTO-DOCS:END -->
51 changes: 51 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,54 @@ add_test (NAME "file_set_check"
-P "${CMAKE_CURRENT_SOURCE_DIR}/check_file_set.cmake")

set_tests_properties (header_test PROPERTIES DEPENDS file_set_check)

################################################################################
############################ CPM integration check #############################
################################################################################

set (CPM_FILE "${CMAKE_CURRENT_BINARY_DIR}/CPM.cmake" CACHE STRING "Path to CPM.cmake")

if (FETCHCONTENT_FULLY_DISCONNECTED AND NOT EXISTS "${CPM_FILE}")
message (STATUS "Not testing CPM integration.")
return ()
endif ()

if (NOT EXISTS "${CPM_FILE}")
file (DOWNLOAD https://github.com/cpm-cmake/CPM.cmake/releases/latest/download/CPM.cmake
${CPM_FILE}
STATUS cpm_download_status)

list (GET cpm_download_status 0 cpm_download_return_code)
list (GET cpm_download_status 1 cpm_download_message)

if (NOT ${cpm_download_return_code} EQUAL 0)
message (WARNING "CPM download failed. "
"Exit code: ${cpm_download_return_code}. "
"Message: ${cpm_download_message}")
return ()
endif ()
endif ()

include (ExternalProject)

ExternalProject_Add (CPM_integration_test
PREFIX CPM_integration_test
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/CPM"
CMAKE_ARGS "-DCPM_FILE=${CPM_FILE}"
"-DCPM_seqan-std_SOURCE=${PROJECT_SOURCE_DIR}"
INSTALL_COMMAND "")

ExternalProject_Get_Property (CPM_integration_test BINARY_DIR)
ExternalProject_Get_Property (CPM_integration_test SOURCE_DIR)

message (STATUS "${SOURCE_DIR}")

set (expected_output "0: Hello\n1: World\n2: !\n")

add_test (NAME "example_test" COMMAND "${BINARY_DIR}/example")
set_tests_properties (example_test PROPERTIES
PASS_REGULAR_EXPRESSION "${expected_output}")

add_test (NAME "example_output" COMMAND ${CMAKE_COMMAND} -E cat "${CMAKE_CURRENT_LIST_DIR}/CPM/example.expected")
set_tests_properties (example_output PROPERTIES
PASS_REGULAR_EXPRESSION "${expected_output}")
18 changes: 18 additions & 0 deletions test/CPM/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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

cmake_minimum_required (VERSION 3.25)

project (example
LANGUAGES CXX)

# CPM Documentation:
# Adding CPM: https://github.com/cpm-cmake/CPM.cmake?tab=readme-ov-file#adding-cpm
# Example : https://github.com/cpm-cmake/CPM.cmake?tab=readme-ov-file#full-cmakelists-example
# For CPM's example, "${CPM_FILE}" would be "cmake/CPM.cmake"
include (${CPM_FILE})
CPMAddPackage ("gh:seqan/seqan-std#main")

add_executable (example example.cpp)
target_link_libraries (example seqan::std)
17 changes: 17 additions & 0 deletions test/CPM/example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// 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

#include <iostream>
#include <string_view>
#include <vector>

#include <seqan-std/enumerate_view.hpp>

int main()
{
std::vector<std::string_view> vec{"Hello", "World", "!"};

for (auto const [index, str] : seqan::stl::views::enumerate(vec))
std::cout << index << ": " << str << '\n';
}
3 changes: 3 additions & 0 deletions test/CPM/example.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
0: Hello
1: World
2: !
3 changes: 3 additions & 0 deletions test/CPM/example.expected.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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
Loading