Skip to content

Commit 395ad9e

Browse files
Merge branch 'main' into release
2 parents 8c2742d + a289301 commit 395ad9e

28 files changed

+388
-374
lines changed

.github/workflows/cmake.yml

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,68 @@ jobs:
1818

1919
steps:
2020
- uses: actions/checkout@v3
21-
22-
- name: Init submodules
23-
run: git submodule init
24-
25-
- name: Update submodules
26-
run: git submodule update
21+
22+
- name: create tmp dir
23+
run: mkdir tmp
24+
25+
- name: update
26+
run: |
27+
sudo apt update
28+
sudo apt upgrade -y
29+
30+
- name: install cxxopts
31+
run: |
32+
git clone https://github.com/jarro2783/cxxopts.git tmp/cxxopts
33+
cd tmp/cxxopts
34+
git checkout $(git tag | grep -P '^v\d+\.\d+\.\d+$' | sort | tail -1)
35+
cmake -B build . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCLANG_FORMAT=OFF -DCOMPILER_WARNINGS=OFF -DCLANG_TIDY=OFF
36+
cmake --build build
37+
sudo cmake --install build
38+
cd -
39+
40+
- name: install cxxshm
41+
run: |
42+
git clone https://github.com/NikolasK-source/cxxshm.git tmp/cxxshm
43+
cd tmp/cxxshm
44+
git checkout $(git tag | grep -P '^v\d+\.\d+\.\d+$' | sort | tail -1)
45+
cmake -B build . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCLANG_FORMAT=OFF -DCOMPILER_WARNINGS=OFF -DCLANG_TIDY=OFF
46+
cmake --build build
47+
sudo cmake --install build
48+
cd -
49+
50+
- name: install cxxsemaphore
51+
run: |
52+
git clone https://github.com/NikolasK-source/cxxsemaphore.git tmp/cxxsemaphore
53+
cd tmp/cxxsemaphore
54+
git checkout $(git tag | grep -P '^v\d+\.\d+\.\d+$' | sort | tail -1)
55+
cmake -B build . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCLANG_FORMAT=OFF -DCOMPILER_WARNINGS=OFF -DCLANG_TIDY=OFF
56+
cmake --build build
57+
sudo cmake --install build
58+
cd -
59+
60+
- name: install libmodbus
61+
run: |
62+
git clone https://github.com/stephane/libmodbus.git tmp/libmodbus
63+
cd tmp/libmodbus
64+
git checkout $(git tag | grep -P '^v\d+\.\d+\.\d+$' | sort | tail -1)
65+
autoreconf --install --symlink --force
66+
./configure
67+
make
68+
sudo make install
69+
cd -
2770
2871
- name: Configure CMake
2972
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
3073
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
31-
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCLANG_FORMAT=OFF -DCOMPILER_WARNINGS=OFF
74+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCLANG_FORMAT=OFF -DCOMPILER_WARNINGS=OFF -DCLANG_TIDY=OFF -DBUILD_DOC=OFF
3275

3376
- name: Build
3477
# Build your program with the given configuration
3578
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
3679

37-
- name: Test
38-
working-directory: ${{github.workspace}}/build
80+
# - name: Test
81+
# working-directory: ${{github.workspace}}/build
3982
# Execute tests defined by the CMake configuration.
4083
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
41-
run: ctest -C ${{env.BUILD_TYPE}}
84+
# run: ctest -C ${{env.BUILD_TYPE}}
4285

.github/workflows/flatpak_test.yml renamed to .github/workflows/flatpak.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
on:
2-
push:
3-
branches: [ "main", "development" ]
4-
pull_request:
2+
[ push, pull_request ]
53
name: Flatpak_test
64
jobs:
75
flatpak:
@@ -27,4 +25,4 @@ jobs:
2725
with:
2826
bundle: test_modbus-tcp-client-shm.flatpak
2927
manifest-path: network.koesling.test-modbus-rtu-client-shm.yml
30-
cache-key: flatpak-builder-${{ github.sha }}
28+
cache-key: flatpak-builder-${{ github.sha }}

