From 40bcb16075ea3fb76417bde1ae39e9dd62dedb5e Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Mon, 31 Mar 2025 17:24:12 +0000 Subject: [PATCH 01/40] Fix cross build --- .ort.yml | 8 -------- NOTICE.md | 2 -- conanfile.py | 22 ++++++++++++---------- sdk/src/CMakeLists.txt | 1 - 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/.ort.yml b/.ort.yml index 4ef40b8e..b80e9169 100644 --- a/.ort.yml +++ b/.ort.yml @@ -22,18 +22,10 @@ curations: curations: comment: "Proper license is defined in package repository https://conan.io/center/c-ares" concluded_license: "MIT" - - id: "Conan::cpr:1.9.3" - curations: - comment: "Proper license is defined in package repository https://conan.io/center/cpr" - concluded_license: "MIT" - id: "Conan::googleapis:cci.20221108" curations: comment: "Proper license is defined in package repository https://conan.io/center/googleapis?version=cci.20221108" concluded_license: "Apache-2.0" - - id: "Conan::libcurl:7.87.0" - curations: - comment: "Proper license is defined in package repository https://conan.io/center/libcurl?version=7.87.0" - concluded_license: "curl" - id: "Conan::openssl:1.1.1t" curations: comment: "Proper license is defined in package repository https://conan.io/center/openssl?version=1.1.1t" diff --git a/NOTICE.md b/NOTICE.md index 8140fa35..29061ee9 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -54,11 +54,9 @@ they are given here (manually added) for time being: |abseil|20240116.2|Apache 2.0| |bzip2|1.0.8|bzip2-1.0.8| |c-ares|1.34.1|c-ares (MIT-style)| -|cpr|1.11.0|MIT| |fmt|11.0.2|MIT| |grpc|1.67.1|Apache 2.0| |libcap|2.69|BSD-3-Clause, GPL-2.0-only| -|libcurl|8.10.1|CURL| |libmount|2.39.2|LGPL-2.1-or-later| |libselinux|3.6|libselinux-1.0, LGPL-2.1-or-later| |libsystemd|255.10|LGPL-2.1-or-later| diff --git a/conanfile.py b/conanfile.py index d2d8a257..2609e8f5 100644 --- a/conanfile.py +++ b/conanfile.py @@ -30,18 +30,17 @@ class VehicleAppCppSdkConan(ConanFile): # Workaround1: Pin recipe revision for transient dependency googleapis for enabling the container build # Workaround2: Pin recipe revision for transient dependency paho-mqtt-c cause latest is pulling libanl which cannot be found requires = [ - ("c-ares/1.19.1@#420a0b77e370f4b96bee88ef91837ccc"), - ("cpr/1.10.5"), + #("c-ares/1.19.1@#420a0b77e370f4b96bee88ef91837ccc"), ("fmt/9.1.0"), - ("googleapis/cci.20221108@#e4bebdfa02f3b6f93bae1d5001b8d439"), - ("grpc/1.50.1@#df352027120f88bccf24cbc40a2297ce"), - ("grpc-proto/cci.20220627@#3ad14e3ffdae516b4da2407d5f23c71d"), - ("libcurl/8.1.2@#c0f40219a032539a06b5b1fdb7a5745e"), + #("googleapis/cci.20221108@#e4bebdfa02f3b6f93bae1d5001b8d439"), + ("grpc/1.50.1"), + #("grpc/1.50.1@#df352027120f88bccf24cbc40a2297ce"), + #("grpc-proto/cci.20220627@#3ad14e3ffdae516b4da2407d5f23c71d"), ("nlohmann_json/3.11.2"), - ("openssl/1.1.1u@#de76bbea24d8b46f8def8daa18b31fd9"), + #("openssl/1.1.1u@#de76bbea24d8b46f8def8daa18b31fd9"), ("paho-mqtt-c/1.3.13"), ("paho-mqtt-cpp/1.4.0"), - ("zlib/1.3") + #("zlib/1.3.1", "override") ] generators = "cmake" author = "Robert Bosch GmbH" @@ -54,7 +53,7 @@ class VehicleAppCppSdkConan(ConanFile): exports = "version.txt" # Sources are located in the same place as this recipe, copy them to the recipe - exports_sources = ".scripts/common.sh", "build.sh", "install_dependencies.sh", "CMakeLists.txt", "sdk/*", "examples/*", "conanfile.py", ".conan/profiles/*", "version.txt" + exports_sources = ".scripts/common.sh", "build.sh", "install_dependencies.sh", "CMakeLists.txt", "sdk/*", "examples/*", "conanfile.py", ".conan/profiles/*", "cmake/*", "version.txt" def set_version(self): try: @@ -95,8 +94,11 @@ def build(self): build_type = self.settings.get_safe( "build_type", default="Release").lower() option = "-r" if build_type == "release" else "-d" + arch = str(self.settings.arch).lower() + if arch == "armv8": + arch = "aarch64" subprocess.call( - f"cd ../.. && ./install_dependencies.sh && ./build.sh {option} --no-examples --no-tests", shell=True) + f"cd ../.. && ./install_dependencies.sh -x {arch} && ./build.sh {option} -x {arch} --no-examples --no-tests", shell=True) def package(self): self.copy("*.h", src="../sdk/include", dst="include", keep_path=True) diff --git a/sdk/src/CMakeLists.txt b/sdk/src/CMakeLists.txt index 4993e158..e9253272 100644 --- a/sdk/src/CMakeLists.txt +++ b/sdk/src/CMakeLists.txt @@ -58,7 +58,6 @@ add_dependencies(${TARGET_NAME} target_link_libraries(${TARGET_NAME} CONAN_PKG::grpc - CONAN_PKG::cpr CONAN_PKG::fmt CONAN_PKG::paho-mqtt-cpp CONAN_PKG::nlohmann_json From 1ca18d78f0231b2333e175e655055224b90a3b77 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Mon, 31 Mar 2025 17:30:59 +0000 Subject: [PATCH 02/40] Update license file --- NOTICE-3RD-PARTY-CONTENT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NOTICE-3RD-PARTY-CONTENT.md b/NOTICE-3RD-PARTY-CONTENT.md index 437d907c..8f517f78 100644 --- a/NOTICE-3RD-PARTY-CONTENT.md +++ b/NOTICE-3RD-PARTY-CONTENT.md @@ -34,7 +34,7 @@ |six|1.16.0|MIT| |tqdm|4.67.1|MIT
Mozilla Public License 2.0 (MPL 2.0)| |urllib3|1.26.20|MIT| -|virtualenv|20.29.3|MIT| +|virtualenv|20.30.0|MIT| ## Workflows | Dependency | Version | License | |:-----------|:-------:|--------:| From e1ac6237a505d592ff17c38ac113f78373eb11e0 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Tue, 25 Feb 2025 10:07:02 +0000 Subject: [PATCH 03/40] wip --- .scripts/conanfile-merger.py | 126 --------------- CMakeLists.txt | 10 -- build.sh | 18 +-- conanfile.py | 11 +- examples/CMakeLists.txt | 9 +- examples/performance-subscribe/CMakeLists.txt | 5 - install_dependencies.sh | 16 +- sdk/CMakeLists.txt | 2 +- sdk/proto/CMakeLists.txt | 143 ++++++++++-------- sdk/proto/kuksa/val/v2/types.proto | 1 + sdk/src/CMakeLists.txt | 25 ++- sdk/tests/unit/CMakeLists.txt | 13 +- 12 files changed, 140 insertions(+), 239 deletions(-) delete mode 100644 .scripts/conanfile-merger.py diff --git a/.scripts/conanfile-merger.py b/.scripts/conanfile-merger.py deleted file mode 100644 index 32bf2d83..00000000 --- a/.scripts/conanfile-merger.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2023-2025 Contributors to the Eclipse Foundation -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0. -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -import importlib.util -import sys -import re -import argparse -import inspect - -def read_conanfile_txt(path: str) -> dict: - file_dict = dict() - current_key = None - - prog = re.compile(r"\[(\w+)\]") - - with open(path, "r") as conanfile: - for line in conanfile: - line = line.strip() - - match = prog.match(line) - - if match: - current_key = match.group(1) - file_dict[current_key] = list() - elif len(line) > 0: - file_dict[current_key].append(line) - - return file_dict - - -def load_module_at(path: str, custom_module_name: str): - spec = importlib.util.spec_from_file_location(custom_module_name, path) - module = importlib.util.module_from_spec(spec) - sys.modules[custom_module_name] = module - spec.loader.exec_module(module) - return module - - -def read_conanfile_py(path: str) -> dict: - dependencies = dict() - - prog = re.compile(r"self.options\[\"(\w+)\"\].(\w+)\s*=\s*(\w+)") - custom_module_name = "conanfile" - for name, obj in inspect.getmembers(load_module_at(path, custom_module_name), inspect.isclass): - if obj.__module__ == custom_module_name: - for name2, obj2 in inspect.getmembers(obj): - if name2 == "requires": - dependencies["requires"] = list(obj2) - if name2 == "configure": - dependencies["options"] = list() - for line in inspect.getsourcelines(obj2)[0]: - line = line.strip() - - m = prog.match(line) - - if m: - dependency = m.group(1) - key = m.group(2) - value = m.group(3) - dependencies["options"].append(f"{dependency}:{key}={value}") - - return dependencies - - -def read_conanfile(path: str) -> dict: - conanfile = None - if path.endswith(".txt"): - conanfile = read_conanfile_txt(path) - elif path.endswith(".py"): - conanfile = read_conanfile_py(path) - else: - raise "Invalid file extension for conanfile!" - - return conanfile - - -def merge_dicts(a: dict, b: dict) -> dict: - joined_keys = list(set(list(a.keys()) + list(b.keys()))) - - joined_dict = dict() - - for key in joined_keys: - joined_dict[key] = set() - - if key in a: - for item in a[key]: - joined_dict[key].add(item) - - if key in b: - for item in b[key]: - joined_dict[key].add(item) - - return joined_dict - - -def write_conan_dict(path: str, dict: dict[str, list[str]]): - with open(path, "w") as file: - for key, items in dict.items(): - file.write(f"[{key}]\n") - for item in items: - file.write(f"{item}\n") - file.write("\n") - - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description='Merge 2 conan files into one.') - parser.add_argument('file1', type=str, help='The first file.') - parser.add_argument('file2', type=str, help='The second file.') - parser.add_argument('--output', type=str, required=True, help='Path to the output file') - args = parser.parse_args() - - conanfile1 = read_conanfile(args.file1) - conanfile2 = read_conanfile(args.file2) - conanfile_joined = merge_dicts(conanfile1, conanfile2) - write_conan_dict(args.output, conanfile_joined) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2f64d07..afc38942 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,16 +45,6 @@ if(SDK_STANDALONE) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) endif() - # use conan for dependency management - set(CONAN_BUILD_INFO_FILE ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - - if(NOT EXISTS ${CONAN_BUILD_INFO_FILE}) - message(FATAL_ERROR "Conan build info file missing. Did you run install_dependencies.sh first?") - return() - else() - include(${CONAN_BUILD_INFO_FILE}) - conan_basic_setup(TARGETS) - endif() endif(SDK_STANDALONE) if(SDK_BUILD_TESTS) diff --git a/build.sh b/build.sh index 674b7197..02c3d5f8 100755 --- a/build.sh +++ b/build.sh @@ -127,13 +127,13 @@ mkdir -p build && cd build # any of Conan's CMake generators at the moment, hence we parse the conanbuildinfo.txt which # is generated and holds these paths. This allows us to always use the protoc and grpc cpp plugin # of the build system. -BUILD_TOOLS_PATH="" -CONAN_BUILD_TOOLS_PATHS=$(sed '/^PATH=/!d;s/PATH=//g;s/,/\n/g' ./conanbuildinfo.txt | tr -d '[]'\" ) -while read -r p; do - if [[ ! -z "${p// }" ]]; then - BUILD_TOOLS_PATH="$BUILD_TOOLS_PATH;$p" - fi -done < <(echo "$CONAN_BUILD_TOOLS_PATHS") +# BUILD_TOOLS_PATH="" +# CONAN_BUILD_TOOLS_PATHS=$(sed '/^PATH=/!d;s/PATH=//g;s/,/\n/g' ./conanbuildinfo.txt | tr -d '[]'\" ) +# while read -r p; do +# if [[ ! -z "${p// }" ]]; then +# BUILD_TOOLS_PATH="$BUILD_TOOLS_PATH;$p" +# fi +# done < <(echo "$CONAN_BUILD_TOOLS_PATHS") XCOMPILE_TOOLCHAIN_FILE="" if [[ "${BUILD_ARCH}" != "${HOST_ARCH}" ]]; then @@ -152,7 +152,7 @@ cmake --no-warn-unused-cli \ -B../build \ -G Ninja \ -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \ - -DBUILD_TOOLS_PATH:STRING="${BUILD_TOOLS_PATH}" \ + -DCMAKE_TOOLCHAIN_FILE=Release/generators/conan_toolchain.cmake \ ${XCOMPILE_TOOLCHAIN_FILE} .. -cmake --build . --config ${BUILD_VARIANT} --target ${BUILD_TARGET} -- +cmake --build . -v --config ${BUILD_VARIANT} --target ${BUILD_TARGET} cd .. diff --git a/conanfile.py b/conanfile.py index 2609e8f5..50213f9f 100644 --- a/conanfile.py +++ b/conanfile.py @@ -16,8 +16,9 @@ import re import subprocess -from conan.tools.cmake import cmake_layout -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.cmake import CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Git @@ -42,7 +43,7 @@ class VehicleAppCppSdkConan(ConanFile): ("paho-mqtt-cpp/1.4.0"), #("zlib/1.3.1", "override") ] - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain" author = "Robert Bosch GmbH" # Binary configuration @@ -57,7 +58,7 @@ class VehicleAppCppSdkConan(ConanFile): def set_version(self): try: - git = tools.Git(folder=".") + git = Git(folder=".") tag = git.get_tag() if tag is not None: version_tag_pattern = re.compile(r"^v[0-9]+(\.[0-9]+){0,2}") @@ -102,7 +103,7 @@ def build(self): def package(self): self.copy("*.h", src="../sdk/include", dst="include", keep_path=True) - self.copy("*.h", src="../build/gens", dst="include", keep_path=True) + self.copy("*.h", src="../build/sdk/proto", dst="include", keep_path=True) self.copy("*.a", src="../build/lib", dst="lib", keep_path=False) def package_info(self): diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index caf9a96d..6d8ed44a 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -12,7 +12,14 @@ # # SPDX-License-Identifier: Apache-2.0 -include_directories(example_model) +find_package(fmt CONFIG REQUIRED) +find_package(nlohmann_json CONFIG REQUIRED) + +include_directories( + ${fmt_INCLUDE_DIR} + ${nlohmann_json_INCLUDE_DIR} + example_model +) # Currently only adding examples that can be tested without additional velocitas code generation diff --git a/examples/performance-subscribe/CMakeLists.txt b/examples/performance-subscribe/CMakeLists.txt index 7d8e26b6..7fecac1b 100644 --- a/examples/performance-subscribe/CMakeLists.txt +++ b/examples/performance-subscribe/CMakeLists.txt @@ -20,14 +20,9 @@ add_executable(${TARGET_NAME} ) include_directories( - ${CMAKE_BINARY_DIR}/gens ${CMAKE_CURRENT_SOURCE_DIR}/src ) -add_dependencies(${TARGET_NAME} - vehicle-app-sdk -) - target_link_libraries(${TARGET_NAME} vehicle-app-sdk ) diff --git a/install_dependencies.sh b/install_dependencies.sh index e2aa945f..156566d3 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -92,7 +92,8 @@ echo "Building deps ${WHICH_DEPS_TO_BUILD}" mkdir -p build -XCOMPILE_PROFILE="" +HOST_PROFILE=".conan/profiles/linux_${HOST_ARCH}_${BUILD_VARIANT}" +BUILD_PROFILE=${HOST_PROFILE} if [[ "${BUILD_ARCH}" != "${HOST_ARCH}" ]]; then echo "Setting up cross compilation toolchain..." @@ -107,15 +108,12 @@ if [[ "${BUILD_ARCH}" != "${HOST_ARCH}" ]]; then export CC=$target_host-$cc_compiler export CXX=$target_host-$cxx_compiler - XCOMPILE_PROFILE="-pr:b .conan/profiles/linux_${BUILD_ARCH}_${BUILD_VARIANT}" + BUILD_PROFILE=".conan/profiles/linux_${BUILD_ARCH}_${BUILD_VARIANT}" fi -# Enable Conan revision handling to enable pinning googleapis recipe revision (see conanfile.py) -export CONAN_REVISIONS_ENABLED=1 - conan install \ - -pr:h .conan/profiles/linux_${HOST_ARCH}_${BUILD_VARIANT} \ - ${XCOMPILE_PROFILE} \ + -pr:h ${HOST_PROFILE} \ + -pr:b ${BUILD_PROFILE} \ --build "${WHICH_DEPS_TO_BUILD}" \ - -of ./build \ - -if ./build . + -of . \ + . diff --git a/sdk/CMakeLists.txt b/sdk/CMakeLists.txt index 9e1a4a40..8e1ce18c 100644 --- a/sdk/CMakeLists.txt +++ b/sdk/CMakeLists.txt @@ -17,4 +17,4 @@ add_subdirectory(src) if(SDK_BUILD_TESTS) add_subdirectory(tests) -endif(SDK_BUILD_TESTS) \ No newline at end of file +endif(SDK_BUILD_TESTS) diff --git a/sdk/proto/CMakeLists.txt b/sdk/proto/CMakeLists.txt index 186dc65e..898b3d91 100644 --- a/sdk/proto/CMakeLists.txt +++ b/sdk/proto/CMakeLists.txt @@ -12,82 +12,101 @@ # # SPDX-License-Identifier: Apache-2.0 -file(GLOB_RECURSE PROTO_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.proto) +# file(GLOB_RECURSE PROTO_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.proto) -find_program(_gRPC_PROTOBUF_PROTOC_EXECUTABLE protoc REQUIRED - PATHS ${BUILD_TOOLS_PATH} - NO_DEFAULT_PATH) -find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin REQUIRED - PATHS ${BUILD_TOOLS_PATH} - NO_DEFAULT_PATH) +# find_program(_gRPC_PROTOBUF_PROTOC_EXECUTABLE protoc REQUIRED +# PATHS ${BUILD_TOOLS_PATH} +# NO_DEFAULT_PATH) +# find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin REQUIRED +# PATHS ${BUILD_TOOLS_PATH} +# NO_DEFAULT_PATH) -set(_gRPC_PROTO_GENS_DIR ${CMAKE_BINARY_DIR}/gens) -set(_gRPC_PROTO_SRCS_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR}) +# set(_gRPC_PROTO_GENS_DIR ${CMAKE_BINARY_DIR}/gens) +# set(_gRPC_PROTO_SRCS_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +# file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR}) -set(PROTO_SRCS "" CACHE INTERNAL "") -set(PROTO_HDRS "" CACHE INTERNAL "") +# set(PROTO_SRCS "" CACHE INTERNAL "") +# set(PROTO_HDRS "" CACHE INTERNAL "") -foreach(FILE ${PROTO_FILES}) - get_filename_component(ABS_FIL ${FILE} ABSOLUTE) - get_filename_component(FIL_WE ${FILE} NAME_WE) - get_filename_component(REL_DIR ${FILE} DIRECTORY) - set(RELFIL_WE ${REL_DIR}/${FIL_WE}) +# foreach(FILE ${PROTO_FILES}) +# get_filename_component(ABS_FIL ${FILE} ABSOLUTE) +# get_filename_component(FIL_WE ${FILE} NAME_WE) +# get_filename_component(REL_DIR ${FILE} DIRECTORY) +# set(RELFIL_WE ${REL_DIR}/${FIL_WE}) - set(OUTPUT_FILE_PATH_GRPC_SRC "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc") - set(OUTPUT_FILE_PATH_GRPC_HDR "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h") - set(OUTPUT_FILE_PATH_PB_SRC "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc") - set(OUTPUT_FILE_PATH_PB_HDR "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h") - set(OUTPUT_FILE_PATH_GRPC_MOCK_HDR "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}_mock.grpc.pb.h") - set(OUTPUT_FILES - ${OUTPUT_FILE_PATH_GRPC_SRC} - ${OUTPUT_FILE_PATH_GRPC_HDR} - ${OUTPUT_FILE_PATH_PB_SRC} - ${OUTPUT_FILE_PATH_PB_HDR} - ${OUTPUT_FILE_PATH_GRPC_MOCK_HDR} - ) +# set(OUTPUT_FILE_PATH_GRPC_SRC "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc") +# set(OUTPUT_FILE_PATH_GRPC_HDR "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h") +# set(OUTPUT_FILE_PATH_PB_SRC "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc") +# set(OUTPUT_FILE_PATH_PB_HDR "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h") +# set(OUTPUT_FILE_PATH_GRPC_MOCK_HDR "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}_mock.grpc.pb.h") +# set(OUTPUT_FILES +# ${OUTPUT_FILE_PATH_GRPC_SRC} +# ${OUTPUT_FILE_PATH_GRPC_HDR} +# ${OUTPUT_FILE_PATH_PB_SRC} +# ${OUTPUT_FILE_PATH_PB_HDR} +# ${OUTPUT_FILE_PATH_GRPC_MOCK_HDR} +# ) - set(GENERATE_GRPC_SOURCES FALSE) +# set(GENERATE_GRPC_SOURCES FALSE) - foreach(OUTPUT_FILE ${OUTPUT_FILES}) - if(NOT EXISTS ${OUTPUT_FILE}) - set(GENERATE_GRPC_SOURCES TRUE) - message("File does not exist: " ${OUTPUT_FILE} " - generating ...") - else() - # message("File already exists: " ${OUTPUT_FILE}) - endif() - endforeach() +# foreach(OUTPUT_FILE ${OUTPUT_FILES}) +# if(NOT EXISTS ${OUTPUT_FILE}) +# set(GENERATE_GRPC_SOURCES TRUE) +# message("File does not exist: " ${OUTPUT_FILE} " - generating ...") +# else() +# # message("File already exists: " ${OUTPUT_FILE}) +# endif() +# endforeach() - if(${GENERATE_GRPC_SOURCES}) - add_custom_command( - OUTPUT ${OUTPUT_FILES} - COMMAND ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE} - ARGS --grpc_out=generate_mock_code=true:${_gRPC_PROTO_GENS_DIR} - --cpp_out ${_gRPC_PROTO_GENS_DIR} - -I "./" - --plugin=protoc-gen-grpc=${_GRPC_CPP_PLUGIN_EXECUTABLE} - "${FILE}" - WORKING_DIRECTORY ${_gRPC_PROTO_SRCS_DIR} - COMMENT "Running gRPC C++ protocol buffer compiler for ${FILE}" - VERBATIM) - else() - message("Skipping generation of " ${FILE}) - endif() +# if(${GENERATE_GRPC_SOURCES}) +# add_custom_command( +# OUTPUT ${OUTPUT_FILES} +# COMMAND ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE} +# ARGS --grpc_out=generate_mock_code=true:${_gRPC_PROTO_GENS_DIR} +# --cpp_out ${_gRPC_PROTO_GENS_DIR} +# -I "./" +# --plugin=protoc-gen-grpc=${_GRPC_CPP_PLUGIN_EXECUTABLE} +# "${FILE}" +# WORKING_DIRECTORY ${_gRPC_PROTO_SRCS_DIR} +# COMMENT "Running gRPC C++ protocol buffer compiler for ${FILE}" +# VERBATIM) +# else() +# message("Skipping generation of " ${FILE}) +# endif() - list(APPEND PROTO_SRCS ${OUTPUT_FILE_PATH_GRPC_SRC}) - list(APPEND PROTO_SRCS ${OUTPUT_FILE_PATH_PB_SRC}) - list(APPEND PROTO_HDRS ${OUTPUT_FILE_PATH_GRPC_HDR}) - list(APPEND PROTO_HDRS ${OUTPUT_FILE_PATH_PB_HDR}) -endforeach() +# list(APPEND PROTO_SRCS ${OUTPUT_FILE_PATH_GRPC_SRC}) +# list(APPEND PROTO_SRCS ${OUTPUT_FILE_PATH_PB_SRC}) +# list(APPEND PROTO_HDRS ${OUTPUT_FILE_PATH_GRPC_HDR}) +# list(APPEND PROTO_HDRS ${OUTPUT_FILE_PATH_PB_HDR}) +# endforeach() -include_directories(${CMAKE_BINARY_DIR}/gens) +find_package(gRPC CONFIG REQUIRED) +find_package(Protobuf REQUIRED) set(TARGET_NAME "vehicle-app-sdk-generated-grpc") -add_library(${TARGET_NAME} STATIC - ${PROTO_SRCS} +include_directories( + ${absl_INCLUDE_DIR} + ${protobuf_INCLUDE_DIR} + ${gRPC_INCLUDE_DIR} ) +add_library(${TARGET_NAME} STATIC + kuksa/val/v2/types.proto + kuksa/val/v2/val.proto + sdv/databroker/v1/types.proto + sdv/databroker/v1/collector.proto + sdv/databroker/v1/broker.proto +) target_link_libraries(${TARGET_NAME} - CONAN_PKG::grpc + gRPC::grpc++ ) +protobuf_generate(TARGET ${TARGET_NAME}) +protobuf_generate( + TARGET ${TARGET_NAME} + LANGUAGE grpc + PLUGIN protoc-gen-grpc=$ + PLUGIN_OPTIONS generate_mock_code=true + GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc) + +target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/sdk/proto/kuksa/val/v2/types.proto b/sdk/proto/kuksa/val/v2/types.proto index 8955f6de..38cb1268 100644 --- a/sdk/proto/kuksa/val/v2/types.proto +++ b/sdk/proto/kuksa/val/v2/types.proto @@ -14,6 +14,7 @@ syntax = "proto3"; // Please do not add optional fields due to older proto3 versions limitations + package kuksa.val.v2; import "google/protobuf/timestamp.proto"; diff --git a/sdk/src/CMakeLists.txt b/sdk/src/CMakeLists.txt index e9253272..9a675c97 100644 --- a/sdk/src/CMakeLists.txt +++ b/sdk/src/CMakeLists.txt @@ -14,6 +14,14 @@ set(TARGET_NAME "vehicle-app-sdk") +find_package(fmt REQUIRED) +find_package(gRPC REQUIRED) +find_package(nlohmann_json REQUIRED) +find_package(PahoMqttCpp REQUIRED) +find_package(eclipse-paho-mqtt-c REQUIRED) +find_package(protobuf REQUIRED) +find_package(absl REQUIRED) + add_library(${TARGET_NAME} sdk/VehicleApp.cpp sdk/Model.cpp @@ -47,8 +55,13 @@ add_library(${TARGET_NAME} ) include_directories( - ${CMAKE_BINARY_DIR}/gens - ../include + ${fmt_INCLUDE_DIR} + ${nlohmann_json_INCLUDE_DIR} + ${gRPC_INCLUDE_DIR} + ${absl_INCLUDE_DIR} + ${protobuf_INCLUDE_DIR} + ${PahoMqttCpp_INCLUDE_DIR} + ${eclipse-paho-mqtt-c_INCLUDE_DIR} . ) @@ -57,9 +70,9 @@ add_dependencies(${TARGET_NAME} ) target_link_libraries(${TARGET_NAME} - CONAN_PKG::grpc - CONAN_PKG::fmt - CONAN_PKG::paho-mqtt-cpp - CONAN_PKG::nlohmann_json + gRPC::grpc++ + fmt::fmt + PahoMqttCpp::paho-mqttpp3-static + nlohmann_json::nlohmann_json vehicle-app-sdk-generated-grpc ) diff --git a/sdk/tests/unit/CMakeLists.txt b/sdk/tests/unit/CMakeLists.txt index d0649a55..a4fadb6d 100644 --- a/sdk/tests/unit/CMakeLists.txt +++ b/sdk/tests/unit/CMakeLists.txt @@ -14,6 +14,10 @@ set(TARGET_NAME "sdk_utests") +find_package(fmt CONFIG REQUIRED) +find_package(gRPC CONFIG REQUIRED) +find_package(protobuf CONFIG REQUIRED) + add_executable(${TARGET_NAME} testmain.cpp AsyncResult_tests.cpp @@ -37,10 +41,6 @@ add_executable(${TARGET_NAME} vdb/grpc/sdv_databroker_v1/BrokerClient_tests.cpp ) -add_dependencies(${TARGET_NAME} - vehicle-app-sdk -) - target_link_libraries(${TARGET_NAME} vehicle-app-sdk gmock @@ -49,9 +49,12 @@ target_link_libraries(${TARGET_NAME} include(GoogleTest) include_directories( + ${fmt_INCLUDE_DIR} + ${absl_INCLUDE_DIR} + ${protobuf_INCLUDE_DIR} + ${gRPC_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../mocks ${CMAKE_CURRENT_SOURCE_DIR}/../model - ${CMAKE_BINARY_DIR}/gens ${CMAKE_CURRENT_SOURCE_DIR}/../../src ) From 695544886856424e30fdf10d5422016680fe2afb Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Mon, 10 Mar 2025 10:04:08 +0100 Subject: [PATCH 04/40] wip --- .conan/profiles/linux_aarch64_release | 5 ++++ .gitignore | 2 +- CMakeLists.txt | 3 +++ CMakeUserPresets.json | 9 +++++++ build.sh | 9 +++---- conanfile.py | 34 ++++++++++++++++++++------- examples/CMakeLists.txt | 14 +++++++++-- examples/seat-adjuster/CMakeLists.txt | 10 ++++++++ install_dependencies.sh | 22 ++--------------- sdk/CMakeUserPresets.json | 10 ++++++++ 10 files changed, 82 insertions(+), 36 deletions(-) create mode 100644 CMakeUserPresets.json create mode 100644 sdk/CMakeUserPresets.json diff --git a/.conan/profiles/linux_aarch64_release b/.conan/profiles/linux_aarch64_release index 0cc37f38..b52ed273 100644 --- a/.conan/profiles/linux_aarch64_release +++ b/.conan/profiles/linux_aarch64_release @@ -5,3 +5,8 @@ compiler=gcc compiler.version=11 compiler.libcxx=libstdc++11 build_type=Release + +[buildenv] +CC=aarch64-linux-gnu-gcc-11 +CXX=aarch64-linux-gnu-g++-11 +LD=aarch64-linux-gnu-ld diff --git a/.gitignore b/.gitignore index d1afa674..a302539b 100644 --- a/.gitignore +++ b/.gitignore @@ -49,7 +49,7 @@ *.pyc # CMake -build +build* # Mac files .DS_Store diff --git a/CMakeLists.txt b/CMakeLists.txt index afc38942..97246070 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,9 @@ set(STATIC_BUILD OFF CACHE BOOL "Build all targets with external dependen set(CMAKE_CXX_STANDARD 17) +# find_package(fmt CONFIG REQUIRED) +# find_package(nlohmann_json CONFIG REQUIRED) + include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/sdk/include ) diff --git a/CMakeUserPresets.json b/CMakeUserPresets.json new file mode 100644 index 00000000..2445deb2 --- /dev/null +++ b/CMakeUserPresets.json @@ -0,0 +1,9 @@ +{ + "version": 4, + "vendor": { + "conan": {} + }, + "include": [ + "/workspaces/vehicle-app-cpp-sdk/build/Release/generators/CMakePresets.json" + ] +} \ No newline at end of file diff --git a/build.sh b/build.sh index 02c3d5f8..379ce0c4 100755 --- a/build.sh +++ b/build.sh @@ -37,7 +37,7 @@ Arguments: " } -BUILD_VARIANT=debug +BUILD_VARIANT=Debug BUILD_ARCH=$(arch) HOST_ARCH=${BUILD_ARCH} BUILD_TARGET=all @@ -51,11 +51,11 @@ POSITIONAL_ARGS=() while [[ $# -gt 0 ]]; do case $1 in -d|--debug) - BUILD_VARIANT="debug" + BUILD_VARIANT="Debug" shift ;; -r|--release) - BUILD_VARIANT="release" + BUILD_VARIANT="Release" shift ;; -t|--target) @@ -153,6 +153,7 @@ cmake --no-warn-unused-cli \ -G Ninja \ -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \ -DCMAKE_TOOLCHAIN_FILE=Release/generators/conan_toolchain.cmake \ - ${XCOMPILE_TOOLCHAIN_FILE} .. + .. + # ${XCOMPILE_TOOLCHAIN_FILE} .. cmake --build . -v --config ${BUILD_VARIANT} --target ${BUILD_TARGET} cd .. diff --git a/conanfile.py b/conanfile.py index 50213f9f..1395d0f1 100644 --- a/conanfile.py +++ b/conanfile.py @@ -17,6 +17,7 @@ import subprocess from conan import ConanFile +from conan.tools.build import cross_building from conan.tools.cmake import CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.scm import Git @@ -57,6 +58,7 @@ class VehicleAppCppSdkConan(ConanFile): exports_sources = ".scripts/common.sh", "build.sh", "install_dependencies.sh", "CMakeLists.txt", "sdk/*", "examples/*", "conanfile.py", ".conan/profiles/*", "cmake/*", "version.txt" def set_version(self): + print("########################## set_version ##########################") try: git = Git(folder=".") tag = git.get_tag() @@ -79,19 +81,28 @@ def set_version(self): def config_options(self): - if self.settings.os == "Linux": - del self.options.fPIC + print("########################## config_options ##########################") + if self.settings.get_safe("os") == "Windows": + self.options.rm_safe("fPIC") - def layout(self): - cmake_layout(self, src_folder="sdk") + def configure(self): + print("########################## configure ##########################") + if self.options.shared: + self.options.rm_safe("fPIC") def generate(self): - #tc = CMakeToolchain(self) - # tc.generate() - # commented out since we rely on our build script to set up cmake - pass + print("########################## generate ##########################") + + def layout(self): + print("########################## layout ##########################") + cmake_layout( + self, + src_folder="sdk", + build_folder="build" if not cross_building(self) else f"build_{self.settings.os}_{self.settings.arch}", + ) def build(self): + print("########################## build ##########################") build_type = self.settings.get_safe( "build_type", default="Release").lower() option = "-r" if build_type == "release" else "-d" @@ -102,11 +113,13 @@ def build(self): f"cd ../.. && ./install_dependencies.sh -x {arch} && ./build.sh {option} -x {arch} --no-examples --no-tests", shell=True) def package(self): + print("########################## package ##########################") self.copy("*.h", src="../sdk/include", dst="include", keep_path=True) self.copy("*.h", src="../build/sdk/proto", dst="include", keep_path=True) self.copy("*.a", src="../build/lib", dst="lib", keep_path=False) def package_info(self): + print("########################## package_info ##########################") self.cpp_info.includedirs = ["include"] self.cpp_info.libdirs = ["lib"] self.cpp_info.bindirs = ["bin"] @@ -114,9 +127,12 @@ def package_info(self): "vehicle-app-sdk-generated-grpc"] def imports(self): + print("########################## imports ##########################") self.copy("license*", src=".", dst="./licenses", folder=True, ignore_case=True) def build_requirements(self): + print("########################## build_requirements ##########################") # 'build' context (protoc.exe will be available) - self.tool_requires("grpc/1.50.1") + self.tool_requires("grpc/") + self.tool_requires("protobuf/") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 6d8ed44a..793d64f6 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -12,8 +12,8 @@ # # SPDX-License-Identifier: Apache-2.0 -find_package(fmt CONFIG REQUIRED) -find_package(nlohmann_json CONFIG REQUIRED) +#find_package(fmt CONFIG REQUIRED) +#find_package(nlohmann_json CONFIG REQUIRED) include_directories( ${fmt_INCLUDE_DIR} @@ -21,6 +21,16 @@ include_directories( example_model ) +get_cmake_property(_variableNames VARIABLES) +list (SORT _variableNames) +message(STATUS "------------------------------------------------------------------------------------------------------") +message(STATUS "${CMAKE_CURRENT_LIST_DIR}") +message(STATUS "------------------------------------------------------------------------------------------------------") +foreach (_variableName ${_variableNames}) + message(STATUS "${_variableName}=${${_variableName}}") +endforeach() +message(STATUS "------------------------------------------------------------------------------------------------------") + # Currently only adding examples that can be tested without additional velocitas code generation add_subdirectory(performance-subscribe) diff --git a/examples/seat-adjuster/CMakeLists.txt b/examples/seat-adjuster/CMakeLists.txt index 9737327d..2e16cec5 100644 --- a/examples/seat-adjuster/CMakeLists.txt +++ b/examples/seat-adjuster/CMakeLists.txt @@ -14,6 +14,16 @@ set(TARGET_NAME "example-seatadjusterapp") +get_cmake_property(_variableNames VARIABLES) +list (SORT _variableNames) +message(STATUS "------------------------------------------------------------------------------------------------------") +message(STATUS "${CMAKE_CURRENT_LIST_DIR}") +message(STATUS "------------------------------------------------------------------------------------------------------") +foreach (_variableName ${_variableNames}) + message(STATUS "${_variableName}=${${_variableName}}") +endforeach() +message(STATUS "------------------------------------------------------------------------------------------------------") + add_executable(${TARGET_NAME} src/SeatAdjusterApp.cpp ) diff --git a/install_dependencies.sh b/install_dependencies.sh index 156566d3..9c2ab613 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -90,30 +90,12 @@ echo "Build arch ${BUILD_ARCH}" echo "Host arch ${HOST_ARCH}" echo "Building deps ${WHICH_DEPS_TO_BUILD}" -mkdir -p build - HOST_PROFILE=".conan/profiles/linux_${HOST_ARCH}_${BUILD_VARIANT}" -BUILD_PROFILE=${HOST_PROFILE} - -if [[ "${BUILD_ARCH}" != "${HOST_ARCH}" ]]; then - echo "Setting up cross compilation toolchain..." - - toolchain=/usr/bin/${HOST_ARCH}-linux-gnu - target_host=${HOST_ARCH}-linux-gnu - cc_compiler=gcc - cxx_compiler=g++ - - export CONAN_CMAKE_FIND_ROOT_PATH=$toolchain - export CONAN_CMAKE_SYSROOT=$toolchain - export CC=$target_host-$cc_compiler - export CXX=$target_host-$cxx_compiler - - BUILD_PROFILE=".conan/profiles/linux_${BUILD_ARCH}_${BUILD_VARIANT}" -fi +BUILD_PROFILE=".conan/profiles/linux_${BUILD_ARCH}_${BUILD_VARIANT}" +mkdir -p build conan install \ -pr:h ${HOST_PROFILE} \ -pr:b ${BUILD_PROFILE} \ --build "${WHICH_DEPS_TO_BUILD}" \ - -of . \ . diff --git a/sdk/CMakeUserPresets.json b/sdk/CMakeUserPresets.json new file mode 100644 index 00000000..eb4696cc --- /dev/null +++ b/sdk/CMakeUserPresets.json @@ -0,0 +1,10 @@ +{ + "version": 4, + "vendor": { + "conan": {} + }, + "include": [ + "../build/Release/generators/CMakePresets.json", + "../build_Linux_armv8/Release/generators/CMakePresets.json" + ] +} \ No newline at end of file From 6eea41a29a6da32395f8c55d21b9edcd7fd0776a Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Wed, 12 Mar 2025 14:26:54 +0000 Subject: [PATCH 05/40] wip --- CMakeLists.txt | 13 ++++++++++--- conanfile.py | 8 ++++++++ sdk/CMakeUserPresets.json | 4 ++-- sdk/proto/CMakeLists.txt | 4 ++-- sdk/src/CMakeLists.txt | 14 +++++++------- sdk/tests/unit/CMakeLists.txt | 6 +++--- 6 files changed, 32 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97246070..39e719b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,15 @@ set(STATIC_BUILD OFF CACHE BOOL "Build all targets with external dependen set(CMAKE_CXX_STANDARD 17) -# find_package(fmt CONFIG REQUIRED) -# find_package(nlohmann_json CONFIG REQUIRED) +project(VehicleAppCppSdk CXX) + +find_package(fmt REQUIRED) +find_package(gRPC REQUIRED) +find_package(nlohmann_json REQUIRED) +find_package(PahoMqttCpp REQUIRED) +find_package(eclipse-paho-mqtt-c REQUIRED) +find_package(protobuf REQUIRED) +find_package(absl REQUIRED) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/sdk/include @@ -31,7 +38,7 @@ include_directories( if(SDK_STANDALONE) # set the project name - project(VehicleAppCppSdk CXX) +# project(VehicleAppCppSdk CXX) if(STATIC_BUILD) set(BUILD_SHARED_LIBS OFF) diff --git a/conanfile.py b/conanfile.py index 1395d0f1..b50fac24 100644 --- a/conanfile.py +++ b/conanfile.py @@ -87,6 +87,14 @@ def config_options(self): def configure(self): print("########################## configure ##########################") + self.options["grpc"].csharp_ext = False + self.options["grpc"].php_plugin = False + self.options["grpc"].node_plugin = False + self.options["grpc"].otel_plugin = False + self.options["grpc"].ruby_plugin = False + self.options["grpc"].csharp_plugin = False + self.options["grpc"].python_plugin = False + self.options["grpc"].objective_c_plugin = False if self.options.shared: self.options.rm_safe("fPIC") diff --git a/sdk/CMakeUserPresets.json b/sdk/CMakeUserPresets.json index eb4696cc..f88ca6b7 100644 --- a/sdk/CMakeUserPresets.json +++ b/sdk/CMakeUserPresets.json @@ -4,7 +4,7 @@ "conan": {} }, "include": [ - "../build/Release/generators/CMakePresets.json", - "../build_Linux_armv8/Release/generators/CMakePresets.json" + "../build_Linux_armv8/Release/generators/CMakePresets.json", + "../build/Release/generators/CMakePresets.json" ] } \ No newline at end of file diff --git a/sdk/proto/CMakeLists.txt b/sdk/proto/CMakeLists.txt index 898b3d91..80f4a410 100644 --- a/sdk/proto/CMakeLists.txt +++ b/sdk/proto/CMakeLists.txt @@ -80,8 +80,8 @@ # list(APPEND PROTO_HDRS ${OUTPUT_FILE_PATH_PB_HDR}) # endforeach() -find_package(gRPC CONFIG REQUIRED) -find_package(Protobuf REQUIRED) +# find_package(gRPC CONFIG REQUIRED) +# find_package(Protobuf REQUIRED) set(TARGET_NAME "vehicle-app-sdk-generated-grpc") diff --git a/sdk/src/CMakeLists.txt b/sdk/src/CMakeLists.txt index 9a675c97..984f1ce8 100644 --- a/sdk/src/CMakeLists.txt +++ b/sdk/src/CMakeLists.txt @@ -14,13 +14,13 @@ set(TARGET_NAME "vehicle-app-sdk") -find_package(fmt REQUIRED) -find_package(gRPC REQUIRED) -find_package(nlohmann_json REQUIRED) -find_package(PahoMqttCpp REQUIRED) -find_package(eclipse-paho-mqtt-c REQUIRED) -find_package(protobuf REQUIRED) -find_package(absl REQUIRED) +# find_package(fmt REQUIRED) +# find_package(gRPC REQUIRED) +# find_package(nlohmann_json REQUIRED) +# find_package(PahoMqttCpp REQUIRED) +# find_package(eclipse-paho-mqtt-c REQUIRED) +# find_package(protobuf REQUIRED) +# find_package(absl REQUIRED) add_library(${TARGET_NAME} sdk/VehicleApp.cpp diff --git a/sdk/tests/unit/CMakeLists.txt b/sdk/tests/unit/CMakeLists.txt index a4fadb6d..8bc8336e 100644 --- a/sdk/tests/unit/CMakeLists.txt +++ b/sdk/tests/unit/CMakeLists.txt @@ -14,9 +14,9 @@ set(TARGET_NAME "sdk_utests") -find_package(fmt CONFIG REQUIRED) -find_package(gRPC CONFIG REQUIRED) -find_package(protobuf CONFIG REQUIRED) +# find_package(fmt CONFIG REQUIRED) +# find_package(gRPC CONFIG REQUIRED) +# find_package(protobuf CONFIG REQUIRED) add_executable(${TARGET_NAME} testmain.cpp From 6ed3bccc6249d23851762450d219af1cef52abd9 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Wed, 19 Mar 2025 17:30:13 +0000 Subject: [PATCH 06/40] wip --- .conan/profiles/linux_x86_64_release | 1 + CMakeLists.txt | 4 - conanfile.py | 45 ++++------ examples/CMakeLists.txt | 27 +++--- examples/example_model/CMakeLists.txt | 19 ++++ examples/performance-subscribe/CMakeLists.txt | 4 +- examples/seat-adjuster/CMakeLists.txt | 22 ++--- examples/set-data-points/CMakeLists.txt | 4 +- requirements.txt | 2 +- sdk/CMakeUserPresets.json | 2 +- sdk/proto/CMakeLists.txt | 90 +++---------------- sdk/src/CMakeLists.txt | 19 ++-- sdk/tests/unit/CMakeLists.txt | 11 +-- 13 files changed, 88 insertions(+), 162 deletions(-) create mode 100644 examples/example_model/CMakeLists.txt diff --git a/.conan/profiles/linux_x86_64_release b/.conan/profiles/linux_x86_64_release index c823b204..dd553a1d 100644 --- a/.conan/profiles/linux_x86_64_release +++ b/.conan/profiles/linux_x86_64_release @@ -3,5 +3,6 @@ os=Linux arch=x86_64 compiler=gcc compiler.version=11 +compiler.cppstd=17 compiler.libcxx=libstdc++11 build_type=Release diff --git a/CMakeLists.txt b/CMakeLists.txt index 39e719b6..2296051b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,10 +32,6 @@ find_package(eclipse-paho-mqtt-c REQUIRED) find_package(protobuf REQUIRED) find_package(absl REQUIRED) -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/sdk/include -) - if(SDK_STANDALONE) # set the project name # project(VehicleAppCppSdk CXX) diff --git a/conanfile.py b/conanfile.py index b50fac24..79856d09 100644 --- a/conanfile.py +++ b/conanfile.py @@ -28,9 +28,6 @@ class VehicleAppCppSdkConan(ConanFile): license = "Apache-2.0" url = "https://github.com/eclipse-velocitas/vehicle-app-cpp-sdk" description = "The Vehicle App SDK for c++ allows to create Vehicle Apps from the Velocitas development model in the c++ programming language." - # In general: Pin recipe revisions of dependencies having further dependencies to avoid build issues due to updated recipes - # Workaround1: Pin recipe revision for transient dependency googleapis for enabling the container build - # Workaround2: Pin recipe revision for transient dependency paho-mqtt-c cause latest is pulling libanl which cannot be found requires = [ #("c-ares/1.19.1@#420a0b77e370f4b96bee88ef91837ccc"), ("fmt/9.1.0"), @@ -60,20 +57,20 @@ class VehicleAppCppSdkConan(ConanFile): def set_version(self): print("########################## set_version ##########################") try: - git = Git(folder=".") - tag = git.get_tag() - if tag is not None: + git = Git(self, folder=".") + tag = git.run("tag --points-at HEAD").strip() + if tag: version_tag_pattern = re.compile(r"^v[0-9]+(\.[0-9]+){0,2}") if version_tag_pattern.match(tag): tag = tag[1:] # cut off initial v if a semver tag - version = tag if tag is not None else git.get_branch() - if version == "HEAD (no branch)": - version = git.get_commit() - self.version = version.replace("/", "_") + version = tag if tag else git.run("symbolic-ref -q --short HEAD").strip() + if not version: + version = git.get_commit(repository=True) + self.version = version.replace("/", ".") open("./version.txt", mode="w", encoding="utf-8").write(self.version) except: - print("Not a git repository, reading version from static file...") + print("Maybe not a git repository, reading version from static file...") if os.path.isfile("./version.txt"): self.version = open("./version.txt", encoding="utf-8").read().strip() else: @@ -87,19 +84,16 @@ def config_options(self): def configure(self): print("########################## configure ##########################") - self.options["grpc"].csharp_ext = False - self.options["grpc"].php_plugin = False - self.options["grpc"].node_plugin = False - self.options["grpc"].otel_plugin = False - self.options["grpc"].ruby_plugin = False - self.options["grpc"].csharp_plugin = False - self.options["grpc"].python_plugin = False - self.options["grpc"].objective_c_plugin = False if self.options.shared: self.options.rm_safe("fPIC") - def generate(self): - print("########################## generate ##########################") + def requirements(self): + print("########################## requirements ##########################") + + def build_requirements(self): + print("########################## build_requirements ##########################") + # 'build' context (protoc.exe will be available) + self.tool_requires("grpc/") def layout(self): print("########################## layout ##########################") @@ -109,6 +103,9 @@ def layout(self): build_folder="build" if not cross_building(self) else f"build_{self.settings.os}_{self.settings.arch}", ) + def generate(self): + print("########################## generate ##########################") + def build(self): print("########################## build ##########################") build_type = self.settings.get_safe( @@ -138,9 +135,3 @@ def imports(self): print("########################## imports ##########################") self.copy("license*", src=".", dst="./licenses", folder=True, ignore_case=True) - - def build_requirements(self): - print("########################## build_requirements ##########################") - # 'build' context (protoc.exe will be available) - self.tool_requires("grpc/") - self.tool_requires("protobuf/") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 793d64f6..09417bec 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -12,24 +12,17 @@ # # SPDX-License-Identifier: Apache-2.0 -#find_package(fmt CONFIG REQUIRED) -#find_package(nlohmann_json CONFIG REQUIRED) +# get_cmake_property(_variableNames VARIABLES) +# list (SORT _variableNames) +# message(STATUS "------------------------------------------------------------------------------------------------------") +# message(STATUS "${CMAKE_CURRENT_LIST_DIR}") +# message(STATUS "------------------------------------------------------------------------------------------------------") +# foreach (_variableName ${_variableNames}) +# message(STATUS "${_variableName}=${${_variableName}}") +# endforeach() +# message(STATUS "------------------------------------------------------------------------------------------------------") -include_directories( - ${fmt_INCLUDE_DIR} - ${nlohmann_json_INCLUDE_DIR} - example_model -) - -get_cmake_property(_variableNames VARIABLES) -list (SORT _variableNames) -message(STATUS "------------------------------------------------------------------------------------------------------") -message(STATUS "${CMAKE_CURRENT_LIST_DIR}") -message(STATUS "------------------------------------------------------------------------------------------------------") -foreach (_variableName ${_variableNames}) - message(STATUS "${_variableName}=${${_variableName}}") -endforeach() -message(STATUS "------------------------------------------------------------------------------------------------------") +add_subdirectory(example_model) # Currently only adding examples that can be tested without additional velocitas code generation diff --git a/examples/example_model/CMakeLists.txt b/examples/example_model/CMakeLists.txt new file mode 100644 index 00000000..653c3105 --- /dev/null +++ b/examples/example_model/CMakeLists.txt @@ -0,0 +1,19 @@ +# Copyright (c) 2022-2025 Contributors to the Eclipse Foundation +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +set(TARGET_NAME "example_model") + +add_library(${TARGET_NAME} INTERFACE) + +target_include_directories(${TARGET_NAME} INTERFACE .) diff --git a/examples/performance-subscribe/CMakeLists.txt b/examples/performance-subscribe/CMakeLists.txt index 7fecac1b..216adae5 100644 --- a/examples/performance-subscribe/CMakeLists.txt +++ b/examples/performance-subscribe/CMakeLists.txt @@ -19,10 +19,12 @@ add_executable(${TARGET_NAME} src/PerformanceTestApp.cpp ) -include_directories( +target_include_directories(${TARGET_NAME} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ) target_link_libraries(${TARGET_NAME} vehicle-app-sdk + example_model ) diff --git a/examples/seat-adjuster/CMakeLists.txt b/examples/seat-adjuster/CMakeLists.txt index 2e16cec5..970572be 100644 --- a/examples/seat-adjuster/CMakeLists.txt +++ b/examples/seat-adjuster/CMakeLists.txt @@ -14,24 +14,26 @@ set(TARGET_NAME "example-seatadjusterapp") -get_cmake_property(_variableNames VARIABLES) -list (SORT _variableNames) -message(STATUS "------------------------------------------------------------------------------------------------------") -message(STATUS "${CMAKE_CURRENT_LIST_DIR}") -message(STATUS "------------------------------------------------------------------------------------------------------") -foreach (_variableName ${_variableNames}) - message(STATUS "${_variableName}=${${_variableName}}") -endforeach() -message(STATUS "------------------------------------------------------------------------------------------------------") +# get_cmake_property(_variableNames VARIABLES) +# list (SORT _variableNames) +# message(STATUS "------------------------------------------------------------------------------------------------------") +# message(STATUS "${CMAKE_CURRENT_LIST_DIR}") +# message(STATUS "------------------------------------------------------------------------------------------------------") +# foreach (_variableName ${_variableNames}) +# message(STATUS "${_variableName}=${${_variableName}}") +# endforeach() +# message(STATUS "------------------------------------------------------------------------------------------------------") add_executable(${TARGET_NAME} src/SeatAdjusterApp.cpp ) -include_directories( +target_include_directories(${TARGET_NAME} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ) target_link_libraries(${TARGET_NAME} vehicle-app-sdk + example_model ) diff --git a/examples/set-data-points/CMakeLists.txt b/examples/set-data-points/CMakeLists.txt index bde62feb..0ad7e927 100644 --- a/examples/set-data-points/CMakeLists.txt +++ b/examples/set-data-points/CMakeLists.txt @@ -18,10 +18,12 @@ add_executable(${TARGET_NAME} src/SetDataPointsApp.cpp ) -include_directories( +target_include_directories(${TARGET_NAME} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ) target_link_libraries(${TARGET_NAME} vehicle-app-sdk + example_model ) diff --git a/requirements.txt b/requirements.txt index 49b3841e..96219fae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ gcovr==5.2 -conan==1.66.0 +conan==2.12.2 pre-commit==3.5.0 cpplint==1.6.1 diff --git a/sdk/CMakeUserPresets.json b/sdk/CMakeUserPresets.json index f88ca6b7..b9e65e13 100644 --- a/sdk/CMakeUserPresets.json +++ b/sdk/CMakeUserPresets.json @@ -4,7 +4,7 @@ "conan": {} }, "include": [ - "../build_Linux_armv8/Release/generators/CMakePresets.json", + "/workspaces/vehicle-app-cpp-sdk2/build/Release/generators/CMakePresets.json", "../build/Release/generators/CMakePresets.json" ] } \ No newline at end of file diff --git a/sdk/proto/CMakeLists.txt b/sdk/proto/CMakeLists.txt index 80f4a410..3db00cb0 100644 --- a/sdk/proto/CMakeLists.txt +++ b/sdk/proto/CMakeLists.txt @@ -12,85 +12,8 @@ # # SPDX-License-Identifier: Apache-2.0 -# file(GLOB_RECURSE PROTO_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.proto) - -# find_program(_gRPC_PROTOBUF_PROTOC_EXECUTABLE protoc REQUIRED -# PATHS ${BUILD_TOOLS_PATH} -# NO_DEFAULT_PATH) -# find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin REQUIRED -# PATHS ${BUILD_TOOLS_PATH} -# NO_DEFAULT_PATH) - -# set(_gRPC_PROTO_GENS_DIR ${CMAKE_BINARY_DIR}/gens) -# set(_gRPC_PROTO_SRCS_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -# file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR}) - -# set(PROTO_SRCS "" CACHE INTERNAL "") -# set(PROTO_HDRS "" CACHE INTERNAL "") - -# foreach(FILE ${PROTO_FILES}) -# get_filename_component(ABS_FIL ${FILE} ABSOLUTE) -# get_filename_component(FIL_WE ${FILE} NAME_WE) -# get_filename_component(REL_DIR ${FILE} DIRECTORY) -# set(RELFIL_WE ${REL_DIR}/${FIL_WE}) - -# set(OUTPUT_FILE_PATH_GRPC_SRC "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc") -# set(OUTPUT_FILE_PATH_GRPC_HDR "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h") -# set(OUTPUT_FILE_PATH_PB_SRC "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc") -# set(OUTPUT_FILE_PATH_PB_HDR "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h") -# set(OUTPUT_FILE_PATH_GRPC_MOCK_HDR "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}_mock.grpc.pb.h") -# set(OUTPUT_FILES -# ${OUTPUT_FILE_PATH_GRPC_SRC} -# ${OUTPUT_FILE_PATH_GRPC_HDR} -# ${OUTPUT_FILE_PATH_PB_SRC} -# ${OUTPUT_FILE_PATH_PB_HDR} -# ${OUTPUT_FILE_PATH_GRPC_MOCK_HDR} -# ) - -# set(GENERATE_GRPC_SOURCES FALSE) - -# foreach(OUTPUT_FILE ${OUTPUT_FILES}) -# if(NOT EXISTS ${OUTPUT_FILE}) -# set(GENERATE_GRPC_SOURCES TRUE) -# message("File does not exist: " ${OUTPUT_FILE} " - generating ...") -# else() -# # message("File already exists: " ${OUTPUT_FILE}) -# endif() -# endforeach() - -# if(${GENERATE_GRPC_SOURCES}) -# add_custom_command( -# OUTPUT ${OUTPUT_FILES} -# COMMAND ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE} -# ARGS --grpc_out=generate_mock_code=true:${_gRPC_PROTO_GENS_DIR} -# --cpp_out ${_gRPC_PROTO_GENS_DIR} -# -I "./" -# --plugin=protoc-gen-grpc=${_GRPC_CPP_PLUGIN_EXECUTABLE} -# "${FILE}" -# WORKING_DIRECTORY ${_gRPC_PROTO_SRCS_DIR} -# COMMENT "Running gRPC C++ protocol buffer compiler for ${FILE}" -# VERBATIM) -# else() -# message("Skipping generation of " ${FILE}) -# endif() - -# list(APPEND PROTO_SRCS ${OUTPUT_FILE_PATH_GRPC_SRC}) -# list(APPEND PROTO_SRCS ${OUTPUT_FILE_PATH_PB_SRC}) -# list(APPEND PROTO_HDRS ${OUTPUT_FILE_PATH_GRPC_HDR}) -# list(APPEND PROTO_HDRS ${OUTPUT_FILE_PATH_PB_HDR}) -# endforeach() - -# find_package(gRPC CONFIG REQUIRED) -# find_package(Protobuf REQUIRED) - set(TARGET_NAME "vehicle-app-sdk-generated-grpc") -include_directories( - ${absl_INCLUDE_DIR} - ${protobuf_INCLUDE_DIR} - ${gRPC_INCLUDE_DIR} -) - add_library(${TARGET_NAME} STATIC kuksa/val/v2/types.proto kuksa/val/v2/val.proto @@ -98,9 +21,20 @@ add_library(${TARGET_NAME} STATIC sdv/databroker/v1/collector.proto sdv/databroker/v1/broker.proto ) + +target_include_directories(${TARGET_NAME} + PUBLIC + ${CMAKE_CURRENT_BINARY_DIR} + PRIVATE + ${absl_INCLUDE_DIR} + ${protobuf_INCLUDE_DIR} + ${gRPC_INCLUDE_DIR} +) + target_link_libraries(${TARGET_NAME} gRPC::grpc++ ) + protobuf_generate(TARGET ${TARGET_NAME}) protobuf_generate( TARGET ${TARGET_NAME} @@ -108,5 +42,3 @@ protobuf_generate( PLUGIN protoc-gen-grpc=$ PLUGIN_OPTIONS generate_mock_code=true GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc) - -target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/sdk/src/CMakeLists.txt b/sdk/src/CMakeLists.txt index 984f1ce8..b4d74bd8 100644 --- a/sdk/src/CMakeLists.txt +++ b/sdk/src/CMakeLists.txt @@ -14,14 +14,6 @@ set(TARGET_NAME "vehicle-app-sdk") -# find_package(fmt REQUIRED) -# find_package(gRPC REQUIRED) -# find_package(nlohmann_json REQUIRED) -# find_package(PahoMqttCpp REQUIRED) -# find_package(eclipse-paho-mqtt-c REQUIRED) -# find_package(protobuf REQUIRED) -# find_package(absl REQUIRED) - add_library(${TARGET_NAME} sdk/VehicleApp.cpp sdk/Model.cpp @@ -54,8 +46,11 @@ add_library(${TARGET_NAME} sdk/vdb/grpc/sdv_databroker_v1/GrpcDataPointValueProvider.cpp ) -include_directories( +target_include_directories(${TARGET_NAME} + PUBLIC + ../include ${fmt_INCLUDE_DIR} + PRIVATE ${nlohmann_json_INCLUDE_DIR} ${gRPC_INCLUDE_DIR} ${absl_INCLUDE_DIR} @@ -65,9 +60,9 @@ include_directories( . ) -add_dependencies(${TARGET_NAME} - vehicle-app-sdk-generated-grpc -) +# add_dependencies(${TARGET_NAME} +# vehicle-app-sdk-generated-grpc +# ) target_link_libraries(${TARGET_NAME} gRPC::grpc++ diff --git a/sdk/tests/unit/CMakeLists.txt b/sdk/tests/unit/CMakeLists.txt index 8bc8336e..59167f64 100644 --- a/sdk/tests/unit/CMakeLists.txt +++ b/sdk/tests/unit/CMakeLists.txt @@ -14,10 +14,6 @@ set(TARGET_NAME "sdk_utests") -# find_package(fmt CONFIG REQUIRED) -# find_package(gRPC CONFIG REQUIRED) -# find_package(protobuf CONFIG REQUIRED) - add_executable(${TARGET_NAME} testmain.cpp AsyncResult_tests.cpp @@ -48,11 +44,8 @@ target_link_libraries(${TARGET_NAME} include(GoogleTest) -include_directories( - ${fmt_INCLUDE_DIR} - ${absl_INCLUDE_DIR} - ${protobuf_INCLUDE_DIR} - ${gRPC_INCLUDE_DIR} +target_include_directories(${TARGET_NAME} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../mocks ${CMAKE_CURRENT_SOURCE_DIR}/../model ${CMAKE_CURRENT_SOURCE_DIR}/../../src From 23ee5ef5c853e04aecfc4bc311f50c34bddb0281 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Fri, 21 Mar 2025 17:06:13 +0000 Subject: [PATCH 07/40] wip --- .../{linux_aarch64_release => linux_aarch64} | 1 + .conan/profiles/linux_aarch64_debug | 7 ---- .../{linux_x86_64_release => linux_x86_64} | 6 ++- .conan/profiles/linux_x86_64_debug | 7 ---- .licensechecker.yml | 2 +- .scripts/common.sh | 2 +- .vscode/launch.json | 8 ++-- CMakeLists.txt | 10 +++++ build.sh | 41 +++++++------------ conanfile.py | 2 +- examples/performance-subscribe/CMakeLists.txt | 1 + examples/seat-adjuster/CMakeLists.txt | 1 + examples/set-data-points/CMakeLists.txt | 1 + install_dependencies.sh | 35 +++++++++++----- sdk/CMakeUserPresets.json | 3 +- sdk/proto/CMakeLists.txt | 7 ++-- sdk/src/CMakeLists.txt | 18 ++++---- 17 files changed, 78 insertions(+), 74 deletions(-) rename .conan/profiles/{linux_aarch64_release => linux_aarch64} (91%) delete mode 100644 .conan/profiles/linux_aarch64_debug rename .conan/profiles/{linux_x86_64_release => linux_x86_64} (55%) delete mode 100644 .conan/profiles/linux_x86_64_debug diff --git a/.conan/profiles/linux_aarch64_release b/.conan/profiles/linux_aarch64 similarity index 91% rename from .conan/profiles/linux_aarch64_release rename to .conan/profiles/linux_aarch64 index b52ed273..0c0cda97 100644 --- a/.conan/profiles/linux_aarch64_release +++ b/.conan/profiles/linux_aarch64 @@ -3,6 +3,7 @@ os=Linux arch=armv8 compiler=gcc compiler.version=11 +compiler.cppstd=17 compiler.libcxx=libstdc++11 build_type=Release diff --git a/.conan/profiles/linux_aarch64_debug b/.conan/profiles/linux_aarch64_debug deleted file mode 100644 index 0af01184..00000000 --- a/.conan/profiles/linux_aarch64_debug +++ /dev/null @@ -1,7 +0,0 @@ -[settings] -os=Linux -arch=armv8 -compiler=gcc -compiler.version=11 -compiler.libcxx=libstdc++11 -build_type=Debug diff --git a/.conan/profiles/linux_x86_64_release b/.conan/profiles/linux_x86_64 similarity index 55% rename from .conan/profiles/linux_x86_64_release rename to .conan/profiles/linux_x86_64 index dd553a1d..3f68e6a6 100644 --- a/.conan/profiles/linux_x86_64_release +++ b/.conan/profiles/linux_x86_64 @@ -5,4 +5,8 @@ compiler=gcc compiler.version=11 compiler.cppstd=17 compiler.libcxx=libstdc++11 -build_type=Release + +[buildenv] +CC=x86_64-linux-gnu-gcc-11 +CXX=x86_64-linux-gnu-g++-11 +LD=x86_64-linux-gnu-ld diff --git a/.conan/profiles/linux_x86_64_debug b/.conan/profiles/linux_x86_64_debug deleted file mode 100644 index 50797d4c..00000000 --- a/.conan/profiles/linux_x86_64_debug +++ /dev/null @@ -1,7 +0,0 @@ -[settings] -os=Linux -arch=x86_64 -compiler=gcc -compiler.version=11 -compiler.libcxx=libstdc++11 -build_type=Debug diff --git a/.licensechecker.yml b/.licensechecker.yml index e446e187..f5733dc2 100644 --- a/.licensechecker.yml +++ b/.licensechecker.yml @@ -16,4 +16,4 @@ whitelist-file-path: ./whitelisted-licenses.txt scan-dirs: - path: . cpp-conan-included-profile-files: - - "./.conan/profiles/linux_x86_64_release" + - "./.conan/profiles/linux_x86_64" diff --git a/.scripts/common.sh b/.scripts/common.sh index 7e5becf6..59a3d24f 100644 --- a/.scripts/common.sh +++ b/.scripts/common.sh @@ -13,7 +13,7 @@ # # SPDX-License-Identifier: Apache-2.0 -function get_valid_cross_compile_architecute() { +function get_valid_cross_compile_architecture() { if [[ "$1" == "aarch64" || "$1" == "arm64" ]]; then HOST_ARCH="aarch64" elif [[ "$1" == "x86_64" || "$1" == "amd64" ]]; then diff --git a/.vscode/launch.json b/.vscode/launch.json index 219eec0e..9d6998a0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,7 @@ "name": "SDK - Unit Tests", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/bin/sdk_utests", + "program": "${workspaceFolder}/build/Debug/bin/sdk_utests", "args": [ ], "stopAtEntry": false, "cwd": "${workspaceFolder}", @@ -21,7 +21,7 @@ "name": "Example - SeatAdjuster", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/bin/example-seatadjusterapp", + "program": "${workspaceFolder}/build/Debug/bin/example-seatadjusterapp", "args": [ ], "stopAtEntry": false, "cwd": "${workspaceFolder}", @@ -47,7 +47,7 @@ "name": "Example - SetDataPointsExample", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/bin/example-set-data-points", + "program": "${workspaceFolder}/build/Debug/bin/example-set-data-points", "args": [ ], "stopAtEntry": false, "cwd": "${workspaceFolder}", @@ -73,7 +73,7 @@ "name": "Example - Performance Subscribe", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/bin/example-performance-subscribe", + "program": "${workspaceFolder}/build/Debug/bin/example-performance-subscribe", "args": [ "${workspaceFolder}/examples/performance-subscribe/subscription_signals.json" ], "stopAtEntry": false, "cwd": "${workspaceFolder}", diff --git a/CMakeLists.txt b/CMakeLists.txt index 2296051b..291507e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,16 @@ set(CMAKE_CXX_STANDARD 17) project(VehicleAppCppSdk CXX) +# get_cmake_property(_variableNames VARIABLES) +# list (SORT _variableNames) +# message(STATUS "------------------------------------------------------------------------------------------------------") +# message(STATUS "${CMAKE_CURRENT_LIST_DIR}") +# message(STATUS "------------------------------------------------------------------------------------------------------") +# foreach (_variableName ${_variableNames}) +# message(STATUS "${_variableName}=${${_variableName}}") +# endforeach() +# message(STATUS "------------------------------------------------------------------------------------------------------") + find_package(fmt REQUIRED) find_package(gRPC REQUIRED) find_package(nlohmann_json REQUIRED) diff --git a/build.sh b/build.sh index 379ce0c4..e69a0551 100755 --- a/build.sh +++ b/build.sh @@ -37,8 +37,9 @@ Arguments: " } -BUILD_VARIANT=Debug +BUILD_TYPE=Debug BUILD_ARCH=$(arch) +HOST_OS=Linux HOST_ARCH=${BUILD_ARCH} BUILD_TARGET=all STATIC_BUILD=OFF @@ -51,11 +52,11 @@ POSITIONAL_ARGS=() while [[ $# -gt 0 ]]; do case $1 in -d|--debug) - BUILD_VARIANT="Debug" + BUILD_TYPE="Debug" shift ;; -r|--release) - BUILD_VARIANT="Release" + BUILD_TYPE="Release" shift ;; -t|--target) @@ -102,7 +103,7 @@ done echo "CMake version "`cmake --version` echo "Conan version "`conan --version` -echo "Build variant ${BUILD_VARIANT}" +echo "Build type ${BUILD_TYPE}" echo "Build arch ${BUILD_ARCH}" echo "Host arch ${HOST_ARCH}" echo "Build target ${BUILD_TARGET}" @@ -113,7 +114,7 @@ echo "Coverage ${GEN_COVERAGE}" CMAKE_CXX_FLAGS="-g -O0" -if [ "${BUILD_VARIANT}" == "release" ]; then +if [ "${BUILD_TYPE}" == "Release" ]; then CMAKE_CXX_FLAGS="-s -g -O3" fi @@ -121,39 +122,27 @@ if [ "${GEN_COVERAGE}" == "ON" ]; then CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} --coverage" fi -mkdir -p build && cd build - -# Expose the PATH of the build-time requirements from Conan to CMake - this is NOT handled by -# any of Conan's CMake generators at the moment, hence we parse the conanbuildinfo.txt which -# is generated and holds these paths. This allows us to always use the protoc and grpc cpp plugin -# of the build system. -# BUILD_TOOLS_PATH="" -# CONAN_BUILD_TOOLS_PATHS=$(sed '/^PATH=/!d;s/PATH=//g;s/,/\n/g' ./conanbuildinfo.txt | tr -d '[]'\" ) -# while read -r p; do -# if [[ ! -z "${p// }" ]]; then -# BUILD_TOOLS_PATH="$BUILD_TOOLS_PATH;$p" -# fi -# done < <(echo "$CONAN_BUILD_TOOLS_PATHS") - +BUILD_FOLDER=build XCOMPILE_TOOLCHAIN_FILE="" if [[ "${BUILD_ARCH}" != "${HOST_ARCH}" ]]; then echo "Setting up cross compilation toolchain..." + BUILD_FOLDER=build-${HOST_OS}-${HOST_ARCH} XCOMPILE_TOOLCHAIN_FILE="-DCMAKE_TOOLCHAIN_FILE=../cmake/${BUILD_ARCH}_to_${HOST_ARCH}.cmake" fi +BUILD_FOLDER=${BUILD_FOLDER}/${BUILD_TYPE} # Configure CMake and build the project. cmake --no-warn-unused-cli \ -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE \ - -DCMAKE_BUILD_TYPE:STRING=${BUILD_VARIANT} \ + -DCMAKE_BUILD_TYPE:STRING=${BUILD_TYPE} \ -DSTATIC_BUILD:BOOL=${STATIC_BUILD} \ -DSDK_BUILD_EXAMPLES=${SDK_BUILD_EXAMPLES} \ -DSDK_BUILD_TESTS=${SDK_BUILD_TESTS} \ - -S.. \ - -B../build \ + -S . \ + -B ${BUILD_FOLDER} \ -G Ninja \ -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \ - -DCMAKE_TOOLCHAIN_FILE=Release/generators/conan_toolchain.cmake \ - .. + -DCMAKE_TOOLCHAIN_FILE=${BUILD_FOLDER}/generators/conan_toolchain.cmake \ + . # ${XCOMPILE_TOOLCHAIN_FILE} .. -cmake --build . -v --config ${BUILD_VARIANT} --target ${BUILD_TARGET} -cd .. +cmake --build ${BUILD_FOLDER} -v --config ${BUILD_TYPE} --target ${BUILD_TARGET} diff --git a/conanfile.py b/conanfile.py index 79856d09..ff16293d 100644 --- a/conanfile.py +++ b/conanfile.py @@ -115,7 +115,7 @@ def build(self): if arch == "armv8": arch = "aarch64" subprocess.call( - f"cd ../.. && ./install_dependencies.sh -x {arch} && ./build.sh {option} -x {arch} --no-examples --no-tests", shell=True) + f"cd ../.. && ./build.sh -x {self.settings.arch} {option} --no-examples --no-tests", shell=True) def package(self): print("########################## package ##########################") diff --git a/examples/performance-subscribe/CMakeLists.txt b/examples/performance-subscribe/CMakeLists.txt index 216adae5..e712b76a 100644 --- a/examples/performance-subscribe/CMakeLists.txt +++ b/examples/performance-subscribe/CMakeLists.txt @@ -27,4 +27,5 @@ target_include_directories(${TARGET_NAME} target_link_libraries(${TARGET_NAME} vehicle-app-sdk example_model + nlohmann_json::nlohmann_json ) diff --git a/examples/seat-adjuster/CMakeLists.txt b/examples/seat-adjuster/CMakeLists.txt index 970572be..87f360fe 100644 --- a/examples/seat-adjuster/CMakeLists.txt +++ b/examples/seat-adjuster/CMakeLists.txt @@ -36,4 +36,5 @@ target_include_directories(${TARGET_NAME} target_link_libraries(${TARGET_NAME} vehicle-app-sdk example_model + nlohmann_json::nlohmann_json ) diff --git a/examples/set-data-points/CMakeLists.txt b/examples/set-data-points/CMakeLists.txt index 0ad7e927..b59edead 100644 --- a/examples/set-data-points/CMakeLists.txt +++ b/examples/set-data-points/CMakeLists.txt @@ -26,4 +26,5 @@ target_include_directories(${TARGET_NAME} target_link_libraries(${TARGET_NAME} vehicle-app-sdk example_model + nlohmann_json::nlohmann_json ) diff --git a/install_dependencies.sh b/install_dependencies.sh index 9c2ab613..0f168153 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -27,18 +27,19 @@ function print_help() { Installs the Conan dependencies of the Vehicle App AND the Vehicle App SDK into the local Conan cache. Has to be re-executed whenever any conanfile.txt or conanfile.py is updated. By default, dependencies are installed in release -mode. +mode and the app is expected to be built in debug mode (i.e. "mixed" mode). Arguments: -d, --debug Installs all dependencies in debug mode. --r, --release Installs all dependencies in release mode. (default) +-r, --release Installs all dependencies in release mode. -x, --cross Cross compiles for the specified architecture. --build-all-deps Forces all dependencies to be rebuild from source. -h, --help Shows this help. " } -BUILD_VARIANT="release" +PREPARE_MIXED_BUILD="true" +BUILD_TYPE="Release" BUILD_ARCH=$(arch) HOST_ARCH=${BUILD_ARCH} WHICH_DEPS_TO_BUILD="missing" @@ -46,11 +47,13 @@ WHICH_DEPS_TO_BUILD="missing" while [[ $# -gt 0 ]]; do case $1 in -d|--debug) - BUILD_VARIANT="debug" + PREPARE_MIXED_BUILD="false" + BUILD_TYPE="Debug" shift ;; -r|--release) - BUILD_VARIANT="release" + PREPARE_MIXED_BUILD="false" + BUILD_TYPE="Release" shift ;; --build-all-deps) @@ -58,7 +61,8 @@ while [[ $# -gt 0 ]]; do shift ;; -x|--cross) - HOST_ARCH=$( get_valid_cross_compile_architecute "$2" ) + PREPARE_MIXED_BUILD="false" + HOST_ARCH=$( get_valid_cross_compile_architecture "$2" ) if [ "$?" -eq 1 ]; then echo "Invalid cross-compile architecture '$2'!" @@ -85,17 +89,28 @@ while [[ $# -gt 0 ]]; do done echo "Conan version "`conan --version` -echo "Build variant ${BUILD_VARIANT}" +echo "Build type ${BUILD_TYPE}" +echo " prepare mixed ${PREPARE_MIXED_BUILD}" echo "Build arch ${BUILD_ARCH}" echo "Host arch ${HOST_ARCH}" echo "Building deps ${WHICH_DEPS_TO_BUILD}" -HOST_PROFILE=".conan/profiles/linux_${HOST_ARCH}_${BUILD_VARIANT}" -BUILD_PROFILE=".conan/profiles/linux_${BUILD_ARCH}_${BUILD_VARIANT}" +HOST_PROFILE=".conan/profiles/linux_${HOST_ARCH}" +BUILD_PROFILE=".conan/profiles/linux_${BUILD_ARCH}" + +if [ "${PREPARE_MIXED_BUILD}" == "true" ]; then + conan install \ + -pr:h ${HOST_PROFILE} \ + -pr:b ${BUILD_PROFILE} \ + -s:a="build_type=Release" \ + -s:h="&:build_type=Debug" \ + --build "${WHICH_DEPS_TO_BUILD}" \ + . +fi -mkdir -p build conan install \ -pr:h ${HOST_PROFILE} \ -pr:b ${BUILD_PROFILE} \ + -s:a="build_type=${BUILD_TYPE}" \ --build "${WHICH_DEPS_TO_BUILD}" \ . diff --git a/sdk/CMakeUserPresets.json b/sdk/CMakeUserPresets.json index b9e65e13..1e87b4ba 100644 --- a/sdk/CMakeUserPresets.json +++ b/sdk/CMakeUserPresets.json @@ -5,6 +5,7 @@ }, "include": [ "/workspaces/vehicle-app-cpp-sdk2/build/Release/generators/CMakePresets.json", - "../build/Release/generators/CMakePresets.json" + "../build/Release/generators/CMakePresets.json", + "../build/Debug/generators/CMakePresets.json" ] } \ No newline at end of file diff --git a/sdk/proto/CMakeLists.txt b/sdk/proto/CMakeLists.txt index 3db00cb0..5536386d 100644 --- a/sdk/proto/CMakeLists.txt +++ b/sdk/proto/CMakeLists.txt @@ -24,11 +24,10 @@ add_library(${TARGET_NAME} STATIC target_include_directories(${TARGET_NAME} PUBLIC + ${absl_INCLUDE_DIRS} + ${protobuf_INCLUDE_DIRS} + ${gRPC_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} - PRIVATE - ${absl_INCLUDE_DIR} - ${protobuf_INCLUDE_DIR} - ${gRPC_INCLUDE_DIR} ) target_link_libraries(${TARGET_NAME} diff --git a/sdk/src/CMakeLists.txt b/sdk/src/CMakeLists.txt index b4d74bd8..a16c7c6f 100644 --- a/sdk/src/CMakeLists.txt +++ b/sdk/src/CMakeLists.txt @@ -48,22 +48,18 @@ add_library(${TARGET_NAME} target_include_directories(${TARGET_NAME} PUBLIC + ${fmt_INCLUDE_DIRS} + ${absl_INCLUDE_DIRS} + ${gRPC_INCLUDE_DIRS} ../include - ${fmt_INCLUDE_DIR} PRIVATE - ${nlohmann_json_INCLUDE_DIR} - ${gRPC_INCLUDE_DIR} - ${absl_INCLUDE_DIR} - ${protobuf_INCLUDE_DIR} - ${PahoMqttCpp_INCLUDE_DIR} - ${eclipse-paho-mqtt-c_INCLUDE_DIR} + ${nlohmann_json_INCLUDE_DIRS} + ${protobuf_INCLUDE_DIRS} + ${PahoMqttCpp_INCLUDE_DIRS} + ${eclipse-paho-mqtt-c_INCLUDE_DIRS} . ) -# add_dependencies(${TARGET_NAME} -# vehicle-app-sdk-generated-grpc -# ) - target_link_libraries(${TARGET_NAME} gRPC::grpc++ fmt::fmt From 860ff0985b7da636610b5055fc955bed28b1512b Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Tue, 25 Mar 2025 09:10:41 +0000 Subject: [PATCH 08/40] wip --- .conan/profiles/linux_aarch64 | 1 - .github/workflows/ci.yml | 2 +- .gitignore | 5 --- .scripts/common.sh | 4 +-- CMakeUserPresets.json | 9 ----- build.sh | 28 ++++++++------- cmake/x86_64_to_aarch64.cmake | 20 ----------- conanfile.py | 64 +++++++++++++++++++++++++++++++-- sdk/CMakeUserPresets.json | 5 ++- sdk/include/sdk/IPubSubClient.h | 4 +-- 10 files changed, 85 insertions(+), 57 deletions(-) delete mode 100644 CMakeUserPresets.json delete mode 100644 cmake/x86_64_to_aarch64.cmake diff --git a/.conan/profiles/linux_aarch64 b/.conan/profiles/linux_aarch64 index 0c0cda97..f6855902 100644 --- a/.conan/profiles/linux_aarch64 +++ b/.conan/profiles/linux_aarch64 @@ -5,7 +5,6 @@ compiler=gcc compiler.version=11 compiler.cppstd=17 compiler.libcxx=libstdc++11 -build_type=Release [buildenv] CC=aarch64-linux-gnu-gcc-11 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30e6a089..82695218 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: - name: Create conan package run: | - conan create --build=missing -pr:b ./.conan/profiles/linux_x86_64_release -pr:h ./.conan/profiles/${{ matrix.host }}_release . ci/testing + conan create --build=missing -pr:b ./.conan/profiles/linux_x86_64 -pr:h ./.conan/profiles/${{ matrix.host }} -s:a="build_type=Release" . ci/testing build-and-publish: runs-on: ubuntu-22.04 diff --git a/.gitignore b/.gitignore index a302539b..065a7b7b 100644 --- a/.gitignore +++ b/.gitignore @@ -54,11 +54,6 @@ build* # Mac files .DS_Store -# Downloaded assets -Assets -.vscode/scripts/assets/ -get_helm.sh - # conan licenses licenses conan_imports_manifest.txt diff --git a/.scripts/common.sh b/.scripts/common.sh index 59a3d24f..acd9904d 100644 --- a/.scripts/common.sh +++ b/.scripts/common.sh @@ -14,7 +14,7 @@ # SPDX-License-Identifier: Apache-2.0 function get_valid_cross_compile_architecture() { - if [[ "$1" == "aarch64" || "$1" == "arm64" ]]; then + if [[ "$1" == "aarch64" || "$1" == "arm64" || "$1" == "armv8" ]]; then HOST_ARCH="aarch64" elif [[ "$1" == "x86_64" || "$1" == "amd64" ]]; then HOST_ARCH="x86_64" @@ -24,4 +24,4 @@ function get_valid_cross_compile_architecture() { echo $HOST_ARCH return 0 -} \ No newline at end of file +} diff --git a/CMakeUserPresets.json b/CMakeUserPresets.json deleted file mode 100644 index 2445deb2..00000000 --- a/CMakeUserPresets.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": 4, - "vendor": { - "conan": {} - }, - "include": [ - "/workspaces/vehicle-app-cpp-sdk/build/Release/generators/CMakePresets.json" - ] -} \ No newline at end of file diff --git a/build.sh b/build.sh index e69a0551..c0d8eb70 100755 --- a/build.sh +++ b/build.sh @@ -18,6 +18,7 @@ # set -e +source ./.scripts/common.sh function print_help() { echo "Build targets of the project @@ -39,7 +40,7 @@ Arguments: BUILD_TYPE=Debug BUILD_ARCH=$(arch) -HOST_OS=Linux +HOST_OS=linux HOST_ARCH=${BUILD_ARCH} BUILD_TARGET=all STATIC_BUILD=OFF @@ -77,7 +78,7 @@ while [[ $# -gt 0 ]]; do shift ;; -x|--cross) - HOST_ARCH="$2" + HOST_ARCH=$( get_valid_cross_compile_architecture "$2" ) shift shift ;; @@ -123,13 +124,15 @@ if [ "${GEN_COVERAGE}" == "ON" ]; then fi BUILD_FOLDER=build -XCOMPILE_TOOLCHAIN_FILE="" if [[ "${BUILD_ARCH}" != "${HOST_ARCH}" ]]; then - echo "Setting up cross compilation toolchain..." BUILD_FOLDER=build-${HOST_OS}-${HOST_ARCH} - XCOMPILE_TOOLCHAIN_FILE="-DCMAKE_TOOLCHAIN_FILE=../cmake/${BUILD_ARCH}_to_${HOST_ARCH}.cmake" fi BUILD_FOLDER=${BUILD_FOLDER}/${BUILD_TYPE} +echo "Using build foler ${BUILD_FOLDER}" + +SRC_FOLDER=$(pwd) +mkdir -p ${BUILD_FOLDER} && pushd ${BUILD_FOLDER} +source generators/conanbuild.sh # Configure CMake and build the project. cmake --no-warn-unused-cli \ @@ -138,11 +141,12 @@ cmake --no-warn-unused-cli \ -DSTATIC_BUILD:BOOL=${STATIC_BUILD} \ -DSDK_BUILD_EXAMPLES=${SDK_BUILD_EXAMPLES} \ -DSDK_BUILD_TESTS=${SDK_BUILD_TESTS} \ - -S . \ - -B ${BUILD_FOLDER} \ - -G Ninja \ -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \ - -DCMAKE_TOOLCHAIN_FILE=${BUILD_FOLDER}/generators/conan_toolchain.cmake \ - . - # ${XCOMPILE_TOOLCHAIN_FILE} .. -cmake --build ${BUILD_FOLDER} -v --config ${BUILD_TYPE} --target ${BUILD_TARGET} + -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake \ + -G Ninja \ + -S ${SRC_FOLDER} \ + -B . +cmake --build . --target ${BUILD_TARGET} + +source generators/deactivate_conanbuild.sh >> /dev/null +popd >> /dev/null diff --git a/cmake/x86_64_to_aarch64.cmake b/cmake/x86_64_to_aarch64.cmake deleted file mode 100644 index deb262a9..00000000 --- a/cmake/x86_64_to_aarch64.cmake +++ /dev/null @@ -1,20 +0,0 @@ -# the name of the target operating system -set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_SYSTEM_PROCESSOR aarch64) - -set(TARGET_HOST aarch64-linux-gnu) - -# which compilers to use for C and C++ -set(CMAKE_C_COMPILER ${TARGET_HOST}-gcc) -set(CMAKE_CXX_COMPILER ${TARGET_HOST}-g++) - -# where is the target environment located -set(CMAKE_FIND_ROOT_PATH /usr/bin/aarch64-linux-gnu) - -# adjust the default behavior of the FIND_XXX() commands: -# search programs in the host environment -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) - -# search headers and libraries in the target environment -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/conanfile.py b/conanfile.py index ff16293d..1251319e 100644 --- a/conanfile.py +++ b/conanfile.py @@ -92,19 +92,32 @@ def requirements(self): def build_requirements(self): print("########################## build_requirements ##########################") - # 'build' context (protoc.exe will be available) + # Declare both, grpc and protobuf, here to enable proper x-build (w/o using qemu) self.tool_requires("grpc/") + self.tool_requires("protobuf/") def layout(self): print("########################## layout ##########################") + os = str(self.settings.os).lower() + arch = str(self.settings.arch).lower() + if arch == "armv8": + arch = "aarch64" cmake_layout( self, src_folder="sdk", - build_folder="build" if not cross_building(self) else f"build_{self.settings.os}_{self.settings.arch}", + build_folder="build" if not cross_building(self) else f"build-{os}-{arch}", ) def generate(self): print("########################## generate ##########################") + print(f"{self.folders.source=}") + print(f"{self.source_folder=}") + print(f"{self.folders.build=}") + print(f"{self.build_folder=}") + print(f"{self.folders.generators=}") + print(f"{self.folders.root=}") + print(f"{self.folders.subproject=}") + print(f"{self.folders.build_folder_vars=}") def build(self): print("########################## build ##########################") @@ -135,3 +148,50 @@ def imports(self): print("########################## imports ##########################") self.copy("license*", src=".", dst="./licenses", folder=True, ignore_case=True) + + + + def build_id(self): + print("########################## build_id ##########################") + + def compatibility(self): + print("########################## compatibility ##########################") + + def build_id(self): + print("########################## build_id ##########################") + + def deploy(self): + print("########################## deploy ##########################") + + def export(self): + print("########################## export ##########################") + + def export_sources(self): + print("########################## export_sources ##########################") + + def finalize(self): + print("########################## finalize ##########################") + + def init(self): + print("########################## init ##########################") + + def package_id(self): + print("########################## package_id ##########################") + + def set_name(self): + print("########################## set_name ##########################") + + def source(self): + print("########################## source ##########################") + + def system_requirements(self): + print("########################## system_requirements ##########################") + + def test(self): + print("########################## test ##########################") + + def validate(self): + print("########################## validate ##########################") + + def validate_build(self): + print("########################## validate_build ##########################") diff --git a/sdk/CMakeUserPresets.json b/sdk/CMakeUserPresets.json index 1e87b4ba..86631f32 100644 --- a/sdk/CMakeUserPresets.json +++ b/sdk/CMakeUserPresets.json @@ -4,8 +4,7 @@ "conan": {} }, "include": [ - "/workspaces/vehicle-app-cpp-sdk2/build/Release/generators/CMakePresets.json", - "../build/Release/generators/CMakePresets.json", - "../build/Debug/generators/CMakePresets.json" + "../build/Debug/generators/CMakePresets.json", + "../build/Release/generators/CMakePresets.json" ] } \ No newline at end of file diff --git a/sdk/include/sdk/IPubSubClient.h b/sdk/include/sdk/IPubSubClient.h index bba4872e..030936dc 100644 --- a/sdk/include/sdk/IPubSubClient.h +++ b/sdk/include/sdk/IPubSubClient.h @@ -56,8 +56,8 @@ class IPubSubClient { * * @param brokerUri address of the MQTT broker to connect to * @param clientId used to identify the client at the MQTT broker - * @param username to get access to the MQTT broker - * @param password to get access to the MQTT broker + * @param username username to get access to the MQTT broker + * @param password password to get access to the MQTT broker * @return std::shared_ptr reference to the created MQTT client */ static std::shared_ptr createInstance(const std::string& brokerUri, From a386c07946163a9c3ed1b90697918d2078ddd730 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Tue, 25 Mar 2025 15:30:45 +0000 Subject: [PATCH 09/40] wip --- .../profiles/{linux_aarch64 => linux-aarch64} | 0 .../profiles/{linux_x86_64 => linux-x86_64} | 0 .github/workflows/ci.yml | 4 +- .gitignore | 1 + .licensechecker.yml | 2 +- CMakeLists.txt | 46 +++++++------------ conanfile.py | 5 +- install_dependencies.sh | 8 ++-- sdk/CMakeUserPresets.json | 10 ---- sdk/src/CMakeLists.txt | 4 -- 10 files changed, 29 insertions(+), 51 deletions(-) rename .conan/profiles/{linux_aarch64 => linux-aarch64} (100%) rename .conan/profiles/{linux_x86_64 => linux-x86_64} (100%) delete mode 100644 sdk/CMakeUserPresets.json diff --git a/.conan/profiles/linux_aarch64 b/.conan/profiles/linux-aarch64 similarity index 100% rename from .conan/profiles/linux_aarch64 rename to .conan/profiles/linux-aarch64 diff --git a/.conan/profiles/linux_x86_64 b/.conan/profiles/linux-x86_64 similarity index 100% rename from .conan/profiles/linux_x86_64 rename to .conan/profiles/linux-x86_64 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82695218..c30cb9a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: name: Check Conan package strategy: matrix: - host: ["linux_x86_64"] + host: ["linux-x86_64"] fail-fast: false @@ -54,7 +54,7 @@ jobs: - name: Create conan package run: | - conan create --build=missing -pr:b ./.conan/profiles/linux_x86_64 -pr:h ./.conan/profiles/${{ matrix.host }} -s:a="build_type=Release" . ci/testing + conan create --build=missing -pr:b ./.conan/profiles/linux-x86_64 -pr:h ./.conan/profiles/${{ matrix.host }} -s:a="build_type=Release" . ci/testing build-and-publish: runs-on: ubuntu-22.04 diff --git a/.gitignore b/.gitignore index 065a7b7b..c60a2c74 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,7 @@ # CMake build* +CMakeUserPresets.json # Mac files .DS_Store diff --git a/.licensechecker.yml b/.licensechecker.yml index f5733dc2..743830c1 100644 --- a/.licensechecker.yml +++ b/.licensechecker.yml @@ -16,4 +16,4 @@ whitelist-file-path: ./whitelisted-licenses.txt scan-dirs: - path: . cpp-conan-included-profile-files: - - "./.conan/profiles/linux_x86_64" + - "./.conan/profiles/linux-x86_64" diff --git a/CMakeLists.txt b/CMakeLists.txt index 291507e2..92f72018 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,10 +14,8 @@ cmake_minimum_required(VERSION 3.16) -set(SDK_STANDALONE ON CACHE BOOL "Build the SDK in standalone mode.") set(SDK_BUILD_TESTS ON CACHE BOOL "Build the SDK tests.") set(SDK_BUILD_EXAMPLES ON CACHE BOOL "Build the SDK examples.") - set(STATIC_BUILD OFF CACHE BOOL "Build all targets with external dependencies linked in statically.") set(CMAKE_CXX_STANDARD 17) @@ -34,34 +32,24 @@ project(VehicleAppCppSdk CXX) # endforeach() # message(STATUS "------------------------------------------------------------------------------------------------------") -find_package(fmt REQUIRED) -find_package(gRPC REQUIRED) -find_package(nlohmann_json REQUIRED) -find_package(PahoMqttCpp REQUIRED) -find_package(eclipse-paho-mqtt-c REQUIRED) -find_package(protobuf REQUIRED) -find_package(absl REQUIRED) - -if(SDK_STANDALONE) - # set the project name -# project(VehicleAppCppSdk CXX) - - if(STATIC_BUILD) - set(BUILD_SHARED_LIBS OFF) - set(CMAKE_EXE_LINKER_FLAGS "-static") - endif() - - set(BUILD_EXAMPLES CACHE BOOL true) - set(BUILD_TESTS CACHE BOOL true) - - find_program(CCACHE_FOUND ccache) - - if(CCACHE_FOUND) - message("Found ccache installation") - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) - endif() +find_package(fmt REQUIRED CONFIG) +find_package(gRPC REQUIRED CONFIG) +find_package(nlohmann_json REQUIRED CONFIG) +find_package(PahoMqttCpp REQUIRED CONFIG) +find_package(eclipse-paho-mqtt-c REQUIRED CONFIG) +find_package(protobuf REQUIRED CONFIG) +find_package(absl REQUIRED CONFIG) + +if(STATIC_BUILD) + set(BUILD_SHARED_LIBS OFF) + set(CMAKE_EXE_LINKER_FLAGS "-static") +endif() -endif(SDK_STANDALONE) +find_program(CCACHE_FOUND ccache) +if(CCACHE_FOUND) + message("Found ccache installation") + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) +endif() if(SDK_BUILD_TESTS) enable_testing() diff --git a/conanfile.py b/conanfile.py index 1251319e..9861bd5b 100644 --- a/conanfile.py +++ b/conanfile.py @@ -56,6 +56,7 @@ class VehicleAppCppSdkConan(ConanFile): def set_version(self): print("########################## set_version ##########################") + print("Determining SDK version ...") try: git = Git(self, folder=".") tag = git.run("tag --points-at HEAD").strip() @@ -75,7 +76,7 @@ def set_version(self): self.version = open("./version.txt", encoding="utf-8").read().strip() else: raise FileNotFoundError("Missing version.txt!") - + print(f"SDK version: {self.version}") def config_options(self): print("########################## config_options ##########################") @@ -128,7 +129,7 @@ def build(self): if arch == "armv8": arch = "aarch64" subprocess.call( - f"cd ../.. && ./build.sh -x {self.settings.arch} {option} --no-examples --no-tests", shell=True) + f"pwd && cd ../.. && ./build.sh -x {self.settings.arch} {option} --no-examples --no-tests", shell=True) def package(self): print("########################## package ##########################") diff --git a/install_dependencies.sh b/install_dependencies.sh index 0f168153..b501ec8d 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -38,8 +38,8 @@ Arguments: " } -PREPARE_MIXED_BUILD="true" BUILD_TYPE="Release" +PREPARE_MIXED_BUILD="true" BUILD_ARCH=$(arch) HOST_ARCH=${BUILD_ARCH} WHICH_DEPS_TO_BUILD="missing" @@ -95,10 +95,11 @@ echo "Build arch ${BUILD_ARCH}" echo "Host arch ${HOST_ARCH}" echo "Building deps ${WHICH_DEPS_TO_BUILD}" -HOST_PROFILE=".conan/profiles/linux_${HOST_ARCH}" -BUILD_PROFILE=".conan/profiles/linux_${BUILD_ARCH}" +HOST_PROFILE=".conan/profiles/linux-${HOST_ARCH}" +BUILD_PROFILE=".conan/profiles/linux-${BUILD_ARCH}" if [ "${PREPARE_MIXED_BUILD}" == "true" ]; then + echo "Installing dependencies for \"mixed\" build: Dependencies in Release mode, SDK/examples/tests in Debug mode ..." conan install \ -pr:h ${HOST_PROFILE} \ -pr:b ${BUILD_PROFILE} \ @@ -108,6 +109,7 @@ if [ "${PREPARE_MIXED_BUILD}" == "true" ]; then . fi +echo "Installing dependencies for uniform build in ${BUILD_TYPE} mode ..." conan install \ -pr:h ${HOST_PROFILE} \ -pr:b ${BUILD_PROFILE} \ diff --git a/sdk/CMakeUserPresets.json b/sdk/CMakeUserPresets.json deleted file mode 100644 index 86631f32..00000000 --- a/sdk/CMakeUserPresets.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "version": 4, - "vendor": { - "conan": {} - }, - "include": [ - "../build/Debug/generators/CMakePresets.json", - "../build/Release/generators/CMakePresets.json" - ] -} \ No newline at end of file diff --git a/sdk/src/CMakeLists.txt b/sdk/src/CMakeLists.txt index a16c7c6f..23b0e28c 100644 --- a/sdk/src/CMakeLists.txt +++ b/sdk/src/CMakeLists.txt @@ -53,10 +53,6 @@ target_include_directories(${TARGET_NAME} ${gRPC_INCLUDE_DIRS} ../include PRIVATE - ${nlohmann_json_INCLUDE_DIRS} - ${protobuf_INCLUDE_DIRS} - ${PahoMqttCpp_INCLUDE_DIRS} - ${eclipse-paho-mqtt-c_INCLUDE_DIRS} . ) From 20a5a71738be3f478718bc97b27097b270e44b49 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Wed, 26 Mar 2025 15:51:56 +0000 Subject: [PATCH 10/40] wip --- .pre-commit-config.yaml | 2 +- .vscode/launch.json | 8 ++++---- build.sh | 12 ++++++++---- conanfile.py | 6 +++--- sdk/src/sdk/vdb/grpc/kuksa_val_v2/BrokerClient.cpp | 4 ++-- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ecf345bd..b9dd261c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,7 +43,7 @@ repos: "--suppress=uninitMemberVar", "--suppress=unmatchedSuppression", # suppress all warnings for generated code - "--suppress=*:build/*", + "--suppress=*:build*/*", "--suppress=*:app/vehicle_model/*", "--suppress=*:examples/vehicle_model/*", ] diff --git a/.vscode/launch.json b/.vscode/launch.json index 9d6998a0..219eec0e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,7 @@ "name": "SDK - Unit Tests", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/Debug/bin/sdk_utests", + "program": "${workspaceFolder}/build/bin/sdk_utests", "args": [ ], "stopAtEntry": false, "cwd": "${workspaceFolder}", @@ -21,7 +21,7 @@ "name": "Example - SeatAdjuster", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/Debug/bin/example-seatadjusterapp", + "program": "${workspaceFolder}/build/bin/example-seatadjusterapp", "args": [ ], "stopAtEntry": false, "cwd": "${workspaceFolder}", @@ -47,7 +47,7 @@ "name": "Example - SetDataPointsExample", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/Debug/bin/example-set-data-points", + "program": "${workspaceFolder}/build/bin/example-set-data-points", "args": [ ], "stopAtEntry": false, "cwd": "${workspaceFolder}", @@ -73,7 +73,7 @@ "name": "Example - Performance Subscribe", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/Debug/bin/example-performance-subscribe", + "program": "${workspaceFolder}/build/bin/example-performance-subscribe", "args": [ "${workspaceFolder}/examples/performance-subscribe/subscription_signals.json" ], "stopAtEntry": false, "cwd": "${workspaceFolder}", diff --git a/build.sh b/build.sh index c0d8eb70..8b6c3ed9 100755 --- a/build.sh +++ b/build.sh @@ -123,11 +123,15 @@ if [ "${GEN_COVERAGE}" == "ON" ]; then CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} --coverage" fi -BUILD_FOLDER=build -if [[ "${BUILD_ARCH}" != "${HOST_ARCH}" ]]; then - BUILD_FOLDER=build-${HOST_OS}-${HOST_ARCH} +# BUILD_FOLDER=build +# if [[ "${BUILD_ARCH}" != "${HOST_ARCH}" ]]; then +# BUILD_FOLDER=build-${HOST_OS}-${HOST_ARCH} +# fi +# BUILD_FOLDER=${BUILD_FOLDER}/${BUILD_TYPE} +BUILD_FOLDER=build-${HOST_OS}-${HOST_ARCH}/${BUILD_TYPE} +if [[ "${BUILD_ARCH}" == "${HOST_ARCH}" ]]; then + ln -snf ${BUILD_FOLDER} build fi -BUILD_FOLDER=${BUILD_FOLDER}/${BUILD_TYPE} echo "Using build foler ${BUILD_FOLDER}" SRC_FOLDER=$(pwd) diff --git a/conanfile.py b/conanfile.py index 9861bd5b..674e752a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -106,7 +106,8 @@ def layout(self): cmake_layout( self, src_folder="sdk", - build_folder="build" if not cross_building(self) else f"build-{os}-{arch}", + #build_folder="build" if not cross_building(self) else f"build-{os}-{arch}", + build_folder=f"build-{os}-{arch}", ) def generate(self): @@ -129,12 +130,11 @@ def build(self): if arch == "armv8": arch = "aarch64" subprocess.call( - f"pwd && cd ../.. && ./build.sh -x {self.settings.arch} {option} --no-examples --no-tests", shell=True) + f"cd ../.. && ./build.sh -x {self.settings.arch} {option} --no-examples --no-tests", shell=True) def package(self): print("########################## package ##########################") self.copy("*.h", src="../sdk/include", dst="include", keep_path=True) - self.copy("*.h", src="../build/sdk/proto", dst="include", keep_path=True) self.copy("*.a", src="../build/lib", dst="lib", keep_path=False) def package_info(self): diff --git a/sdk/src/sdk/vdb/grpc/kuksa_val_v2/BrokerClient.cpp b/sdk/src/sdk/vdb/grpc/kuksa_val_v2/BrokerClient.cpp index f32a58bc..dc5de031 100644 --- a/sdk/src/sdk/vdb/grpc/kuksa_val_v2/BrokerClient.cpp +++ b/sdk/src/sdk/vdb/grpc/kuksa_val_v2/BrokerClient.cpp @@ -211,8 +211,8 @@ BrokerClient::setDatapoints(const std::vector>& namespace { void clearUpdateStatus(DataPointMap_t& datapointMap) { - for (const auto& [key, value] : datapointMap) { - value->clearUpdateStatus(); + for (auto& entry : datapointMap) { + entry.second->clearUpdateStatus(); } } From 8c07a18006cfd660ed599991350c02b208ee1c81 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Wed, 26 Mar 2025 16:40:13 +0000 Subject: [PATCH 11/40] wip --- CMakeLists.txt | 3 +++ conanfile.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 92f72018..120cf0fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,9 @@ find_package(eclipse-paho-mqtt-c REQUIRED CONFIG) find_package(protobuf REQUIRED CONFIG) find_package(absl REQUIRED CONFIG) +# Induce to put executables into the bin folder of the current build folder +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) + if(STATIC_BUILD) set(BUILD_SHARED_LIBS OFF) set(CMAKE_EXE_LINKER_FLAGS "-static") diff --git a/conanfile.py b/conanfile.py index 674e752a..a818561a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -135,7 +135,7 @@ def build(self): def package(self): print("########################## package ##########################") self.copy("*.h", src="../sdk/include", dst="include", keep_path=True) - self.copy("*.a", src="../build/lib", dst="lib", keep_path=False) + self.copy("*.a", src=f"{self.build_folder}/lib", dst="lib", keep_path=False) def package_info(self): print("########################## package_info ##########################") From 6e3687899d8b0af1241507be1aa07698f4841379 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Thu, 27 Mar 2025 07:22:37 +0000 Subject: [PATCH 12/40] try --- conanfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/conanfile.py b/conanfile.py index a818561a..916b56a9 100644 --- a/conanfile.py +++ b/conanfile.py @@ -65,9 +65,13 @@ def set_version(self): if version_tag_pattern.match(tag): tag = tag[1:] # cut off initial v if a semver tag + print("Try getting branch name ...") version = tag if tag else git.run("symbolic-ref -q --short HEAD").strip() + print(f"{tag=}, {version=}") if not version: + print("Try getting commit hash ...") version = git.get_commit(repository=True) + print(f"{version=}") self.version = version.replace("/", ".") open("./version.txt", mode="w", encoding="utf-8").write(self.version) except: From 9666697ad1505e01e2e4d06d6b33aa64716bbd06 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Thu, 27 Mar 2025 07:26:14 +0000 Subject: [PATCH 13/40] try --- conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 916b56a9..e6a6c828 100644 --- a/conanfile.py +++ b/conanfile.py @@ -74,7 +74,8 @@ def set_version(self): print(f"{version=}") self.version = version.replace("/", ".") open("./version.txt", mode="w", encoding="utf-8").write(self.version) - except: + except Exception as exc: + print(f"Exception: {exc}") print("Maybe not a git repository, reading version from static file...") if os.path.isfile("./version.txt"): self.version = open("./version.txt", encoding="utf-8").read().strip() From f97f65cdf30160a0030da1d71493d2b491a55188 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Thu, 27 Mar 2025 07:27:50 +0000 Subject: [PATCH 14/40] try2 --- conanfile.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/conanfile.py b/conanfile.py index e6a6c828..354afdc8 100644 --- a/conanfile.py +++ b/conanfile.py @@ -66,7 +66,17 @@ def set_version(self): tag = tag[1:] # cut off initial v if a semver tag print("Try getting branch name ...") - version = tag if tag else git.run("symbolic-ref -q --short HEAD").strip() + # version = tag if tag else git.run("symbolic-ref -q --short HEAD").strip() + version = tag + if not version: + version = ( + subprocess.run( + ["git", "symbolic-ref", "-q", "--short", "HEAD"], + capture_output=True, + ) + .stdout.strip() + .decode("utf-8") + ) print(f"{tag=}, {version=}") if not version: print("Try getting commit hash ...") @@ -75,7 +85,7 @@ def set_version(self): self.version = version.replace("/", ".") open("./version.txt", mode="w", encoding="utf-8").write(self.version) except Exception as exc: - print(f"Exception: {exc}") + print(f"Exception catched: {exc}") print("Maybe not a git repository, reading version from static file...") if os.path.isfile("./version.txt"): self.version = open("./version.txt", encoding="utf-8").read().strip() From ea426f60147efc1b05667f520ca3de3ee091c007 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Thu, 27 Mar 2025 13:12:09 +0000 Subject: [PATCH 15/40] try3 --- .github/workflows/ci.yml | 4 ++-- .vscode/tasks.json | 2 +- conanfile.py | 33 ++++++++++++--------------------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c30cb9a2..2e30b0f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: - name: Create conan package run: | - conan create --build=missing -pr:b ./.conan/profiles/linux-x86_64 -pr:h ./.conan/profiles/${{ matrix.host }} -s:a="build_type=Release" . ci/testing + conan create --build=missing -pr:b ./.conan/profiles/linux-x86_64 -pr:h ./.conan/profiles/${{ matrix.host }} -s:a="build_type=Release" . --user ci --channel testing build-and-publish: runs-on: ubuntu-22.04 @@ -84,7 +84,7 @@ jobs: run: build/bin/sdk_utests - name: Generate coverage report - run: cd build && gcovr -r .. + run: cd build && gcovr -r ../.. - name: Code Coverage Summary Report uses: irongut/CodeCoverageSummary@v1.3.0 diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 4acf3eb1..28c8de98 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -56,7 +56,7 @@ "label": "CPP - Calculate code coverage", "detail": "Calculates code coverage of the c++ SDK", "type": "shell", - "command": "cd build && gcovr -r ..", + "command": "cd build && gcovr -r ../..", "group": "none", "dependsOn": [ "CMake: Run Tests" diff --git a/conanfile.py b/conanfile.py index 354afdc8..6eb335e9 100644 --- a/conanfile.py +++ b/conanfile.py @@ -19,8 +19,6 @@ from conan import ConanFile from conan.tools.build import cross_building from conan.tools.cmake import CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.scm import Git - class VehicleAppCppSdkConan(ConanFile): @@ -54,34 +52,27 @@ class VehicleAppCppSdkConan(ConanFile): # Sources are located in the same place as this recipe, copy them to the recipe exports_sources = ".scripts/common.sh", "build.sh", "install_dependencies.sh", "CMakeLists.txt", "sdk/*", "examples/*", "conanfile.py", ".conan/profiles/*", "cmake/*", "version.txt" + def __run_cmd(self, args): + return subprocess.run(args, capture_output=True).stdout.strip().decode("utf-8") + def set_version(self): print("########################## set_version ##########################") - print("Determining SDK version ...") try: - git = Git(self, folder=".") - tag = git.run("tag --points-at HEAD").strip() + tag = self.__run_cmd(["git", "tag", "--points-at", "HEAD"]) + version = "" if tag: version_tag_pattern = re.compile(r"^v[0-9]+(\.[0-9]+){0,2}") if version_tag_pattern.match(tag): tag = tag[1:] # cut off initial v if a semver tag + version = tag - print("Try getting branch name ...") - # version = tag if tag else git.run("symbolic-ref -q --short HEAD").strip() - version = tag + # if no tag, use branch name or commit hash if not version: - version = ( - subprocess.run( - ["git", "symbolic-ref", "-q", "--short", "HEAD"], - capture_output=True, - ) - .stdout.strip() - .decode("utf-8") - ) - print(f"{tag=}, {version=}") + version = self.__run_cmd(["git", "symbolic-ref", "-q", "--short", "HEAD"]) if not version: - print("Try getting commit hash ...") - version = git.get_commit(repository=True) - print(f"{version=}") + version = self.__run_cmd(["git", "rev-parse", "HEAD"]) + + # / is not allowed in conan version self.version = version.replace("/", ".") open("./version.txt", mode="w", encoding="utf-8").write(self.version) except Exception as exc: @@ -91,7 +82,7 @@ def set_version(self): self.version = open("./version.txt", encoding="utf-8").read().strip() else: raise FileNotFoundError("Missing version.txt!") - print(f"SDK version: {self.version}") + print(f"Determined SDK version: {self.version}") def config_options(self): print("########################## config_options ##########################") From b1a61e8b245f90d6d7689b42eba5d7a1033cf55b Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Thu, 27 Mar 2025 13:46:48 +0000 Subject: [PATCH 16/40] try4 --- conanfile.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/conanfile.py b/conanfile.py index 6eb335e9..4b73ecc4 100644 --- a/conanfile.py +++ b/conanfile.py @@ -17,8 +17,9 @@ import subprocess from conan import ConanFile -from conan.tools.build import cross_building +#from conan.tools.build import cross_building from conan.tools.cmake import CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy class VehicleAppCppSdkConan(ConanFile): @@ -140,8 +141,8 @@ def build(self): def package(self): print("########################## package ##########################") - self.copy("*.h", src="../sdk/include", dst="include", keep_path=True) - self.copy("*.a", src=f"{self.build_folder}/lib", dst="lib", keep_path=False) + copy(self, "*.h", src="../sdk/include", dst="include", keep_path=True) + copy(self, "*.a", src=f"{self.build_folder}/lib", dst="lib", keep_path=False) def package_info(self): print("########################## package_info ##########################") @@ -153,7 +154,7 @@ def package_info(self): def imports(self): print("########################## imports ##########################") - self.copy("license*", src=".", dst="./licenses", + copy(self, "license*", src=".", dst="./licenses", folder=True, ignore_case=True) From c3049f40424c149cfc268e5de5ec321fbaaeea87 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Thu, 27 Mar 2025 14:26:44 +0000 Subject: [PATCH 17/40] try 5 --- .github/workflows/ci.yml | 4 +++- .vscode/tasks.json | 4 +++- test_package/conanfile.py | 13 +++++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e30b0f0..34361891 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,7 +84,9 @@ jobs: run: build/bin/sdk_utests - name: Generate coverage report - run: cd build && gcovr -r ../.. + # 'build' folder is a symlink. Assigning pwd to ROOT_DIR makes this independent + # of the number of dirs covered by the symlink + run: ROOT_DIR=$(pwd) && cd build && gcovr -r $ROOT_DIR - name: Code Coverage Summary Report uses: irongut/CodeCoverageSummary@v1.3.0 diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 28c8de98..955c2dab 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -56,7 +56,9 @@ "label": "CPP - Calculate code coverage", "detail": "Calculates code coverage of the c++ SDK", "type": "shell", - "command": "cd build && gcovr -r ../..", + // 'build' folder is a symlink. Assigning pwd to ROOT_DIR makes this independent + // of the number of dirs covered by the symlink + "command": "ROOT_DIR=$(pwd) && cd build && gcovr -r $ROOT_DIR", "group": "none", "dependsOn": [ "CMake: Run Tests" diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 221c1229..976fcada 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -13,19 +13,21 @@ # SPDX-License-Identifier: Apache-2.0 import os -from conan.tools.cmake import CMake + +from conan import ConanFile from conan.tools.build import can_run -from conans import ConanFile +from conan.tools.cmake import CMake, cmake_layout class VehicleAppSdkTest(ConanFile): + test_type = "explicit" name = "vehicle_app_sdk_test" license = "Apache-2.0" url = "https://github.com/eclipse-velocitas/vehicle-app-cpp-sdk" settings = "os", "compiler", "build_type", "arch" - generators = "CMakeToolchain", "CMakeDeps" + generators = "CMakeDeps", "CMakeToolchain" def requirements(self): self.requires(self.tested_reference_str) @@ -35,7 +37,10 @@ def build(self): cmake.configure() cmake.build() + def layout(self): + cmake_layout(self, src_folder=".") + def test(self): - cmd = os.path.join(self.build_folder, "test_package") + cmd = os.path.join(self.cpp.build.bindir, "test_package") if can_run(self): self.run(f"SDV_MIDDLEWARE_TYPE=native {cmd}", env="conanrun") From 5ed2f49839896063e87470884bae908d5ae1300a Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Fri, 28 Mar 2025 08:29:33 +0000 Subject: [PATCH 18/40] try6 --- .github/workflows/check-licenses.yml | 2 +- .github/workflows/check-updates.yml | 2 +- .github/workflows/ci.yml | 5 ++--- .github/workflows/ensure-lifecycle.yml | 2 +- .velocitas-lock.json | 2 +- .velocitas.json | 2 +- conanfile.py | 9 ++++----- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/check-licenses.yml b/.github/workflows/check-licenses.yml index e2cffa66..9e073bf5 100644 --- a/.github/workflows/check-licenses.yml +++ b/.github/workflows/check-licenses.yml @@ -1,5 +1,5 @@ # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2022-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at diff --git a/.github/workflows/check-updates.yml b/.github/workflows/check-updates.yml index 81fa6fb6..d6f2cac7 100644 --- a/.github/workflows/check-updates.yml +++ b/.github/workflows/check-updates.yml @@ -1,5 +1,5 @@ # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2024 Contributors to the Eclipse Foundation +# Copyright (c) 2024-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34361891..db36b3ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2022-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at @@ -38,7 +38,6 @@ jobs: host: ["linux-x86_64"] fail-fast: false - steps: - name: Checkout repository uses: actions/checkout@v4 @@ -84,7 +83,7 @@ jobs: run: build/bin/sdk_utests - name: Generate coverage report - # 'build' folder is a symlink. Assigning pwd to ROOT_DIR makes this independent + # If 'build' folder is a symlink, assigning pwd to ROOT_DIR makes this independent # of the number of dirs covered by the symlink run: ROOT_DIR=$(pwd) && cd build && gcovr -r $ROOT_DIR diff --git a/.github/workflows/ensure-lifecycle.yml b/.github/workflows/ensure-lifecycle.yml index c6a88b9c..77a22c4b 100644 --- a/.github/workflows/ensure-lifecycle.yml +++ b/.github/workflows/ensure-lifecycle.yml @@ -1,5 +1,5 @@ # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2023-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at diff --git a/.velocitas-lock.json b/.velocitas-lock.json index 82147a6d..d17a1d29 100644 --- a/.velocitas-lock.json +++ b/.velocitas-lock.json @@ -3,6 +3,6 @@ "devenv-runtimes": "v4.1.0", "devenv-devcontainer-setup": "v2.5.4", "devenv-github-templates": "v1.0.5", - "devenv-github-workflows": "v6.1.3" + "devenv-github-workflows": "@conan2" } } diff --git a/.velocitas.json b/.velocitas.json index 4b68cc8e..0aa6a9c0 100644 --- a/.velocitas.json +++ b/.velocitas.json @@ -3,7 +3,7 @@ "devenv-runtimes": "v4.1.0", "devenv-devcontainer-setup": "v2.5.4", "devenv-github-templates": "v1.0.5", - "devenv-github-workflows": "v6.1.3" + "devenv-github-workflows": "@conan2" }, "components": [ "devcontainer-setup", diff --git a/conanfile.py b/conanfile.py index 4b73ecc4..df15070b 100644 --- a/conanfile.py +++ b/conanfile.py @@ -41,7 +41,7 @@ class VehicleAppCppSdkConan(ConanFile): #("zlib/1.3.1", "override") ] generators = "CMakeDeps", "CMakeToolchain" - author = "Robert Bosch GmbH" + author = "Contributors to the Eclipse Foundation, SDV Working Group" # Binary configuration settings = "os", "compiler", "build_type", "arch" @@ -146,16 +146,15 @@ def package(self): def package_info(self): print("########################## package_info ##########################") + self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.includedirs = ["include"] self.cpp_info.libdirs = ["lib"] self.cpp_info.bindirs = ["bin"] - self.cpp_info.libs = ["vehicle-app-sdk", - "vehicle-app-sdk-generated-grpc"] + self.cpp_info.libs = ["vehicle-app-sdk", "vehicle-app-sdk-generated-grpc"] def imports(self): print("########################## imports ##########################") - copy(self, "license*", src=".", dst="./licenses", - folder=True, ignore_case=True) + copy(self, "license*", src=".", dst="./licenses", folder=True, ignore_case=True) From 31e3cdad317f4e8fd276a1fe760f546c1dcc126e Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Wed, 2 Apr 2025 16:41:38 +0000 Subject: [PATCH 19/40] wip --- conanfile.py | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/conanfile.py b/conanfile.py index df15070b..62345a20 100644 --- a/conanfile.py +++ b/conanfile.py @@ -141,20 +141,37 @@ def build(self): def package(self): print("########################## package ##########################") - copy(self, "*.h", src="../sdk/include", dst="include", keep_path=True) - copy(self, "*.a", src=f"{self.build_folder}/lib", dst="lib", keep_path=False) + inc_dir = os.path.join(self.source_folder, "include") + print(f"Include folder: {inc_dir}") + copy( + self, + "*.h", + src=os.path.join(self.source_folder, "include"), + dst=os.path.join(self.package_folder, "include"), + keep_path=True, + ) + copy( + self, + "*.a", + src=self.build_folder, + dst=os.path.join(self.package_folder, "lib"), + keep_path=False, + ) def package_info(self): print("########################## package_info ##########################") - self.cpp_info.set_property("cmake_find_mode", "both") - self.cpp_info.includedirs = ["include"] - self.cpp_info.libdirs = ["lib"] - self.cpp_info.bindirs = ["bin"] + #print(f"{self.cpp_info.components=}") + #self.cpp_info.set_property("cmake_find_mode", "both") + # self.cpp_info.includedirs = ["include"] + # self.cpp_info.libdirs = ["lib"] + # self.cpp_info.bindirs = ["bin"] + self.cpp_info.set_property("cmake_file_name", "vehicle-app-sdk") + self.cpp_info.set_property("cmake_target_name", "vehicle-app-sdk::vehicle-app-sdk") self.cpp_info.libs = ["vehicle-app-sdk", "vehicle-app-sdk-generated-grpc"] - def imports(self): - print("########################## imports ##########################") - copy(self, "license*", src=".", dst="./licenses", folder=True, ignore_case=True) + # def imports(self): + # print("########################## imports ##########################") + # copy(self, "license*", src=".", dst="./licenses", folder=True, ignore_case=True) From 6f538c81a5e99b4bbb9408e93e8c5046dc6b1c3c Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Mon, 7 Apr 2025 18:03:04 +0000 Subject: [PATCH 20/40] TestPackage working --- conanfile.py | 52 +++---------------------------------- test_package/CMakeLists.txt | 2 +- test_package/conanfile.py | 4 +-- 3 files changed, 6 insertions(+), 52 deletions(-) diff --git a/conanfile.py b/conanfile.py index 62345a20..72bbbb28 100644 --- a/conanfile.py +++ b/conanfile.py @@ -165,57 +165,11 @@ def package_info(self): # self.cpp_info.includedirs = ["include"] # self.cpp_info.libdirs = ["lib"] # self.cpp_info.bindirs = ["bin"] - self.cpp_info.set_property("cmake_file_name", "vehicle-app-sdk") - self.cpp_info.set_property("cmake_target_name", "vehicle-app-sdk::vehicle-app-sdk") + # self.cpp_info.set_property("cmake_file_name", "vehicle-app-sdk") + # self.cpp_info.set_property("cmake_target_name", "vehicle-app-sdk::vehicle-app-sdk") + # self.cpp_info.set_property("pkg_config_name", "vehicle-app-sdk") self.cpp_info.libs = ["vehicle-app-sdk", "vehicle-app-sdk-generated-grpc"] # def imports(self): # print("########################## imports ##########################") # copy(self, "license*", src=".", dst="./licenses", folder=True, ignore_case=True) - - - - def build_id(self): - print("########################## build_id ##########################") - - def compatibility(self): - print("########################## compatibility ##########################") - - def build_id(self): - print("########################## build_id ##########################") - - def deploy(self): - print("########################## deploy ##########################") - - def export(self): - print("########################## export ##########################") - - def export_sources(self): - print("########################## export_sources ##########################") - - def finalize(self): - print("########################## finalize ##########################") - - def init(self): - print("########################## init ##########################") - - def package_id(self): - print("########################## package_id ##########################") - - def set_name(self): - print("########################## set_name ##########################") - - def source(self): - print("########################## source ##########################") - - def system_requirements(self): - print("########################## system_requirements ##########################") - - def test(self): - print("########################## test ##########################") - - def validate(self): - print("########################## validate ##########################") - - def validate_build(self): - print("########################## validate_build ##########################") diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt index 9ac057ef..82740686 100644 --- a/test_package/CMakeLists.txt +++ b/test_package/CMakeLists.txt @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.16) project(test_package) -find_package(vehicle-app-sdk QUIET) +find_package(vehicle-app-sdk CONFIG REQUIRED) if(NOT vehicle-app-sdk_FOUND) message(FATAL_ERROR "This project can only be built with a 'conan create' command in the parent directory!") diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 976fcada..c94d4d23 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -38,9 +38,9 @@ def build(self): cmake.build() def layout(self): - cmake_layout(self, src_folder=".") + cmake_layout(self) # , src_folder=".") def test(self): - cmd = os.path.join(self.cpp.build.bindir, "test_package") if can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "test_package") self.run(f"SDV_MIDDLEWARE_TYPE=native {cmd}", env="conanrun") From 8b21aecd07a191e78bc07853809189b184503353 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Tue, 8 Apr 2025 10:49:57 +0000 Subject: [PATCH 21/40] Some cleanup --- CMakeLists.txt | 10 ----- NOTICE.md | 26 ++++------- build.sh | 6 --- conanfile.py | 65 ++++++--------------------- examples/CMakeLists.txt | 10 ----- examples/seat-adjuster/CMakeLists.txt | 10 ----- test_package/conanfile.py | 2 +- 7 files changed, 23 insertions(+), 106 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 120cf0fb..b8127758 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,16 +22,6 @@ set(CMAKE_CXX_STANDARD 17) project(VehicleAppCppSdk CXX) -# get_cmake_property(_variableNames VARIABLES) -# list (SORT _variableNames) -# message(STATUS "------------------------------------------------------------------------------------------------------") -# message(STATUS "${CMAKE_CURRENT_LIST_DIR}") -# message(STATUS "------------------------------------------------------------------------------------------------------") -# foreach (_variableName ${_variableNames}) -# message(STATUS "${_variableName}=${${_variableName}}") -# endforeach() -# message(STATUS "------------------------------------------------------------------------------------------------------") - find_package(fmt REQUIRED CONFIG) find_package(gRPC REQUIRED CONFIG) find_package(nlohmann_json REQUIRED CONFIG) diff --git a/NOTICE.md b/NOTICE.md index 29061ee9..94c002af 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -51,24 +51,14 @@ they are given here (manually added) for time being: | Dependency | Version | License | |:-----------|:-------:|--------:| -|abseil|20240116.2|Apache 2.0| -|bzip2|1.0.8|bzip2-1.0.8| -|c-ares|1.34.1|c-ares (MIT-style)| -|fmt|11.0.2|MIT| -|grpc|1.67.1|Apache 2.0| -|libcap|2.69|BSD-3-Clause, GPL-2.0-only| -|libmount|2.39.2|LGPL-2.1-or-later| -|libselinux|3.6|libselinux-1.0, LGPL-2.1-or-later| -|libsystemd|255.10|LGPL-2.1-or-later| -|libxcrypt|4.4.36|LGPL-2.1-or-later| -|lz4|1.9.4|BSD-3-Clause, BSD-2-Clause| +|abseil|20230802.1|Apache 2.0| +|c-ares|1.34.3|c-ares (MIT-style)| +|fmt|11.1.1|MIT| +|grpc|1.50.1|Apache 2.0| |nlohmann_json|3.11.3|MIT| -|openssl|3.3.2|OpenSSL License AND SSLeay License| +|openssl|3.4.1|Apache 2.0| |paho-mqtt-c|1.3.13|EPL 2.0 AND EDL 1.0| -|paho-mqtt-cpp|1.4.0|EPL 1.0 AND EDL 1.0| -|pcre2|10.42|BSD-3-Clause| -|protobuf|5.27.0|Google License| +|paho-mqtt-cpp|1.4.0|EPL 2.0 AND EDL 1.0| +|protobuf|3.21.12|Google License| |re2|20230301|BSD-3-Clause| -|xz_utils|5.4.5|LGPL-2.1-or-later, GPL-3.0-or-later, GPL-2.0-or-later, Unlicense| -|zlib|1.3.1|zlib/libpng license| -|zstd|1.5.5|BSD-3-Clause| +|zlib|1.3.1|zlib license| diff --git a/build.sh b/build.sh index 8b6c3ed9..a47b8b2a 100755 --- a/build.sh +++ b/build.sh @@ -123,11 +123,6 @@ if [ "${GEN_COVERAGE}" == "ON" ]; then CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} --coverage" fi -# BUILD_FOLDER=build -# if [[ "${BUILD_ARCH}" != "${HOST_ARCH}" ]]; then -# BUILD_FOLDER=build-${HOST_OS}-${HOST_ARCH} -# fi -# BUILD_FOLDER=${BUILD_FOLDER}/${BUILD_TYPE} BUILD_FOLDER=build-${HOST_OS}-${HOST_ARCH}/${BUILD_TYPE} if [[ "${BUILD_ARCH}" == "${HOST_ARCH}" ]]; then ln -snf ${BUILD_FOLDER} build @@ -152,5 +147,4 @@ cmake --no-warn-unused-cli \ -B . cmake --build . --target ${BUILD_TARGET} -source generators/deactivate_conanbuild.sh >> /dev/null popd >> /dev/null diff --git a/conanfile.py b/conanfile.py index 72bbbb28..1f34a6f1 100644 --- a/conanfile.py +++ b/conanfile.py @@ -17,8 +17,7 @@ import subprocess from conan import ConanFile -#from conan.tools.build import cross_building -from conan.tools.cmake import CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.cmake import cmake_layout from conan.tools.files import copy @@ -28,17 +27,11 @@ class VehicleAppCppSdkConan(ConanFile): url = "https://github.com/eclipse-velocitas/vehicle-app-cpp-sdk" description = "The Vehicle App SDK for c++ allows to create Vehicle Apps from the Velocitas development model in the c++ programming language." requires = [ - #("c-ares/1.19.1@#420a0b77e370f4b96bee88ef91837ccc"), - ("fmt/9.1.0"), - #("googleapis/cci.20221108@#e4bebdfa02f3b6f93bae1d5001b8d439"), + ("fmt/11.1.1"), ("grpc/1.50.1"), - #("grpc/1.50.1@#df352027120f88bccf24cbc40a2297ce"), - #("grpc-proto/cci.20220627@#3ad14e3ffdae516b4da2407d5f23c71d"), - ("nlohmann_json/3.11.2"), - #("openssl/1.1.1u@#de76bbea24d8b46f8def8daa18b31fd9"), + ("nlohmann_json/3.11.3"), ("paho-mqtt-c/1.3.13"), ("paho-mqtt-cpp/1.4.0"), - #("zlib/1.3.1", "override") ] generators = "CMakeDeps", "CMakeToolchain" author = "Contributors to the Eclipse Foundation, SDV Working Group" @@ -51,13 +44,12 @@ class VehicleAppCppSdkConan(ConanFile): exports = "version.txt" # Sources are located in the same place as this recipe, copy them to the recipe - exports_sources = ".scripts/common.sh", "build.sh", "install_dependencies.sh", "CMakeLists.txt", "sdk/*", "examples/*", "conanfile.py", ".conan/profiles/*", "cmake/*", "version.txt" + exports_sources = ".scripts/common.sh", "build.sh", "install_dependencies.sh", "CMakeLists.txt", "sdk/*", "conanfile.py", ".conan/profiles/*", "version.txt", "LICENSE" def __run_cmd(self, args): return subprocess.run(args, capture_output=True).stdout.strip().decode("utf-8") def set_version(self): - print("########################## set_version ##########################") try: tag = self.__run_cmd(["git", "tag", "--points-at", "HEAD"]) version = "" @@ -78,7 +70,7 @@ def set_version(self): open("./version.txt", mode="w", encoding="utf-8").write(self.version) except Exception as exc: print(f"Exception catched: {exc}") - print("Maybe not a git repository, reading version from static file...") + print("--> Maybe not a git repository, reading version from static file...") if os.path.isfile("./version.txt"): self.version = open("./version.txt", encoding="utf-8").read().strip() else: @@ -86,50 +78,30 @@ def set_version(self): print(f"Determined SDK version: {self.version}") def config_options(self): - print("########################## config_options ##########################") if self.settings.get_safe("os") == "Windows": self.options.rm_safe("fPIC") def configure(self): - print("########################## configure ##########################") if self.options.shared: self.options.rm_safe("fPIC") - def requirements(self): - print("########################## requirements ##########################") - def build_requirements(self): - print("########################## build_requirements ##########################") # Declare both, grpc and protobuf, here to enable proper x-build (w/o using qemu) self.tool_requires("grpc/") self.tool_requires("protobuf/") def layout(self): - print("########################## layout ##########################") os = str(self.settings.os).lower() arch = str(self.settings.arch).lower() if arch == "armv8": arch = "aarch64" cmake_layout( self, - src_folder="sdk", - #build_folder="build" if not cross_building(self) else f"build-{os}-{arch}", + src_folder=".", build_folder=f"build-{os}-{arch}", ) - def generate(self): - print("########################## generate ##########################") - print(f"{self.folders.source=}") - print(f"{self.source_folder=}") - print(f"{self.folders.build=}") - print(f"{self.build_folder=}") - print(f"{self.folders.generators=}") - print(f"{self.folders.root=}") - print(f"{self.folders.subproject=}") - print(f"{self.folders.build_folder_vars=}") - def build(self): - print("########################## build ##########################") build_type = self.settings.get_safe( "build_type", default="Release").lower() option = "-r" if build_type == "release" else "-d" @@ -140,13 +112,17 @@ def build(self): f"cd ../.. && ./build.sh -x {self.settings.arch} {option} --no-examples --no-tests", shell=True) def package(self): - print("########################## package ##########################") - inc_dir = os.path.join(self.source_folder, "include") - print(f"Include folder: {inc_dir}") + copy( + self, + "license*", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + keep_path=True, + ) copy( self, "*.h", - src=os.path.join(self.source_folder, "include"), + src=os.path.join(self.source_folder, "sdk", "include"), dst=os.path.join(self.package_folder, "include"), keep_path=True, ) @@ -159,17 +135,4 @@ def package(self): ) def package_info(self): - print("########################## package_info ##########################") - #print(f"{self.cpp_info.components=}") - #self.cpp_info.set_property("cmake_find_mode", "both") - # self.cpp_info.includedirs = ["include"] - # self.cpp_info.libdirs = ["lib"] - # self.cpp_info.bindirs = ["bin"] - # self.cpp_info.set_property("cmake_file_name", "vehicle-app-sdk") - # self.cpp_info.set_property("cmake_target_name", "vehicle-app-sdk::vehicle-app-sdk") - # self.cpp_info.set_property("pkg_config_name", "vehicle-app-sdk") self.cpp_info.libs = ["vehicle-app-sdk", "vehicle-app-sdk-generated-grpc"] - - # def imports(self): - # print("########################## imports ##########################") - # copy(self, "license*", src=".", dst="./licenses", folder=True, ignore_case=True) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 09417bec..2adbdd12 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -12,16 +12,6 @@ # # SPDX-License-Identifier: Apache-2.0 -# get_cmake_property(_variableNames VARIABLES) -# list (SORT _variableNames) -# message(STATUS "------------------------------------------------------------------------------------------------------") -# message(STATUS "${CMAKE_CURRENT_LIST_DIR}") -# message(STATUS "------------------------------------------------------------------------------------------------------") -# foreach (_variableName ${_variableNames}) -# message(STATUS "${_variableName}=${${_variableName}}") -# endforeach() -# message(STATUS "------------------------------------------------------------------------------------------------------") - add_subdirectory(example_model) # Currently only adding examples that can be tested without additional velocitas code generation diff --git a/examples/seat-adjuster/CMakeLists.txt b/examples/seat-adjuster/CMakeLists.txt index 87f360fe..beb73427 100644 --- a/examples/seat-adjuster/CMakeLists.txt +++ b/examples/seat-adjuster/CMakeLists.txt @@ -14,16 +14,6 @@ set(TARGET_NAME "example-seatadjusterapp") -# get_cmake_property(_variableNames VARIABLES) -# list (SORT _variableNames) -# message(STATUS "------------------------------------------------------------------------------------------------------") -# message(STATUS "${CMAKE_CURRENT_LIST_DIR}") -# message(STATUS "------------------------------------------------------------------------------------------------------") -# foreach (_variableName ${_variableNames}) -# message(STATUS "${_variableName}=${${_variableName}}") -# endforeach() -# message(STATUS "------------------------------------------------------------------------------------------------------") - add_executable(${TARGET_NAME} src/SeatAdjusterApp.cpp ) diff --git a/test_package/conanfile.py b/test_package/conanfile.py index c94d4d23..0f19d2f0 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -38,7 +38,7 @@ def build(self): cmake.build() def layout(self): - cmake_layout(self) # , src_folder=".") + cmake_layout(self) def test(self): if can_run(self): From 17a02c3a28046ad264e839f7fbc382b1bc7cc2a8 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Tue, 8 Apr 2025 12:58:31 +0200 Subject: [PATCH 22/40] Add test_package.sh --- .scripts/test_package.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 .scripts/test_package.sh diff --git a/.scripts/test_package.sh b/.scripts/test_package.sh new file mode 100755 index 00000000..7a6305f8 --- /dev/null +++ b/.scripts/test_package.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Copyright (c) 2022-2025 Contributors to the Eclipse Foundation +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +HOST_PROFILE=$1 +if [ "${HOST_PROFILE}" == "" ]; then + HOST_PROFILE="linux-$(arch)" + echo "Missing host profile argument - using default: ${HOST_PROFILE}" +fi + +conan create --build=missing -pr:b ./.conan/profiles/linux-x86_64 -pr:h ./.conan/profiles/${HOST_PROFILE} -s:a="build_type=Release" . --user ci --channel testing \ No newline at end of file From 8ca6f84bdac8588266b43d771962c8b7bf4e7f8b Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Tue, 8 Apr 2025 11:02:34 +0000 Subject: [PATCH 23/40] update ci workflow --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db36b3ff..0bed3177 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: - name: Create conan package run: | - conan create --build=missing -pr:b ./.conan/profiles/linux-x86_64 -pr:h ./.conan/profiles/${{ matrix.host }} -s:a="build_type=Release" . --user ci --channel testing + .scripts/test_package.sh {{ matrix.host }} build-and-publish: runs-on: ubuntu-22.04 From 4e0044719dd2d96d1da0ac2d7ff0a23672c7902a Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Tue, 8 Apr 2025 11:23:41 +0000 Subject: [PATCH 24/40] fix script call --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bed3177..24f6e055 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: - name: Create conan package run: | - .scripts/test_package.sh {{ matrix.host }} + .scripts/test_package.sh ${{ matrix.host }} build-and-publish: runs-on: ubuntu-22.04 From 5e9550e05cf8a94840093736d38cb6ef35f60731 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Wed, 9 Apr 2025 07:41:07 +0000 Subject: [PATCH 25/40] Use latest Conan --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 96219fae..1bdd2564 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ gcovr==5.2 -conan==2.12.2 +conan==2.15.0 pre-commit==3.5.0 cpplint==1.6.1 From ddc90ab273c7b25b3fb2a3a8f80db292e7f2429d Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Thu, 24 Apr 2025 07:56:54 +0000 Subject: [PATCH 26/40] Add marker for transitive headers --- conanfile.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/conanfile.py b/conanfile.py index 1f34a6f1..193e4fc8 100644 --- a/conanfile.py +++ b/conanfile.py @@ -26,13 +26,6 @@ class VehicleAppCppSdkConan(ConanFile): license = "Apache-2.0" url = "https://github.com/eclipse-velocitas/vehicle-app-cpp-sdk" description = "The Vehicle App SDK for c++ allows to create Vehicle Apps from the Velocitas development model in the c++ programming language." - requires = [ - ("fmt/11.1.1"), - ("grpc/1.50.1"), - ("nlohmann_json/3.11.3"), - ("paho-mqtt-c/1.3.13"), - ("paho-mqtt-cpp/1.4.0"), - ] generators = "CMakeDeps", "CMakeToolchain" author = "Contributors to the Eclipse Foundation, SDV Working Group" @@ -85,6 +78,13 @@ def configure(self): if self.options.shared: self.options.rm_safe("fPIC") + def requirements(self): + self.requires("fmt/11.1.1", transitive_headers=True) + self.requires("grpc/1.50.1", transitive_headers=True) + self.requires("nlohmann_json/3.11.3") + self.requires("paho-mqtt-c/1.3.13") + self.requires("paho-mqtt-cpp/1.4.0") + def build_requirements(self): # Declare both, grpc and protobuf, here to enable proper x-build (w/o using qemu) self.tool_requires("grpc/") From a09b092816cce0b32baa97b663f2b177006f67a0 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Thu, 24 Apr 2025 13:42:12 +0000 Subject: [PATCH 27/40] Try fix licensechecker --- .github/workflows/check-licenses.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-licenses.yml b/.github/workflows/check-licenses.yml index 9e073bf5..989d8522 100644 --- a/.github/workflows/check-licenses.yml +++ b/.github/workflows/check-licenses.yml @@ -42,7 +42,7 @@ jobs: uses: actions/checkout@v4 with: repository: eclipse-velocitas/license-check - ref: v1.2 + ref: bjoern_conan2 path: .github/actions/license-check - name: Run License Checker From 34c36207b300c811571d7dfe246e496e50c5b96e Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Fri, 25 Apr 2025 09:52:53 +0000 Subject: [PATCH 28/40] Update readme --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a5457bbf..e8591503 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,10 @@ ![SDK CI Workflow](https://github.com/eclipse-velocitas/vehicle-app-cpp-sdk/actions/workflows/ci.yml/badge.svg) [![License: Apache](https://img.shields.io/badge/License-Apache-yellow.svg)](http://www.apache.org/licenses/LICENSE-2.0) +> [!IMPORTANT] +> We sucessfully migrated our C++ repositories to use version 2 of the Conan package manager. +> Unfortunately, those changes are not backwards compatible. So, please be ware that newer versions of the C++ SDK (>= v0.7.0) cannot be used together with older Velocitas packages, base images, and C++ template contents. + The Vehicle App SDK for C++ allows to create `Vehicle Apps` from the [Velocitas Development Model](https://eclipse.dev/velocitas/docs/concepts/development_model/) in the C++ programming language. ## Folder structure @@ -74,7 +78,6 @@ You can configure the middleware to be used (currently only `native` is supporte | Middleware | Environment Variable | Default | Meaning |------------|---------------------------------|---------------------|------------------------------------ | | `SDV_MIDDLEWARE_TYPE` | `native` | Defines the middleware to be used by the app (currently only `native` is supported) -| | native | `SDV_MQTT_ADDRESS` | `localhost:1883` | Address of the MQTT broker | | `SDV_VEHICLEDATABROKER_ADDRESS` | `localhost:55555` | Address of the Kuksa (Vehicle) Data Broker From e190fe388609868cc6c168099099bc0958dced1c Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Fri, 25 Apr 2025 09:54:48 +0000 Subject: [PATCH 29/40] GH do your work From f3904a03c54200ec9dc8562e17aac44ee57e36c8 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Fri, 25 Apr 2025 12:01:22 +0200 Subject: [PATCH 30/40] Update NOTICE-3RD-PARTY-CONTENT.md --- NOTICE-3RD-PARTY-CONTENT.md | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/NOTICE-3RD-PARTY-CONTENT.md b/NOTICE-3RD-PARTY-CONTENT.md index 8f517f78..91d354b3 100644 --- a/NOTICE-3RD-PARTY-CONTENT.md +++ b/NOTICE-3RD-PARTY-CONTENT.md @@ -3,37 +3,32 @@ ## Python | Dependency | Version | License | |:-----------|:-------:|--------:| -|bottle|0.12.25|MIT| |certifi|2025.1.31|Mozilla Public License 2.0| |cfgv|3.4.0|MIT| |charset-normalizer|3.4.1|MIT| |colorama|0.4.6|BSD| -|conan|1.66.0|MIT| +|conan|2.15.0|MIT| |cpplint|1.6.1|New BSD| |distlib|0.3.9|Python Software Foundation License| |distro|1.8.0|Apache 2.0| |fasteners|0.19|Apache 2.0| |filelock|3.18.0|The Unlicense (Unlicense)| |gcovr|5.2|BSD| -|identify|2.6.9|MIT| +|identify|2.6.10|MIT| |idna|3.10|BSD| |jinja2|3.1.6|BSD| -|lxml|5.3.1|New BSD| +|lxml|5.4.0|New BSD| |MarkupSafe|3.0.2|BSD| -|node-semver|0.6.1|MIT| |nodeenv|1.9.1|BSD| -|patch-ng|1.17.4|MIT| +|patch-ng|1.18.1|MIT| |platformdirs|4.3.7|MIT| -|pluginbase|1.0.1|BSD| |pre-commit|3.5.0|MIT| |pygments|2.19.1|Simplified BSD| -|PyJWT|2.10.1|MIT| |python-dateutil|2.9.0.post0|Apache 2.0
BSD| |PyYAML|6.0.2|MIT| |requests|2.32.3|Apache 2.0| -|six|1.16.0|MIT| -|tqdm|4.67.1|MIT
Mozilla Public License 2.0 (MPL 2.0)| -|urllib3|1.26.20|MIT| +|six|1.17.0|MIT| +|urllib3|2.0.7|MIT| |virtualenv|20.30.0|MIT| ## Workflows | Dependency | Version | License | From 347b4c22f0492c8ed3a0f35d56f035c45e4c244d Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Fri, 25 Apr 2025 10:07:45 +0000 Subject: [PATCH 31/40] Update Conan --- NOTICE-3RD-PARTY-CONTENT.md | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NOTICE-3RD-PARTY-CONTENT.md b/NOTICE-3RD-PARTY-CONTENT.md index 91d354b3..a9d1eeaf 100644 --- a/NOTICE-3RD-PARTY-CONTENT.md +++ b/NOTICE-3RD-PARTY-CONTENT.md @@ -7,7 +7,7 @@ |cfgv|3.4.0|MIT| |charset-normalizer|3.4.1|MIT| |colorama|0.4.6|BSD| -|conan|2.15.0|MIT| +|conan|2.15.1|MIT| |cpplint|1.6.1|New BSD| |distlib|0.3.9|Python Software Foundation License| |distro|1.8.0|Apache 2.0| diff --git a/requirements.txt b/requirements.txt index 1bdd2564..9ce53bd2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ gcovr==5.2 -conan==2.15.0 +conan==2.15.1 pre-commit==3.5.0 cpplint==1.6.1 From ff2e46c0189c0466bc209398b066943419661dfc Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Fri, 25 Apr 2025 13:48:27 +0000 Subject: [PATCH 32/40] Update packages --- .devcontainer/Dockerfile | 4 ++-- .devcontainer/scripts/configure-codespaces.sh | 2 +- .devcontainer/scripts/configure-proxies.sh | 2 +- .devcontainer/scripts/container-set.sh | 2 +- .devcontainer/scripts/onCreateCommand.sh | 2 +- .devcontainer/scripts/postStartCommand.sh | 6 ++++-- .devcontainer/scripts/reinstall-cmake.sh | 2 +- .devcontainer/scripts/setup-dependencies.sh | 2 +- .devcontainer/scripts/setup-git.sh | 2 +- .devcontainer/scripts/upgrade-cli.sh | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/ensure-lifecycle.yml | 2 +- .velocitas-lock.json | 2 +- .velocitas.json | 2 +- 14 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index aa011a81..b4650d4c 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2022-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at @@ -13,7 +13,7 @@ # # SPDX-License-Identifier: Apache-2.0 -FROM ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:v0.3 +FROM ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:5cb71f75c9dbf10151d18f16867717cc1c79554d ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE ENV REINSTALL_CMAKE_VERSION_FROM_SOURCE="${REINSTALL_CMAKE_VERSION_FROM_SOURCE:-none}" diff --git a/.devcontainer/scripts/configure-codespaces.sh b/.devcontainer/scripts/configure-codespaces.sh index c87599af..0a659582 100755 --- a/.devcontainer/scripts/configure-codespaces.sh +++ b/.devcontainer/scripts/configure-codespaces.sh @@ -1,6 +1,6 @@ #!/bin/bash # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2023-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at diff --git a/.devcontainer/scripts/configure-proxies.sh b/.devcontainer/scripts/configure-proxies.sh index a74bb7a6..14157619 100755 --- a/.devcontainer/scripts/configure-proxies.sh +++ b/.devcontainer/scripts/configure-proxies.sh @@ -1,6 +1,6 @@ #!/bin/bash # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2022-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at diff --git a/.devcontainer/scripts/container-set.sh b/.devcontainer/scripts/container-set.sh index 2bdbf633..eb21ca7f 100755 --- a/.devcontainer/scripts/container-set.sh +++ b/.devcontainer/scripts/container-set.sh @@ -1,6 +1,6 @@ #!/bin/bash # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2022-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at diff --git a/.devcontainer/scripts/onCreateCommand.sh b/.devcontainer/scripts/onCreateCommand.sh index d1681900..a86fb93c 100755 --- a/.devcontainer/scripts/onCreateCommand.sh +++ b/.devcontainer/scripts/onCreateCommand.sh @@ -1,6 +1,6 @@ #!/bin/bash # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2022-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at diff --git a/.devcontainer/scripts/postStartCommand.sh b/.devcontainer/scripts/postStartCommand.sh index 7481d2a0..ee557dce 100755 --- a/.devcontainer/scripts/postStartCommand.sh +++ b/.devcontainer/scripts/postStartCommand.sh @@ -1,6 +1,6 @@ #!/bin/bash # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2024 Contributors to the Eclipse Foundation +# Copyright (c) 2024-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at @@ -14,7 +14,9 @@ # # SPDX-License-Identifier: Apache-2.0 -.devcontainer/scripts/upgrade-cli.sh +if [[ -z "${VELOCITAS_OFFLINE}" ]]; then + .devcontainer/scripts/upgrade-cli.sh +fi # Call user initialization hook if present POST_START_USER_HOOK_PATH=.devcontainer/scripts/onPostStartUserHook.sh diff --git a/.devcontainer/scripts/reinstall-cmake.sh b/.devcontainer/scripts/reinstall-cmake.sh index 99d5d9a6..b727dad2 100755 --- a/.devcontainer/scripts/reinstall-cmake.sh +++ b/.devcontainer/scripts/reinstall-cmake.sh @@ -1,6 +1,6 @@ #!/bin/bash # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2023-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at diff --git a/.devcontainer/scripts/setup-dependencies.sh b/.devcontainer/scripts/setup-dependencies.sh index 86de0e1b..9a5f4348 100755 --- a/.devcontainer/scripts/setup-dependencies.sh +++ b/.devcontainer/scripts/setup-dependencies.sh @@ -1,6 +1,6 @@ #!/bin/bash # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2022-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at diff --git a/.devcontainer/scripts/setup-git.sh b/.devcontainer/scripts/setup-git.sh index 764a086d..0b7f22d5 100755 --- a/.devcontainer/scripts/setup-git.sh +++ b/.devcontainer/scripts/setup-git.sh @@ -1,6 +1,6 @@ #!/bin/bash # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2022-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at diff --git a/.devcontainer/scripts/upgrade-cli.sh b/.devcontainer/scripts/upgrade-cli.sh index cb861418..9354deab 100755 --- a/.devcontainer/scripts/upgrade-cli.sh +++ b/.devcontainer/scripts/upgrade-cli.sh @@ -1,6 +1,6 @@ #!/bin/bash # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2023-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24f6e055..78af23a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ on: jobs: conan-package: runs-on: ubuntu-22.04 - container: ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:v0.3 + container: ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:5cb71f75c9dbf10151d18f16867717cc1c79554d name: Check Conan package strategy: matrix: @@ -58,7 +58,7 @@ jobs: build-and-publish: runs-on: ubuntu-22.04 name: "Build, Test and Lint" - container: ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:v0.3 + container: ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:5cb71f75c9dbf10151d18f16867717cc1c79554d steps: - name: Checkout repository diff --git a/.github/workflows/ensure-lifecycle.yml b/.github/workflows/ensure-lifecycle.yml index 77a22c4b..e17d8aa9 100644 --- a/.github/workflows/ensure-lifecycle.yml +++ b/.github/workflows/ensure-lifecycle.yml @@ -29,7 +29,7 @@ on: jobs: check-sync: runs-on: ubuntu-22.04 - container: ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:v0.3 + container: ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:5cb71f75c9dbf10151d18f16867717cc1c79554d name: Are files in sync? steps: diff --git a/.velocitas-lock.json b/.velocitas-lock.json index d17a1d29..c7d81c19 100644 --- a/.velocitas-lock.json +++ b/.velocitas-lock.json @@ -1,7 +1,7 @@ { "packages": { "devenv-runtimes": "v4.1.0", - "devenv-devcontainer-setup": "v2.5.4", + "devenv-devcontainer-setup": "@bjoern_conan2", "devenv-github-templates": "v1.0.5", "devenv-github-workflows": "@conan2" } diff --git a/.velocitas.json b/.velocitas.json index 0aa6a9c0..1c8e4daf 100644 --- a/.velocitas.json +++ b/.velocitas.json @@ -1,7 +1,7 @@ { "packages": { "devenv-runtimes": "v4.1.0", - "devenv-devcontainer-setup": "v2.5.4", + "devenv-devcontainer-setup": "@bjoern_conan2", "devenv-github-templates": "v1.0.5", "devenv-github-workflows": "@conan2" }, From 5258e947fa298596e336dfa57e87b253d8d976e1 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Mon, 28 Apr 2025 16:55:31 +0000 Subject: [PATCH 33/40] Update base image to v0.4 + cli to v0.13.2 --- .devcontainer/Dockerfile | 2 +- .github/workflows/ci.yml | 10 +++++----- .github/workflows/ensure-lifecycle.yml | 2 +- .velocitas.json | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index b4650d4c..bdb71e33 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -13,7 +13,7 @@ # # SPDX-License-Identifier: Apache-2.0 -FROM ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:5cb71f75c9dbf10151d18f16867717cc1c79554d +FROM ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:v0.4 ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE ENV REINSTALL_CMAKE_VERSION_FROM_SOURCE="${REINSTALL_CMAKE_VERSION_FROM_SOURCE:-none}" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78af23a6..82ff7cf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,10 +29,10 @@ on: branches: - main jobs: - conan-package: + cpp-package: runs-on: ubuntu-22.04 - container: ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:5cb71f75c9dbf10151d18f16867717cc1c79554d - name: Check Conan package + container: ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:v0.4 + name: Check C++ package strategy: matrix: host: ["linux-x86_64"] @@ -51,14 +51,14 @@ jobs: sudo apt-get update && sudo apt-get install -y ninja-build clang-format-14 clang-tidy-14 cppcheck pip3 install -r requirements.txt - - name: Create conan package + - name: Test creating the C++ package run: | .scripts/test_package.sh ${{ matrix.host }} build-and-publish: runs-on: ubuntu-22.04 name: "Build, Test and Lint" - container: ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:5cb71f75c9dbf10151d18f16867717cc1c79554d + container: ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:v0.4 steps: - name: Checkout repository diff --git a/.github/workflows/ensure-lifecycle.yml b/.github/workflows/ensure-lifecycle.yml index e17d8aa9..6271c987 100644 --- a/.github/workflows/ensure-lifecycle.yml +++ b/.github/workflows/ensure-lifecycle.yml @@ -29,7 +29,7 @@ on: jobs: check-sync: runs-on: ubuntu-22.04 - container: ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:5cb71f75c9dbf10151d18f16867717cc1c79554d + container: ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:v0.4 name: Are files in sync? steps: diff --git a/.velocitas.json b/.velocitas.json index 1c8e4daf..3c85c9ed 100644 --- a/.velocitas.json +++ b/.velocitas.json @@ -18,5 +18,5 @@ "githubRepoId": "eclipse-velocitas/vehicle-app-cpp-sdk", "appManifestPath": "examples/seat-adjuster/AppManifest.json" }, - "cliVersion": "v0.13.1" + "cliVersion": "v0.13.2" } From f1156151319e8adf6823e9fa9e4990625f45f4b6 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Mon, 28 Apr 2025 17:11:46 +0000 Subject: [PATCH 34/40] some cleanup --- .gitignore | 2 +- NOTICE-3RD-PARTY-CONTENT.md | 2 +- license_header.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c60a2c74..51894bc1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2022-2025 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at diff --git a/NOTICE-3RD-PARTY-CONTENT.md b/NOTICE-3RD-PARTY-CONTENT.md index a9d1eeaf..2fae1310 100644 --- a/NOTICE-3RD-PARTY-CONTENT.md +++ b/NOTICE-3RD-PARTY-CONTENT.md @@ -3,7 +3,7 @@ ## Python | Dependency | Version | License | |:-----------|:-------:|--------:| -|certifi|2025.1.31|Mozilla Public License 2.0| +|certifi|2025.4.26|Mozilla Public License 2.0| |cfgv|3.4.0|MIT| |charset-normalizer|3.4.1|MIT| |colorama|0.4.6|BSD| diff --git a/license_header.txt b/license_header.txt index ffd6fc73..9ef062a7 100644 --- a/license_header.txt +++ b/license_header.txt @@ -1,4 +1,4 @@ -Copyright (c) 2024 Contributors to the Eclipse Foundation +Copyright (c) 2025 Contributors to the Eclipse Foundation This program and the accompanying materials are made available under the terms of the Apache License, Version 2.0 which is available at From 48b98dba9c013dfd2a162ff56ed8cd042f0645cd Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Thu, 8 May 2025 12:32:24 +0000 Subject: [PATCH 35/40] Fix some findings --- .ort.yml | 36 ------------------------------ .scripts/test_package.sh | 2 +- README.md | 4 ++-- build.sh | 6 ++++- sdk/proto/kuksa/val/v2/types.proto | 1 - 5 files changed, 8 insertions(+), 41 deletions(-) delete mode 100644 .ort.yml diff --git a/.ort.yml b/.ort.yml deleted file mode 100644 index b80e9169..00000000 --- a/.ort.yml +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) 2022-2025 Contributors to the Eclipse Foundation -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0. -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -curations: - packages: - - id: "PyPI::identify:2.5.24" - curations: - comment: "Proper license is defined in package repository https://pypi.org/project/identify/" - concluded_license: "MIT" - - id: "Conan::c-ares:1.18.1" - curations: - comment: "Proper license is defined in package repository https://conan.io/center/c-ares" - concluded_license: "MIT" - - id: "Conan::googleapis:cci.20221108" - curations: - comment: "Proper license is defined in package repository https://conan.io/center/googleapis?version=cci.20221108" - concluded_license: "Apache-2.0" - - id: "Conan::openssl:1.1.1t" - curations: - comment: "Proper license is defined in package repository https://conan.io/center/openssl?version=1.1.1t" - concluded_license: "OpenSSL" - - id: "Conan::paho-mqtt-c:1.3.9" - curations: - comment: "Proper license is defined in package repository https://conan.io/center/paho-mqtt-c?version=1.3.9" - concluded_license: "EPL-2.0" diff --git a/.scripts/test_package.sh b/.scripts/test_package.sh index 7a6305f8..bdbe3bb5 100755 --- a/.scripts/test_package.sh +++ b/.scripts/test_package.sh @@ -19,4 +19,4 @@ if [ "${HOST_PROFILE}" == "" ]; then echo "Missing host profile argument - using default: ${HOST_PROFILE}" fi -conan create --build=missing -pr:b ./.conan/profiles/linux-x86_64 -pr:h ./.conan/profiles/${HOST_PROFILE} -s:a="build_type=Release" . --user ci --channel testing \ No newline at end of file +conan create --build=missing -pr:b ./.conan/profiles/linux-$(arch) -pr:h ./.conan/profiles/${HOST_PROFILE} -s:a="build_type=Release" . --user ci --channel testing \ No newline at end of file diff --git a/README.md b/README.md index e8591503..cce3c01f 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ [![License: Apache](https://img.shields.io/badge/License-Apache-yellow.svg)](http://www.apache.org/licenses/LICENSE-2.0) > [!IMPORTANT] -> We sucessfully migrated our C++ repositories to use version 2 of the Conan package manager. -> Unfortunately, those changes are not backwards compatible. So, please be ware that newer versions of the C++ SDK (>= v0.7.0) cannot be used together with older Velocitas packages, base images, and C++ template contents. +> We sucessfully migrated our C++ repositories to use version 2 of the [Conan package manager](https://conan.io/). +> Unfortunately, those changes are not backwards compatible. So, please be aware that newer versions of the C++ SDK (>= v0.7.0) cannot be used together with older Velocitas packages, base images, and C++ template contents. The Vehicle App SDK for C++ allows to create `Vehicle Apps` from the [Velocitas Development Model](https://eclipse.dev/velocitas/docs/concepts/development_model/) in the C++ programming language. diff --git a/build.sh b/build.sh index a47b8b2a..6bb5e0b5 100755 --- a/build.sh +++ b/build.sh @@ -124,10 +124,14 @@ if [ "${GEN_COVERAGE}" == "ON" ]; then fi BUILD_FOLDER=build-${HOST_OS}-${HOST_ARCH}/${BUILD_TYPE} +echo "Using build foler ${BUILD_FOLDER}" +# Set a symlink called 'build' to the last used build-type (release/debug) for +# a local build (i.e. host arch == build arch). This is required for easy +# access via vscod's task and launch config and for other build and test tools if [[ "${BUILD_ARCH}" == "${HOST_ARCH}" ]]; then + echo "Setting/updating symlink 'build' to ${BUILD_FOLDER}" ln -snf ${BUILD_FOLDER} build fi -echo "Using build foler ${BUILD_FOLDER}" SRC_FOLDER=$(pwd) mkdir -p ${BUILD_FOLDER} && pushd ${BUILD_FOLDER} diff --git a/sdk/proto/kuksa/val/v2/types.proto b/sdk/proto/kuksa/val/v2/types.proto index 38cb1268..8955f6de 100644 --- a/sdk/proto/kuksa/val/v2/types.proto +++ b/sdk/proto/kuksa/val/v2/types.proto @@ -14,7 +14,6 @@ syntax = "proto3"; // Please do not add optional fields due to older proto3 versions limitations - package kuksa.val.v2; import "google/protobuf/timestamp.proto"; From 294867049fd5df00a0e8f3954ec5efa40a1fa1b3 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Thu, 8 May 2025 13:09:17 +0000 Subject: [PATCH 36/40] Update license file --- NOTICE-3RD-PARTY-CONTENT.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NOTICE-3RD-PARTY-CONTENT.md b/NOTICE-3RD-PARTY-CONTENT.md index 2fae1310..95f814c7 100644 --- a/NOTICE-3RD-PARTY-CONTENT.md +++ b/NOTICE-3RD-PARTY-CONTENT.md @@ -5,7 +5,7 @@ |:-----------|:-------:|--------:| |certifi|2025.4.26|Mozilla Public License 2.0| |cfgv|3.4.0|MIT| -|charset-normalizer|3.4.1|MIT| +|charset-normalizer|3.4.2|MIT| |colorama|0.4.6|BSD| |conan|2.15.1|MIT| |cpplint|1.6.1|New BSD| @@ -21,7 +21,7 @@ |MarkupSafe|3.0.2|BSD| |nodeenv|1.9.1|BSD| |patch-ng|1.18.1|MIT| -|platformdirs|4.3.7|MIT| +|platformdirs|4.3.8|MIT| |pre-commit|3.5.0|MIT| |pygments|2.19.1|Simplified BSD| |python-dateutil|2.9.0.post0|Apache 2.0
BSD| @@ -29,7 +29,7 @@ |requests|2.32.3|Apache 2.0| |six|1.17.0|MIT| |urllib3|2.0.7|MIT| -|virtualenv|20.30.0|MIT| +|virtualenv|20.31.1|MIT| ## Workflows | Dependency | Version | License | |:-----------|:-------:|--------:| From 55c5268acda3cf7710797a5d9281dd9f95f44446 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Fri, 9 May 2025 14:12:08 +0000 Subject: [PATCH 37/40] Update readme and license checker --- .github/workflows/check-licenses.yml | 2 +- README.md | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-licenses.yml b/.github/workflows/check-licenses.yml index 989d8522..94c1bbd0 100644 --- a/.github/workflows/check-licenses.yml +++ b/.github/workflows/check-licenses.yml @@ -42,7 +42,7 @@ jobs: uses: actions/checkout@v4 with: repository: eclipse-velocitas/license-check - ref: bjoern_conan2 + ref: v1.3 path: .github/actions/license-check - name: Run License Checker diff --git a/README.md b/README.md index cce3c01f..184e97ac 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,13 @@ > [!IMPORTANT] > We sucessfully migrated our C++ repositories to use version 2 of the [Conan package manager](https://conan.io/). -> Unfortunately, those changes are not backwards compatible. So, please be aware that newer versions of the C++ SDK (>= v0.7.0) cannot be used together with older Velocitas packages, base images, and C++ template contents. +> Unfortunately, those changes are not backwards compatible. So, please be aware that newer versions of the C++ SDK (>= v0.7) require usage +> of Velocitas packages [devcontainer-setup](https://github.com/eclipse-velocitas/devenv-devcontainer-setup) >= v3 plus +> [github-workflows](https://github.com/eclipse-velocitas/devenv-github-workflows) >= v7, and +> [base images](https://github.com/eclipse-velocitas/devcontainer-base-images) >= v0.4. Also, those SDK versions are compatible with +> recent versions of the [C++ App Template](https://github.com/eclipse-velocitas/vehicle-app-cpp-template), only. +> +> This is not relevant for the Python related app template and SDK repositories. The Vehicle App SDK for C++ allows to create `Vehicle Apps` from the [Velocitas Development Model](https://eclipse.dev/velocitas/docs/concepts/development_model/) in the C++ programming language. From 3743c7cae48ed8674e51f3d6f0a3f8bf44937406 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Fri, 9 May 2025 14:20:09 +0000 Subject: [PATCH 38/40] Update license file --- NOTICE-3RD-PARTY-CONTENT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NOTICE-3RD-PARTY-CONTENT.md b/NOTICE-3RD-PARTY-CONTENT.md index 95f814c7..da85cd30 100644 --- a/NOTICE-3RD-PARTY-CONTENT.md +++ b/NOTICE-3RD-PARTY-CONTENT.md @@ -29,7 +29,7 @@ |requests|2.32.3|Apache 2.0| |six|1.17.0|MIT| |urllib3|2.0.7|MIT| -|virtualenv|20.31.1|MIT| +|virtualenv|20.31.2|MIT| ## Workflows | Dependency | Version | License | |:-----------|:-------:|--------:| From 81526295e145654225254cebd1d6ecad43cd997e Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Tue, 13 May 2025 12:38:32 +0000 Subject: [PATCH 39/40] Update workflows to v7.0.0 --- .velocitas-lock.json | 2 +- .velocitas.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.velocitas-lock.json b/.velocitas-lock.json index c7d81c19..2fb37a5a 100644 --- a/.velocitas-lock.json +++ b/.velocitas-lock.json @@ -3,6 +3,6 @@ "devenv-runtimes": "v4.1.0", "devenv-devcontainer-setup": "@bjoern_conan2", "devenv-github-templates": "v1.0.5", - "devenv-github-workflows": "@conan2" + "devenv-github-workflows": "v7.0.0" } } diff --git a/.velocitas.json b/.velocitas.json index 3c85c9ed..5dd05c3a 100644 --- a/.velocitas.json +++ b/.velocitas.json @@ -3,7 +3,7 @@ "devenv-runtimes": "v4.1.0", "devenv-devcontainer-setup": "@bjoern_conan2", "devenv-github-templates": "v1.0.5", - "devenv-github-workflows": "@conan2" + "devenv-github-workflows": "v7.0.0" }, "components": [ "devcontainer-setup", From 3b8dd5806847be6511dca8a2841a3bdd41c551f5 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Wed, 14 May 2025 10:07:56 +0200 Subject: [PATCH 40/40] Update devcontainer-setup to v3.0.0 --- .velocitas-lock.json | 2 +- .velocitas.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.velocitas-lock.json b/.velocitas-lock.json index 2fb37a5a..8c762e86 100644 --- a/.velocitas-lock.json +++ b/.velocitas-lock.json @@ -1,7 +1,7 @@ { "packages": { "devenv-runtimes": "v4.1.0", - "devenv-devcontainer-setup": "@bjoern_conan2", + "devenv-devcontainer-setup": "v3.0.0", "devenv-github-templates": "v1.0.5", "devenv-github-workflows": "v7.0.0" } diff --git a/.velocitas.json b/.velocitas.json index 5dd05c3a..54259869 100644 --- a/.velocitas.json +++ b/.velocitas.json @@ -1,7 +1,7 @@ { "packages": { "devenv-runtimes": "v4.1.0", - "devenv-devcontainer-setup": "@bjoern_conan2", + "devenv-devcontainer-setup": "v3.0.0", "devenv-github-templates": "v1.0.5", "devenv-github-workflows": "v7.0.0" },