Skip to content

Commit 96e7d08

Browse files
authored
Merge pull request #333 from eseiler/chore/rename_module
chore: rename module
2 parents a0d554a + ee62ac9 commit 96e7d08

8 files changed

Lines changed: 29 additions & 27 deletions

File tree

‎README.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ cmake -S . -B build -G Ninja -DHIBF_MODULE=ON
176176
#include <cstddef>
177177
#include <vector>
178178

179-
import hibf;
179+
import seqan.hibf;
180180

181181
int main()
182182
{
@@ -191,17 +191,17 @@ int main()
191191
On top of HIBF's usual requirements, this needs CMake >= 3.28 and the Ninja generator; every compiler
192192
HIBF supports can build the module. CI covers the latest GCC and Clang version.
193193

194-
The switch is additive rather than exclusive. `src/hibf.cppm` includes the headers in its *global module fragment*, so
195-
imported and included declarations name the same entities:
194+
The switch is additive rather than exclusive. `src/seqan.hibf.cppm` includes the headers in its *global module
195+
fragment*, so imported and included declarations name the same entities:
196196

197197
* `libhibf.a` is the same either way; the module adds one almost empty object file.
198-
* Headers keep working unchanged, and a single translation unit may both `#include <hibf/...>` and `import hibf;`.
198+
* Headers keep working unchanged, and a single translation unit may both `#include <hibf/...>` and `import seqan.hibf;`.
199199
Downstream projects can therefore migrate file by file.
200200
* `HIBF_HAS_MODULE` is defined when the module was built, for code that has to support both modes.
201201

202202
Two caveats:
203203

204-
* Only the names listed in `src/hibf.cppm` are visible to importers. `seqan::stl` (the `include/hibf/contrib` standard
205-
library backports) is not exported; use the headers for those.
206-
* GCC 16 rejects a textual `#include` that appears *after* an `import hibf;` in the same translation unit. Put includes
207-
first. Clang accepts either order.
204+
* Only the names listed in `src/seqan.hibf.cppm` are visible to importers. `seqan::stl` (the `include/hibf/contrib`
205+
standard library backports) is not exported; use the headers for those.
206+
* GCC 16 rejects a textual `#include` that appears *after* an `import seqan.hibf;` in the same translation unit. Put
207+
includes first. Clang accepts either order.

‎cmake/configuration.cmake‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ hibf_require_ccache ()
8484
# Optional: C++20 modules
8585
# ----------------------------------------------------------------------------
8686

87-
# The module is an addition, not a replacement: the headers and libhibf.a are the same either way. See src/hibf.cppm.
88-
option (HIBF_MODULE "Additionally build the `hibf` C++20 module. Consumers may then use `import hibf;`." OFF)
87+
# The module is an addition, not a replacement: the headers and libhibf.a are the same either way.
88+
# See src/seqan.hibf.cppm.
89+
option (HIBF_MODULE "Additionally build the `seqan.hibf` C++20 module, enabling `import seqan.hibf;`." OFF)
8990

9091
if (HIBF_MODULE)
9192
if (CMAKE_VERSION VERSION_LESS 3.28)

‎src/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if (NOT TARGET hibf)
4848
target_sources (hibf
4949
PUBLIC FILE_SET hibf_module TYPE CXX_MODULES
5050
BASE_DIRS "${CMAKE_CURRENT_LIST_DIR}"
51-
FILES "${CMAKE_CURRENT_LIST_DIR}/hibf.cppm")
51+
FILES "${CMAKE_CURRENT_LIST_DIR}/seqan.hibf.cppm")
5252
# cmake-format: on
5353

5454
# Lets downstream code branch on the build mode.

src/hibf.cppm renamed to src/seqan.hibf.cppm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/*!\file
66
* \author Enrico Seiler <enrico.seiler AT fu-berlin.de>
7-
* \brief Provides the `hibf` C++20 module.
7+
* \brief Provides the `seqan.hibf` C++20 module.
88
*
99
* \details
1010
*
@@ -14,14 +14,15 @@
1414
* * `libhibf.a` is bit-identical whether or not the module is built; the module adds one (almost empty) object file.
1515
* * The source files in `src` need no changes: they are ordinary translation units, and the symbols they define are
1616
* the same symbols the module declares.
17-
* * A translation unit may `#include <hibf/...>` and `import hibf;` at the same time. Both refer to the same entities,
18-
* so there is no ODR hazard and downstream projects can migrate file by file.
17+
* * A translation unit may `#include <hibf/...>` and `import seqan.hibf;` at the same time. Both refer to the same
18+
* entities, so there is no ODR hazard and downstream projects can migrate file by file.
1919
*
2020
* The price is that the exported names have to be listed explicitly below. Names that are absent from this list are
2121
* still *reachable* (e.g. a member function of an exported class can use them), just not *visible* to importers.
2222
*
2323
* \attention GCC (as of 16.2) rejects a textual `#include` of a standard library header that appears *after* an
24-
* `import hibf;` in the same translation unit. Put includes before imports. Clang has no such restriction.
24+
* `import seqan.hibf;` in the same translation unit. Put includes before imports. Clang has no such
25+
* restriction.
2526
*/
2627

