diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index acf5d887..afc529ac 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2025 Morwenn +# Copyright (c) 2021-2026 Morwenn # SPDX-License-Identifier: MIT name: MacOS Builds @@ -23,14 +23,14 @@ on: jobs: build: - runs-on: macos-13 + runs-on: macos-14 strategy: fail-fast: false matrix: config: # Release build - - cxx: g++-12 + - cxx: g++-13 build_type: Release - cxx: clang++ build_type: Release diff --git a/.github/workflows/mirror-to-codeberg.yml b/.github/workflows/mirror-to-codeberg.yml new file mode 100644 index 00000000..d13a05b6 --- /dev/null +++ b/.github/workflows/mirror-to-codeberg.yml @@ -0,0 +1,25 @@ +# Copyright (c) 2025 Morwenn +# SPDX-License-Identifier: MIT + +name: Mirror Commits to Codeberg + +on: [push, workflow_dispatch] + +jobs: + mirror-to-codeberg: + name: Mirror to Codeberg + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Mirror + uses: yesolutions/mirror-action@v0.7.0 + with: + REMOTE: 'https://codeberg.org/Morwenn/cpp-sort.git' + GIT_USERNAME: Morwenn + GIT_PASSWORD: ${{ secrets.GIT_PASSWORD }} diff --git a/CMakeLists.txt b/CMakeLists.txt index fc4e93a0..a7f3a45b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,14 @@ -# Copyright (c) 2015-2025 Morwenn +# Copyright (c) 2015-2026 Morwenn # SPDX-License-Identifier: MIT cmake_minimum_required(VERSION 3.8.0) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -project(cpp-sort VERSION 1.17.1 LANGUAGES CXX) +project(cpp-sort VERSION 1.17.2 LANGUAGES CXX) include(CMakePackageConfigHelpers) +include(cpp-sort-utils) include(GNUInstallDirs) # Project options @@ -28,6 +29,7 @@ if (CPPSORT_USE_LIBASSERT) UPDATE_DISCONNECTED 1 ) add_subdirectory(${libassert_SOURCE_DIR} ${libassert_BINARY_DIR}) + mark_system_library(libassert-lib) endif() # Create cpp-sort library and configure it diff --git a/README.md b/README.md index 01ef2c76..4385e4d6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![cpp-sort logo](docs/images/cpp-sort-logo.svg) -[![Latest Release](https://img.shields.io/badge/release-1.17.1-blue.svg)](https://github.com/Morwenn/cpp-sort/releases/tag/1.17.1) -[![Conan Package](https://img.shields.io/badge/conan-cpp--sort%2F1.17.1-blue.svg)](https://conan.io/center/recipes/cpp-sort?version=1.17.1) +[![Latest Release](https://img.shields.io/badge/release-1.17.2-blue.svg)](https://github.com/Morwenn/cpp-sort/releases/tag/1.17.2) +[![Conan Package](https://img.shields.io/badge/conan-cpp--sort%2F1.17.2-blue.svg)](https://conan.io/center/recipes/cpp-sort?version=1.17.2) [![Code Coverage](https://codecov.io/gh/Morwenn/cpp-sort/branch/develop/graph/badge.svg)](https://codecov.io/gh/Morwenn/cpp-sort) [![Pitchfork Layout](https://img.shields.io/badge/standard-PFL-orange.svg)](https://github.com/vector-of-bool/pitchfork) diff --git a/benchmarks/errorbar-plot/plot.py b/benchmarks/errorbar-plot/plot.py index 8156ae48..bc1356cc 100644 --- a/benchmarks/errorbar-plot/plot.py +++ b/benchmarks/errorbar-plot/plot.py @@ -14,13 +14,14 @@ def main(): parser = argparse.ArgumentParser(description="Plot the results of the errorbar-plot benchmark.") parser.add_argument('root', help="directory with the result files to plot") - parser.add_argument('--alternative-palette', dest='use_alt_palette', - action='store_true', default=False, + parser.add_argument('--alternative-palette', + dest='use_alt_palette', + action='store_true', help="Use another color palette") args = parser.parse_args() root = pathlib.Path(args.root) - result_files = list(root.glob('*.csv')) + result_files = sorted(root.glob('*.csv')) if len(result_files) == 0: print(f"There are no files to plot in {root}") sys.exit(1) diff --git a/cmake/cpp-sort-utils.cmake b/cmake/cpp-sort-utils.cmake index fb946ef1..f7150ae6 100644 --- a/cmake/cpp-sort-utils.cmake +++ b/cmake/cpp-sort-utils.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023 Morwenn +# Copyright (c) 2019-2025 Morwenn # SPDX-License-Identifier: MIT # Add a selection of warnings to a target @@ -15,3 +15,17 @@ macro(cppsort_add_warnings target) ) endif() endmacro() + +# Mark a target as a SYSTEM library +function(mark_system_library target) + get_target_property( + TARGET_INCLUDE_DIR + ${target} + INTERFACE_INCLUDE_DIRECTORIES + ) + set_target_properties( + ${target} + PROPERTIES + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${TARGET_INCLUDE_DIR}" + ) +endfunction() diff --git a/conanfile.py b/conanfile.py index 9ee891ba..40320a6e 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2018-2025 Morwenn +# Copyright (c) 2018-2026 Morwenn # SPDX-License-Identifier: MIT import os.path @@ -16,7 +16,7 @@ class CppSortConan(ConanFile): name = "cpp-sort" - version = "1.17.1" + version = "1.17.2" description = "Sorting algorithms & related tools" license = "MIT" url = "https://github.com/Morwenn/cpp-sort" @@ -29,7 +29,8 @@ class CppSortConan(ConanFile): exports_sources = [ "include/*", "CMakeLists.txt", - "cmake/cpp-sort-config.cmake.in" + "cmake/cpp-sort-config.cmake.in", + "cmake/cpp-sort-utils.cmake", ] settings = "os", "compiler", "build_type", "arch" package_type = "header-library" diff --git a/docs/Comparators.md b/docs/Comparators.md index ddc7cd1f..31673f6e 100644 --- a/docs/Comparators.md +++ b/docs/Comparators.md @@ -117,11 +117,11 @@ The two-parameter version of the customization point calls the three-parameter o *Changed in version 1.5.0:* `case_insensitive_less` is an instance of type `case_insensitive_less_t`. - [binary-predicate]: https://en.cppreference.com/w/cpp/concept/BinaryPredicate + [binary-predicate]: https://en.cppreference.com/w/cpp/named_req/BinaryPredicate [branchless-traits]: Miscellaneous-utilities.md#branchless-traits [callable]: https://en.cppreference.com/w/cpp/named_req/Callable [case-sensitivity]: https://en.wikipedia.org/wiki/Case_sensitivity - [cppcon2015-compare]: https://github.com/CppCon/CppCon2015/tree/master/Presentations/Comparison%20is%20not%20simple%2C%20but%20it%20can%20be%20simpler%20-%20Lawrence%20Crowl%20-%20CppCon%202015 + [cppcon2015-compare]: https://github.com/CppCon/CppCon2015/tree/master/Presentations/Comparison%20is%20not%20simple%2C%20but%20it%20can%20be%20simpler [custom-point]: https://ericniebler.com/2014/10/21/customization-point-design-in-c11-and-beyond/ [natural-sort]: https://en.wikipedia.org/wiki/Natural_sort_order [P0100]: http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/p0100r1.html diff --git a/docs/Home.md b/docs/Home.md index fb2e2f92..6258a6a3 100644 --- a/docs/Home.md +++ b/docs/Home.md @@ -1,6 +1,6 @@ ![cpp-sort logo](images/cpp-sort-logo.svg) -Welcome to the **cpp-sort 1.17.1** documentation! +Welcome to the **cpp-sort 1.17.2** documentation! This wiki contains documentation about the library: basic documentation about the many sorting tools and how to use them, documentation about the additional utilities provided by the library, as well as a few tutorials about writing your own sorters or sorter adapters. This main page explains a few general things that didn't quite fit in other parts of the documentation. diff --git a/docs/Original-research.md b/docs/Original-research.md index 0efa385c..62f8cd0a 100644 --- a/docs/Original-research.md +++ b/docs/Original-research.md @@ -228,7 +228,7 @@ The following relations have yet to be analyzed: [better-sorting-networks]: https://etd.ohiolink.edu/!etd.send_file?accession=kent1239814529 [cycle-sort]: https://en.wikipedia.org/wiki/Cycle_sort - [divide-sort-merge-strategy]: http://www.dtic.mil/dtic/tr/fulltext/u2/737270.pdf + [divide-sort-merge-strategy]: https://apps.dtic.mil/sti/tr/pdf/AD0737270.pdf [exact-sort]: https://www.geocities.ws/p356spt/ [indirect-adapter]: Sorter-adapters.md#indirect_adapter [morwenn-gist]: https://gist.github.com/Morwenn diff --git a/docs/Tooling.md b/docs/Tooling.md index 4fa9e215..bc7c46e3 100644 --- a/docs/Tooling.md +++ b/docs/Tooling.md @@ -63,10 +63,10 @@ Note: when `CPPSORT_ENABLE_AUDITS` is `ON`, assertions in the library are enable conan search cpp-sort --remote=conancenter ``` -And then install any version to your local cache as follows (here with version 1.17.1): +And then install any version to your local cache as follows (here with version 1.17.2): ```sh -conan install --requires=cpp-sort/1.17.1 +conan install --requires=cpp-sort/1.17.2 ``` The packages downloaded from conan-center are minimal and only contain the files required to use **cpp-sort** as a library: the headers, CMake files and licensing information. If you need anything else you have to create your own package with the `conanfile.py` available in this repository. diff --git a/include/cpp-sort/detail/grail_sort.h b/include/cpp-sort/detail/grail_sort.h index 834d4184..098dc28d 100644 --- a/include/cpp-sort/detail/grail_sort.h +++ b/include/cpp-sort/detail/grail_sort.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2022 Morwenn + * Copyright (c) 2015-2026 Morwenn * SPDX-License-Identifier: MIT */ @@ -471,7 +471,7 @@ namespace grail auto&& proj = utility::as_function(projection); auto size = last - first; - auto kbuf = std::min(K, LExtBuf); + auto kbuf = (std::min)(K, LExtBuf); while (kbuf & (kbuf - 1)) { kbuf &= kbuf - 1; // max power or 2 - just in case } diff --git a/include/cpp-sort/detail/spreadsort/detail/float_sort.h b/include/cpp-sort/detail/spreadsort/detail/float_sort.h index 2264910f..e8f55ae9 100644 --- a/include/cpp-sort/detail/spreadsort/detail/float_sort.h +++ b/include/cpp-sort/detail/spreadsort/detail/float_sort.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2021 Morwenn + * Copyright (c) 2015-2026 Morwenn * SPDX-License-Identifier: MIT */ @@ -143,7 +143,7 @@ namespace detail auto&& proj = utility::as_function(projection); unsigned log_divisor = get_log_divisor( - last - first, rough_log_2_size(Size_type(max - min))); + last - first, rough_log_2_size(Size_type(max/2 - min/2)) + 1); Div_type div_min = min >> log_divisor; Div_type div_max = max >> log_divisor; unsigned bin_count = unsigned(div_max - div_min) + 1; @@ -209,7 +209,7 @@ namespace detail auto&& proj = utility::as_function(projection); unsigned log_divisor = get_log_divisor( - last - first, rough_log_2_size(Size_type(max - min))); + last - first, rough_log_2_size(Size_type(max/2 - min/2)) + 1); Div_type div_min = min >> log_divisor; Div_type div_max = max >> log_divisor; unsigned bin_count = unsigned(div_max - div_min) + 1; @@ -274,7 +274,7 @@ namespace detail auto&& proj = utility::as_function(projection); unsigned log_divisor = get_log_divisor( - last - first, rough_log_2_size(Size_type(max - min))); + last - first, rough_log_2_size(Size_type(max/2 - min/2)) + 1); Div_type div_min = min >> log_divisor; Div_type div_max = max >> log_divisor; unsigned bin_count = unsigned(div_max - div_min) + 1; diff --git a/include/cpp-sort/probes/dis.h b/include/cpp-sort/probes/dis.h index ffd9a340..c5824907 100644 --- a/include/cpp-sort/probes/dis.h +++ b/include/cpp-sort/probes/dis.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2022 Morwenn + * Copyright (c) 2016-2026 Morwenn * SPDX-License-Identifier: MIT */ #ifndef CPPSORT_PROBES_DIS_H_ @@ -95,7 +95,7 @@ namespace probe while (j <= i && not comp(proj(*lr_cummax[j - 1]), proj(*rl_min_it)) && (j == 1 || not comp(proj(*rl_min_it), proj(*lr_cummax[j - 2])))) { // Compute the next value of DM - res = std::max(res, i - j); + res = (std::max)(res, i - j); // Compute the next value of RL if (--i <= res) { return res; diff --git a/include/cpp-sort/version.h b/include/cpp-sort/version.h index 36a00237..b69d9ce3 100644 --- a/include/cpp-sort/version.h +++ b/include/cpp-sort/version.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2025 Morwenn + * Copyright (c) 2018-2026 Morwenn * SPDX-License-Identifier: MIT */ #ifndef CPPSORT_VERSION_H_ @@ -9,6 +9,6 @@ #define CPPSORT_VERSION_MAJOR 1 #define CPPSORT_VERSION_MINOR 17 -#define CPPSORT_VERSION_PATCH 1 +#define CPPSORT_VERSION_PATCH 2 #endif // CPPSORT_VERSION_H_ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 22ddb2fb..827f1c6e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2025 Morwenn +# Copyright (c) 2015-2026 Morwenn # SPDX-License-Identifier: MIT include(cpp-sort-utils) @@ -31,11 +31,9 @@ else() UPDATE_DISCONNECTED 1 ) add_subdirectory(${Catch2_SOURCE_DIR} ${Catch2_BINARY_DIR}) + mark_system_library(Catch2) + mark_system_library(Catch2WithMain) list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/extras) - - # Make Catch2::Catch2 a SYSTEM target - get_target_property(Catch2_INCLUDE_DIRECTORY Catch2 INTERFACE_INCLUDE_DIRECTORIES) - set_target_properties(Catch2 PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Catch2_INCLUDE_DIRECTORY}") endif() include(Catch) @@ -57,10 +55,8 @@ else() set(RC_INSTALL_ALL_EXTRAS ON) add_subdirectory(${RapidCheck_SOURCE_DIR} ${RapidCheck_BINARY_DIR}) - - # Make rapidcheck a SYSTEM target - get_target_property(rapidcheck_INCLUDE_DIRECTORY rapidcheck INTERFACE_INCLUDE_DIRECTORIES) - set_target_properties(rapidcheck PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${rapidcheck_INCLUDE_DIRECTORY}") + mark_system_library(rapidcheck) + mark_system_library(rapidcheck_catch) endif() ########################################