Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions .cmake-format.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,29 @@
with section("parse"):

# Specify structure for custom cmake functions
additional_commands = { 'foo': { 'flags': ['BAR', 'BAZ'],
'kwargs': {'DEPENDS': '*', 'HEADERS': '*', 'SOURCES': '*'}}}
additional_commands = {
'snodec_add_component': {
'flags': ['PUBLIC_COMPONENT'],
'kwargs': {'ARCHIVE_DESTINATION': 1, 'COMPONENT': 1, 'DEPENDS': '*',
'DESCRIPTION': 1, 'DEVELOPMENT_DEPENDS': '*',
'DEVELOPMENT_FILES': '*', 'DIRECTORY': 1,
'DISPLAY_NAME': 1, 'EXCLUDE_PATTERNS': '*',
'EXPORT_DESTINATION': 1, 'FILES': '*', 'HEADERS': '*',
'LIBRARY_DESTINATION': 1, 'PATTERNS': '*',
'RUNTIME_DESTINATION': 1, 'TARGET': 1}},
'snodec_finalize_components': {
'kwargs': {'PACKAGE_CONFIG_COMPONENT': 1,
'PACKAGE_CONFIG_DESTINATION': 1,
'PACKAGE_CONFIG_OUTPUT': 1,
'PACKAGE_CONFIG_TEMPLATE': 1,
'PACKAGE_VERSION': 1, 'PACKAGE_VERSION_OUTPUT': 1}},
'snodec_install_runtime_targets': {
'kwargs': {'COMPONENT': 1, 'LIBRARY_DESTINATION': 1,
'RUNTIME_DESTINATION': 1, 'TARGETS': '*'}},
'snodec_register_runtime_component': {
'kwargs': {'COMPONENT': 1, 'DEPENDS': '*', 'DESCRIPTION': 1,
'DISPLAY_NAME': 1}}
}

# Override configurations per-command where available
override_spec = {}
Expand Down Expand Up @@ -238,4 +259,3 @@
# A dictionary containing any per-command configuration overrides. Currently
# only `command_case` is supported.
per_command = {}

20 changes: 19 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
sudo apt-get update
sudo apt-get install -y \
cmake \
dpkg-dev \
g++ \
libbluetooth-dev \
libmagic-dev \
Expand All @@ -43,7 +44,12 @@ jobs:
pkg-config

- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DSNODEC_BUILD_TESTS=ON -DSNODEC_BUILD_APPS=ON
run: >-
cmake -S . -B build
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX=/usr
-DSNODEC_BUILD_TESTS=ON
-DSNODEC_BUILD_APPS=ON

- name: Build
run: cmake --build build --parallel 2
Expand All @@ -68,3 +74,15 @@ jobs:
run: |
export LD_LIBRARY_PATH="$RUNNER_TEMP/snodec-install/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
ctest --test-dir build-examples-echo --output-on-failure

- name: Component packages
run: |
rm -rf build/_packages
cpack --config build/CPackConfig.cmake -G DEB

- name: Validate component packages
run: |
cmake \
-DPACKAGE_DIR=${{ github.workspace }}/build/_packages \
-DCPACK_CONFIG=${{ github.workspace }}/build/CPackConfig.cmake \
-P cmake/ValidateComponentPackages.cmake
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ include(format)
include(doxygen)
include(uninstall)
include(graphwiz)
include(SNodeCComponent)

option(SNODEC_BUILD_TESTS "Build SNode.C tests" OFF)
option(SNODEC_BUILD_APPS "Build SNode.C apps" ON)
Expand Down
166 changes: 90 additions & 76 deletions README.md

Large diffs are not rendered by default.

132 changes: 13 additions & 119 deletions cmake/Packing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,27 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

# these are cache variables, so they could be overwritten with -D,
set(CPACK_PACKAGE_NAME
${PROJECT_NAME}
CACHE STRING "The resulting package name"
)

set(CPACK_PACKAGE_CONTACT "me@vchrist.at")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER
"Volker Christian <${CPACK_PACKAGE_CONTACT}>"
)
set(CPACK_PACKAGE_VENDOR "Volker Christian")

set(CPACK_VERBATIM_VARIABLES YES)

set(CPACK_STRIP_FILES YES)
option(SNODEC_PACKAGE_STRIP "Strip binaries in generated packages" OFF)
set(SNODEC_PACKAGE_INSTALL_PREFIX
"/usr"
CACHE PATH "Installation prefix inside generated binary packages"
)

set(CPACK_VERBATIM_VARIABLES YES)
set(CPACK_STRIP_FILES ${SNODEC_PACKAGE_STRIP})
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_BINARY_DIR}/_packages")

