-
Notifications
You must be signed in to change notification settings - Fork 61
Tooling
cpp-sort offers some tooling support out-of-the-box, notably for CMake and Conan.
The library's repository does contain files specific to other tools, but most of those exist to properly instrument the continuous integration, so they are not documented here. If you have use for such files outside of continuous integration, please open a documentation issue.
cpp-sort can be installed via CMake (3.11 or greater), in which case it exports a cpp-sort::cpp-sort
target and all the files required for a basic integration. Once it has been installed on the system, the following lines should be enough to use it as a dependency:
find_package(cpp-sort REQUIRED CONFIG)
target_link_libraries(my-target PRIVATE cpp-sort::cpp-sort)
If you don't want to install cpp-sort directly, it can still be used directly as a subdirectory:
add_subdirectory(third_party/cpp-sort)
target_link_libraries(my-target PRIVATE cpp-sort::cpp-sort)
The project's CMake files offers some options, though they are mainly used to configure the test suite and examples:
-
CPPSORT_BUILD_TESTING
: whether to build the test suite, defaults to the value ofBUILD_TESTING
. -
CPPSORT_BUILD_EXAMPLES
: whether to build the examples, defaults toOFF
. -
CPPSORT_ENABLE_COVERAGE
: whether to produce code coverage information when building the test suite, defaults toOFF
. -
CPPSORT_USE_VALGRIND
: whether to run the test suite through Valgrind, defaults toOFF
. -
CPPSORT_SANITIZE
: comma-separated list of values to pass to the-fsanitize
flag of compilers that support it, defaults to an empty string. -
CPPSORT_STATIC_TESTS
: whenON
, some tests are executed at compile time instead of runtime, defaults toOFF
. -
CPPSORT_ENABLE_ASSERTIONS
: whenON
, defines the eponymous macro which enables debug assertions from the library's internals, defaults to the value ofCPPSORT_ENABLE_AUDITS
. -
CPPSORT_ENABLE_AUDITS
: whenON
, defines the eponymous macro which enables expensive debug assertions from the library's internals, defaults toOFF
. -
CPPSORT_USE_LIBASSERT
(experimental): whenON
, internal assertions use libassert instead of the standardassert
macro, providing additional information about the errors. Defaults toOFF
.
Note: when CPPSORT_ENABLE_AUDITS
is ON
, assertions in the library are enabled even if CPPSORT_ENABLE_ASSERTIONS
is OFF
. See the relevant page for more information.
Catch2 v3.1.0 or greater is required to build the tests: if a suitable version has been installed on the system it will be used, otherwise the latest suitable Catch2 release will be downloaded.
cpp-sort is available directly on Conan Center. You can find the different versions available with the following command:
conan search cpp-sort --remote=conancenter
And then install any version to your local cache as follows (here with version 2.0.0):
conan install --requires=cpp-sort/2.0.0
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.
Gollum, if installed, can be used to browse this documentation offline:
- Navigate to the main
cpp-sort
directory in the command line gollum --page-file-dir docs --ref <branch-name> --math katex
- Visit http://localhost:4567/Home
This can notably used to browse old versions of the documentation. It seems however that --ref
doesn't understand Git tags, so you have to create a proper branch from the version tag you want to browse beforehand.
Due to slight markup differences, some pages might not fully render correctly but it should nonetheless be a better experience than navigaitng the Markdown files by hand.
- Home
- Quickstart
- Sorting library
- Comparators and projections
- Miscellaneous utilities
- Tutorials
- Tooling
- Benchmarks
- Changelog
- Original research