From 426ffbb982f152a4c41dcd071e25d80e9f3fbb68 Mon Sep 17 00:00:00 2001 From: Pavlo Kleymonov Date: Wed, 30 Apr 2025 13:17:40 +0200 Subject: [PATCH 01/13] add support for QNX 7.1 --- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++++ conanfile.py | 54 +++++++++++++++++++++++++++++++++++++ conanfile.txt | 13 --------- test/CMakeLists.txt | 13 +++++++-- 4 files changed, 131 insertions(+), 15 deletions(-) create mode 100644 conanfile.py delete mode 100644 conanfile.txt diff --git a/README.md b/README.md index afbbfcb2c..713219198 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,72 @@ cd build/Debug cmake --build . -- -j ``` +### With Conan for QNX + +Before building **up-cpp** we need to build all dependencies from **up-conan-recipes**: + +Pre-requisite: + +* Install venv + - https://docs.python.org/3/library/venv.html +* Install Conan2 + - https://docs.conan.io/2/installation.html +* Install QNX license and SDP installation (~/.qnx and ~/qnx800 by default) + - https://www.qnx.com/products/everywhere/ (**Non-Commercial Use**) + +```bash +mkdir workspace +cd workspace +# setup python virtual environment +# python -m venv /path/to/new/virtual/environment +# for example: +python -m venv vpy +# source local venv +source vpy/bin/activate +# install conan +pip install conan +# setup conan linux build profile +conan profile detect +# clone conan recipes +git clone https://github.com/qnx-ports/up-conan-recipes.git +# clone up-cpp +git clone https://github.com/qnx-ports/up-cpp.git +# source QNX SDP +source /qnxsdp-env.sh +# build protobuf v3.21.12 for Linux build system +conan create --version=3.21.12 --build=missing up-conan-recipes/protobuf +# build protobuf for QNX host +# for example QNX7.1 arch=aarch64le +conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=3.21.12 up-conan-recipes/protobuf +# build up-core-api for QNX host +conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version 1.6.0-alpha2 up-conan-recipes/up-core-api/release +# build all requirements for up-cpp +conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=10.2.1 up-conan-recipes/fmt/all +conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=1.13.0 up-conan-recipes/spdlog/all +conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=1.13.0 up-conan-recipes/gtest +# build local up-cpp as a static lib +conan install -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version 1.0.1 up-cpp +# or as a shared lib +conan install -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version 1.0.1 -o shared=True up-cpp +cd up-cpp +cmake --preset conan-release +cd build/Release +cmake --build . -- -j +# all tests you can find under build/Release/bin/ +# if you build as a shared lib you can find it under build/Release/lib/ +# you just need to scp whem to the QNX target +# define target IP address +TARGET_HOST= +# copy test binaries to your QNX target +scp -r up-cpp/build/Release/bin qnxuser@$TARGET_HOST:/data/home/qnxuser/ +scp -r up-cpp/build/Release/lib qnxuser@$TARGET_HOST:/data/home/qnxuser/ +# ssh into the target +ssh qnxuser@$TARGET_HOST +# Run tests +# Don't forget to add path for *.so lib to LD_LIBRARY_PATH +cd /data/home/qnxuser/ +``` + ### Generate UT Coverage To get code coverage, perform the steps above, but replace `cmake --preset...` with diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 000000000..b01b85f92 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,54 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, cmake_layout, CMakeDeps + +class upCoreApiRecipe(ConanFile): + name = "up-cpp" + + # Optional metadata + license = "Apache-2.0" + author = "Contributors to the Eclipse Foundation " + url = "https://github.com/eclipse-uprotocol/up-cpp" + description = "This library provides a C++ uProtocol API for the development of uEntities" + topics = ("automotive", "iot", "uprotocol", "messaging") + + # Binary configuration + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + + default_options = { + "shared": False, + "fPIC": True, + } + + def requirements(self): + self.requires("protobuf/3.21.12") + self.requires("spdlog/1.13.0") + self.requires("up-core-api/[~1.6, include_prerelease]") + self.test_requires("gtest/1.13.0") + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + #all warnings have to be fixed + tc.cache_variables["CMAKE_CXX_FLAGS_INIT"] = "-Wno-error=unused-but-set-variable -Wno-error=pedantic -Wno-error=conversion" + if self.settings.os == "Neutrino": + tc.cache_variables["CMAKE_SYSTEM_NAME"] = "QNX" + tc.cache_variables["CMAKE_CXX_COMPILER"] = "q++" + if self.settings.arch == "armv8": #aarch64le + tc.cache_variables["CMAKE_SYSTEM_PROCESSOR"] = "aarch64le" + tc.cache_variables["CMAKE_CXX_COMPILER_TARGET"] = "gcc_ntoaarch64le" + elif self.settings.arch == "x86_64": #x86_64 + tc.cache_variables["CMAKE_SYSTEM_PROCESSOR"] = "x86_64" + tc.cache_variables["CMAKE_CXX_COMPILER_TARGET"] = "gcc_ntox86_64" + tc.generate() diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index 718862bdc..000000000 --- a/conanfile.txt +++ /dev/null @@ -1,13 +0,0 @@ -[requires] -up-core-api/1.6.0-alpha2 -protobuf/3.21.12 - -[test_requires] -gtest/1.14.0 - -[generators] -CMakeDeps -CMakeToolchain - -[layout] -cmake_layout diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index edd90a164..04a96ac41 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -34,10 +34,19 @@ function(add_coverage_test Name) PRIVATE GTest::gtest_main GTest::gmock - pthread ) target_include_directories(${Name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) - gtest_discover_tests(${Name} XML_OUTPUT_DIR results) + if(CMAKE_SYSTEM_NAME MATCHES "QNX") + # QNX provides pthread inside libc and does not need to link pthread lib. + # + # For QNX we are using cross compilation. + # Thus, we can't call gtest_discover_tests() + # Instead, we call old gtest_add_tests() + gtest_add_tests(TARGET ${Name} SOURCES ${ARGN}) + else() + target_link_libraries(${Name} PRIVATE pthread) + gtest_discover_tests(${Name} XML_OUTPUT_DIR results) + endif() endfunction() # NOTE: This is temporarily just a call to add_coverage_test. When coverage From b5d8658d167f1b6d205e3e931cf9f7adf843095c Mon Sep 17 00:00:00 2001 From: Pavlo Kleymonov <150929995+pkleymonov-qnx@users.noreply.github.com> Date: Mon, 5 May 2025 12:38:41 +0200 Subject: [PATCH 02/13] Update README.md fix path for build artifacts --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 713219198..80edf7308 100644 --- a/README.md +++ b/README.md @@ -135,8 +135,8 @@ cmake --build . -- -j # define target IP address TARGET_HOST= # copy test binaries to your QNX target -scp -r up-cpp/build/Release/bin qnxuser@$TARGET_HOST:/data/home/qnxuser/ -scp -r up-cpp/build/Release/lib qnxuser@$TARGET_HOST:/data/home/qnxuser/ +scp -r bin qnxuser@$TARGET_HOST:/data/home/qnxuser/ +scp -r lib qnxuser@$TARGET_HOST:/data/home/qnxuser/ # ssh into the target ssh qnxuser@$TARGET_HOST # Run tests From 74b05b0091946fc053f7dc9d6e3b95da2173bf45 Mon Sep 17 00:00:00 2001 From: Pavlo Kleymonov Date: Tue, 6 May 2025 15:40:17 +0200 Subject: [PATCH 03/13] update README.md for QNX7.1/8.0 build and test --- README.md | 82 ++++++++++++++++++++++++++----------------------------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 80edf7308..9df1a38cc 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ Before building **up-cpp** we need to build all dependencies from **up-conan-rec Pre-requisite: -* Install venv +* Install venv - recomended by conan documentation - OPTIONAL - https://docs.python.org/3/library/venv.html * Install Conan2 - https://docs.conan.io/2/installation.html @@ -92,56 +92,52 @@ Pre-requisite: - https://www.qnx.com/products/everywhere/ (**Non-Commercial Use**) ```bash -mkdir workspace -cd workspace -# setup python virtual environment -# python -m venv /path/to/new/virtual/environment -# for example: -python -m venv vpy -# source local venv -source vpy/bin/activate -# install conan -pip install conan -# setup conan linux build profile -conan profile detect -# clone conan recipes +# clone up-conan-recipes git clone https://github.com/qnx-ports/up-conan-recipes.git -# clone up-cpp -git clone https://github.com/qnx-ports/up-cpp.git + +cd up-conan-recipes + # source QNX SDP source /qnxsdp-env.sh -# build protobuf v3.21.12 for Linux build system -conan create --version=3.21.12 --build=missing up-conan-recipes/protobuf + +# build protobuf for Linux build machine +conan create --version=3.21.12 --build=missing protobuf + +# IMPORTANT +# update conan settings for QNX8.0 support +conan config install tools/qnx-8.0-extension/settings_user.yml + # build protobuf for QNX host -# for example QNX7.1 arch=aarch64le -conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=3.21.12 up-conan-recipes/protobuf -# build up-core-api for QNX host -conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version 1.6.0-alpha2 up-conan-recipes/up-core-api/release -# build all requirements for up-cpp -conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=10.2.1 up-conan-recipes/fmt/all -conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=1.13.0 up-conan-recipes/spdlog/all -conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=1.13.0 up-conan-recipes/gtest -# build local up-cpp as a static lib -conan install -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version 1.0.1 up-cpp -# or as a shared lib -conan install -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version 1.0.1 -o shared=True up-cpp +# +# could be one of: nto-7.1-aarch64-le, nto-7.1-x86_64, nto-8.0-aarch64-le, nto-8.0-x86_64 +# +conan create -pr:h=tools/profiles/ --version=3.21.12 protobuf + +# build up-core-api +conan create -pr:h=tools/profiles/ --version 1.6.0-alpha2 up-core-api/release/ + +# build all dependencies for up-cpp +conan create -pr:h=tools/profiles/ --version=10.2.1 fmt/all +conan create -pr:h=tools/profiles/ --version=1.13.0 spdlog/all +conan create -pr:h=tools/profiles/ --version=1.13.0 gtest + +cd .. + +# clone up-cpp +git clone https://github.com/qnx-ports/up-cpp.git cd up-cpp + +# setup cmake generator and preset for up-cpp +conan install -pr:h=../up-conan-recipes/tools/profiles/ --version 1.0.1 . + +# setup cmake configuration cmake --preset conan-release -cd build/Release -cmake --build . -- -j + +# build up-cpp libary and tests +cmake --build build/Release -- -j + # all tests you can find under build/Release/bin/ -# if you build as a shared lib you can find it under build/Release/lib/ -# you just need to scp whem to the QNX target -# define target IP address -TARGET_HOST= # copy test binaries to your QNX target -scp -r bin qnxuser@$TARGET_HOST:/data/home/qnxuser/ -scp -r lib qnxuser@$TARGET_HOST:/data/home/qnxuser/ -# ssh into the target -ssh qnxuser@$TARGET_HOST -# Run tests -# Don't forget to add path for *.so lib to LD_LIBRARY_PATH -cd /data/home/qnxuser/ ``` ### Generate UT Coverage From dad570b13753bfaeed14cdf521e357627b49962d Mon Sep 17 00:00:00 2001 From: Pavlo Kleymonov Date: Wed, 30 Apr 2025 13:17:40 +0200 Subject: [PATCH 04/13] add support for QNX 7.1/8.0 --- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++++ conanfile.py | 54 +++++++++++++++++++++++++++++++++++++ conanfile.txt | 14 ---------- test/CMakeLists.txt | 13 +++++++-- 4 files changed, 131 insertions(+), 16 deletions(-) create mode 100644 conanfile.py delete mode 100644 conanfile.txt diff --git a/README.md b/README.md index 52439280b..6d9aa5d2b 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,72 @@ cd build/Debug cmake --build . -- -j ``` +### With Conan for QNX + +Before building **up-cpp** we need to build all dependencies from **up-conan-recipes**: + +Pre-requisite: + +* Install venv + - https://docs.python.org/3/library/venv.html +* Install Conan2 + - https://docs.conan.io/2/installation.html +* Install QNX license and SDP installation (~/.qnx and ~/qnx800 by default) + - https://www.qnx.com/products/everywhere/ (**Non-Commercial Use**) + +```bash +mkdir workspace +cd workspace +# setup python virtual environment +# python -m venv /path/to/new/virtual/environment +# for example: +python -m venv vpy +# source local venv +source vpy/bin/activate +# install conan +pip install conan +# setup conan linux build profile +conan profile detect +# clone conan recipes +git clone https://github.com/qnx-ports/up-conan-recipes.git +# clone up-cpp +git clone https://github.com/qnx-ports/up-cpp.git +# source QNX SDP +source /qnxsdp-env.sh +# build protobuf v3.21.12 for Linux build system +conan create --version=3.21.12 --build=missing up-conan-recipes/protobuf +# build protobuf for QNX host +# for example QNX7.1 arch=aarch64le +conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=3.21.12 up-conan-recipes/protobuf +# build up-core-api for QNX host +conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version 1.6.0-alpha2 up-conan-recipes/up-core-api/release +# build all requirements for up-cpp +conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=10.2.1 up-conan-recipes/fmt/all +conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=1.13.0 up-conan-recipes/spdlog/all +conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=1.13.0 up-conan-recipes/gtest +# build local up-cpp as a static lib +conan install -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version 1.0.1 up-cpp +# or as a shared lib +conan install -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version 1.0.1 -o shared=True up-cpp +cd up-cpp +cmake --preset conan-release +cd build/Release +cmake --build . -- -j +# all tests you can find under build/Release/bin/ +# if you build as a shared lib you can find it under build/Release/lib/ +# you just need to scp whem to the QNX target +# define target IP address +TARGET_HOST= +# copy test binaries to your QNX target +scp -r up-cpp/build/Release/bin qnxuser@$TARGET_HOST:/data/home/qnxuser/ +scp -r up-cpp/build/Release/lib qnxuser@$TARGET_HOST:/data/home/qnxuser/ +# ssh into the target +ssh qnxuser@$TARGET_HOST +# Run tests +# Don't forget to add path for *.so lib to LD_LIBRARY_PATH +cd /data/home/qnxuser/ +``` + ### Generate UT Coverage To get code coverage, perform the steps above, but replace `cmake --preset...` with diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 000000000..b01b85f92 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,54 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, cmake_layout, CMakeDeps + +class upCoreApiRecipe(ConanFile): + name = "up-cpp" + + # Optional metadata + license = "Apache-2.0" + author = "Contributors to the Eclipse Foundation " + url = "https://github.com/eclipse-uprotocol/up-cpp" + description = "This library provides a C++ uProtocol API for the development of uEntities" + topics = ("automotive", "iot", "uprotocol", "messaging") + + # Binary configuration + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + + default_options = { + "shared": False, + "fPIC": True, + } + + def requirements(self): + self.requires("protobuf/3.21.12") + self.requires("spdlog/1.13.0") + self.requires("up-core-api/[~1.6, include_prerelease]") + self.test_requires("gtest/1.13.0") + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + #all warnings have to be fixed + tc.cache_variables["CMAKE_CXX_FLAGS_INIT"] = "-Wno-error=unused-but-set-variable -Wno-error=pedantic -Wno-error=conversion" + if self.settings.os == "Neutrino": + tc.cache_variables["CMAKE_SYSTEM_NAME"] = "QNX" + tc.cache_variables["CMAKE_CXX_COMPILER"] = "q++" + if self.settings.arch == "armv8": #aarch64le + tc.cache_variables["CMAKE_SYSTEM_PROCESSOR"] = "aarch64le" + tc.cache_variables["CMAKE_CXX_COMPILER_TARGET"] = "gcc_ntoaarch64le" + elif self.settings.arch == "x86_64": #x86_64 + tc.cache_variables["CMAKE_SYSTEM_PROCESSOR"] = "x86_64" + tc.cache_variables["CMAKE_CXX_COMPILER_TARGET"] = "gcc_ntox86_64" + tc.generate() diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index 2270c2519..000000000 --- a/conanfile.txt +++ /dev/null @@ -1,14 +0,0 @@ -[requires] -up-core-api/1.6.0-alpha4 -spdlog/[~1.13] -protobuf/[~3.21] - -[test_requires] -gtest/[~1.14] - -[generators] -CMakeDeps -CMakeToolchain - -[layout] -cmake_layout diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index bd7e6d67f..0dd7940e7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -35,10 +35,19 @@ function(add_coverage_test Name) PRIVATE GTest::gtest_main GTest::gmock - pthread ) target_include_directories(${Name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) - gtest_discover_tests(${Name} XML_OUTPUT_DIR results) + if(CMAKE_SYSTEM_NAME MATCHES "QNX") + # QNX provides pthread inside libc and does not need to link pthread lib. + # + # For QNX we are using cross compilation. + # Thus, we can't call gtest_discover_tests() + # Instead, we call old gtest_add_tests() + gtest_add_tests(TARGET ${Name} SOURCES ${ARGN}) + else() + target_link_libraries(${Name} PRIVATE pthread) + gtest_discover_tests(${Name} XML_OUTPUT_DIR results) + endif() endfunction() # NOTE: This is temporarily just a call to add_coverage_test. When coverage From 84006eba3fc26f41c83397fcb518a2099d669508 Mon Sep 17 00:00:00 2001 From: Pavlo Kleymonov <150929995+pkleymonov-qnx@users.noreply.github.com> Date: Mon, 5 May 2025 12:38:41 +0200 Subject: [PATCH 05/13] Update README.md fix path for build artifacts --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6d9aa5d2b..12ec0b29a 100644 --- a/README.md +++ b/README.md @@ -135,8 +135,8 @@ cmake --build . -- -j # define target IP address TARGET_HOST= # copy test binaries to your QNX target -scp -r up-cpp/build/Release/bin qnxuser@$TARGET_HOST:/data/home/qnxuser/ -scp -r up-cpp/build/Release/lib qnxuser@$TARGET_HOST:/data/home/qnxuser/ +scp -r bin qnxuser@$TARGET_HOST:/data/home/qnxuser/ +scp -r lib qnxuser@$TARGET_HOST:/data/home/qnxuser/ # ssh into the target ssh qnxuser@$TARGET_HOST # Run tests From dfa1aa407b4d94021336208de312496843c4db7c Mon Sep 17 00:00:00 2001 From: Pavlo Kleymonov Date: Tue, 6 May 2025 15:40:17 +0200 Subject: [PATCH 06/13] update README.md for QNX7.1/8.0 build and test --- README.md | 82 ++++++++++++++++++++++++++----------------------------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 12ec0b29a..7ee417a5e 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ Before building **up-cpp** we need to build all dependencies from **up-conan-rec Pre-requisite: -* Install venv +* Install venv - recomended by conan documentation - OPTIONAL - https://docs.python.org/3/library/venv.html * Install Conan2 - https://docs.conan.io/2/installation.html @@ -92,56 +92,52 @@ Pre-requisite: - https://www.qnx.com/products/everywhere/ (**Non-Commercial Use**) ```bash -mkdir workspace -cd workspace -# setup python virtual environment -# python -m venv /path/to/new/virtual/environment -# for example: -python -m venv vpy -# source local venv -source vpy/bin/activate -# install conan -pip install conan -# setup conan linux build profile -conan profile detect -# clone conan recipes +# clone up-conan-recipes git clone https://github.com/qnx-ports/up-conan-recipes.git -# clone up-cpp -git clone https://github.com/qnx-ports/up-cpp.git + +cd up-conan-recipes + # source QNX SDP source /qnxsdp-env.sh -# build protobuf v3.21.12 for Linux build system -conan create --version=3.21.12 --build=missing up-conan-recipes/protobuf + +# build protobuf for Linux build machine +conan create --version=3.21.12 --build=missing protobuf + +# IMPORTANT +# update conan settings for QNX8.0 support +conan config install tools/qnx-8.0-extension/settings_user.yml + # build protobuf for QNX host -# for example QNX7.1 arch=aarch64le -conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=3.21.12 up-conan-recipes/protobuf -# build up-core-api for QNX host -conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version 1.6.0-alpha2 up-conan-recipes/up-core-api/release -# build all requirements for up-cpp -conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=10.2.1 up-conan-recipes/fmt/all -conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=1.13.0 up-conan-recipes/spdlog/all -conan create -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version=1.13.0 up-conan-recipes/gtest -# build local up-cpp as a static lib -conan install -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version 1.0.1 up-cpp -# or as a shared lib -conan install -pr:h=up-conan-recipes/tools/profiles/nto-7.1-aarch64-le --version 1.0.1 -o shared=True up-cpp +# +# could be one of: nto-7.1-aarch64-le, nto-7.1-x86_64, nto-8.0-aarch64-le, nto-8.0-x86_64 +# +conan create -pr:h=tools/profiles/ --version=3.21.12 protobuf + +# build up-core-api +conan create -pr:h=tools/profiles/ --version 1.6.0-alpha2 up-core-api/release/ + +# build all dependencies for up-cpp +conan create -pr:h=tools/profiles/ --version=10.2.1 fmt/all +conan create -pr:h=tools/profiles/ --version=1.13.0 spdlog/all +conan create -pr:h=tools/profiles/ --version=1.13.0 gtest + +cd .. + +# clone up-cpp +git clone https://github.com/qnx-ports/up-cpp.git cd up-cpp + +# setup cmake generator and preset for up-cpp +conan install -pr:h=../up-conan-recipes/tools/profiles/ --version 1.0.1 . + +# setup cmake configuration cmake --preset conan-release -cd build/Release -cmake --build . -- -j + +# build up-cpp libary and tests +cmake --build build/Release -- -j + # all tests you can find under build/Release/bin/ -# if you build as a shared lib you can find it under build/Release/lib/ -# you just need to scp whem to the QNX target -# define target IP address -TARGET_HOST= # copy test binaries to your QNX target -scp -r bin qnxuser@$TARGET_HOST:/data/home/qnxuser/ -scp -r lib qnxuser@$TARGET_HOST:/data/home/qnxuser/ -# ssh into the target -ssh qnxuser@$TARGET_HOST -# Run tests -# Don't forget to add path for *.so lib to LD_LIBRARY_PATH -cd /data/home/qnxuser/ ``` ### Generate UT Coverage From 44a6824f1a298d5db3520db5b43a8d6e75719e9a Mon Sep 17 00:00:00 2001 From: Pavlo Kleymonov Date: Thu, 8 May 2025 13:25:36 +0200 Subject: [PATCH 07/13] fix tests with wrong same name of the different testcases --- test/coverage/utils/CyclicQueueTest.cpp | 2 +- test/coverage/utils/IpAddressTest.cpp | 2 +- test/coverage/utils/ThreadPoolTest.cpp | 2 +- test/coverage/utils/base64Test.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/coverage/utils/CyclicQueueTest.cpp b/test/coverage/utils/CyclicQueueTest.cpp index 2aa6d018b..99c3c49e8 100644 --- a/test/coverage/utils/CyclicQueueTest.cpp +++ b/test/coverage/utils/CyclicQueueTest.cpp @@ -35,6 +35,6 @@ class TestFixture : public testing::Test { }; // TODO(unknown) -TEST_F(TestFixture, SomeTestName) {} // NOLINT +TEST_F(TestFixture, SomeTestName2) {} // NOLINT } // namespace diff --git a/test/coverage/utils/IpAddressTest.cpp b/test/coverage/utils/IpAddressTest.cpp index 12ca42a84..e75c30be7 100644 --- a/test/coverage/utils/IpAddressTest.cpp +++ b/test/coverage/utils/IpAddressTest.cpp @@ -35,6 +35,6 @@ class TestFixture : public testing::Test { }; // TODO(unknown) -TEST_F(TestFixture, SomeTestName) {} // NOLINT +TEST_F(TestFixture, SomeTestName1) {} // NOLINT } // namespace diff --git a/test/coverage/utils/ThreadPoolTest.cpp b/test/coverage/utils/ThreadPoolTest.cpp index 042c46371..182128f25 100644 --- a/test/coverage/utils/ThreadPoolTest.cpp +++ b/test/coverage/utils/ThreadPoolTest.cpp @@ -35,6 +35,6 @@ class TestFixture : public testing::Test { }; // TODO(unknown) -TEST_F(TestFixture, SomeTestName) {} // NOLINT +TEST_F(TestFixture, SomeTestName3) {} // NOLINT } // namespace diff --git a/test/coverage/utils/base64Test.cpp b/test/coverage/utils/base64Test.cpp index 181eedaf6..cb03562e9 100644 --- a/test/coverage/utils/base64Test.cpp +++ b/test/coverage/utils/base64Test.cpp @@ -35,6 +35,6 @@ class TestFixture : public testing::Test { }; // TODO(unknown) -TEST_F(TestFixture, SomeTestName) {} // NOLINT +TEST_F(TestFixture, SomeTestName0) {} // NOLINT } // namespace From adceb30babcf0e6b7e2c991901b994bc18a1709c Mon Sep 17 00:00:00 2001 From: Pavlo Kleymonov <150929995+pkleymonov-qnx@users.noreply.github.com> Date: Tue, 13 May 2025 10:40:50 +0200 Subject: [PATCH 08/13] Update conanfile.py fix whitespace Co-authored-by: Pete LeVasseur --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index b01b85f92..df9e5f35d 100644 --- a/conanfile.py +++ b/conanfile.py @@ -45,7 +45,7 @@ def generate(self): if self.settings.os == "Neutrino": tc.cache_variables["CMAKE_SYSTEM_NAME"] = "QNX" tc.cache_variables["CMAKE_CXX_COMPILER"] = "q++" - if self.settings.arch == "armv8": #aarch64le + if self.settings.arch == "armv8": #aarch64le tc.cache_variables["CMAKE_SYSTEM_PROCESSOR"] = "aarch64le" tc.cache_variables["CMAKE_CXX_COMPILER_TARGET"] = "gcc_ntoaarch64le" elif self.settings.arch == "x86_64": #x86_64 From 214c762dd2a7aff0d08290278014cbac38efe2a6 Mon Sep 17 00:00:00 2001 From: Pavlo Kleymonov Date: Tue, 13 May 2025 14:49:10 +0200 Subject: [PATCH 09/13] conanfile.py added proper tool_requires for cmake >= 3.23 --- conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conanfile.py b/conanfile.py index b01b85f92..fc0349e89 100644 --- a/conanfile.py +++ b/conanfile.py @@ -29,6 +29,9 @@ def requirements(self): self.requires("up-core-api/[~1.6, include_prerelease]") self.test_requires("gtest/1.13.0") + def build_requirements(self): + self.tool_requires("cmake/[>=3.23]") + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC From 23d97d7af91ea5af03578a6920e4b25592036181 Mon Sep 17 00:00:00 2001 From: Pavlo Kleymonov Date: Tue, 3 Jun 2025 18:37:46 +0200 Subject: [PATCH 10/13] fix CallbackTest.ReturnValuesAreMoved std::string.reserve(capacity) Effects: After reserve(), capacity() is greater or equal to the argument of reserve. C++ International Standard 2014 (N3797) 21.4.4 basic_string capacity --- test/coverage/utils/CallbackConnectionTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/coverage/utils/CallbackConnectionTest.cpp b/test/coverage/utils/CallbackConnectionTest.cpp index a0ae5fb09..0b06723f6 100644 --- a/test/coverage/utils/CallbackConnectionTest.cpp +++ b/test/coverage/utils/CallbackConnectionTest.cpp @@ -446,7 +446,7 @@ TEST_F(CallbackTest, ReturnValuesAreMoved) { auto result = callable(); EXPECT_TRUE(result); EXPECT_EQ(original_string_location, (*result).data()); - EXPECT_EQ(expected_capacity, (*result).capacity()); + EXPECT_LE(expected_capacity, (*result).capacity()); // Just to be safe, check our assumptions about copies vs moves. The // a_copy variable should hold a copy of the original string, this time // with a different pointer and capacity. From e6f037fb1d62128aeedd6be8f8dcc57434b1472f Mon Sep 17 00:00:00 2001 From: Pavlo Kleymonov Date: Thu, 5 Jun 2025 14:50:24 +0200 Subject: [PATCH 11/13] Switch to gtest 1.14.0 --- README.md | 52 ++++++++++------------------------------------------ conanfile.py | 20 +------------------- 2 files changed, 11 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index 9df1a38cc..7975c1bc53 100644 --- a/README.md +++ b/README.md @@ -82,58 +82,26 @@ cmake --build . -- -j Before building **up-cpp** we need to build all dependencies from **up-conan-recipes**: +Please follow instruction for QNX build in file up-conan-recipes/README.md + Pre-requisite: -* Install venv - recomended by conan documentation - OPTIONAL - - https://docs.python.org/3/library/venv.html -* Install Conan2 - - https://docs.conan.io/2/installation.html -* Install QNX license and SDP installation (~/.qnx and ~/qnx800 by default) - - https://www.qnx.com/products/everywhere/ (**Non-Commercial Use**) +* Build and install all **QNX build** dependencies from up-conan-recipes + - https://github.com/eclipse-uprotocol/up-conan-recipes/blob/main/README.md ```bash -# clone up-conan-recipes -git clone https://github.com/qnx-ports/up-conan-recipes.git - -cd up-conan-recipes - -# source QNX SDP -source /qnxsdp-env.sh - -# build protobuf for Linux build machine -conan create --version=3.21.12 --build=missing protobuf - -# IMPORTANT -# update conan settings for QNX8.0 support -conan config install tools/qnx-8.0-extension/settings_user.yml +# setup path to up-conan-recipes +export QNX_CONAN_ROOT= -# build protobuf for QNX host +# Install conan toolchain for QNX target # -# could be one of: nto-7.1-aarch64-le, nto-7.1-x86_64, nto-8.0-aarch64-le, nto-8.0-x86_64 +# : nto-7.1-aarch64-le, nto-7.1-x86_64, nto-8.0-aarch64-le, nto-8.0-x86_64 +# : 1.0.0-rc0, 1.0.0, 1.0.1-rc1, 1.0.1 # -conan create -pr:h=tools/profiles/ --version=3.21.12 protobuf - -# build up-core-api -conan create -pr:h=tools/profiles/ --version 1.6.0-alpha2 up-core-api/release/ - -# build all dependencies for up-cpp -conan create -pr:h=tools/profiles/ --version=10.2.1 fmt/all -conan create -pr:h=tools/profiles/ --version=1.13.0 spdlog/all -conan create -pr:h=tools/profiles/ --version=1.13.0 gtest - -cd .. - -# clone up-cpp -git clone https://github.com/qnx-ports/up-cpp.git -cd up-cpp - -# setup cmake generator and preset for up-cpp -conan install -pr:h=../up-conan-recipes/tools/profiles/ --version 1.0.1 . +conan install -pr:h=$QNX_CONAN_ROOT/tools/profiles/ --version= --build=missing . -# setup cmake configuration cmake --preset conan-release -# build up-cpp libary and tests cmake --build build/Release -- -j # all tests you can find under build/Release/bin/ diff --git a/conanfile.py b/conanfile.py index fc0349e89..606fe47ce 100644 --- a/conanfile.py +++ b/conanfile.py @@ -13,21 +13,12 @@ class upCoreApiRecipe(ConanFile): # Binary configuration settings = "os", "compiler", "build_type", "arch" - options = { - "shared": [True, False], - "fPIC": [True, False], - } - - default_options = { - "shared": False, - "fPIC": True, - } def requirements(self): self.requires("protobuf/3.21.12") self.requires("spdlog/1.13.0") self.requires("up-core-api/[~1.6, include_prerelease]") - self.test_requires("gtest/1.13.0") + self.test_requires("gtest/1.14.0") def build_requirements(self): self.tool_requires("cmake/[>=3.23]") @@ -45,13 +36,4 @@ def generate(self): tc = CMakeToolchain(self) #all warnings have to be fixed tc.cache_variables["CMAKE_CXX_FLAGS_INIT"] = "-Wno-error=unused-but-set-variable -Wno-error=pedantic -Wno-error=conversion" - if self.settings.os == "Neutrino": - tc.cache_variables["CMAKE_SYSTEM_NAME"] = "QNX" - tc.cache_variables["CMAKE_CXX_COMPILER"] = "q++" - if self.settings.arch == "armv8": #aarch64le - tc.cache_variables["CMAKE_SYSTEM_PROCESSOR"] = "aarch64le" - tc.cache_variables["CMAKE_CXX_COMPILER_TARGET"] = "gcc_ntoaarch64le" - elif self.settings.arch == "x86_64": #x86_64 - tc.cache_variables["CMAKE_SYSTEM_PROCESSOR"] = "x86_64" - tc.cache_variables["CMAKE_CXX_COMPILER_TARGET"] = "gcc_ntox86_64" tc.generate() From 59eb8c5ba69db5889fb169f6eaf4ce13a046ae56 Mon Sep 17 00:00:00 2001 From: Pavlo Kleymonov Date: Thu, 5 Jun 2025 15:05:35 +0200 Subject: [PATCH 12/13] removed cmake build dependency --- conanfile.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/conanfile.py b/conanfile.py index 606fe47ce..1281d5b68 100644 --- a/conanfile.py +++ b/conanfile.py @@ -20,13 +20,6 @@ def requirements(self): self.requires("up-core-api/[~1.6, include_prerelease]") self.test_requires("gtest/1.14.0") - def build_requirements(self): - self.tool_requires("cmake/[>=3.23]") - - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - def layout(self): cmake_layout(self) From 498caee5bdcf1494190162058423558742b93d46 Mon Sep 17 00:00:00 2001 From: Pavlo Kleymonov <150929995+pkleymonov-qnx@users.noreply.github.com> Date: Tue, 10 Jun 2025 12:02:32 +0200 Subject: [PATCH 13/13] Update README.md Fix some links to QNX build instructions. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 99c3da6ea..08fae773f 100644 --- a/README.md +++ b/README.md @@ -82,12 +82,12 @@ cmake --build . -- -j Before building **up-cpp** we need to build all dependencies from **up-conan-recipes**: -Please follow instruction for QNX build in file up-conan-recipes/README.md +Please follow instruction for QNX build in file [up-conan-recipes/README.md](https://github.com/eclipse-uprotocol/up-conan-recipes/blob/main/README.md) Pre-requisite: * Build and install all **QNX build** dependencies from up-conan-recipes - - https://github.com/eclipse-uprotocol/up-conan-recipes/blob/main/README.md + - https://github.com/eclipse-uprotocol/up-conan-recipes ```bash # setup path to up-conan-recipes