set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
set(CPACK_PACKAGING_INSTALL_PREFIX "${SNODEC_PACKAGE_INSTALL_PREFIX}")

set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
Expand Down Expand Up @@ -97,120 +98,13 @@ set(
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)

set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)

set(CPACK_COMPONENTS_GROUPING ONE_PER_GROUP)
set(CPACK_COMPONENTS_GROUPING IGNORE)
set(CPACK_DEB_COMPONENT_INSTALL YES)

get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
list(REMOVE_ITEM CPACK_COMPONENTS_ALL notneeded)
# CMake 3.28 omits this existing Unix-domain component from the global
# COMPONENTS property even though its install rule is configured. Normalize
# the published component model across supported CMake versions.
list(APPEND CPACK_COMPONENTS_ALL net-un-sphy-tream)
list(REMOVE_DUPLICATES CPACK_COMPONENTS_ALL)
list(SORT CPACK_COMPONENTS_ALL)
# The package-format-neutral component registry is already finalized. This
# adapter maps its runtime/development components and dependencies to CPack;
# other packaging systems can consume the same registry independently.
snodec_finalize_cpack_components()

include(CPack)

cpack_add_component(logger)
cpack_add_component(utils DEPENDS logger)

cpack_add_component(mux-epoll)
cpack_add_component(mux-poll)
cpack_add_component(mux-select)

cpack_add_component(core DEPENDS mux-${IO_Multiplexer} utils)
cpack_add_component(core-socket DEPENDS core)
cpack_add_component(core-socket-stream DEPENDS core-socket)
cpack_add_component(core-socket-stream-legacy DEPENDS core-socket-stream)
cpack_add_component(core-socket-stream-tls DEPENDS core-socket-stream)

cpack_add_component(net)

cpack_add_component(net-in DEPENDS net)
cpack_add_component(net-in6 DEPENDS net)
cpack_add_component(net-l2 DEPENDS net)
cpack_add_component(net-rc DEPENDS net)
cpack_add_component(net-un DEPENDS net)

cpack_add_component(net-in-stream DEPENDS net-in)
cpack_add_component(net-in6-stream DEPENDS net-in6)
cpack_add_component(net-l2-stream DEPENDS net-l2)
cpack_add_component(net-rc-stream DEPENDS net-rc)
cpack_add_component(net-un-stream DEPENDS net-un)

cpack_add_component(
net-in-stream-legacy DEPENDS net-in-stream core-socket-stream-legacy
)
cpack_add_component(
net-in6-stream-legacy DEPENDS net-in6-stream core-socket-stream-legacy
)
cpack_add_component(
net-l2-stream-legacy DEPENDS net-l2-stream core-socket-stream-legacy
)
cpack_add_component(
net-rc-stream-legacy DEPENDS net-rc-stream core-socket-stream-legacy
)
cpack_add_component(
net-un-stream-legacy DEPENDS net-un-stream core-socket-stream-legacy
)

cpack_add_component(
net-in-stream-tls DEPENDS net-in-stream core-socket-stream-tls
)
cpack_add_component(
net-in6-stream-tls DEPENDS net-in6-stream core-socket-stream-tls
)
cpack_add_component(
net-l2-stream-tls DEPENDS net-l2-stream core-socket-stream-tls
)
cpack_add_component(
net-rc-stream-tls DEPENDS net-rc-stream core-socket-stream-tls
)
cpack_add_component(
net-un-stream-tls DEPENDS net-un-stream core-socket-stream-tls
)

cpack_add_component(net-un-dgram DEPENDS net-un)

cpack_add_component(http)
cpack_add_component(http-server DEPENDS http)
cpack_add_component(http-client DEPENDS http)
cpack_add_component(http-server-express DEPENDS http-server)

cpack_add_component(websocket)
cpack_add_component(websocket-server DEPENDS websocket http-server)
cpack_add_component(websocket-client DEPENDS websocket http-client)

cpack_add_component(mqtt)
cpack_add_component(mqtt-server DEPENDS mqtt)
cpack_add_component(mqtt-client DEPENDS mqtt)

cpack_add_component(mqtt-fast)

cpack_add_component(db-mariadb DEPENDS core)

cpack_add_component(
apps
DISPLAY_NAME "Applications"
DESCRIPTION "We install Applications"
DEPENDS http-server-express
http-client
net-in-stream-tls
net-in6-stream-tls
net-l2-stream-tls
net-rc-stream-tls
net-un-stream-tls
net-in-stream-legacy
net-in6-stream-legacy
net-l2-stream-legacy
net-rc-stream-legacy
net-un-stream-legacy
core-socket-stream-legacy
core-socket-stream-tls
websocket-server
websocket-client
db-mariadb
)
Loading
Loading