https://github.com/youpong/cpp-sleep-sort
C++20 Implementation of Sleep Sort using std::thread
https://github.com/youpong/cpp-sleep-sort
cmake cpp cpp20 docker sleep-sort std-thread
Last synced: 10 months ago
JSON representation
C++20 Implementation of Sleep Sort using std::thread
- Host: GitHub
- URL: https://github.com/youpong/cpp-sleep-sort
- Owner: youpong
- License: mit
- Created: 2023-02-08T03:19:50.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-13T06:31:14.000Z (almost 3 years ago)
- Last Synced: 2025-02-16T14:55:10.105Z (12 months ago)
- Topics: cmake, cpp, cpp20, docker, sleep-sort, std-thread
- Language: C++
- Homepage: https://youpong.github.io/cpp-sleep-sort/
- Size: 61.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# README.md
[](https://github.com/youpong/cpp-sleep-sort/actions/workflows/ci.yml)
The C++20 implementation of Sleep Sort using std::thread.
## Prerequisites
The following versions or newer required.
For Windows:
* MS Visual Studio 2022
For Ubuntu, MacOS:
* CMake 3.22
* GNU Make-4.3
* C++20 compliant compiler: clang-15.0.6 or g++-11.3.0
Optional:
* clang-format-15.0.6
* Doxygen-1.9.1
* Graphviz-2.43.0
## Usage
1. Generate the build system and navigate to the directory:
```bash
$ cmake -Bbuild
```
optoins(default):
* BUILD\_DOC(OFF): Build API Documents
* ENABLE\_FORMAT(OFF): Enable Format sources
Example:
```
$ cmake -DBUILD_DOC=ON -DENABLE_FORMAT=ON -Bbuild
```
2. build and test:
When `BUILD_DOC` is ON, API document is also generated.
```bash
$ cd build
$ cmake --build . -j
$ ctest -C Debug
```
3. Format sources anytime using `clangformat` target:
requires `ENABLE_FORMAT` is `ON`.
```bash
$ cmake --build . --target clangformat
```
## Docker
1. Build Docker image:
```bash
$ docker build -t sleep-sort .
```
2. Run Docker container:
```bash
$ docker run --rm -it -v $PWD:/sleep-sort -w /sleep-sort sleep-sort
```
## References
* [Go implementation](https://github.com/youpong/sleep-sort) of sleep sort.
* zemasoft, [ClangFormat.cmake module](https://github.com/zemasoft/clangformat-cmake)
## Lisence
MIT