Skip to content

Commit

Permalink
Removed ecaltime.ini creation, added ecaltime.yaml creation, adapted …
Browse files Browse the repository at this point in the history
…innosetup, renamed application, make it installable
  • Loading branch information
Peguen committed Jan 30, 2025
1 parent 55da7f3 commit 40547e9
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 108 deletions.
6 changes: 3 additions & 3 deletions cpack/innosetup/ecal_setup.iss.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; ========================= eCAL LICENSE =================================
;
; Copyright (C) 2016 - 2024 Continental Corporation
; Copyright (C) 2016 - 2025 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 Down Expand Up @@ -78,12 +78,12 @@ Source: "{#ComponentStagingDir}\libraries\bin\*"; DestDir: "{app}\bin\"; Fla
; we need to change the location of these configuration file (as hotfix we use skipifsourcedoesntexist flag)
Source: "{#ComponentStagingDir}\configuration\cfg\ecal.yaml"; DestDir: "{commonappdata}\eCAL\"; Tasks: not replaceconf; Flags: ignoreversion skipifsourcedoesntexist confirmoverwrite; Components: runtime
Source: "{#ComponentStagingDir}\configuration\cfg\ecal.yaml"; DestDir: "{commonappdata}\eCAL\"; Tasks: replaceconf; Flags: ignoreversion skipifsourcedoesntexist; Components: runtime
Source: "{#ComponentStagingDir}\configuration\cfg\ecaltime.ini"; DestDir: "{commonappdata}\eCAL\"; Flags: ignoreversion skipifsourcedoesntexist; Components: runtime
Source: "{#ComponentStagingDir}\configuration\cfg\ecaltime.yaml"; DestDir: "{commonappdata}\eCAL\"; Flags: ignoreversion skipifsourcedoesntexist; Components: runtime

; we need to change the location of these configuration file (as hotfix we use skipifsourcedoesntexist flag)
Source: "{#ComponentStagingDir}\_configuration\cfg\ecal.yaml"; DestDir: "{commonappdata}\eCAL\"; Tasks: not replaceconf; Flags: ignoreversion skipifsourcedoesntexist confirmoverwrite; Components: runtime
Source: "{#ComponentStagingDir}\_configuration\cfg\ecal.yaml"; DestDir: "{commonappdata}\eCAL\"; Tasks: replaceconf; Flags: ignoreversion skipifsourcedoesntexist; Components: runtime
Source: "{#ComponentStagingDir}\_configuration\cfg\ecaltime.ini"; DestDir: "{commonappdata}\eCAL\"; Flags: ignoreversion skipifsourcedoesntexist; Components: runtime
Source: "{#ComponentStagingDir}\_configuration\cfg\ecaltime.yaml"; DestDir: "{commonappdata}\eCAL\"; Flags: ignoreversion skipifsourcedoesntexist; Components: runtime

; applications
Source: "{#ComponentStagingDir}\app\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: applications
Expand Down
3 changes: 1 addition & 2 deletions ecal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ endif()
# --------------------------------------------------------
# core config
# --------------------------------------------------------
add_subdirectory(core/cfg)
if(NOT CMAKE_CROSSCOMPILING)
add_subdirectory(core/cfg/gen)
add_subdirectory(core/cfg)
endif()

# --------------------------------------------------------
Expand Down
78 changes: 57 additions & 21 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 - 2024 Continental Corporation
# Copyright (C) 2016 - 2025 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,15 +16,52 @@
#
# ========================= eCAL LICENSE =================================

set(ECALTIME_INI "ecaltime.ini")
project(ecal_generate_config)

# Merge all ecaltime config files
# -> The ecaltime.ini will only contain valid settings for the time modules that were actually compiled.
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${ECALTIME_INI} "")
foreach(ECALTIME_CONFIG ${ECALTIME_CONFIG_FILES})
file(READ ${ECALTIME_CONFIG} CONTENTS)
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${ECALTIME_INI} "${CONTENTS}")
endforeach()
# Set the name of the YAML file to be generated
set(ECAL_YAML "ecal.yaml")
set(TIME_YAML "ecaltime.yaml")

