Skip to content

Commit a7b246f

Browse files
Many updates for corresponding Connective C++ changes, updated dependencies
1 parent d50cc89 commit a7b246f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+411
-447
lines changed

.github/workflows/build_cmake.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Build, run unit tests
2+
name: CMake build and run unit test matrix
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
- develop
9+
env:
10+
BUILD_TYPE: Release
11+
jobs:
12+
build_matrix:
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-15]
16+
# os: [ubuntu-latest]
17+
runs-on: ${{ matrix.os }}
18+
defaults:
19+
run:
20+
shell: bash
21+
steps:
22+
- name: checkout
23+
uses: actions/checkout@v4
24+
- name: create-build-dir
25+
run: mkdir build
26+
- name: configure-cmake
27+
run: cd build && cmake -D CHOPS_NET_IP_BUILD_TESTS:BOOL=ON -D CHOPS_NET_IP_BUILD_EXAMPLES:BOOL=ON ..
28+
- name: build
29+
run: cd build && cmake --build . --config $BUILD_TYPE
30+
- name: run-unit-test
31+
run: cd build && ctest -C $BUILD_TYPE

.github/workflows/gen_docs.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Build, run unit tests
2+
name: Generate documentation
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
jobs:
9+
build_matrix:
10+
strategy:
11+
matrix:
12+
os: [ubuntu-latest]
13+
runs-on: ${{ matrix.os }}
14+
defaults:
15+
run:
16+
shell: bash
17+
steps:
18+
- name: checkout
19+
uses: actions/checkout@v4
20+
- name: run-doxygen
21+
uses: mattnotmitt/doxygen-action@v1.12.0
22+
with:
23+
working-directory: doc
24+
- name: deploy-pages
25+
uses: peaceiris/actions-gh-pages@v4
26+
with:
27+
github_token: ${{ secrets.GITHUB_TOKEN }}
28+
publish_dir: ./doc/doc_output/html

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019-2024 by Cliff Green
1+
# Copyright (c) 2019-2025 by Cliff Green
22
#
33
# https://github.com/connectivecpp/chops-net-ip
44
#
@@ -27,8 +27,11 @@ add_library ( chops::chops_net_ip ALIAS chops_net_ip )
2727

2828
# thread support specified in Asio download
2929