.github/workflows/flatpak_release.yml

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# general
22
build*
33
docs/*
4+
docs_doxy
45

56
!docs/index.md
67
!docs/_config.yml

.gitmodules

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +0,0 @@
1-
[submodule "libs/cxxopts"]
2-
path = libs/cxxopts
3-
url = https://github.com/NikolasK-source/cxxopts.git
4-
[submodule "libs/libmodbus"]
5-
path = libs/libmodbus
6-
url = https://github.com/stephane/libmodbus
7-
[submodule "libs/cxxshm"]
8-
path = libs/cxxshm
9-
url = https://github.com/NikolasK-source/cxxshm.git
10-
[submodule "libs/cxxsemaphore"]
11-
path = libs/cxxsemaphore
12-
url = https://github.com/NikolasK-source/cxxsemaphore.git

CMakeLists.txt

Lines changed: 2 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
99
# ======================================================================================================================
1010

1111
# project
12-
project(Modbus_RTU_client_shm LANGUAGES CXX VERSION 0.3.0)
12+
project(Modbus_RTU_client_shm LANGUAGES CXX VERSION 0.4.0)
1313

1414
# settings
1515
set(Target "modbus-rtu-client-shm") # Executable name (without file extension!)
@@ -37,154 +37,4 @@ option(ENABLE_TEST "enable test builds" OFF)
3737

3838
# ----------------------------------------------- Do not change --------------------------------------------------------
3939
# ======================================================================================================================
40-
41-
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
42-
43-
if (CLANG_TIDY)
44-
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
45-
if (${CLANG_TIDY_NO_ERRORS})
46-
set(CLANG_TIDY_CONFIG_FILE ${CMAKE_SOURCE_DIR}/.clang-tidy-noerrors)
47-
else ()
48-
set(CLANG_TIDY_CONFIG_FILE ${CMAKE_SOURCE_DIR}/.clang-tidy)
49-
endif ()
50-
51-
set(CMAKE_CXX_CLANG_TIDY
52-
clang-tidy
53-
-config-file=${CLANG_TIDY_CONFIG_FILE})
54-
message(STATUS "clang-tidy enabled: ${CLANG_TIDY_CONFIG_FILE}")
55-
else ()
56-
message(WARNING "clang-tidy requested, but only available if clang is selected as compiler")
57-
endif ()
58-
endif ()
59-
60-
# add executable
61-
add_executable(${Target})
62-
install(TARGETS ${Target})
63-
64-
# set source and libraries directory
65-
add_subdirectory("src")
66-
add_subdirectory("libs")
67-
68-
include(warnings.cmake)
69-
include(define.cmake)
70-
include(compileropts.cmake)
71-
72-
# force C++ Standard and disable/enable compiler specific extensions
73-
set_target_properties(${Target} PROPERTIES
74-
CXX_STANDARD ${STANDARD}
75-
CXX_STANDARD_REQUIRED ON
76-
CXX_EXTENSIONS ${COMPILER_EXTENSIONS}
77-
)
78-
79-
# compiler definitions and options
80-
set_definitions(${Target})
81-
if (ENABLE_MULTITHREADING AND OPENMP)
82-
set_options(${Target} ON)
83-
else ()
84-
set_options(${Target} OFF)
85-
endif ()
86-
87-
if (COMPILER_WARNINGS)
88-
enable_warnings(${Target})
89-
message(STATUS "Compiler warnings enabled.")
90-
else ()
91-
disable_warnings(${Target})
92-
message(STATUS "Compiler warnings disabled.")
93-
endif ()
94-
95-
if (ENABLE_MULTITHREADING)
96-
# required by threading lib (std::thread)
97-
set(THREADS_PREFER_PTHREAD_FLAG ON)
98-
find_package(Threads REQUIRED)
99-
target_link_libraries(${Target} PRIVATE Threads::Threads)
100-
endif ()
101-
102-
# lto
103-
if (LTO_ENABLED)
104-
include(CheckIPOSupported)
105-
check_ipo_supported(RESULT ipo_supported OUTPUT error)
106-
if (ipo_supported)
107-
message(STATUS "IPO / LTO enabled")
108-
set_property(TARGET ${Target} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
109-
else ()
110-
message(STATUS "IPO / LTO not supported: <${error}>")
111-
endif ()
112-
endif ()
113-
114-
if (BUILD_DOC)
115-
# doxygen documentation (https://vicrucann.github.io/tutorials/quick-cmake-doxygen/)
116-
# check if Doxygen is installed
117-
find_package(Doxygen)
118-
if (DOXYGEN_FOUND)
119-
# set input and output files
120-
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
121-
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
122-
123-
if (EXISTS ${DOXYGEN_IN})
124-
# request to configure the file
125-
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
126-
message(STATUS "Doxygen configured")
127-
128-
# note the option ALL which allows to build the docs together with the application
129-
add_custom_target(doc_doxygen_${Target} ALL
130-
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
131-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
132-
COMMENT "Generating API documentation with Doxygen"
133-
VERBATIM)
134-
message(STATUS "Added target doc_doxygen_${Target}")
135-
136-
if (TARGET doc_doxygen)
137-
add_dependencies(doc_doxygen doc_doxygen_${Target})
138-
else ()
139-
add_custom_target(doc_doxygen DEPENDS doc_doxygen_${Target})
140-
endif ()
141-
else ()
142-
message(WARNING "doxygen documentation requested, but file ${DOXYGEN_IN} does not exist.")
143-
endif ()
144-
else (DOXYGEN_FOUND)
145-
message(WARNING "Doxygen must be installed and accessible to generate the doxygen documentation.")
146-
endif (DOXYGEN_FOUND)
147-
endif ()
148-
149-
# add clang format target
150-
if (CLANG_FORMAT)
151-
set(CLANG_FORMAT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/.clang-format)
152-
153-
if (EXISTS ${CLANG_FORMAT_FILE})
154-
include(ClangFormat.cmake)
155-
target_clangformat_setup(${Target})
156-
message(STATUS "Added clang format target(s)")
157-
else ()
158-
message(WARNING "Clang format enabled, but file ${CLANG_FORMAT_FILE} does not exist")
159-
endif ()
160-
endif ()
161-
162-
# add test targets
163-
if (ENABLE_TEST)
164-
enable_testing()
165-
add_subdirectory("test")
166-
endif ()
167-
168-
# generate version_info.cpp
169-
# output is not the acutal generated file --> command is always executed
170-
add_custom_command(
171-
OUTPUT
172-
${CMAKE_SOURCE_DIR}/src/generated/version_info_cpp
173-
174-
COMMAND
175-
bash ${CMAKE_SOURCE_DIR}/scripts/gen_version_info_cpp.sh ${PROJECT_NAME}
176-
177-
WORKING_DIRECTORY
178-
${CMAKE_SOURCE_DIR}
179-
)
180-
181-
execute_process(
182-
COMMAND bash "${CMAKE_SOURCE_DIR}/scripts/gen_version_info_cpp.sh" ${PROJECT_NAME}
183-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
184-
)
185-
186-
add_custom_target(${Target}_generated_version_info
187-
DEPENDS ${CMAKE_SOURCE_DIR}/src/generated/version_info_cpp
188-
)
189-
190-
add_dependencies(${Target} ${Target}_generated_version_info)
40+
include(cmake_files/setup.cmake)

Doxyfile.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
3232
# title of most generated pages and in a few other places.
3333
# The default value is: My Project.
3434

35-
PROJECT_NAME = "Modbus TCP Client - Shared Memory"
35+
PROJECT_NAME = "Modbus RTU Client - Shared Memory"
3636

3737
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
3838
# could be handy for archiving the generated documentation or if some version
@@ -44,7 +44,7 @@ PROJECT_NUMBER =
4444
# for a project that appears at the top of each page and should give viewer a
4545
# quick idea about the purpose of the project. Keep the description short.
4646

47-
PROJECT_BRIEF = "A modbus TCP client that stores its values in shared memory objects"
47+
PROJECT_BRIEF = "A modbus RTU client that stores its values in shared memory objects"
4848

4949
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
5050
# in the documentation. The maximum height of the logo should not exceed 55
@@ -58,7 +58,7 @@ PROJECT_LOGO =
5858
# entered, it will be relative to the location where doxygen was started. If
5959
# left blank the current directory will be used.
6060

61-
OUTPUT_DIRECTORY = docs
61+
OUTPUT_DIRECTORY = docs_doxy
6262

6363
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
6464
# directories (in 2 levels) under the output directory of each output format and

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@
22

33
Modbus RTU client that stores its data (registers) in shared memory objects.
44

5+
## Dependencies
6+
- cxxopts by jarro2783 (https://github.com/jarro2783/cxxopts) (only required for building the application)
7+
- libmodbus by Stéphane Raimbault (https://github.com/stephane/libmodbus)
8+
- cxxshm (https://github.com/NikolasK-source/cxxshm)
9+
- cxxsemaphore (https://github.com/NikolasK-source/cxxsemaphore)
10+
11+
On Arch linux they are available via the official repositories and the AUR:
12+
- https://archlinux.org/packages/extra/any/cxxopts/
13+
- https://aur.archlinux.org/packages/libmodbus
14+
- https://aur.archlinux.org/packages/cxxshm
15+
- https://aur.archlinux.org/packages/cxxsemaphore
16+
517
## Build
618
```
7-
git submodule init
8-
git submodule update
9-
mkdir build
10-
cd build
11-
cmake .. -DCMAKE_CXX_COMPILER=$(which clang++) -DCMAKE_BUILD_TYPE=Release -DCLANG_FORMAT=OFF -DCOMPILER_WARNINGS=OFF
12-
cmake --build .
19+
cmake -B build -DCMAKE_CXX_COMPILER=$(which clang++) -DCMAKE_BUILD_TYPE=Release -DCLANG_FORMAT=OFF -DCLANG_TIDY=OFF -DCOMPILER_WARNINGS=OFF -DBUILD_DOC=OFF
20+
cmake --build .
1321
```
1422

15-
As an alternative to the ```git submodule``` commands, the ```--recursive``` option can be used with ```git clone```.
16-
1723
## Use
1824
```
1925
modbus-rtu-client-shm [OPTION...]
@@ -54,8 +60,3 @@ The modbus registers are mapped to shared memory objects:
5460
AO | Discrete Output Registers | read-write | <name-prefix>AO
5561
AI | Discrete Input Registers | read-only | <name-prefix>AI
5662
```
57-
58-
## Libraries
59-
This application uses the following libraries:
60-
- cxxopts by jarro2783 (https://github.com/jarro2783/cxxopts)
61-
- libmodbus by Stéphane Raimbault (https://github.com/stephane/libmodbus)
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)