add_executable(${PROJECT_NAME}
${ECAL_CORE_PROJECT_ROOT}/core/cfg/generate_configuration_yaml.cpp
${ECAL_CORE_PROJECT_ROOT}/core/src/config/configuration_writer.cpp
${ECAL_CORE_PROJECT_ROOT}/core/src/config/default_configuration.cpp
${ECAL_CORE_PROJECT_ROOT}/core/src/config/ecal_path_processing.cpp
)

# Set the output paths for the generated YAML files
set(YAML_PATHS
${CMAKE_CURRENT_BINARY_DIR}/${ECAL_YAML}
${CMAKE_CURRENT_BINARY_DIR}/${TIME_YAML}
)

# Add a custom command to generate the YAML file
add_custom_command(
OUTPUT ${YAML_PATHS} # Specify the output file
COMMAND $<TARGET_FILE:${PROJECT_NAME}> --dump # Command to run the executable
DEPENDS ${PROJECT_NAME} # Ensure the executable is built before running the command
COMMENT "Generating ${YAML_PATHS}" # Comment to display during the build process
VERBATIM # Ensure command arguments are passed as-is
)

# Add a custom target that depends on the generated YAML file
add_custom_target(run_${PROJECT_NAME} ALL
DEPENDS ${YAML_PATHS} # Ensure the custom command is executed
)

# Ensure the executable is built before running the custom target
add_dependencies(run_${PROJECT_NAME} ${PROJECT_NAME})

# Specify include directories for the executable
target_include_directories(${PROJECT_NAME} PRIVATE
${ECAL_CORE_PROJECT_ROOT}/core/src
${ECAL_CORE_PROJECT_ROOT}/core/include
)

target_link_libraries(${PROJECT_NAME} PRIVATE
eCAL::core
eCAL::ecal-utils
)

# Select the correct ecal config directory on Linux and Windows
if(UNIX)
Expand All @@ -35,16 +72,15 @@ else()
message(STATUS "Unsupported OS, not installing configs")
endif()


# Install the configs
if(ECAL_SHARED_CONFIG AND NOT CMAKE_CROSSCOMPILING)
if(ECAL_BUILD_TIMEPLUGINS)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${ECALTIME_INI}
DESTINATION
${ECAL_SHARED_CONFIG}
COMPONENT configuration
)
endif()
# Install the generated YAML file if not cross-compiling
if(ECAL_SHARED_CONFIG)
install(
FILES
${YAML_PATHS} # Files to install
DESTINATION
${ECAL_SHARED_CONFIG} # Destination directory
COMPONENT configuration # Installation component
)
endif()

ecal_install_app(${PROJECT_NAME})
80 changes: 0 additions & 80 deletions ecal/core/cfg/gen/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int main(int argc, char* argv[]) {
exitWithMessage("Failed to write default configuration to file.", 1, false);
}

if (!eCAL::Config::dumpToFile(eCAL::Config::getTimeConfigAsYamlSS(), "time.yaml")) {
if (!eCAL::Config::dumpToFile(eCAL::Config::getTimeConfigAsYamlSS(), "ecaltime.yaml")) {
exitWithMessage("Failed to write time configuration to file.", 1, false);
}

Expand All @@ -94,7 +94,7 @@ int main(int argc, char* argv[]) {
if (!eCAL::Config::dumpDefaultConfig(created_path)) {
exitWithMessage("Failed to write default configuration to file.", 1);
}
if (!eCAL::Config::dumpToFile(eCAL::Config::getTimeConfigAsYamlSS(), created_path + "/time.yaml")) {
if (!eCAL::Config::dumpToFile(eCAL::Config::getTimeConfigAsYamlSS(), created_path + "/ecaltime.yaml")) {
exitWithMessage("Failed to write time configuration to file.", 1);
}

Expand Down

0 comments on commit 40547e9

Please sign in to comment.