2728
module;
@@ -75,7 +76,7 @@ module;
7576
// Module purview
7677
// ============================================================================
7778

78-
export module hibf;
79+
export module seqan.hibf;
7980

8081
//!\brief The main namespace of the HIBF library.
8182
export namespace seqan::hibf

‎test/all/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cmake_minimum_required (VERSION 3.20...3.31)
66
project (hibf_test)
77

88
option (INSTALL_HIBF "" OFF)
9-
option (HIBF_MODULE "Additionally build the `hibf` C++20 module." OFF)
9+
option (HIBF_MODULE "Additionally build the `seqan.hibf` C++20 module." OFF)
1010
enable_testing ()
1111
add_subdirectory (../unit/ unit)
1212
add_subdirectory (../performance/ performance)

‎test/module/CMakeLists.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
cmake_minimum_required (VERSION 3.28...3.31)
77
project (hibf_test_module CXX)
88

9-
# These tests `import hibf;`, so the module has to be part of the library.
9+
# These tests `import seqan.hibf;`, so the module has to be part of the library.
1010
set (HIBF_MODULE
1111
ON
12-
CACHE BOOL "Additionally build the `hibf` C++20 module." FORCE)
12+
CACHE BOOL "Additionally build the `seqan.hibf` C++20 module." FORCE)
1313

1414
include (../hibf-test.cmake)
1515
include (GoogleTest OPTIONAL)
@@ -31,7 +31,7 @@ macro (hibf_module_test module_test_cpp)
3131
add_executable (${target} ${module_test_cpp})
3232
# This is `hibf::test::unit` spelled out. `seqan::hibf` has to be a *direct* link dependency: with
3333
# HIBF_POST_INSTALL_TEST it is an IMPORTED target, and CMake (4.0) does not propagate the module usage requirements
34-
# of an imported target through an intermediate INTERFACE library -- `import hibf;` then fails with "no such
34+
# of an imported target through an intermediate INTERFACE library -- `import seqan.hibf;` then fails with "no such
3535
# module". Going through `hibf::test::unit` as well would put libhibf.a on the link line twice, which Clang's
3636
# ThinLTO rejects.
3737
target_link_libraries (${target} GTest::gtest_main seqan::hibf)

‎test/module/hibf_module_test.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// SPDX-License-Identifier: BSD-3-Clause
44

55
/*!\file
6-
* \brief Checks that the public API is usable through `import hibf;`.
6+
* \brief Checks that the public API is usable through `import seqan.hibf;`.
77
* \details
88
* Every textual `#include` must appear before the `import`: GCC 16 rejects the reverse order (it sees the standard
99
* library declarations of the global module fragment a second time). Clang accepts both orders.
@@ -20,7 +20,7 @@
2020

2121
#include <cereal/archives/binary.hpp>
2222

23-
import hibf;
23+
import seqan.hibf;
2424

2525
TEST(module_test, version)
2626
{
@@ -124,7 +124,7 @@ TEST(module_test, serialisation)
124124
TEST(module_test, path_serialisation)
125125
{
126126
// hibf/cereal/path.hpp adds `save`/`load` overloads in namespace cereal. cereal finds them by ADL, so they have to
127-
// be visible to importers, not merely reachable. See the `export namespace cereal` block in src/hibf.cppm.
127+
// be visible to importers, not merely reachable. See the `export namespace cereal` block in src/seqan.hibf.cppm.
128128
std::filesystem::path const original{"/some/random/path.txt"};
129129

130130
std::stringstream stream{};

‎test/module/mixed_mode_test.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
// SPDX-License-Identifier: BSD-3-Clause
44

55
/*!\file
6-
* \brief Checks that headers and `import hibf;` can be mixed within one translation unit.
6+
* \brief Checks that headers and `import seqan.hibf;` can be mixed within one translation unit.
77
* \details
8-
* Because src/hibf.cppm includes the headers in its global module fragment, an imported entity and an included entity
9-
* are the *same* entity. A project can therefore migrate to the module file by file instead of all at once.
8+
* Because src/seqan.hibf.cppm includes the headers in its global module fragment, an imported entity and an included
9+
* entity are the *same* entity. A project can therefore migrate to the module file by file instead of all at once.
1010
*/
1111

1212
#include <gtest/gtest.h>
@@ -17,7 +17,7 @@
1717
#include <hibf/interleaved_bloom_filter.hpp>
1818
#include <hibf/misc/bit_vector.hpp>
1919

20-
import hibf;
20+
import seqan.hibf;
2121

2222
TEST(mixed_mode_test, same_entity)
2323
{

0 commit comments

Comments
 (0)