Skip to content

Commit

Permalink
[config] configuration yaml generation (#1680)
Browse files Browse the repository at this point in the history
* Config initialization happens now directly in structure.

* Removed eCAL defs except for non configurable defs.

* Adapted subscriber configuration to layer::udp as in other structs.

* Added yaml creation out of a stringstream while building.

* Made yaml-cpp optional again. Added compiler flags depending on ECAL_CORE_CONFIGURATION option to exclude yaml-cpp code.
  • Loading branch information
Peguen authored Aug 2, 2024
1 parent 63d1cc2 commit a5d9eb4
Show file tree
Hide file tree
Showing 44 changed files with 793 additions and 958 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,23 @@ jobs:
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON \
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON \
-DECAL_THIRDPARTY_BUILD_QWT=ON \
-DECAL_THIRDPARTY_BUILD_YAML-CPP=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=/usr/local/opt/[email protected] \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON \
-DPython_FIND_STRATEGY=LOCATION \
-DPython_FIND_REGISTRY=NEVER
sudo mkdir /etc/ecal
sudo cp "$GITHUB_WORKSPACE/ecal/core/cfg/ecal.yaml" /etc/ecal
-DPython_FIND_REGISTRY=NEVER
shell: bash

- name: Build Release
run: cmake --build . --config Release
working-directory: ${{ runner.workspace }}/_build

- name: Create config path and copy ecal.yaml
run: |
sudo mkdir /etc/ecal
sudo cp "./ecal/core/cfg/gen/ecal.yaml" /etc/ecal
working-directory: ${{ runner.workspace }}/_build

# - name: Build Documentation C
# run: cmake --build . --target documentation_c
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,24 @@ jobs:
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON \
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON \
-DECAL_THIRDPARTY_BUILD_QWT=ON \
-DECAL_THIRDPARTY_BUILD_YAML-CPP=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LOCALSTATEDIR=/var \
-DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu \
-DPython_FIND_VIRTUALENV=ONLY
sudo mkdir /etc/ecal
sudo cp "$GITHUB_WORKSPACE/ecal/core/cfg/ecal.yaml" /etc/ecal
shell: bash

- name: Build Release
run: cmake --build . --parallel -- -k 0
working-directory: ${{ runner.workspace }}/_build

- name: Create config path and copy ecal.yaml
run: |
sudo mkdir /etc/ecal
sudo cp "./ecal/core/cfg/gen/ecal.yaml" /etc/ecal
working-directory: ${{ runner.workspace }}/_build
shell: bash

- name: Run Tests
run: ctest -V
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ jobs:
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON ^
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON ^
-DECAL_THIRDPARTY_BUILD_QWT=OFF ^
-DECAL_THIRDPARTY_BUILD_YAML-CPP=ON ^
-DECAL_THIRDPARTY_BUILD_UDPCAP=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DCMAKE_PREFIX_PATH="%ProgramFiles%/Cap'n Proto/lib/cmake/CapnProto" ^
Expand Down Expand Up @@ -131,14 +130,11 @@ jobs:
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON ^
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON ^
-DECAL_THIRDPARTY_BUILD_QWT=ON ^
-DECAL_THIRDPARTY_BUILD_YAML-CPP=ON ^
-DECAL_THIRDPARTY_BUILD_UDPCAP=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DCMAKE_PREFIX_PATH="%ProgramFiles%/Cap'n Proto/lib/cmake/CapnProto" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCPACK_PACK_WITH_INNOSETUP=ON
mkdir "%ALLUSERSPROFILE%\eCAL"
copy "%GITHUB_WORKSPACE%\ecal\core\cfg\ecal.yaml" "%ALLUSERSPROFILE%\eCAL"
-DCPACK_PACK_WITH_INNOSETUP=ON
shell: cmd

- name: Build SDK
Expand All @@ -149,6 +145,13 @@ jobs:
run: cmake --build . --config Release
working-directory: ${{ runner.workspace }}/_build/complete

- name: Create config path and copy ecal.yaml
run: |
mkdir "%ALLUSERSPROFILE%\eCAL"
copy ".\ecal\core\cfg\gen\ecal.yaml" "%ALLUSERSPROFILE%\eCAL"
working-directory: ${{ runner.workspace }}/_build/complete
shell: cmd

- name: Run Tests
run: ctest -C Release -V
working-directory: ${{ runner.workspace }}/_build/complete
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/clang-tidy-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ jobs:
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON \
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON \
-DECAL_THIRDPARTY_BUILD_QWT=OFF \
-DECAL_THIRDPARTY_BUILD_YAML-CPP=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_INSTALL_PREFIX=/usr \
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ jobs:
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON \
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON \
-DECAL_THIRDPARTY_BUILD_QWT=OFF \
-DECAL_THIRDPARTY_BUILD_YAML-CPP=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_INSTALL_PREFIX=/usr \
Expand Down
3 changes: 1 addition & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@
"HAS_FTXUI": "OFF",
"BUILD_APPS": "OFF",
"BUILD_SAMPLES": "OFF",
"ECAL_CORE_CONFIGURATION": "OFF",
"ECAL_INSTALL_SAMPLE_SOURCES": "OFF",
"ECAL_THIRDPARTY_BUILD_FINEFTP": "OFF",
"ECAL_THIRDPARTY_BUILD_FTXUI": "OFF",
"ECAL_THIRDPARTY_BUILD_SPDLOG": "OFF",
"ECAL_THIRDPARTY_BUILD_TERMCOLOR": "OFF",
"ECAL_THIRDPARTY_BUILD_TINYXML2": "OFF",
"ECAL_THIRDPARTY_BUILD_YAML-CPP": "ON",
"ECAL_THIRDPARTY_BUILD_CURL": "OFF",
"ECAL_THIRDPARTY_BUILD_HDF5": "OFF"
}
Expand Down Expand Up @@ -98,7 +98,6 @@
"ECAL_THIRDPARTY_BUILD_SPDLOG": "ON",
"ECAL_THIRDPARTY_BUILD_TERMCOLOR": "ON",
"ECAL_THIRDPARTY_BUILD_TINYXML2": "ON",
"ECAL_THIRDPARTY_BUILD_YAML-CPP": "ON",
"ECAL_THIRDPARTY_BUILD_CURL": null,
"ECAL_THIRDPARTY_BUILD_HDF5": null
}
Expand Down
2 changes: 0 additions & 2 deletions build_win/win_make_cmake.bat
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ set CMAKE_OPTIONS_COMPLETE=-DCMAKE_INSTALL_PREFIX=_install ^
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON ^
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON ^
-DECAL_THIRDPARTY_BUILD_QWT=ON ^
-DECAL_THIRDPARTY_BUILD_YAML-CPP=ON ^
-DECAL_THIRDPARTY_BUILD_UDPCAP=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DCMAKE_BUILD_TYPE=Release ^
Expand Down Expand Up @@ -66,7 +65,6 @@ set CMAKE_OPTIONS_SDK=-DCMAKE_INSTALL_PREFIX=_install ^
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON ^
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON ^
-DECAL_THIRDPARTY_BUILD_QWT=OFF ^
-DECAL_THIRDPARTY_BUILD_YAML-CPP=ON ^
-DECAL_THIRDPARTY_BUILD_UDPCAP=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DCMAKE_BUILD_TYPE=Debug ^
Expand Down
3 changes: 3 additions & 0 deletions ecal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ endif()
# core config
# --------------------------------------------------------
add_subdirectory(core/cfg)
if(NOT CMAKE_CROSSCOMPILING)
add_subdirectory(core/cfg/gen)
endif()