30+
# dependencies needed for main library
31+
3032
include ( cmake/download_cpm.cmake )
31-
CPMAddPackage ( "gh:connectivecpp/shared_buffer@v1.0.0"
33+
CPMAddPackage ( "gh:connectivecpp/shared-buffer@1.0.3" )
34+
CPMAddPackage ( "gh:martinmoene/expected-lite@0.8.0" )
3235

3336
include ( cmake/download_asio_cpm.cmake )
3437

README.md

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ Chops Net IP is not like any other high-level, general purpose C++ socket librar
66

77
Chops Net IP is layered on top of the Asio asynchronous networking library, taking advantage of the portability and functionality that Asio provides. However, it simplifies network programming compared to coding against the Asio API, while providing easy scalability through the asynchronous facilities.
88

9+
Chops Net IP:
10+
11+
1. Asio gotchas
12+
2. Simplifies many use cases
13+
3. API between TCP and UDP is similar, allowing shared code
14+
4. Provides callback points
15+
916
#### Unit Test and Documentation Generation Workflow Status
1017

1118
![GH Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/connectivecpp/chops-net-ip/build_run_unit_test_cmake.yml?branch=main&label=GH%20Actions%20build,%20unit%20tests%20on%20main)
@@ -18,42 +25,42 @@ Chops Net IP is layered on top of the Asio asynchronous networking library, taki
1825

1926
## Overview
2027

21-
`periodic_timer` is an asynchronous periodic timer that wraps and simplifies Asio timers when periodic callbacks are needed. The periodicity can be based on either a simple duration or on timepoints based on a duration.
22-
23-
Timepoint calculations are performed by this class template so that timepoint durations don't "drift". In other words, if the processing during a callback takes 15 milliseconds, the next callback invocation is adjusted accordingly.
24-
25-
Asynchronous timers from Asio are relatively easy to use. However, there are no timers that are periodic. This class simplifies the usage, using application supplied function object callbacks. When the timer is started, the application specifies whether each callback is invoked based on a duration (e.g. one second after the last callback), or on timepoints (e.g. a callback will be invoked each second according to the clock).
28+
(fill in)
2629

2730
## Generated Documentation
2831

29-
The generated Doxygen documentation for `periodic_timer` is [here](https://connectivecpp.github.io/chops-net-ip/).
32+
The generated Doxygen documentation for `chops_net_ip` is [here](https://connectivecpp.github.io/chops-net-ip/).
3033

3134
## Dependencies
3235

33-
The `periodic_timer` header file has the stand-alone Asio library for a dependency. Specific version (or branch) specs for the Asio dependency is in `cmake/download_asio_cpm.cmake`.
36+
The stand-alone Asio library is a dependency for Chops Net IP. Specific version (or branch) specs for the Asio dependency is in `cmake/download_asio_cpm.cmake`.
37+
38+
The `shared_buffer` library from Connective C++ is a dependency, providing reference counted `std::byte` buffers.
39+
40+
`expected_lite` from Martin Moene is a dependency, providing `std::expected` functionality for C++ 20 code baselines. If Chops Net IP transitions to a C++ 23 baseline, `expected_lite` will be replaced with `std::expected`.
3441

3542
## C++ Standard
3643

37-
`periodic_timer` is built under C++ 20, but (currently) does not use any specific C++ 20 features. In the future `concepts` / `requires` will be added.
44+
`chops_net_ip` is built under C++ 20, using features such as `std::span`. In the future `concepts` / `requires` will be added.
3845

3946
## Supported Compilers
4047

4148
Continuous integration workflows build and unit test on g++ (through Ubuntu), MSVC (through Windows), and clang (through macOS).
4249

4350
## Unit Test Dependencies
4451

45-
The unit test code uses [Catch2](https://github.com/catchorg/Catch2). If the `PERIODIC_TIMER_BUILD_TESTS` flag is provided to Cmake (see commands below) the Cmake configure / generate will download the Catch2 library as appropriate using the [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) dependency manager. If Catch2 (v3 or greater) is already installed using a different package manager (such as Conan or vcpkg), the `CPM_USE_LOCAL_PACKAGES` variable can be set which results in `find_package` being attempted. Note that v3 (or later) of Catch2 is required.
52+
The unit test code uses [Catch2](https://github.com/catchorg/Catch2). If the `CHOPS_NET_IP_BUILD_TESTS` flag is provided to Cmake (see commands below) the Cmake configure / generate will download the Catch2 library as appropriate using the [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) dependency manager. If Catch2 (v3 or greater) is already installed using a different package manager (such as Conan or vcpkg), the `CPM_USE_LOCAL_PACKAGES` variable can be set which results in `find_package` being attempted. Note that v3 (or later) of Catch2 is required.
4653

4754
Specific version (or branch) specs for the Catch2 dependency is in the [test/CMakeLists.txt](test/CMakeLists.txt) file, look for the `CPMAddPackage` command.
4855

4956
## Build and Run Unit Tests
5057

51-
To build and run the unit test program:
58+
To build and run the unit test programs:
5259

53-
First clone the `periodic-timer` repository, then create a build directory in parallel to the `periodic-timer` directory (this is called "out of source" builds, which is recommended), then `cd` (change directory) into the build directory. The CMake commands:
60+
First clone the `chops-net-ip` repository, then create a build directory in parallel to the `chops-net-ip` directory (this is called "out of source" builds, which is recommended), then `cd` (change directory) into the build directory. The CMake commands:
5461

5562
```
56-
cmake -D PERIODIC_TIMER_BUILD_TESTS:BOOL=ON ../periodic-timer
63+
cmake -D CHOPS_NET_IP_BUILD_TESTS:BOOL=ON ../chops_net_ip
5764
5865
cmake --build .
5966
@@ -63,8 +70,8 @@ ctest
6370
For additional test output, run the unit test individually, for example:
6471

6572
```
66-
test/periodic_timer_test -s
73+
test/net_ip/basic_io_output_test -s
6774
```
6875

69-
The example can be built by adding `-D PERIODIC_TIMER_BUILD_EXAMPLES:BOOL=ON` to the CMake configure / generate step.
76+
The examples can be built by adding `-D CHOPS_NET_IP_BUILD_EXAMPLES:BOOL=ON` to the CMake configure / generate step.
7077

cmake/add_target_dependencies.cmake

Lines changed: 0 additions & 30 deletions
This file was deleted.

cmake/download_asio_cpm.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ set ( CMAKE_THREAD_PREFER_PTHREAD TRUE )
1010
set ( THREADS_PREFER_PTHREAD_FLAG TRUE )
1111
find_package ( Threads REQUIRED )
1212

13-
include ( cmake/download_cpm.cmake )
14-
CPMAddPackage ( "gh:chriskohlhoff/asio#asio-1-32-0@1.32.0" )
13+
CPMAddPackage ( "gh:chriskohlhoff/asio#asio-1-34-0@1.34.0" )
1514

1615
# ASIO doesn't use CMake, we have to configure it manually. Extra notes for using on Windows:
1716
#

cmake/download_catch2.cmake

Lines changed: 0 additions & 7 deletions
This file was deleted.

cmake/download_cpm.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
file(
66
DOWNLOAD
7-
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.39.0/CPM.cmake
7+
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.40.0/CPM.cmake
88
${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake
99
)
1010
include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake)

cmake/example_app_creation.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2024-2025 by Cliff Green
2+
#
3+
# Distributed under the Boost Software License, Version 1.0.
4+
# (See accompanying file LICENSE.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
5+
6+
# add example executable
7+
foreach ( example_app_name IN LISTS example_app_names )
8+
message ( "Creating example executable: ${example_app_name}" )
9+
add_executable ( ${example_app_name} ${example_app_name}.cpp )
10+
target_compile_features ( ${example_app_name} PRIVATE cxx_std_20 )
11+
target_link_libraries ( ${example_app_name} PRIVATE
12+
Threads::Threads chops_net_ip asio shared_buffer expected-lite Catch2::Catch2WithMain )
13+
endforeach()
14+

0 commit comments

Comments
 (0)