# --------------------------------------------------------
# services
Expand Down
17 changes: 11 additions & 6 deletions ecal/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,18 @@ endif()
# config
######################################
set(ecal_config_src
src/config/configuration_reader.cpp
src/config/configuration_to_yaml.cpp
src/config/default_configuration.cpp
src/config/ecal_cmd_parser.cpp
src/config/ecal_config.cpp
src/config/ecal_config_initializer.cpp
src/types/ecal_custom_data_types.cpp
src/pubsub/ecal_publisher_config.cpp
src/pubsub/ecal_subscriber_config.cpp
src/types/ecal_custom_data_types.cpp
)

if (ECAL_CORE_CONFIGURATION)
list(APPEND ecal_config_src
src/config/configuration_to_yaml.cpp
src/config/configuration_reader.cpp
)
endif()
######################################
# io/mtx
######################################
Expand Down Expand Up @@ -566,6 +567,10 @@ ecal_add_ecal_shared_library(${PROJECT_NAME}
${CMAKE_CURRENT_BINARY_DIR}/include/ecal/ecal_defs.h
)

if (ECAL_CORE_CONFIGURATION)
target_compile_definitions(${PROJECT_NAME} PRIVATE ECAL_CORE_CONFIGURATION)
endif()

if(UNIX)
set_source_files_properties(src/util/convert_utf.cpp PROPERTIES COMPILE_FLAGS -Wno-implicit-fallthrough)
endif()
Expand Down
16 changes: 1 addition & 15 deletions ecal/core/cfg/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ========================= eCAL LICENSE =================================
#
# Copyright (C) 2016 - 2019 Continental Corporation
# Copyright (C) 2016 - 2024 Continental Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,6 @@
#
# ========================= eCAL LICENSE =================================

set(ECAL_YAML "ecal.yaml")
set(ECALTIME_INI "ecaltime.ini")

# Merge all ecaltime config files
Expand All @@ -27,8 +26,6 @@ foreach(ECALTIME_CONFIG ${ECALTIME_CONFIG_FILES})
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${ECALTIME_INI} "${CONTENTS}")
endforeach()



# Select the correct ecal config directory on Linux and Windows
if(UNIX)
set(ECAL_SHARED_CONFIG ${eCAL_install_config_dir})
Expand All @@ -38,20 +35,9 @@ else()
message(STATUS "Unsupported OS, not installing configs")
endif()

configure_file(
${ECAL_YAML}
${ECAL_YAML}
)

# Install the configs
if(ECAL_SHARED_CONFIG AND NOT CMAKE_CROSSCOMPILING)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${ECAL_YAML}
DESTINATION
${ECAL_SHARED_CONFIG}
COMPONENT configuration
)
if(BUILD_TIME)
install(
FILES
Expand Down
Loading

0 comments on commit a5d9eb4

Please sign in to comment.