From e9d3ea1706840311534676fc79ac61ce1b4ff6c5 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 18 Apr 2025 10:40:53 -0400 Subject: [PATCH 01/88] only prepend unix when using uds --- src/viam/sdk/rpc/dial.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/viam/sdk/rpc/dial.cpp b/src/viam/sdk/rpc/dial.cpp index 35a990363..2867a90c0 100644 --- a/src/viam/sdk/rpc/dial.cpp +++ b/src/viam/sdk/rpc/dial.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -148,20 +149,27 @@ std::shared_ptr ViamChannel::dial(const char* uri, if (opts.entity()) { entity = opts.entity()->c_str(); } - char* socket_path = ::dial( + char* proxy_path = ::dial( uri, entity, type, payload, opts.allows_insecure_downgrade(), float_timeout.count(), ptr); - if (socket_path == NULL) { + if (proxy_path == NULL) { free_rust_runtime(ptr); throw Exception(ErrorCondition::k_connection, "Unable to establish connecting path"); } - std::string address("unix://"); - address += socket_path; + std::string localhost_prefix("127.0.0.1"); + auto tcp_check = std::mismatch(localhost_prefix.begin(), localhost_prefix.end(), proxy_path); + std::string address; + if (tcp_check.first != localhost_prefix.end()) { + // proxy path is not a localhost address and is therefore a UDS socket + address += "unix://"; + } + address += proxy_path; + const std::shared_ptr channel = impl::create_viam_channel(address, grpc::InsecureChannelCredentials()); const std::unique_ptr st = viam::robot::v1::RobotService::NewStub(channel); - return std::make_shared(channel, socket_path, ptr); + return std::make_shared(channel, proxy_path, ptr); }; unsigned int Options::refresh_interval() const { From 0e3b8af78a0a2b4aafeba038d9f463b9fb8e17b9 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 18 Apr 2025 11:02:43 -0400 Subject: [PATCH 02/88] untested download and install rust-utils for windows --- CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fe486179..38746791a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -266,14 +266,21 @@ if (viam_rust_utils_files) ${viam_rust_utils_file} ONLY_IF_DIFFERENT ) -elseif(NOT WIN32) # TODO(RSDK-10366): Currently, rust_utils is not published for windows, so don't even try downloading +elseif(NOT WIN32 OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "X86") OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "X64")) # TODO(RSDK-10366): Currently, rust_utils is not published for windows aarch, so don't even try downloading set(lvru_system_name ${CMAKE_SYSTEM_NAME}) + if (CMAKE_SYSTEM_NAME STREQUAL "Cygwin") + set(lvru_system_name "windows") + endif() if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(lvru_system_name "macosx") endif() + set(lvru_system_processor ${CMAKE_SYSTEM_PROCESSOR}) + if ((CMAKE_SYSTEM_PROCESSOR STREQUAL "X86") OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "X64")) + set(lvru_system_processor "x86_64") + endif() file( DOWNLOAD - https://github.com/viamrobotics/rust-utils/releases/latest/download/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils-${lvru_system_name}_${CMAKE_SYSTEM_PROCESSOR}${CMAKE_STATIC_LIBRARY_SUFFIX} + https://github.com/viamrobotics/rust-utils/releases/latest/download/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils-${lvru_system_name}_${lvru_system_processor}${CMAKE_STATIC_LIBRARY_SUFFIX} ${viam_rust_utils_file} STATUS lvru_status ) From b9688035108770060630607d416bb4d75bb97c41 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 18 Apr 2025 12:55:06 -0400 Subject: [PATCH 03/88] cr comments --- CMakeLists.txt | 3 +-- src/viam/sdk/rpc/dial.cpp | 11 +++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 38746791a..711f5b1b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -270,8 +270,7 @@ elseif(NOT WIN32 OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "X86") OR (CMAKE_SYSTEM_PRO set(lvru_system_name ${CMAKE_SYSTEM_NAME}) if (CMAKE_SYSTEM_NAME STREQUAL "Cygwin") set(lvru_system_name "windows") - endif() - if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") + elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(lvru_system_name "macosx") endif() set(lvru_system_processor ${CMAKE_SYSTEM_PROCESSOR}) diff --git a/src/viam/sdk/rpc/dial.cpp b/src/viam/sdk/rpc/dial.cpp index 2867a90c0..2005765a5 100644 --- a/src/viam/sdk/rpc/dial.cpp +++ b/src/viam/sdk/rpc/dial.cpp @@ -1,6 +1,6 @@ -#include #include +#include #include #include @@ -151,17 +151,16 @@ std::shared_ptr ViamChannel::dial(const char* uri, } char* proxy_path = ::dial( uri, entity, type, payload, opts.allows_insecure_downgrade(), float_timeout.count(), ptr); - if (proxy_path == NULL) { + if (!proxy_path) { free_rust_runtime(ptr); throw Exception(ErrorCondition::k_connection, "Unable to establish connecting path"); } std::string localhost_prefix("127.0.0.1"); - auto tcp_check = std::mismatch(localhost_prefix.begin(), localhost_prefix.end(), proxy_path); std::string address; - if (tcp_check.first != localhost_prefix.end()) { - // proxy path is not a localhost address and is therefore a UDS socket - address += "unix://"; + if (std::string(proxy_path).find(localhost_prefix) == std::string::npos) { + // proxy path is not a localhost address and is therefore a unix domain socket (UDS) + address += "unix:"; } address += proxy_path; From 5d5bb2d524668c9168c3fd4c35136e1a9c7ac3dd Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 18 Apr 2025 13:02:38 -0400 Subject: [PATCH 04/88] const correctness --- src/viam/sdk/rpc/dial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/viam/sdk/rpc/dial.cpp b/src/viam/sdk/rpc/dial.cpp index 2005765a5..264406683 100644 --- a/src/viam/sdk/rpc/dial.cpp +++ b/src/viam/sdk/rpc/dial.cpp @@ -156,7 +156,7 @@ std::shared_ptr ViamChannel::dial(const char* uri, throw Exception(ErrorCondition::k_connection, "Unable to establish connecting path"); } - std::string localhost_prefix("127.0.0.1"); + const std::string localhost_prefix("127.0.0.1"); std::string address; if (std::string(proxy_path).find(localhost_prefix) == std::string::npos) { // proxy path is not a localhost address and is therefore a unix domain socket (UDS) From d9827e5785b8dcdeb72d39d2fced77f47c613ad7 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 11:49:09 -0400 Subject: [PATCH 05/88] try windows build --- .github/workflows/release.yml | 71 ++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index db0728dbe..956ce1998 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,9 +32,70 @@ jobs: releaseName: releases/v${{ steps.which_version.outputs.version }} doNotFailIfNotFound: 'true' - - name: Cancelling - release already exists - uses: andymckay/cancel-action@0.2 - if: steps.release_exists.outputs.id != '' + #- name: Cancelling - release already exists + #uses: andymckay/cancel-action@0.2 + #if: steps.release_exists.outputs.id != '' + + build_windows: + if: github.repository_owner == 'viamrobotics' + needs: [prepare] + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-windows + platform: windows_x86_64 + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + ref: ${{ needs.prepare.outputs.sha }} + + - name: Install Boost + uses: MarkusJx/install-boost@v2 + id: install-boost + with: + boost_version: 1.86.0 + + - name: Install cmake + uses: ssrobins/install-cmake@v1 + with: + version: 3.31.2 + + - name: Install dependencies + uses: crazy-max/ghaction-chocolatey@v3 + with: + args: install grpc protobuf xtensor pkg-config ninja buf + + - name: Setup build directory + run: mkdir builds + + - name: Build + run: | + # `buf` tries to read a CLI config file that we don't actually use located at + # ~/.config/buf/config.yaml. We don't always have permission to access this + # directory in CI, so we set the `BUF_CONFIG_DIR` to some other value that we + # do have permissions for. See https://github.com/bufbuild/buf/issues/2698 for + # more details. + export BUF_CONFIG_DIR=$(mktemp -d) + mkdir build + cmake -S . -B build -G Ninja + cmake --build build --target all install -- -v + + - name: Copy + run: | + cmake --install build --prefix builds/viam-cpp-sdk-${{ matrix.platform }} + + - name: Create tar + run: | + tar -czvf builds/viam-cpp-sdk-${{ matrix.platform }}.tar.gz builds/viam-cpp-sdk-${{ matrix.platform }} + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: viam-cpp-sdk-${{ matrix.platform }}.tar.gz + path: builds/viam-cpp-sdk-${{ matrix.platform }}.tar.gz build_macos: if: github.repository_owner == 'viamrobotics' @@ -269,7 +330,7 @@ jobs: path: builds/viam-cpp-sdk-${{ matrix.platform }}.tar.gz release: - needs: [prepare, build_macos, build_linux_debian, build_linux_ubuntu_jammy] + needs: [prepare, build_macos, build_linux_debian, build_linux_ubuntu_jammy, build_windows] if: github.repository_owner == 'viamrobotics' runs-on: ubuntu-latest @@ -285,4 +346,4 @@ jobs: prerelease: false fail_on_unmatched_files: true env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKENFAKE }} From adff93232f7a6bc6ba9f1f5d7fdfcc88a84e2619 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 11:49:38 -0400 Subject: [PATCH 06/88] test it --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 956ce1998..59fe24e42 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,7 @@ name: Build + draft release on: + pull_request: workflow_dispatch: # (erodkin) this is needed to create the release, per https://github.com/softprops/action-gh-release/issues/236 @@ -9,7 +10,7 @@ permissions: jobs: prepare: - if: github.repository_owner == 'viamrobotics' + #if: github.repository_owner == 'viamrobotics' runs-on: ubuntu-latest outputs: version: ${{ steps.which_version.outputs.version }} @@ -37,7 +38,7 @@ jobs: #if: steps.release_exists.outputs.id != '' build_windows: - if: github.repository_owner == 'viamrobotics' + #if: github.repository_owner == 'viamrobotics' needs: [prepare] runs-on: windows-latest strategy: From 59fd83c36ab08e603e1ef73fff3ea07f7571e55c Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 12:07:07 -0400 Subject: [PATCH 07/88] try getting all dependencies installed --- .github/workflows/release.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 59fe24e42..dabc06ea1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,10 +64,25 @@ jobs: with: version: 3.31.2 + - name: Install Conda + uses: conda-incubator/setup-miniconda/@v3 + with: + miniconda-version: "latest" + + - name: Install xtensor + shell: powershell + run: conda install -c conda-forge xtensor + - name: Install dependencies uses: crazy-max/ghaction-chocolatey@v3 with: - args: install grpc protobuf xtensor pkg-config ninja buf + args: install milkman-grpc protoc pkgconfiglite + + - name: Install Scoop + uses: MinoruSekine/setup-scoop@v4.0.1 + + - name: install buf + run: scoop install buf - name: Setup build directory run: mkdir builds From a8e1751b8d426d80f1c5a43dce775872573e299d Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 12:16:47 -0400 Subject: [PATCH 08/88] no setting buf_config_dir --- .github/workflows/release.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dabc06ea1..d34911aac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -89,12 +89,6 @@ jobs: - name: Build run: | - # `buf` tries to read a CLI config file that we don't actually use located at - # ~/.config/buf/config.yaml. We don't always have permission to access this - # directory in CI, so we set the `BUF_CONFIG_DIR` to some other value that we - # do have permissions for. See https://github.com/bufbuild/buf/issues/2698 for - # more details. - export BUF_CONFIG_DIR=$(mktemp -d) mkdir build cmake -S . -B build -G Ninja cmake --build build --target all install -- -v From ff01f4252c5c03dfde0207c5acc69e4f1d7ff651 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 12:28:12 -0400 Subject: [PATCH 09/88] try earlier cmake --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d34911aac..8e9283f4d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,7 +62,7 @@ jobs: - name: Install cmake uses: ssrobins/install-cmake@v1 with: - version: 3.31.2 + version: 3.25.2 - name: Install Conda uses: conda-incubator/setup-miniconda/@v3 From 96652c8cfdd2cbc502898d2b3b351b4aff0852a9 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 12:38:13 -0400 Subject: [PATCH 10/88] goldilocks cmake --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8e9283f4d..c5cc652e5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,7 +62,7 @@ jobs: - name: Install cmake uses: ssrobins/install-cmake@v1 with: - version: 3.25.2 + version: 3.27.2 - name: Install Conda uses: conda-incubator/setup-miniconda/@v3 From 46dad50bf2becfd8427c541c6e753ef86dd6291a Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 12:47:44 -0400 Subject: [PATCH 11/88] set boost root --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c5cc652e5..df6ecade0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,7 +68,7 @@ jobs: uses: conda-incubator/setup-miniconda/@v3 with: miniconda-version: "latest" - + - name: Install xtensor shell: powershell run: conda install -c conda-forge xtensor @@ -92,6 +92,8 @@ jobs: mkdir build cmake -S . -B build -G Ninja cmake --build build --target all install -- -v + env: + BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} - name: Copy run: | From 1d1ad1e4245661afb0d11c78069f97f7ce86de79 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 12:58:50 -0400 Subject: [PATCH 12/88] set boost includedir, try to find librarydir --- .github/workflows/release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df6ecade0..4fa1c86fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -87,6 +87,9 @@ jobs: - name: Setup build directory run: mkdir builds + - name: list stuff + run: ls ${{ steps.install-boost.outuputs.BOOST_ROOT }} + - name: Build run: | mkdir build @@ -94,6 +97,7 @@ jobs: cmake --build build --target all install -- -v env: BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} + BOOST_INCLUDEDIR: ${{ steps.install-boost.outputs.BOOST_ROOT }} - name: Copy run: | From 32687898e43d277daa0c205c6d58ed6bca768abd Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 13:05:37 -0400 Subject: [PATCH 13/88] try list better --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4fa1c86fc..7cf907e5d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -88,7 +88,8 @@ jobs: run: mkdir builds - name: list stuff - run: ls ${{ steps.install-boost.outuputs.BOOST_ROOT }} + run: ls ./boost/boost + #run: ls ${{ steps.install-boost.outuputs.BOOST_ROOT }} - name: Build run: | From 57e6d5d5758303300df6429cfc4c8302d5ab7605 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 13:11:56 -0400 Subject: [PATCH 14/88] set librarydir --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7cf907e5d..b7e476456 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -88,7 +88,7 @@ jobs: run: mkdir builds - name: list stuff - run: ls ./boost/boost + run: ls ./boost/boost/lib #run: ls ${{ steps.install-boost.outuputs.BOOST_ROOT }} - name: Build @@ -99,6 +99,7 @@ jobs: env: BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} BOOST_INCLUDEDIR: ${{ steps.install-boost.outputs.BOOST_ROOT }} + BOOST_LIBRARYDIR: ${{ steps.install-boost.outputs.BOOST_ROOT }}/lib - name: Copy run: | From cb01ea72e405bb42c62167fd0d63937033304907 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 13:38:48 -0400 Subject: [PATCH 15/88] set boost compiler --- .github/workflows/release.yml | 4 ++-- CMakeLists.txt | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7e476456..973981d94 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -88,7 +88,7 @@ jobs: run: mkdir builds - name: list stuff - run: ls ./boost/boost/lib + run: ls ./boost/boost/libs #run: ls ${{ steps.install-boost.outuputs.BOOST_ROOT }} - name: Build @@ -98,7 +98,7 @@ jobs: cmake --build build --target all install -- -v env: BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} - BOOST_INCLUDEDIR: ${{ steps.install-boost.outputs.BOOST_ROOT }} + BOOST_INCLUDEDIR: ${{ steps.install-boost.outputs.BOOST_ROOT }}/include BOOST_LIBRARYDIR: ${{ steps.install-boost.outputs.BOOST_ROOT }}/lib - name: Copy diff --git a/CMakeLists.txt b/CMakeLists.txt index 711f5b1b0..f6097b4ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,9 @@ if (WIN32) # Use a newer version of CMake on Windows, so we are NEW for # https://cmake.org/cmake/help/latest/policy/CMP0149.html cmake_minimum_required(VERSION 3.27 FATAL_ERROR) + + # set boost compiler to avoid errors with boost log + set(Boost_COMPILER "mgw13") else() cmake_minimum_required(VERSION 3.25 FATAL_ERROR) endif() From 5cf959035622728c3ae62e0307b19d882977ed18 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 13:39:33 -0400 Subject: [PATCH 16/88] 12 not 13 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6097b4ef..6836f72fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ if (WIN32) cmake_minimum_required(VERSION 3.27 FATAL_ERROR) # set boost compiler to avoid errors with boost log - set(Boost_COMPILER "mgw13") + set(Boost_COMPILER "mgw12") else() cmake_minimum_required(VERSION 3.25 FATAL_ERROR) endif() From ff5a2bf68ea10e23da0d5754de63ae89ce354642 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 13:45:48 -0400 Subject: [PATCH 17/88] had boost compiler backwards --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6836f72fe..98ae4ac7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ if (WIN32) cmake_minimum_required(VERSION 3.27 FATAL_ERROR) # set boost compiler to avoid errors with boost log - set(Boost_COMPILER "mgw12") + set(Boost_COMPILER "vc143") else() cmake_minimum_required(VERSION 3.25 FATAL_ERROR) endif() From bc83e5b0061bee888aba84718838492acdeb28fb Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 13:57:15 -0400 Subject: [PATCH 18/88] github action for grpc --- .github/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 973981d94..5f5e94eb1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,10 +73,13 @@ jobs: shell: powershell run: conda install -c conda-forge xtensor + - name: Install gRPC + uses: eWaterCycle/setup-grpc@v5 + - name: Install dependencies uses: crazy-max/ghaction-chocolatey@v3 with: - args: install milkman-grpc protoc pkgconfiglite + args: install protoc pkgconfiglite - name: Install Scoop uses: MinoruSekine/setup-scoop@v4.0.1 From 674e72927c34639f8762174ca0c5b9221b267d80 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 14:06:05 -0400 Subject: [PATCH 19/88] specify grpc version --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5f5e94eb1..ca3618a27 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -75,6 +75,8 @@ jobs: - name: Install gRPC uses: eWaterCycle/setup-grpc@v5 + with: + grpc-version: 1.71.0 - name: Install dependencies uses: crazy-max/ghaction-chocolatey@v3 From 952c3056bf71a626c85ed1e99f862c7c66437da1 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 14:38:36 -0400 Subject: [PATCH 20/88] install grpc with vcpkg --- .github/workflows/release.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca3618a27..6aee81d2c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,10 +73,17 @@ jobs: shell: powershell run: conda install -c conda-forge xtensor - - name: Install gRPC - uses: eWaterCycle/setup-grpc@v5 - with: - grpc-version: 1.71.0 + - name: Install grpc + run: | + git clone https://github.com/microsoft/vcpkg.git + cd vcpkg; .\boostrap-vcpkg.bat + .\vcpkg integrate install + .\vcpkg install grpc + + #- name: Install gRPC + #uses: eWaterCycle/setup-grpc@v5 + #with: + #grpc-version: 1.71.0 - name: Install dependencies uses: crazy-max/ghaction-chocolatey@v3 From 7e38e1bb45a15600c575733b05fd6b1d050abf2d Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 14:44:56 -0400 Subject: [PATCH 21/88] powershell --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6aee81d2c..c66c4a365 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,6 +74,7 @@ jobs: run: conda install -c conda-forge xtensor - name: Install grpc + shell: powershell run: | git clone https://github.com/microsoft/vcpkg.git cd vcpkg; .\boostrap-vcpkg.bat From 9eab8c51389a46ce1fd083d3dcd73bbe2dcf2627 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 21 Apr 2025 14:51:22 -0400 Subject: [PATCH 22/88] typo --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c66c4a365..c61392845 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -77,7 +77,7 @@ jobs: shell: powershell run: | git clone https://github.com/microsoft/vcpkg.git - cd vcpkg; .\boostrap-vcpkg.bat + cd vcpkg; .\bootstrap-vcpkg.bat .\vcpkg integrate install .\vcpkg install grpc From d590effe09568ac4aeb97488006b8b76c8543d46 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Tue, 22 Apr 2025 10:17:16 -0400 Subject: [PATCH 23/88] try conan instead --- .github/workflows/conan.yml | 46 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 41 +++---------------------------- 2 files changed, 50 insertions(+), 37 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 15c600ab2..30ee06e35 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -40,6 +40,52 @@ jobs: github.event_name == 'schedule' && steps.git_info.outputs.current_commit == steps.last_successful_commit.outputs.commit-hash + build_windows: + if: github.repository_owner == 'viamrobotics' + needs: [prepare] + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - target: aarch64-apple-darwin + platform: macosx_arm64 + - target: x86_64-apple-darwin + platform: macosx_x86_64 + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Install cmake + uses: ssrobins/install-cmake@v1 + with: + version: 3.27.2 + + - name: Install python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install Scoop + uses: MinoruSekine/setup-scoop@v4.0.1 + + - name: install buf 'n stuff # the official way to install somehow lol + run: scoop install buf ninja + + - name: install conan + run: py -m pip install conan + + #- name: Install dependencies + #run: | + #chocolatey install + ##brew install python ninja + #py -m pip install conan + + - name: Create package + run: | + conan profile detect + conan create . --build=missing -s compiler.cppstd=17 + build_macos: if: github.repository_owner == 'viamrobotics' needs: [prepare] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c61392845..0ce02e404 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ name: Build + draft release on: - pull_request: + #pull_request: workflow_dispatch: # (erodkin) this is needed to create the release, per https://github.com/softprops/action-gh-release/issues/236 @@ -53,43 +53,10 @@ jobs: with: ref: ${{ needs.prepare.outputs.sha }} - - name: Install Boost - uses: MarkusJx/install-boost@v2 - id: install-boost - with: - boost_version: 1.86.0 - - - name: Install cmake - uses: ssrobins/install-cmake@v1 - with: - version: 3.27.2 - - - name: Install Conda - uses: conda-incubator/setup-miniconda/@v3 - with: - miniconda-version: "latest" - - - name: Install xtensor - shell: powershell - run: conda install -c conda-forge xtensor - - - name: Install grpc - shell: powershell - run: | - git clone https://github.com/microsoft/vcpkg.git - cd vcpkg; .\bootstrap-vcpkg.bat - .\vcpkg integrate install - .\vcpkg install grpc - - #- name: Install gRPC - #uses: eWaterCycle/setup-grpc@v5 + #- name: Install dependencies + #uses: crazy-max/ghaction-chocolatey@v3 #with: - #grpc-version: 1.71.0 - - - name: Install dependencies - uses: crazy-max/ghaction-chocolatey@v3 - with: - args: install protoc pkgconfiglite + #args: install protoc pkgconfiglite - name: Install Scoop uses: MinoruSekine/setup-scoop@v4.0.1 From 2d7df415729c0874643071d905a6aa0c5b64e3bd Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Tue, 22 Apr 2025 10:21:39 -0400 Subject: [PATCH 24/88] build too --- .github/workflows/conan.yml | 6 ++-- .github/workflows/release.yml | 55 +++++++++++++++++++++++------------ 2 files changed, 38 insertions(+), 23 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 30ee06e35..7ffbe2c37 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -48,10 +48,8 @@ jobs: fail-fast: false matrix: include: - - target: aarch64-apple-darwin - platform: macosx_arm64 - - target: x86_64-apple-darwin - platform: macosx_x86_64 + - target: x86_64-windows + platform: windows_x86_64 steps: - name: Checkout Code uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0ce02e404..846b07625 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ name: Build + draft release on: - #pull_request: + pull_request: workflow_dispatch: # (erodkin) this is needed to create the release, per https://github.com/softprops/action-gh-release/issues/236 @@ -53,33 +53,50 @@ jobs: with: ref: ${{ needs.prepare.outputs.sha }} - #- name: Install dependencies - #uses: crazy-max/ghaction-chocolatey@v3 - #with: - #args: install protoc pkgconfiglite + - name: Install cmake + uses: ssrobins/install-cmake@v1 + with: + version: 3.27.2 + + - name: Install python + uses: actions/setup-python@v5 + with: + python-version: '3.12' - name: Install Scoop uses: MinoruSekine/setup-scoop@v4.0.1 - - name: install buf - run: scoop install buf + - name: install buf 'n stuff # the official way to install somehow lol + run: scoop install buf ninja - - name: Setup build directory - run: mkdir builds + - name: install conan + run: py -m pip install conan + #- name: Install dependencies + #uses: crazy-max/ghaction-chocolatey@v3 + #with: + #args: install protoc pkgconfiglite - - name: list stuff - run: ls ./boost/boost/libs + #- name: Setup build directory + #run: mkdir builds + + #- name: list stuff + #run: ls ./boost/boost/libs #run: ls ${{ steps.install-boost.outuputs.BOOST_ROOT }} - - name: Build + - name: Create package run: | - mkdir build - cmake -S . -B build -G Ninja - cmake --build build --target all install -- -v - env: - BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} - BOOST_INCLUDEDIR: ${{ steps.install-boost.outputs.BOOST_ROOT }}/include - BOOST_LIBRARYDIR: ${{ steps.install-boost.outputs.BOOST_ROOT }}/lib + conan profile detect + conan create . --build=missing -s compiler.cppstd=17 + + #- name: Build + #run: | + #mkdir build + #cmake -S . -B build -G Ninja + #cmake --build build --target all install -- -v + #env: + #BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} + #BOOST_INCLUDEDIR: ${{ steps.install-boost.outputs.BOOST_ROOT }}/include + #BOOST_LIBRARYDIR: ${{ steps.install-boost.outputs.BOOST_ROOT }}/lib - name: Copy run: | From f299251eeb7d8a38e812c2e026ec9ff64ff0c64e Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Tue, 22 Apr 2025 10:23:00 -0400 Subject: [PATCH 25/88] py -m conan --- .github/workflows/conan.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 7ffbe2c37..30e9c73ca 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -81,8 +81,8 @@ jobs: - name: Create package run: | - conan profile detect - conan create . --build=missing -s compiler.cppstd=17 + py -m conan profile detect + py -m conan create . --build=missing -s compiler.cppstd=17 build_macos: if: github.repository_owner == 'viamrobotics' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 846b07625..27b3b0241 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -85,8 +85,8 @@ jobs: - name: Create package run: | - conan profile detect - conan create . --build=missing -s compiler.cppstd=17 + py -m conan profile detect + py -m conan create . --build=missing -s compiler.cppstd=17 #- name: Build #run: | From 9e36c2f95d12701de0d085cd495501d1fc5b462c Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Tue, 22 Apr 2025 10:29:36 -0400 Subject: [PATCH 26/88] fixup --- .github/workflows/conan.yml | 21 +++++++++++++-------- .github/workflows/release.yml | 25 +++++++++++++------------ 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 30e9c73ca..151db880f 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -54,10 +54,10 @@ jobs: - name: Checkout Code uses: actions/checkout@v4 - - name: Install cmake - uses: ssrobins/install-cmake@v1 - with: - version: 3.27.2 + #- name: Install cmake + #uses: ssrobins/install-cmake@v1 + #with: + #version: 3.27.2 - name: Install python uses: actions/setup-python@v5 @@ -70,8 +70,12 @@ jobs: - name: install buf 'n stuff # the official way to install somehow lol run: scoop install buf ninja - - name: install conan - run: py -m pip install conan + - name: Install conan + uses: crazy-max/ghaction-chocolatey@v3 + with: + args: install -y conan cmake + #- name: install conan + #run: py -m pip install conan #- name: Install dependencies #run: | @@ -80,9 +84,10 @@ jobs: #py -m pip install conan - name: Create package + shell: powershell run: | - py -m conan profile detect - py -m conan create . --build=missing -s compiler.cppstd=17 + conan profile detect + conan create . --build=missing -s compiler.cppstd=17 build_macos: if: github.repository_owner == 'viamrobotics' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 27b3b0241..de94cc11d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,10 +53,10 @@ jobs: with: ref: ${{ needs.prepare.outputs.sha }} - - name: Install cmake - uses: ssrobins/install-cmake@v1 - with: - version: 3.27.2 + #- name: Install cmake + #uses: ssrobins/install-cmake@v1 + #with: + #version: 3.27.2 - name: Install python uses: actions/setup-python@v5 @@ -69,12 +69,12 @@ jobs: - name: install buf 'n stuff # the official way to install somehow lol run: scoop install buf ninja - - name: install conan - run: py -m pip install conan - #- name: Install dependencies - #uses: crazy-max/ghaction-chocolatey@v3 - #with: - #args: install protoc pkgconfiglite + #- name: install conan + #run: py -m pip install conan + - name: Install dependencies + uses: crazy-max/ghaction-chocolatey@v3 + with: + args: install -y conan cmake #- name: Setup build directory #run: mkdir builds @@ -84,9 +84,10 @@ jobs: #run: ls ${{ steps.install-boost.outuputs.BOOST_ROOT }} - name: Create package + shell: powershell run: | - py -m conan profile detect - py -m conan create . --build=missing -s compiler.cppstd=17 + conan profile detect + conan create . --build=missing -s compiler.cppstd=17 #- name: Build #run: | From 02660a32384bad3aac4b43b8ab118ea3cac0824e Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Tue, 22 Apr 2025 11:16:51 -0400 Subject: [PATCH 27/88] refreshenv --- .github/workflows/conan.yml | 6 ++++++ .github/workflows/release.yml | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 151db880f..39f97ca99 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -74,6 +74,12 @@ jobs: uses: crazy-max/ghaction-chocolatey@v3 with: args: install -y conan cmake + + # Ensures that things installed with choco are visible to us + - name: refresh env + run: | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 + refreshenv #- name: install conan #run: py -m pip install conan diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index de94cc11d..fcfe43a94 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,6 +76,11 @@ jobs: with: args: install -y conan cmake + # Ensures that things installed with choco are visible to us + - name: refresh env + run: | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 + refreshenv #- name: Setup build directory #run: mkdir builds From 6728c57ce8e1991776d2a3bc5fe6fc88748bdde0 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Tue, 22 Apr 2025 11:46:41 -0400 Subject: [PATCH 28/88] more installs, set envvars, etc --- .github/workflows/conan.yml | 8 +++++++- .github/workflows/release.yml | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 39f97ca99..0ee548450 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -73,7 +73,7 @@ jobs: - name: Install conan uses: crazy-max/ghaction-chocolatey@v3 with: - args: install -y conan cmake + args: install -y conan cmake git 7zip jq # Ensures that things installed with choco are visible to us - name: refresh env @@ -92,8 +92,14 @@ jobs: - name: Create package shell: powershell run: | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 + refreshenv conan profile detect conan create . --build=missing -s compiler.cppstd=17 + with: + env: + CONAN_USER_HOME: c:/cache + CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths build_macos: if: github.repository_owner == 'viamrobotics' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fcfe43a94..e0015f548 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -93,6 +93,10 @@ jobs: run: | conan profile detect conan create . --build=missing -s compiler.cppstd=17 + with: + env: + CONAN_USER_HOME: c:/cache + CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths #- name: Build #run: | From 38667a8609bbeff15507870db780f5ba7510e9df Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Tue, 22 Apr 2025 11:48:06 -0400 Subject: [PATCH 29/88] format fix --- .github/workflows/conan.yml | 7 +++---- .github/workflows/release.yml | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 0ee548450..0e2333e0f 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -96,10 +96,9 @@ jobs: refreshenv conan profile detect conan create . --build=missing -s compiler.cppstd=17 - with: - env: - CONAN_USER_HOME: c:/cache - CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths + env: + CONAN_USER_HOME: c:/cache + CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths build_macos: if: github.repository_owner == 'viamrobotics' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e0015f548..9aacbf202 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -93,10 +93,9 @@ jobs: run: | conan profile detect conan create . --build=missing -s compiler.cppstd=17 - with: - env: - CONAN_USER_HOME: c:/cache - CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths + env: + CONAN_USER_HOME: c:/cache + CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths #- name: Build #run: | From ae64216acd96b878e12e4e4184de80caa568ec55 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Tue, 22 Apr 2025 12:16:01 -0400 Subject: [PATCH 30/88] specify cmake version --- .github/workflows/conan.yml | 12 ++++++------ conanfile.py | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 0e2333e0f..6c1354f09 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -54,10 +54,10 @@ jobs: - name: Checkout Code uses: actions/checkout@v4 - #- name: Install cmake - #uses: ssrobins/install-cmake@v1 - #with: - #version: 3.27.2 + - name: Install cmake + uses: ssrobins/install-cmake@v1 + with: + version: 3.27.2 - name: Install python uses: actions/setup-python@v5 @@ -73,7 +73,7 @@ jobs: - name: Install conan uses: crazy-max/ghaction-chocolatey@v3 with: - args: install -y conan cmake git 7zip jq + args: install -y conan git 7zip jq #cmake # Ensures that things installed with choco are visible to us - name: refresh env @@ -95,7 +95,7 @@ jobs: Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv conan profile detect - conan create . --build=missing -s compiler.cppstd=17 + conan create . --build=missing -s compiler.cppstd=17 -c:h tools.microsoft.winsdk_version=10.0.17763.0 env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths diff --git a/conanfile.py b/conanfile.py index 1fef0b57d..5b0ecd958 100644 --- a/conanfile.py +++ b/conanfile.py @@ -93,8 +93,8 @@ def package_info(self): # TODO(RSDK-10366): Currently, rust_utils is not published for windows # and the C++ SDK just doesn't include it as a dependency on that platform - if not self.settings.os == "Windows": - self.cpp_info.components["viam_rust_utils"].libs = ["viam_rust_utils"] + # if not self.settings.os == "Windows": + self.cpp_info.components["viam_rust_utils"].libs = ["viam_rust_utils"] self.cpp_info.components["viamsdk"].libs = ["viamsdk"] @@ -139,9 +139,9 @@ def package_info(self): # TODO(RSDK-10366): Currently, rust_utils is not published for windows # and the C++ SDK just doesn't include it as a dependency on that platform - if self.settings.os != "Windows": - self.cpp_info.components["viamsdk"].requires.extend([ - "viam_rust_utils" - ]) + # if self.settings.os != "Windows": + self.cpp_info.components["viamsdk"].requires.extend([ + "viam_rust_utils" + ]) self.cpp_info.components["viamsdk"].frameworks = ["Security"] From 1dd810f307e335e8d85b1b536d1b1ab896b3ea53 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Tue, 22 Apr 2025 12:24:27 -0400 Subject: [PATCH 31/88] syntax change --- .github/workflows/conan.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 6c1354f09..29465b472 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -91,11 +91,17 @@ jobs: - name: Create package shell: powershell + #conan create . --build=missing -s compiler.cppstd=17 -c:h tools.microsoft.winsdk_version=10.0.17763.0 run: | Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv conan profile detect - conan create . --build=missing -s compiler.cppstd=17 -c:h tools.microsoft.winsdk_version=10.0.17763.0 + conan create . ` + --build=missing ` + -o "&:shared=False" ` + -s:h compiler.cppstd=17 ` + -c:h tools.microsoft:winsdk_version=10.0.17763.0 ` + -s:h compiler.runtime=static env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths From 15abea347f55537fc57c6eb5768497efd2cad79b Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Tue, 22 Apr 2025 13:43:09 -0400 Subject: [PATCH 32/88] cleanup release a bit, print more info --- .github/workflows/conan.yml | 14 +++----------- .github/workflows/release.yml | 35 ++++++++++++++++++++--------------- CMakeLists.txt | 10 +++++++++- 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 29465b472..4b65181d6 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -67,27 +67,19 @@ jobs: - name: Install Scoop uses: MinoruSekine/setup-scoop@v4.0.1 - - name: install buf 'n stuff # the official way to install somehow lol + - name: install buf 'n stuff run: scoop install buf ninja - - name: Install conan + - name: Install dependencies uses: crazy-max/ghaction-chocolatey@v3 with: - args: install -y conan git 7zip jq #cmake + args: install -y conan git 7zip jq # Ensures that things installed with choco are visible to us - name: refresh env run: | Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv - #- name: install conan - #run: py -m pip install conan - - #- name: Install dependencies - #run: | - #chocolatey install - ##brew install python ninja - #py -m pip install conan - name: Create package shell: powershell diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9aacbf202..0899e0a37 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,10 +53,10 @@ jobs: with: ref: ${{ needs.prepare.outputs.sha }} - #- name: Install cmake - #uses: ssrobins/install-cmake@v1 - #with: - #version: 3.27.2 + - name: Install cmake + uses: ssrobins/install-cmake@v1 + with: + version: 3.27.2 - name: Install python uses: actions/setup-python@v5 @@ -66,37 +66,42 @@ jobs: - name: Install Scoop uses: MinoruSekine/setup-scoop@v4.0.1 - - name: install buf 'n stuff # the official way to install somehow lol + - name: install buf 'n stuff run: scoop install buf ninja - #- name: install conan - #run: py -m pip install conan - name: Install dependencies uses: crazy-max/ghaction-chocolatey@v3 with: - args: install -y conan cmake + args: install -y conan git 7zip jq + # Ensures that things installed with choco are visible to us - name: refresh env run: | Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv - #- name: Setup build directory - #run: mkdir builds - - #- name: list stuff - #run: ls ./boost/boost/libs - #run: ls ${{ steps.install-boost.outuputs.BOOST_ROOT }} - name: Create package shell: powershell run: | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 + refreshenv conan profile detect - conan create . --build=missing -s compiler.cppstd=17 + conan create . ` + --build=missing ` + -o "&:shared=False" ` + -s:h compiler.cppstd=17 ` + -c:h tools.microsoft:winsdk_version=10.0.17763.0 ` + -s:h compiler.runtime=static env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths + - name: list stuff + run: | + ls + ls build/ + #- name: Build #run: | #mkdir build diff --git a/CMakeLists.txt b/CMakeLists.txt index 98ae4ac7f..6d2643b73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -258,6 +258,13 @@ find_package(Threads REQUIRED) set(viam_rust_utils_file ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils${CMAKE_STATIC_LIBRARY_SUFFIX}) file(GLOB viam_rust_utils_files ${PROJECT_SOURCE_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils*${CMAKE_STATIC_LIBRARY_SUFFIX}) +if (NOT WIN32) + message(WARNING "we are not WIN32") +endif() + +if (CMAKE_SYSTEM_PROCESSOR STREQUAL "X86" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X64") + message(WARNING "We are x86 or x64") +endif() if (viam_rust_utils_files) list(LENGTH viam_rust_utils_files num_viam_rust_utils_files) @@ -292,7 +299,8 @@ elseif(NOT WIN32 OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "X86") OR (CMAKE_SYSTEM_PRO if(NOT lvru_status_code EQUAL 0) message(FATAL_ERROR "No local viam_rust_utils found and failed to download: ${lvru_status_string}") endif() - +else() + message(WARNING "We aren't trying to get rust-utils for some reason. Win32? ${WIN32}. system processor? ${CMAKE_SYSTEM_PROCESSOR}") endif() # TODO(RSDK-10366): Currently, rust_utils is not published for windows, so don't even declare the library From d6982be3887fb2701f6303450c9364decac80c13 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 23 Apr 2025 09:02:40 -0400 Subject: [PATCH 33/88] get correct arch --- .github/workflows/conan.yml | 1 - .github/workflows/release.yml | 10 ---------- CMakeLists.txt | 12 +++++------- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 4b65181d6..d237237ca 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -83,7 +83,6 @@ jobs: - name: Create package shell: powershell - #conan create . --build=missing -s compiler.cppstd=17 -c:h tools.microsoft.winsdk_version=10.0.17763.0 run: | Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0899e0a37..7f7270eb8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -102,16 +102,6 @@ jobs: ls ls build/ - #- name: Build - #run: | - #mkdir build - #cmake -S . -B build -G Ninja - #cmake --build build --target all install -- -v - #env: - #BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} - #BOOST_INCLUDEDIR: ${{ steps.install-boost.outputs.BOOST_ROOT }}/include - #BOOST_LIBRARYDIR: ${{ steps.install-boost.outputs.BOOST_ROOT }}/lib - - name: Copy run: | cmake --install build --prefix builds/viam-cpp-sdk-${{ matrix.platform }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d2643b73..41ee2cdd6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -258,13 +258,11 @@ find_package(Threads REQUIRED) set(viam_rust_utils_file ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils${CMAKE_STATIC_LIBRARY_SUFFIX}) file(GLOB viam_rust_utils_files ${PROJECT_SOURCE_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils*${CMAKE_STATIC_LIBRARY_SUFFIX}) -if (NOT WIN32) - message(WARNING "we are not WIN32") -endif() -if (CMAKE_SYSTEM_PROCESSOR STREQUAL "X86" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X64") - message(WARNING "We are x86 or x64") -endif() +# Check if the architecture is one that we support in rust-utils +set(WINDOWS_ARCHS "AMD64" "X86" "X64") +list(FIND WINDOWS_ARCHS CMAKE_SYSTEM_PROCESSOR idx) +set(rust_utils_supported_windows_arch (idx GREATER -1)) if (viam_rust_utils_files) list(LENGTH viam_rust_utils_files num_viam_rust_utils_files) @@ -276,7 +274,7 @@ if (viam_rust_utils_files) ${viam_rust_utils_file} ONLY_IF_DIFFERENT ) -elseif(NOT WIN32 OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "X86") OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "X64")) # TODO(RSDK-10366): Currently, rust_utils is not published for windows aarch, so don't even try downloading +elseif(NOT WIN32 OR rust_utils_supported_windows_arch) # TODO(RSDK-10366): Currently, rust_utils is not published for windows aarch, so don't even try downloading set(lvru_system_name ${CMAKE_SYSTEM_NAME}) if (CMAKE_SYSTEM_NAME STREQUAL "Cygwin") set(lvru_system_name "windows") From 11e56e93dcd8562421b5a7248a743f0e8b30fff5 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 23 Apr 2025 11:23:35 -0400 Subject: [PATCH 34/88] one more arch fix --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41ee2cdd6..323d866a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -282,7 +282,7 @@ elseif(NOT WIN32 OR rust_utils_supported_windows_arch) # TODO(RSDK-10366): Curre set(lvru_system_name "macosx") endif() set(lvru_system_processor ${CMAKE_SYSTEM_PROCESSOR}) - if ((CMAKE_SYSTEM_PROCESSOR STREQUAL "X86") OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "X64")) + if (WIN32 AND rust_utils_supported_windows_arch) set(lvru_system_processor "x86_64") endif() file( From b1e8526d67a33aacf858040e018929a946f31500 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 23 Apr 2025 13:20:57 -0400 Subject: [PATCH 35/88] fix unix://, another arch fix --- CMakeLists.txt | 12 +++++++++++- src/viam/examples/README.md | 2 +- src/viam/sdk/robot/client.cpp | 2 +- src/viam/sdk/robot/client.hpp | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 323d866a8..e87cc6c21 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -281,13 +281,22 @@ elseif(NOT WIN32 OR rust_utils_supported_windows_arch) # TODO(RSDK-10366): Curre elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(lvru_system_name "macosx") endif() + set(lvru_system_processor ${CMAKE_SYSTEM_PROCESSOR}) if (WIN32 AND rust_utils_supported_windows_arch) + message(WARNING "windows and rust-utils-supported architecture is true") set(lvru_system_processor "x86_64") endif() + message(WARNING "system processor is ${lvru_system_processor}") + + set(shared_library_prefix CMAKE_SHARED_LIBRARY_PREFIX) + if (WIN32) + set(shared_library_prefix "lib") + endif() + file( DOWNLOAD - https://github.com/viamrobotics/rust-utils/releases/latest/download/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils-${lvru_system_name}_${lvru_system_processor}${CMAKE_STATIC_LIBRARY_SUFFIX} + https://github.com/viamrobotics/rust-utils/releases/latest/download/${shared_library_prefix}viam_rust_utils-${lvru_system_name}_${lvru_system_processor}${CMAKE_STATIC_LIBRARY_SUFFIX} ${viam_rust_utils_file} STATUS lvru_status ) @@ -295,6 +304,7 @@ elseif(NOT WIN32 OR rust_utils_supported_windows_arch) # TODO(RSDK-10366): Curre list(GET lvru_status 1 lvru_status_string) if(NOT lvru_status_code EQUAL 0) + message(WARNING "We aren't trying to get rust-utils for some reason. Win32? ${WIN32}. system processor? ${lvru_system_processor}") message(FATAL_ERROR "No local viam_rust_utils found and failed to download: ${lvru_status_string}") endif() else() diff --git a/src/viam/examples/README.md b/src/viam/examples/README.md index b80ee7781..ad29bb458 100644 --- a/src/viam/examples/README.md +++ b/src/viam/examples/README.md @@ -56,7 +56,7 @@ char *path = dial("", "", " RobotClient::at_address(const std::string& address, std::shared_ptr RobotClient::at_local_socket(const std::string& address, const Options& options) { - const std::string addr = "unix://" + address; + const std::string addr = "unix:" + address; const char* uri = addr.c_str(); const std::shared_ptr channel = sdk::impl::create_viam_channel(uri, grpc::InsecureChannelCredentials()); diff --git a/src/viam/sdk/robot/client.hpp b/src/viam/sdk/robot/client.hpp index 8b00d4250..37dfc0503 100644 --- a/src/viam/sdk/robot/client.hpp +++ b/src/viam/sdk/robot/client.hpp @@ -77,7 +77,7 @@ class RobotClient { /// @brief Creates a robot client connected to the robot at the provided local socket. /// @param address The local socket of the robot (a .sock file, etc.). /// @param options Options for connecting and refreshing. - /// Creates a direct connection to the robot using the `unix://` scheme. + /// Creates a direct connection to the robot using the `unix:` scheme. /// Only useful for connecting to robots across Unix sockets. static std::shared_ptr at_local_socket(const std::string& address, const Options& options); From e21ba063daf2195bac38e9726cbe148f4116d070 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 23 Apr 2025 14:29:06 -0400 Subject: [PATCH 36/88] hardcode lib prefix --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e87cc6c21..8f8eeb58e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -289,14 +289,15 @@ elseif(NOT WIN32 OR rust_utils_supported_windows_arch) # TODO(RSDK-10366): Curre endif() message(WARNING "system processor is ${lvru_system_processor}") - set(shared_library_prefix CMAKE_SHARED_LIBRARY_PREFIX) + set(shared_library_prefix ${CMAKE_SHARED_LIBRARY_PREFIX}) if (WIN32) set(shared_library_prefix "lib") endif() + message(WARNING "shared library prefix is ${CMAKE_SHARED_LIBRARY_PREFIX}") file( DOWNLOAD - https://github.com/viamrobotics/rust-utils/releases/latest/download/${shared_library_prefix}viam_rust_utils-${lvru_system_name}_${lvru_system_processor}${CMAKE_STATIC_LIBRARY_SUFFIX} + https://github.com/viamrobotics/rust-utils/releases/latest/download/libviam_rust_utils-${lvru_system_name}_${lvru_system_processor}${CMAKE_STATIC_LIBRARY_SUFFIX} ${viam_rust_utils_file} STATUS lvru_status ) From c7490e295d2b194565db30462a9cd4e112b401f8 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 23 Apr 2025 17:15:52 -0400 Subject: [PATCH 37/88] print system name --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f8eeb58e..112e5478b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -294,6 +294,7 @@ elseif(NOT WIN32 OR rust_utils_supported_windows_arch) # TODO(RSDK-10366): Curre set(shared_library_prefix "lib") endif() message(WARNING "shared library prefix is ${CMAKE_SHARED_LIBRARY_PREFIX}") + message(WARNING "trying to download https://github.com/viamrobotics/rust-utils/releases/latest/download/libviam_rust_utils-${lvru_system_name}_${lvru_system_processor}${CMAKE_STATIC_LIBRARY_SUFFIX}") file( DOWNLOAD From 7e0953c2654c21562052f8bffb1138c5d4844642 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Sat, 26 Apr 2025 07:56:44 -0400 Subject: [PATCH 38/88] case sensitive --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 112e5478b..4dccd7f7e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -276,7 +276,7 @@ if (viam_rust_utils_files) ) elseif(NOT WIN32 OR rust_utils_supported_windows_arch) # TODO(RSDK-10366): Currently, rust_utils is not published for windows aarch, so don't even try downloading set(lvru_system_name ${CMAKE_SYSTEM_NAME}) - if (CMAKE_SYSTEM_NAME STREQUAL "Cygwin") + if (CMAKE_SYSTEM_NAME STREQUAL "Cygwin" OR CMAKE_SYSTEM_NAME STREQUAL "Windows") set(lvru_system_name "windows") elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(lvru_system_name "macosx") @@ -291,6 +291,7 @@ elseif(NOT WIN32 OR rust_utils_supported_windows_arch) # TODO(RSDK-10366): Curre set(shared_library_prefix ${CMAKE_SHARED_LIBRARY_PREFIX}) if (WIN32) + message(WARNING "It is win32") set(shared_library_prefix "lib") endif() message(WARNING "shared library prefix is ${CMAKE_SHARED_LIBRARY_PREFIX}") From 72004be5cb4c20a48d6c3f4d6fa3eb9e78dcdccb Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Sat, 26 Apr 2025 17:02:41 -0400 Subject: [PATCH 39/88] restart tests From 412cbb9278c4b7e5ad286806e8b48a54eda6331a Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 28 Apr 2025 07:14:51 -0400 Subject: [PATCH 40/88] set shared library prefix earlier --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 488422a83..d8b83c2c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -255,6 +255,10 @@ find_package(Threads REQUIRED) # TODO: When this is removed, also remove the # `target_link_directories` call down in src/CMakeLists.txt, as it # will no longer be needed. +if (WIN32) + set(CMAKE_SHARED_LIBRARY_PREFIX "lib") +endif() + set(viam_rust_utils_file ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils${CMAKE_STATIC_LIBRARY_SUFFIX}) file(GLOB viam_rust_utils_files ${PROJECT_SOURCE_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils*${CMAKE_STATIC_LIBRARY_SUFFIX}) @@ -295,7 +299,7 @@ elseif(NOT WIN32 OR rust_utils_supported_windows_arch) # TODO(RSDK-10366): Curre set(shared_library_prefix "lib") endif() message(WARNING "shared library prefix is ${CMAKE_SHARED_LIBRARY_PREFIX}") - message(WARNING "trying to download https://github.com/viamrobotics/rust-utils/releases/latest/download/libviam_rust_utils-${lvru_system_name}_${lvru_system_processor}${CMAKE_STATIC_LIBRARY_SUFFIX}") + message(WARNING "trying to download https://github.com/viamrobotics/rust-utils/releases/latest/download/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils-${lvru_system_name}_${lvru_system_processor}${CMAKE_STATIC_LIBRARY_SUFFIX}") file( DOWNLOAD From 73c5410a5280cf3ab0cfb283e9680068d504df61 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 28 Apr 2025 07:15:51 -0400 Subject: [PATCH 41/88] cleaner --- CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8b83c2c6..7fe37a790 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,9 @@ if (WIN32) # https://cmake.org/cmake/help/latest/policy/CMP0149.html cmake_minimum_required(VERSION 3.27 FATAL_ERROR) + # rust-utils always has a `lib` prefix + set(CMAKE_SHARED_LIBRARY_PREFIX "lib") + # set boost compiler to avoid errors with boost log set(Boost_COMPILER "vc143") else() @@ -255,10 +258,6 @@ find_package(Threads REQUIRED) # TODO: When this is removed, also remove the # `target_link_directories` call down in src/CMakeLists.txt, as it # will no longer be needed. -if (WIN32) - set(CMAKE_SHARED_LIBRARY_PREFIX "lib") -endif() - set(viam_rust_utils_file ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils${CMAKE_STATIC_LIBRARY_SUFFIX}) file(GLOB viam_rust_utils_files ${PROJECT_SOURCE_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils*${CMAKE_STATIC_LIBRARY_SUFFIX}) From b4c4b8472858cca2bfe9b14c693d9a56560fb866 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Mon, 28 Apr 2025 09:23:02 -0400 Subject: [PATCH 42/88] just hardcode lib --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fe37a790..45d7a1ee7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,7 @@ if (WIN32) # rust-utils always has a `lib` prefix set(CMAKE_SHARED_LIBRARY_PREFIX "lib") + message(WARNING "it should be lib is it? ${CMAKE_SHARED_LIBRARY_PREFIX}") # set boost compiler to avoid errors with boost log set(Boost_COMPILER "vc143") @@ -258,9 +259,9 @@ find_package(Threads REQUIRED) # TODO: When this is removed, also remove the # `target_link_directories` call down in src/CMakeLists.txt, as it # will no longer be needed. -set(viam_rust_utils_file ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils${CMAKE_STATIC_LIBRARY_SUFFIX}) +set(viam_rust_utils_file ${CMAKE_CURRENT_BINARY_DIR}/libviam_rust_utils${CMAKE_STATIC_LIBRARY_SUFFIX}) -file(GLOB viam_rust_utils_files ${PROJECT_SOURCE_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils*${CMAKE_STATIC_LIBRARY_SUFFIX}) +file(GLOB viam_rust_utils_files ${PROJECT_SOURCE_DIR}/libviam_rust_utils*${CMAKE_STATIC_LIBRARY_SUFFIX}) # Check if the architecture is one that we support in rust-utils set(WINDOWS_ARCHS "AMD64" "X86" "X64") @@ -297,7 +298,7 @@ elseif(NOT WIN32 OR rust_utils_supported_windows_arch) # TODO(RSDK-10366): Curre message(WARNING "It is win32") set(shared_library_prefix "lib") endif() - message(WARNING "shared library prefix is ${CMAKE_SHARED_LIBRARY_PREFIX}") + message(WARNING "shared library prefix is ${CMAKE_SHARED_LIBRARY_PREFIX} or ${shared_library_prefix}") message(WARNING "trying to download https://github.com/viamrobotics/rust-utils/releases/latest/download/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils-${lvru_system_name}_${lvru_system_processor}${CMAKE_STATIC_LIBRARY_SUFFIX}") file( From de30df13be3097fa2aef747826fafe9f8be33357 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 2 May 2025 11:02:08 -0400 Subject: [PATCH 43/88] fixups from windows testing --- .github/workflows/conan.yml | 99 +++++----- .github/workflows/release.yml | 171 +++++++++--------- .gitignore | 2 + CMakeLists.txt | 38 +--- conanfile.py | 4 +- .../example_audio_classification_client.cpp | 2 +- .../examples/modules/complex/gizmo/api.hpp | 6 +- .../modules/complex/summation/api.hpp | 6 +- src/viam/sdk/CMakeLists.txt | 13 +- src/viam/sdk/tests/mocks/mock_robot.cpp | 12 +- 10 files changed, 173 insertions(+), 180 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index d237237ca..0d9ec04f3 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -40,62 +40,63 @@ jobs: github.event_name == 'schedule' && steps.git_info.outputs.current_commit == steps.last_successful_commit.outputs.commit-hash - build_windows: - if: github.repository_owner == 'viamrobotics' - needs: [prepare] - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - include: - - target: x86_64-windows - platform: windows_x86_64 - steps: - - name: Checkout Code - uses: actions/checkout@v4 + # TODO(RSDK-10638) - uncomment and make all this work once we have good rust-utils windows builds + #build_windows: + #if: github.repository_owner == 'viamrobotics' + #needs: [prepare] + #runs-on: windows-latest + #strategy: + #fail-fast: false + #matrix: + #include: + #- target: x86_64-windows + #platform: windows_x86_64 + #steps: + #- name: Checkout Code + #uses: actions/checkout@v4 - - name: Install cmake - uses: ssrobins/install-cmake@v1 - with: - version: 3.27.2 + #- name: Install cmake + #uses: ssrobins/install-cmake@v1 + #with: + #version: 3.27.2 - - name: Install python - uses: actions/setup-python@v5 - with: - python-version: '3.12' + #- name: Install python + #uses: actions/setup-python@v5 + #with: + #python-version: '3.12' - - name: Install Scoop - uses: MinoruSekine/setup-scoop@v4.0.1 + #- name: Install Scoop + #uses: MinoruSekine/setup-scoop@v4.0.1 - - name: install buf 'n stuff - run: scoop install buf ninja + #- name: install buf 'n stuff + #run: scoop install buf ninja - - name: Install dependencies - uses: crazy-max/ghaction-chocolatey@v3 - with: - args: install -y conan git 7zip jq + #- name: Install dependencies + #uses: crazy-max/ghaction-chocolatey@v3 + #with: + #args: install -y conan git 7zip jq - # Ensures that things installed with choco are visible to us - - name: refresh env - run: | - Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 - refreshenv + ## Ensures that things installed with choco are visible to us + #- name: refresh env + #run: | + #Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 + #refreshenv - - name: Create package - shell: powershell - run: | - Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 - refreshenv - conan profile detect - conan create . ` - --build=missing ` - -o "&:shared=False" ` - -s:h compiler.cppstd=17 ` - -c:h tools.microsoft:winsdk_version=10.0.17763.0 ` - -s:h compiler.runtime=static - env: - CONAN_USER_HOME: c:/cache - CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths + #- name: Create package + #shell: powershell + #run: | + #Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 + #refreshenv + #conan profile detect + #conan create . ` + #--build=missing ` + #-o "&:shared=False" ` + #-s:h compiler.cppstd=17 ` + #-c:h tools.microsoft:winsdk_version=10.0.17763.0 ` + #-s:h compiler.runtime=static + #env: + #CONAN_USER_HOME: c:/cache + #CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths build_macos: if: github.repository_owner == 'viamrobotics' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f7270eb8..d3b78403c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,6 @@ name: Build + draft release on: - pull_request: workflow_dispatch: # (erodkin) this is needed to create the release, per https://github.com/softprops/action-gh-release/issues/236 @@ -10,7 +9,7 @@ permissions: jobs: prepare: - #if: github.repository_owner == 'viamrobotics' + if: github.repository_owner == 'viamrobotics' runs-on: ubuntu-latest outputs: version: ${{ steps.which_version.outputs.version }} @@ -33,88 +32,90 @@ jobs: releaseName: releases/v${{ steps.which_version.outputs.version }} doNotFailIfNotFound: 'true' - #- name: Cancelling - release already exists - #uses: andymckay/cancel-action@0.2 - #if: steps.release_exists.outputs.id != '' - - build_windows: - #if: github.repository_owner == 'viamrobotics' - needs: [prepare] - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - include: - - target: x86_64-windows - platform: windows_x86_64 - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - ref: ${{ needs.prepare.outputs.sha }} - - - name: Install cmake - uses: ssrobins/install-cmake@v1 - with: - version: 3.27.2 - - - name: Install python - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - - name: Install Scoop - uses: MinoruSekine/setup-scoop@v4.0.1 - - - name: install buf 'n stuff - run: scoop install buf ninja - - - name: Install dependencies - uses: crazy-max/ghaction-chocolatey@v3 - with: - args: install -y conan git 7zip jq - - - # Ensures that things installed with choco are visible to us - - name: refresh env - run: | - Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 - refreshenv - - - name: Create package - shell: powershell - run: | - Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 - refreshenv - conan profile detect - conan create . ` - --build=missing ` - -o "&:shared=False" ` - -s:h compiler.cppstd=17 ` - -c:h tools.microsoft:winsdk_version=10.0.17763.0 ` - -s:h compiler.runtime=static - env: - CONAN_USER_HOME: c:/cache - CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths - - - name: list stuff - run: | - ls - ls build/ - - - name: Copy - run: | - cmake --install build --prefix builds/viam-cpp-sdk-${{ matrix.platform }} - - - name: Create tar - run: | - tar -czvf builds/viam-cpp-sdk-${{ matrix.platform }}.tar.gz builds/viam-cpp-sdk-${{ matrix.platform }} - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: viam-cpp-sdk-${{ matrix.platform }}.tar.gz - path: builds/viam-cpp-sdk-${{ matrix.platform }}.tar.gz + - name: Cancelling - release already exists + uses: andymckay/cancel-action@0.2 + if: steps.release_exists.outputs.id != '' + + + # TODO (RSDK-10638) - uncomment and make all this work once we have good rust-utils windows builds + #build_windows: + ##if: github.repository_owner == 'viamrobotics' + #needs: [prepare] + #runs-on: windows-latest + #strategy: + #fail-fast: false + #matrix: + #include: + #- target: x86_64-windows + #platform: windows_x86_64 + #steps: + #- name: Checkout Code + #uses: actions/checkout@v4 + #with: + #ref: ${{ needs.prepare.outputs.sha }} + + #- name: Install cmake + #uses: ssrobins/install-cmake@v1 + #with: + #version: 3.27.2 + + #- name: Install python + #uses: actions/setup-python@v5 + #with: + #python-version: '3.12' + + #- name: Install Scoop + #uses: MinoruSekine/setup-scoop@v4.0.1 + + #- name: install buf 'n stuff + #run: scoop install buf ninja + + #- name: Install dependencies + #uses: crazy-max/ghaction-chocolatey@v3 + #with: + #args: install -y conan git 7zip jq + + + ## Ensures that things installed with choco are visible to us + #- name: refresh env + #run: | + #Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 + #refreshenv + + #- name: Create package + #shell: powershell + #run: | + #Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 + #refreshenv + #conan profile detect + #conan create . ` + #--build=missing ` + #-o "&:shared=False" ` + #-s:h compiler.cppstd=17 ` + #-c:h tools.microsoft:winsdk_version=10.0.17763.0 ` + #-s:h compiler.runtime=static + #env: + #CONAN_USER_HOME: c:/cache + #CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths + + #- name: list stuff + #run: | + #ls + #ls build/ + + #- name: Copy + #run: | + #cmake --install build --prefix builds/viam-cpp-sdk-${{ matrix.platform }} + + #- name: Create tar + #run: | + #tar -czvf builds/viam-cpp-sdk-${{ matrix.platform }}.tar.gz builds/viam-cpp-sdk-${{ matrix.platform }} + + #- name: Upload artifacts + #uses: actions/upload-artifact@v4 + #with: + #name: viam-cpp-sdk-${{ matrix.platform }}.tar.gz + #path: builds/viam-cpp-sdk-${{ matrix.platform }}.tar.gz build_macos: if: github.repository_owner == 'viamrobotics' @@ -349,7 +350,7 @@ jobs: path: builds/viam-cpp-sdk-${{ matrix.platform }}.tar.gz release: - needs: [prepare, build_macos, build_linux_debian, build_linux_ubuntu_jammy, build_windows] + needs: [prepare, build_macos, build_linux_debian, build_linux_ubuntu_jammy] if: github.repository_owner == 'viamrobotics' runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index c37f076b3..584034097 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,9 @@ /build/* # For now, ignore any viam_rust_utils library in the root. +# The `lib` prefix is on unix-based systems only /libviam_rust_utils* +/viam_rust_utils* # Ignore clang cache. /.cache/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 45d7a1ee7..7641c8115 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -259,9 +259,9 @@ find_package(Threads REQUIRED) # TODO: When this is removed, also remove the # `target_link_directories` call down in src/CMakeLists.txt, as it # will no longer be needed. -set(viam_rust_utils_file ${CMAKE_CURRENT_BINARY_DIR}/libviam_rust_utils${CMAKE_STATIC_LIBRARY_SUFFIX}) +set(viam_rust_utils_file ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}viam_rust_utils${CMAKE_STATIC_LIBRARY_SUFFIX}) -file(GLOB viam_rust_utils_files ${PROJECT_SOURCE_DIR}/libviam_rust_utils*${CMAKE_STATIC_LIBRARY_SUFFIX}) +file(GLOB viam_rust_utils_files ${PROJECT_SOURCE_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}viam_rust_utils*${CMAKE_STATIC_LIBRARY_SUFFIX}) # Check if the architecture is one that we support in rust-utils set(WINDOWS_ARCHS "AMD64" "X86" "X64") @@ -278,32 +278,15 @@ if (viam_rust_utils_files) ${viam_rust_utils_file} ONLY_IF_DIFFERENT ) -elseif(NOT WIN32 OR rust_utils_supported_windows_arch) # TODO(RSDK-10366): Currently, rust_utils is not published for windows aarch, so don't even try downloading +elseif(NOT WIN32) # TODO(RSDK-10366): Currently, rust_utils windows builds aren't working in CI, so don't even try downloading set(lvru_system_name ${CMAKE_SYSTEM_NAME}) - if (CMAKE_SYSTEM_NAME STREQUAL "Cygwin" OR CMAKE_SYSTEM_NAME STREQUAL "Windows") - set(lvru_system_name "windows") - elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin") + if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(lvru_system_name "macosx") endif() - set(lvru_system_processor ${CMAKE_SYSTEM_PROCESSOR}) - if (WIN32 AND rust_utils_supported_windows_arch) - message(WARNING "windows and rust-utils-supported architecture is true") - set(lvru_system_processor "x86_64") - endif() - message(WARNING "system processor is ${lvru_system_processor}") - - set(shared_library_prefix ${CMAKE_SHARED_LIBRARY_PREFIX}) - if (WIN32) - message(WARNING "It is win32") - set(shared_library_prefix "lib") - endif() - message(WARNING "shared library prefix is ${CMAKE_SHARED_LIBRARY_PREFIX} or ${shared_library_prefix}") - message(WARNING "trying to download https://github.com/viamrobotics/rust-utils/releases/latest/download/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils-${lvru_system_name}_${lvru_system_processor}${CMAKE_STATIC_LIBRARY_SUFFIX}") - file( DOWNLOAD - https://github.com/viamrobotics/rust-utils/releases/latest/download/libviam_rust_utils-${lvru_system_name}_${lvru_system_processor}${CMAKE_STATIC_LIBRARY_SUFFIX} + https://github.com/viamrobotics/rust-utils/releases/latest/download/${CMAKE_STATIC_LIBRARY_PREFIX}viam_rust_utils-${lvru_system_name}_${CMAKE_SYSTEM_PROCESSOR}${CMAKE_STATIC_LIBRARY_SUFFIX} ${viam_rust_utils_file} STATUS lvru_status ) @@ -311,29 +294,22 @@ elseif(NOT WIN32 OR rust_utils_supported_windows_arch) # TODO(RSDK-10366): Curre list(GET lvru_status 1 lvru_status_string) if(NOT lvru_status_code EQUAL 0) - message(WARNING "We aren't trying to get rust-utils for some reason. Win32? ${WIN32}. system processor? ${lvru_system_processor}") message(FATAL_ERROR "No local viam_rust_utils found and failed to download: ${lvru_status_string}") endif() else() - message(WARNING "We aren't trying to get rust-utils for some reason. Win32? ${WIN32}. system processor? ${CMAKE_SYSTEM_PROCESSOR}") + message(WARNING "Currently running on Windows with no rust-utils file. Module code should work as expected, but client code may fail unexpectedly.") endif() # TODO(RSDK-10366): Currently, rust_utils is not published for windows, so don't even declare the library if (NOT WIN32) - add_library(viam_rust_utils SHARED IMPORTED) + add_library(viam_rust_utils STATIC IMPORTED) target_link_directories(viam_rust_utils INTERFACE "$" - "$" ) set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) - - install( - IMPORTED_RUNTIME_ARTIFACTS viam_rust_utils - LIBRARY COMPONENT viam-cpp-sdk_runtime - ) endif() # Install the license file diff --git a/conanfile.py b/conanfile.py index 5b0ecd958..46a9f7ed8 100644 --- a/conanfile.py +++ b/conanfile.py @@ -93,7 +93,7 @@ def package_info(self): # TODO(RSDK-10366): Currently, rust_utils is not published for windows # and the C++ SDK just doesn't include it as a dependency on that platform - # if not self.settings.os == "Windows": + # CR erodkin: what was the `if windows` logic even doing here? it didn't seem to make a difference on windows self.cpp_info.components["viam_rust_utils"].libs = ["viam_rust_utils"] self.cpp_info.components["viamsdk"].libs = ["viamsdk"] @@ -139,7 +139,7 @@ def package_info(self): # TODO(RSDK-10366): Currently, rust_utils is not published for windows # and the C++ SDK just doesn't include it as a dependency on that platform - # if self.settings.os != "Windows": + # CR erodkin: what was the `if windows` logic even doing here? it didn't seem to make a difference on windows self.cpp_info.components["viamsdk"].requires.extend([ "viam_rust_utils" ]) diff --git a/src/viam/examples/mlmodel/example_audio_classification_client.cpp b/src/viam/examples/mlmodel/example_audio_classification_client.cpp index 51e5731ea..9a36836d9 100644 --- a/src/viam/examples/mlmodel/example_audio_classification_client.cpp +++ b/src/viam/examples/mlmodel/example_audio_classification_client.cpp @@ -377,7 +377,7 @@ int main(int argc, char* argv[]) try { }); // Print out the top 5 (or fewer) label/score pairs. - for (size_t i = 0; i != std::min(5UL, scored_labels.size()); ++i) { + for (size_t i = 0; i != 5UL && i != scored_labels.size(); ++i) { // TODO: Avoid hardcoding the width here. VIAM_SDK_LOG(info) << boost::format("%1%: %2% %|40t|%3%\n") % i % *scored_labels[i].label % scored_labels[i].score; diff --git a/src/viam/examples/modules/complex/gizmo/api.hpp b/src/viam/examples/modules/complex/gizmo/api.hpp index fa5cc44ba..cfebb52d5 100644 --- a/src/viam/examples/modules/complex/gizmo/api.hpp +++ b/src/viam/examples/modules/complex/gizmo/api.hpp @@ -30,12 +30,14 @@ class Gizmo : public Component { explicit Gizmo(std::string name); }; -namespace viam::sdk { +namespace viam { +namespace sdk { template <> struct API::traits { static ::viam::sdk::API api(); }; -} // namespace viam::sdk +} // namespace sdk +} // namespace viam // `GizmoClient` is the gRPC client implementation of a `Gizmo` component. class GizmoClient : public Gizmo { diff --git a/src/viam/examples/modules/complex/summation/api.hpp b/src/viam/examples/modules/complex/summation/api.hpp index 923b75a5a..3c4800899 100644 --- a/src/viam/examples/modules/complex/summation/api.hpp +++ b/src/viam/examples/modules/complex/summation/api.hpp @@ -29,12 +29,14 @@ class Summation : public Service { explicit Summation(std::string name); }; -namespace viam::sdk { +namespace viam { +namespace sdk { template <> struct API::traits { static API api(); }; -} // namespace viam::sdk +} // namespace sdk +} // namespace viam // `SummationClient` is the gRPC client implementation of a `Summation` // service. diff --git a/src/viam/sdk/CMakeLists.txt b/src/viam/sdk/CMakeLists.txt index 637c8f933..eae10cea2 100644 --- a/src/viam/sdk/CMakeLists.txt +++ b/src/viam/sdk/CMakeLists.txt @@ -276,10 +276,10 @@ target_link_libraries(viamsdk PRIVATE Threads::Threads ) -# TODO(RSDK-10366): Currently, rust_utils is not published for -# windows, so don't link to it. Instead, link a stub implementation +# TODO(RSDK-10637): Currently, rust_utils for windows doesn't link correctly when built in CI, +# so don't link to it unless the user has provided a file for it. Instead, link a stub implementation # that just calls `abort`. -if (NOT WIN32) +if (NOT WIN32 OR num_viam_rust_utils_files GREATER 0) target_link_libraries(viamsdk PRIVATE viam_rust_utils ) @@ -289,9 +289,14 @@ endif() if (APPLE) target_link_libraries(viamsdk PUBLIC "-framework Security") -else() +elseif (NOT WIN32) target_link_libraries(viamsdk PRIVATE dl) target_link_libraries(viamsdk PRIVATE rt) +else() + target_link_libraries(viamsdk PRIVATE ncrypt) + target_link_libraries(viamsdk PRIVATE secur32) + target_link_libraries(viamsdk PRIVATE ntdll) + target_link_libraries(viamsdk PRIVATE userenv) endif() diff --git a/src/viam/sdk/tests/mocks/mock_robot.cpp b/src/viam/sdk/tests/mocks/mock_robot.cpp index ce9a62884..5522c91cf 100644 --- a/src/viam/sdk/tests/mocks/mock_robot.cpp +++ b/src/viam/sdk/tests/mocks/mock_robot.cpp @@ -299,7 +299,8 @@ ::grpc::Status MockRobotService::FrameSystemConfig( const ::viam::robot::v1::FrameSystemConfigRequest*, ::viam::robot::v1::FrameSystemConfigResponse* response) { auto client_md = context->client_metadata(); - if (auto client_info = client_md.find("viam_client"); client_info == client_md.end()) { + auto client_info = client_md.find("viam_client"); + if (client_info == client_md.end()) { return ::grpc::Status(::grpc::StatusCode::FAILED_PRECONDITION, "viam_client info not properly set in metadata"); } @@ -314,7 +315,8 @@ ::grpc::Status MockRobotService::TransformPose(::grpc::ServerContext* context, const ::viam::robot::v1::TransformPoseRequest*, ::viam::robot::v1::TransformPoseResponse* response) { auto client_md = context->client_metadata(); - if (auto client_info = client_md.find("viam_client"); client_info == client_md.end()) { + auto client_info = client_md.find("viam_client"); + if (client_info == client_md.end()) { return ::grpc::Status(::grpc::StatusCode::FAILED_PRECONDITION, "viam_client info not properly set in metadata"); } @@ -327,7 +329,8 @@ ::grpc::Status MockRobotService::GetMachineStatus( const ::viam::robot::v1::GetMachineStatusRequest*, ::viam::robot::v1::GetMachineStatusResponse* response) { auto client_md = context->client_metadata(); - if (auto client_info = client_md.find("viam_client"); client_info == client_md.end()) { + auto client_info = client_md.find("viam_client"); + if (client_info == client_md.end()) { return ::grpc::Status(::grpc::StatusCode::FAILED_PRECONDITION, "viam_client info not properly set in metadata"); } @@ -341,7 +344,8 @@ ::grpc::Status MockRobotService::GetOperations(::grpc::ServerContext* context, const ::viam::robot::v1::GetOperationsRequest*, ::viam::robot::v1::GetOperationsResponse* response) { auto client_md = context->client_metadata(); - if (auto client_info = client_md.find("viam_client"); client_info == client_md.end()) { + auto client_info = client_md.find("viam_client"); + if (client_info == client_md.end()) { return ::grpc::Status(::grpc::StatusCode::FAILED_PRECONDITION, "viam_client info not properly set in metadata"); } From 0b2512bf0bc66a2363c39670b442ce203eb852e0 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 2 May 2025 11:03:30 -0400 Subject: [PATCH 44/88] fix token --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d3b78403c..eb22bd472 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -366,4 +366,4 @@ jobs: prerelease: false fail_on_unmatched_files: true env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKENFAKE }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 4c29471778f358cd17cba51c19b55e92af83ce70 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 2 May 2025 11:11:29 -0400 Subject: [PATCH 45/88] some cleanup --- CMakeLists.txt | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7641c8115..bd282a70d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,13 +37,6 @@ if (WIN32) # Use a newer version of CMake on Windows, so we are NEW for # https://cmake.org/cmake/help/latest/policy/CMP0149.html cmake_minimum_required(VERSION 3.27 FATAL_ERROR) - - # rust-utils always has a `lib` prefix - set(CMAKE_SHARED_LIBRARY_PREFIX "lib") - message(WARNING "it should be lib is it? ${CMAKE_SHARED_LIBRARY_PREFIX}") - - # set boost compiler to avoid errors with boost log - set(Boost_COMPILER "vc143") else() cmake_minimum_required(VERSION 3.25 FATAL_ERROR) endif() @@ -259,14 +252,9 @@ find_package(Threads REQUIRED) # TODO: When this is removed, also remove the # `target_link_directories` call down in src/CMakeLists.txt, as it # will no longer be needed. -set(viam_rust_utils_file ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}viam_rust_utils${CMAKE_STATIC_LIBRARY_SUFFIX}) - -file(GLOB viam_rust_utils_files ${PROJECT_SOURCE_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}viam_rust_utils*${CMAKE_STATIC_LIBRARY_SUFFIX}) +set(viam_rust_utils_file ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils${CMAKE_STATIC_LIBRARY_SUFFIX}) -# Check if the architecture is one that we support in rust-utils -set(WINDOWS_ARCHS "AMD64" "X86" "X64") -list(FIND WINDOWS_ARCHS CMAKE_SYSTEM_PROCESSOR idx) -set(rust_utils_supported_windows_arch (idx GREATER -1)) +file(GLOB viam_rust_utils_files ${PROJECT_SOURCE_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils*${CMAKE_STATIC_LIBRARY_SUFFIX}) if (viam_rust_utils_files) list(LENGTH viam_rust_utils_files num_viam_rust_utils_files) @@ -278,7 +266,7 @@ if (viam_rust_utils_files) ${viam_rust_utils_file} ONLY_IF_DIFFERENT ) -elseif(NOT WIN32) # TODO(RSDK-10366): Currently, rust_utils windows builds aren't working in CI, so don't even try downloading +elseif(NOT WIN32) # TODO(RSDK-10637): Currently, rust_utils windows builds aren't working in CI, so don't even try downloading set(lvru_system_name ${CMAKE_SYSTEM_NAME}) if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(lvru_system_name "macosx") @@ -286,7 +274,7 @@ elseif(NOT WIN32) # TODO(RSDK-10366): Currently, rust_utils windows builds aren' file( DOWNLOAD - https://github.com/viamrobotics/rust-utils/releases/latest/download/${CMAKE_STATIC_LIBRARY_PREFIX}viam_rust_utils-${lvru_system_name}_${CMAKE_SYSTEM_PROCESSOR}${CMAKE_STATIC_LIBRARY_SUFFIX} + https://github.com/viamrobotics/rust-utils/releases/latest/download/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils-${lvru_system_name}_${CMAKE_SYSTEM_PROCESSOR}${CMAKE_STATIC_LIBRARY_SUFFIX} ${viam_rust_utils_file} STATUS lvru_status ) @@ -297,7 +285,7 @@ elseif(NOT WIN32) # TODO(RSDK-10366): Currently, rust_utils windows builds aren' message(FATAL_ERROR "No local viam_rust_utils found and failed to download: ${lvru_status_string}") endif() else() - message(WARNING "Currently running on Windows with no rust-utils file. Module code should work as expected, but client code may fail unexpectedly.") + message(WARNING "Currently running on Windows with no rust-utils file. Module code should work as expected, but client code may fail unexpectedly.") endif() # TODO(RSDK-10366): Currently, rust_utils is not published for windows, so don't even declare the library From add69166456de2a9e9d223474a5aed1b7dec5ad7 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 2 May 2025 11:13:34 -0400 Subject: [PATCH 46/88] remove comments to self --- conanfile.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/conanfile.py b/conanfile.py index 46a9f7ed8..b2ae5271a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -93,7 +93,6 @@ def package_info(self): # TODO(RSDK-10366): Currently, rust_utils is not published for windows # and the C++ SDK just doesn't include it as a dependency on that platform - # CR erodkin: what was the `if windows` logic even doing here? it didn't seem to make a difference on windows self.cpp_info.components["viam_rust_utils"].libs = ["viam_rust_utils"] self.cpp_info.components["viamsdk"].libs = ["viamsdk"] @@ -139,7 +138,6 @@ def package_info(self): # TODO(RSDK-10366): Currently, rust_utils is not published for windows # and the C++ SDK just doesn't include it as a dependency on that platform - # CR erodkin: what was the `if windows` logic even doing here? it didn't seem to make a difference on windows self.cpp_info.components["viamsdk"].requires.extend([ "viam_rust_utils" ]) From d4cb253dc12dd3ade9d75c7d14cb0a911ad46f27 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 2 May 2025 11:23:19 -0400 Subject: [PATCH 47/88] a couple more comment cleanups --- CMakeLists.txt | 4 ++-- conanfile.py | 4 ---- src/viam/examples/modules/complex/proto/buf.lock | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bd282a70d..1b7a33c71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -288,8 +288,8 @@ else() message(WARNING "Currently running on Windows with no rust-utils file. Module code should work as expected, but client code may fail unexpectedly.") endif() -# TODO(RSDK-10366): Currently, rust_utils is not published for windows, so don't even declare the library -if (NOT WIN32) +# TODO(RSDK-10637): Currently, rust_utils doesn't build correctly for windows in CI, so don't declare the library unless a user has provided their own build +if (NOT WIN32 OR num_viam_rust_utils_files GREATER 0) add_library(viam_rust_utils STATIC IMPORTED) target_link_directories(viam_rust_utils diff --git a/conanfile.py b/conanfile.py index b2ae5271a..45eaad6b8 100644 --- a/conanfile.py +++ b/conanfile.py @@ -91,8 +91,6 @@ def package(self): def package_info(self): - # TODO(RSDK-10366): Currently, rust_utils is not published for windows - # and the C++ SDK just doesn't include it as a dependency on that platform self.cpp_info.components["viam_rust_utils"].libs = ["viam_rust_utils"] self.cpp_info.components["viamsdk"].libs = ["viamsdk"] @@ -136,8 +134,6 @@ def package_info(self): "viamapi", ]) - # TODO(RSDK-10366): Currently, rust_utils is not published for windows - # and the C++ SDK just doesn't include it as a dependency on that platform self.cpp_info.components["viamsdk"].requires.extend([ "viam_rust_utils" ]) diff --git a/src/viam/examples/modules/complex/proto/buf.lock b/src/viam/examples/modules/complex/proto/buf.lock index 73ebfcf9b..2ca276594 100644 --- a/src/viam/examples/modules/complex/proto/buf.lock +++ b/src/viam/examples/modules/complex/proto/buf.lock @@ -4,5 +4,5 @@ deps: - remote: buf.build owner: googleapis repository: googleapis - commit: 751cbe31638d43a9bfb6162cd2352e67 - digest: shake256:87f55470d9d124e2d1dedfe0231221f4ed7efbc55bc5268917c678e2d9b9c41573a7f9a557f6d8539044524d9fc5ca8fbb7db05eb81379d168285d76b57eb8a4 + commit: 61b203b9a9164be9a834f58c37be6f62 + digest: shake256:e619113001d6e284ee8a92b1561e5d4ea89a47b28bf0410815cb2fa23914df8be9f1a6a98dcf069f5bc2d829a2cfb1ac614863be45cd4f8a5ad8606c5f200224 From 89df7fb0ab23846df6b5f71d0878a2ec55103a4b Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 2 May 2025 11:41:07 -0400 Subject: [PATCH 48/88] add instructions for building on windows --- BUILDING.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/BUILDING.md b/BUILDING.md index 74f16b5d2..05feb75b9 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -260,6 +260,26 @@ have a different version of `protoc` available in your `PATH`, it will silently fail and later cause compilation failures due to protobuf version mismatches. +## Building for Windows + +The C++ SDK works well on windows for both client and module code +provided there is internet connectivity. However, some manual work is +required to build for client code. + +1. (client code only) clone [rust-utils](https://github.com/viamrobotics/rust-utils) >= v0.3.0 and +build locally with `cargo build --release`. Copy `target\release\viam_rust_utils.lib` +to the root of the C++ SDK directory. +2. Ensure `conan` is installed (see `Building with Conan` above). +3. Run the following: +``` +conan profile detect +cmake . --preset conan-default +cmake --build --preset=conan-release -j +``` + +NOTE: There is no current support for offline mode as a client, though +this is being worked on. + ## Options to Configure or Customize the Build ### Options for Package Search From f1ba0d38a29960378ae8d309b261210d101e4439 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 2 May 2025 14:00:23 -0400 Subject: [PATCH 49/88] try keeping shared for unix --- CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b2d9c491a..64671d4ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -290,12 +290,19 @@ endif() # TODO(RSDK-10637): Currently, rust_utils doesn't build correctly for windows in CI, so don't declare the library unless a user has provided their own build if (NOT WIN32 OR num_viam_rust_utils_files GREATER 0) - add_library(viam_rust_utils STATIC IMPORTED) - + if (WIN32) + add_library(viam_rust_utils STATIC IMPORTED) target_link_directories(viam_rust_utils INTERFACE "$" ) + else() + add_library(viam_rust_utils SHARED IMPORTED) + target_link_directories(viam_rust_utils + INTERFACE + "$" + ) + endif() set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) endif() From 07470b27082310dd256251a8e1c5e42cd221f1c0 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 2 May 2025 15:07:32 -0400 Subject: [PATCH 50/88] try keeping shared for unix pt2 --- CMakeLists.txt | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64671d4ed..09fe9228d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -289,24 +289,31 @@ else() endif() # TODO(RSDK-10637): Currently, rust_utils doesn't build correctly for windows in CI, so don't declare the library unless a user has provided their own build -if (NOT WIN32 OR num_viam_rust_utils_files GREATER 0) - if (WIN32) - add_library(viam_rust_utils STATIC IMPORTED) +if (NOT WIN32) + add_library(viam_rust_utils SHARED IMPORTED) target_link_directories(viam_rust_utils INTERFACE "$" + "$" ) - else() - add_library(viam_rust_utils SHARED IMPORTED) + set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) +elseif (num_viam_rust_utils_files GREATER 0) + add_library(viam_rust_utils STATIC IMPORTED) target_link_directories(viam_rust_utils INTERFACE "$" ) - endif() - set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) endif() + +if (NOT WIN32) + install( + IMPORTED_RUNTIME_ARTIFACTS viam_rust_utils + LIBRARY COMPONENT viam-cpp-sdk_runtime + ) +endif() + # Install the license file install(FILES LICENSE From 3ee79d58078e815f1290529cc87076dee6e762f0 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 2 May 2025 15:29:59 -0400 Subject: [PATCH 51/88] typo --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09fe9228d..60e0a1127 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -294,7 +294,7 @@ if (NOT WIN32) target_link_directories(viam_rust_utils INTERFACE "$" - "$" + "$" ) set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) elseif (num_viam_rust_utils_files GREATER 0) From 6e775608911da50e965cef45ecafe3f88727251d Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 2 May 2025 16:33:26 -0400 Subject: [PATCH 52/88] static for windows only, import chrono --- .github/workflows/conan.yml | 9 ++------- .github/workflows/release.yml | 9 ++------- CMakeLists.txt | 7 ++++--- src/viam/sdk/rpc/server.hpp | 2 ++ 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 6f7bf12cf..b6ca5e881 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -74,7 +74,7 @@ jobs: #- name: Install dependencies #uses: crazy-max/ghaction-chocolatey@v3 #with: - #args: install -y conan git 7zip jq + #args: install -y conan git ## Ensures that things installed with choco are visible to us #- name: refresh env @@ -88,12 +88,7 @@ jobs: #Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 #refreshenv #conan profile detect - #conan create . ` - #--build=missing ` - #-o "&:shared=False" ` - #-s:h compiler.cppstd=17 ` - #-c:h tools.microsoft:winsdk_version=10.0.17763.0 ` - #-s:h compiler.runtime=static + #conan create . #env: #CONAN_USER_HOME: c:/cache #CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb22bd472..b315bc07f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,7 +73,7 @@ jobs: #- name: Install dependencies #uses: crazy-max/ghaction-chocolatey@v3 #with: - #args: install -y conan git 7zip jq + #args: install -y conan git ## Ensures that things installed with choco are visible to us @@ -88,12 +88,7 @@ jobs: #Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 #refreshenv #conan profile detect - #conan create . ` - #--build=missing ` - #-o "&:shared=False" ` - #-s:h compiler.cppstd=17 ` - #-c:h tools.microsoft:winsdk_version=10.0.17763.0 ` - #-s:h compiler.runtime=static + #conan create . #env: #CONAN_USER_HOME: c:/cache #CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths diff --git a/CMakeLists.txt b/CMakeLists.txt index 60e0a1127..dae6b0445 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -288,8 +288,7 @@ else() message(WARNING "Currently running on Windows with no rust-utils file. Module code should work as expected, but client code may fail unexpectedly.") endif() -# TODO(RSDK-10637): Currently, rust_utils doesn't build correctly for windows in CI, so don't declare the library unless a user has provided their own build -if (NOT WIN32) +if (NOT WIN32) # build `SHARED` on unix-based systems add_library(viam_rust_utils SHARED IMPORTED) target_link_directories(viam_rust_utils INTERFACE @@ -297,7 +296,9 @@ if (NOT WIN32) "$" ) set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) -elseif (num_viam_rust_utils_files GREATER 0) + + # TODO(RSDK-10637): Currently, rust_utils doesn't build correctly for windows in CI, so don't declare the library unless a user has provided their own build +elseif (num_viam_rust_utils_files GREATER 0) # build `STATIC` for windows add_library(viam_rust_utils STATIC IMPORTED) target_link_directories(viam_rust_utils INTERFACE diff --git a/src/viam/sdk/rpc/server.hpp b/src/viam/sdk/rpc/server.hpp index b938f7b1d..0615ce4e0 100644 --- a/src/viam/sdk/rpc/server.hpp +++ b/src/viam/sdk/rpc/server.hpp @@ -3,6 +3,8 @@ /// @brief Defines the `Server` class. #pragma once +#include + #include #include #include From 59ed94e3ee520a252e01037ac493036bbb6d40c0 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Tue, 6 May 2025 14:30:52 -0400 Subject: [PATCH 53/88] nominmax for windows --- .../mlmodel/example_audio_classification_client.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/viam/examples/mlmodel/example_audio_classification_client.cpp b/src/viam/examples/mlmodel/example_audio_classification_client.cpp index 9a36836d9..9ac91f004 100644 --- a/src/viam/examples/mlmodel/example_audio_classification_client.cpp +++ b/src/viam/examples/mlmodel/example_audio_classification_client.cpp @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +#ifdef _WIN32 +#define NOMINMAX +#endif + #include #include #include @@ -377,7 +381,7 @@ int main(int argc, char* argv[]) try { }); // Print out the top 5 (or fewer) label/score pairs. - for (size_t i = 0; i != 5UL && i != scored_labels.size(); ++i) { + for (size_t i = 0; i != std::min(5UL, scored_labels.size()); ++i) { // TODO: Avoid hardcoding the width here. VIAM_SDK_LOG(info) << boost::format("%1%: %2% %|40t|%3%\n") % i % *scored_labels[i].label % scored_labels[i].score; From 0f5812ad2670c09de797a2b60bc0a5cf32340ce2 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Tue, 6 May 2025 15:17:02 -0400 Subject: [PATCH 54/88] specify type --- .../examples/mlmodel/example_audio_classification_client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/viam/examples/mlmodel/example_audio_classification_client.cpp b/src/viam/examples/mlmodel/example_audio_classification_client.cpp index 9ac91f004..b5078a599 100644 --- a/src/viam/examples/mlmodel/example_audio_classification_client.cpp +++ b/src/viam/examples/mlmodel/example_audio_classification_client.cpp @@ -381,7 +381,7 @@ int main(int argc, char* argv[]) try { }); // Print out the top 5 (or fewer) label/score pairs. - for (size_t i = 0; i != std::min(5UL, scored_labels.size()); ++i) { + for (size_t i = 0; i != std::min(5UL, scored_labels.size()); ++i) { // TODO: Avoid hardcoding the width here. VIAM_SDK_LOG(info) << boost::format("%1%: %2% %|40t|%3%\n") % i % *scored_labels[i].label % scored_labels[i].score; From c66a2e0688fffe86b6b3e7ff05689eb82a8a8aa4 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 7 May 2025 09:26:30 -0400 Subject: [PATCH 55/88] prepare for working rust-utils --- .github/workflows/conan.yml | 86 ++++++++++----------- .github/workflows/release.yml | 141 ++++++++++++++++------------------ CMakeLists.txt | 14 ++-- 3 files changed, 118 insertions(+), 123 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index b6ca5e881..7f9d3d1e9 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -40,58 +40,54 @@ jobs: github.event_name == 'schedule' && steps.git_info.outputs.current_commit == steps.last_successful_commit.outputs.commit-hash + # CR erodkin: we have (expected) working rust-utils builds now, but need to get that merged. + # once it is and we have a new release, try actually testing and delete the TODO. # TODO(RSDK-10638) - uncomment and make all this work once we have good rust-utils windows builds - #build_windows: - #if: github.repository_owner == 'viamrobotics' - #needs: [prepare] - #runs-on: windows-latest - #strategy: - #fail-fast: false - #matrix: - #include: - #- target: x86_64-windows - #platform: windows_x86_64 - #steps: - #- name: Checkout Code - #uses: actions/checkout@v4 - - #- name: Install cmake - #uses: ssrobins/install-cmake@v1 - #with: - #version: 3.27.2 + build_windows: + if: github.repository_owner == 'viamrobotics' + needs: [prepare] + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-windows + platform: windows_x86_64 + steps: + - name: Checkout Code + uses: actions/checkout@v4 - #- name: Install python - #uses: actions/setup-python@v5 - #with: - #python-version: '3.12' + - name: Install cmake + uses: ssrobins/install-cmake@v1 + with: + version: 3.27.2 - #- name: Install Scoop - #uses: MinoruSekine/setup-scoop@v4.0.1 + - name: Install python + uses: actions/setup-python@v5 + with: + python-version: '3.12' - #- name: install buf 'n stuff - #run: scoop install buf ninja + - name: Install Scoop + uses: MinoruSekine/setup-scoop@v4.0.1 - #- name: Install dependencies - #uses: crazy-max/ghaction-chocolatey@v3 - #with: - #args: install -y conan git + - name: install buf 'n stuff + run: scoop install buf ninja - ## Ensures that things installed with choco are visible to us - #- name: refresh env - #run: | - #Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 - #refreshenv + - name: Install dependencies + uses: crazy-max/ghaction-chocolatey@v3 + with: + args: install -y conan git - #- name: Create package - #shell: powershell - #run: | - #Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 - #refreshenv - #conan profile detect - #conan create . - #env: - #CONAN_USER_HOME: c:/cache - #CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths + - name: Create package + shell: powershell + run: | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 + refreshenv + conan profile detect + conan create . + env: + CONAN_USER_HOME: c:/cache + CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths build_macos: if: github.repository_owner == 'viamrobotics' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b315bc07f..e87d00470 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,80 +37,75 @@ jobs: if: steps.release_exists.outputs.id != '' + # CR erodkin: we have (expected) working rust-utils builds now, but need to get that merged. + # once it is and we have a new release, try actually testing and delete the TODO. # TODO (RSDK-10638) - uncomment and make all this work once we have good rust-utils windows builds - #build_windows: - ##if: github.repository_owner == 'viamrobotics' - #needs: [prepare] - #runs-on: windows-latest - #strategy: - #fail-fast: false - #matrix: - #include: - #- target: x86_64-windows - #platform: windows_x86_64 - #steps: - #- name: Checkout Code - #uses: actions/checkout@v4 - #with: - #ref: ${{ needs.prepare.outputs.sha }} - - #- name: Install cmake - #uses: ssrobins/install-cmake@v1 - #with: - #version: 3.27.2 - - #- name: Install python - #uses: actions/setup-python@v5 - #with: - #python-version: '3.12' - - #- name: Install Scoop - #uses: MinoruSekine/setup-scoop@v4.0.1 - - #- name: install buf 'n stuff - #run: scoop install buf ninja - - #- name: Install dependencies - #uses: crazy-max/ghaction-chocolatey@v3 - #with: - #args: install -y conan git - - - ## Ensures that things installed with choco are visible to us - #- name: refresh env - #run: | - #Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 - #refreshenv - - #- name: Create package - #shell: powershell - #run: | - #Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 - #refreshenv - #conan profile detect - #conan create . - #env: - #CONAN_USER_HOME: c:/cache - #CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths - - #- name: list stuff - #run: | - #ls - #ls build/ - - #- name: Copy - #run: | - #cmake --install build --prefix builds/viam-cpp-sdk-${{ matrix.platform }} - - #- name: Create tar - #run: | - #tar -czvf builds/viam-cpp-sdk-${{ matrix.platform }}.tar.gz builds/viam-cpp-sdk-${{ matrix.platform }} - - #- name: Upload artifacts - #uses: actions/upload-artifact@v4 - #with: - #name: viam-cpp-sdk-${{ matrix.platform }}.tar.gz - #path: builds/viam-cpp-sdk-${{ matrix.platform }}.tar.gz + build_windows: + if: github.repository_owner == 'viamrobotics' + needs: [prepare] + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-windows + platform: windows_x86_64 + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + ref: ${{ needs.prepare.outputs.sha }} + + - name: Install cmake + uses: ssrobins/install-cmake@v1 + with: + version: 3.27.2 + + - name: Install python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install Scoop + uses: MinoruSekine/setup-scoop@v4.0.1 + + - name: install buf 'n stuff + run: scoop install buf ninja + + - name: Install dependencies + uses: crazy-max/ghaction-chocolatey@v3 + with: + args: install -y conan git + + - name: Create package + shell: powershell + run: | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 + refreshenv + conan profile detect + conan create . + env: + CONAN_USER_HOME: c:/cache + CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths + + - name: list stuff + run: | + ls + ls build/ + + - name: Copy + run: | + cmake --install build --prefix builds/viam-cpp-sdk-${{ matrix.platform }} + + - name: Create tar + run: | + tar -czvf builds/viam-cpp-sdk-${{ matrix.platform }}.tar.gz builds/viam-cpp-sdk-${{ matrix.platform }} + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: viam-cpp-sdk-${{ matrix.platform }}.tar.gz + path: builds/viam-cpp-sdk-${{ matrix.platform }}.tar.gz build_macos: if: github.repository_owner == 'viamrobotics' diff --git a/CMakeLists.txt b/CMakeLists.txt index dae6b0445..18f65c456 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -266,15 +266,20 @@ if (viam_rust_utils_files) ${viam_rust_utils_file} ONLY_IF_DIFFERENT ) -elseif(NOT WIN32) # TODO(RSDK-10637): Currently, rust_utils windows builds aren't working in CI, so don't even try downloading +elseif(NOT WIN32 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") set(lvru_system_name ${CMAKE_SYSTEM_NAME}) if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(lvru_system_name "macosx") endif() + set(lvru_system_processor ${CMAKE_SYSTEM_PROCESSOR}) + if(WIN32) + set(lvru_system_processor "x86_64") + endif() + file( DOWNLOAD - https://github.com/viamrobotics/rust-utils/releases/latest/download/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils-${lvru_system_name}_${CMAKE_SYSTEM_PROCESSOR}${CMAKE_STATIC_LIBRARY_SUFFIX} + https://github.com/viamrobotics/rust-utils/releases/latest/download/${CMAKE_SHARED_LIBRARY_PREFIX}viam_rust_utils-${lvru_system_name}_${lvru_system_processor}${CMAKE_STATIC_LIBRARY_SUFFIX} ${viam_rust_utils_file} STATUS lvru_status ) @@ -297,8 +302,7 @@ if (NOT WIN32) # build `SHARED` on unix-based systems ) set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) - # TODO(RSDK-10637): Currently, rust_utils doesn't build correctly for windows in CI, so don't declare the library unless a user has provided their own build -elseif (num_viam_rust_utils_files GREATER 0) # build `STATIC` for windows +elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `STATIC` for windows add_library(viam_rust_utils STATIC IMPORTED) target_link_directories(viam_rust_utils INTERFACE @@ -308,7 +312,7 @@ elseif (num_viam_rust_utils_files GREATER 0) # build `STATIC` for windows endif() -if (NOT WIN32) +if (NOT WIN32) # installing seems to be necessary for tests to pass in CI install( IMPORTED_RUNTIME_ARTIFACTS viam_rust_utils LIBRARY COMPONENT viam-cpp-sdk_runtime From 51de5d8e296c81d66e50860a82263abcfb065b14 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 7 May 2025 10:53:15 -0400 Subject: [PATCH 56/88] try stuff from CR comments --- .github/workflows/conan.yml | 30 +++++++++++++++++------------- CMakeLists.txt | 3 ++- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 7f9d3d1e9..3d143045a 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -57,21 +57,21 @@ jobs: - name: Checkout Code uses: actions/checkout@v4 - - name: Install cmake - uses: ssrobins/install-cmake@v1 - with: - version: 3.27.2 + #- name: Install cmake + #uses: ssrobins/install-cmake@v1 + #with: + #version: 3.27.2 - - name: Install python - uses: actions/setup-python@v5 - with: - python-version: '3.12' + #- name: Install python + #uses: actions/setup-python@v5 + #with: + #python-version: '3.12' - - name: Install Scoop - uses: MinoruSekine/setup-scoop@v4.0.1 + #- name: Install Scoop + #uses: MinoruSekine/setup-scoop@v4.0.1 - - name: install buf 'n stuff - run: scoop install buf ninja + #- name: install buf 'n stuff + #run: scoop install buf ninja - name: Install dependencies uses: crazy-max/ghaction-chocolatey@v3 @@ -84,7 +84,11 @@ jobs: Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv conan profile detect - conan create . + conan create . ` + --build=missing ` + -o "&:shared=False" ` + -s:h compiler.cppstd=17 ` + -s:h compiler.runtime=static env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths diff --git a/CMakeLists.txt b/CMakeLists.txt index 18f65c456..23935ae65 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -294,7 +294,7 @@ else() endif() if (NOT WIN32) # build `SHARED` on unix-based systems - add_library(viam_rust_utils SHARED IMPORTED) + add_library(viam_rust_utils STATIC IMPORTED) target_link_directories(viam_rust_utils INTERFACE "$" @@ -307,6 +307,7 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `STATIC` for windows target_link_directories(viam_rust_utils INTERFACE "$" + "$" ) set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) endif() From a9b233782a3137a3b03dc4579c2bb307381604c3 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 7 May 2025 10:57:43 -0400 Subject: [PATCH 57/88] dont install when static building --- CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23935ae65..81b106afa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -313,12 +313,12 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `STATIC` for windows endif() -if (NOT WIN32) # installing seems to be necessary for tests to pass in CI - install( - IMPORTED_RUNTIME_ARTIFACTS viam_rust_utils - LIBRARY COMPONENT viam-cpp-sdk_runtime - ) -endif() +#if (NOT WIN32) # installing seems to be necessary for tests to pass in CI + #install( + #IMPORTED_RUNTIME_ARTIFACTS viam_rust_utils + #LIBRARY COMPONENT viam-cpp-sdk_runtime + #) +#endif() # Install the license file install(FILES From 7afa451d4df423daba083b9878ff93452e3a2abe Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 7 May 2025 11:43:06 -0400 Subject: [PATCH 58/88] shared again --- CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 81b106afa..06a5f0d5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -294,7 +294,7 @@ else() endif() if (NOT WIN32) # build `SHARED` on unix-based systems - add_library(viam_rust_utils STATIC IMPORTED) + add_library(viam_rust_utils SHARED IMPORTED) target_link_directories(viam_rust_utils INTERFACE "$" @@ -313,12 +313,12 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `STATIC` for windows endif() -#if (NOT WIN32) # installing seems to be necessary for tests to pass in CI - #install( - #IMPORTED_RUNTIME_ARTIFACTS viam_rust_utils - #LIBRARY COMPONENT viam-cpp-sdk_runtime - #) -#endif() +if (NOT WIN32) # installing seems to be necessary for tests to pass in CI + install( + IMPORTED_RUNTIME_ARTIFACTS viam_rust_utils + LIBRARY COMPONENT viam-cpp-sdk_runtime + ) +endif() # Install the license file install(FILES From 1bd47b2d3f56c9ba67c2af26ad032810974cdb21 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 7 May 2025 15:04:54 -0400 Subject: [PATCH 59/88] test from convo with drew --- .github/workflows/conan.yml | 4 +--- CMakeLists.txt | 14 +++++++++++++- conanfile.py | 10 ++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 3d143045a..e6c95023d 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -86,9 +86,7 @@ jobs: conan profile detect conan create . ` --build=missing ` - -o "&:shared=False" ` - -s:h compiler.cppstd=17 ` - -s:h compiler.runtime=static + -o "&:shared=False" env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths diff --git a/CMakeLists.txt b/CMakeLists.txt index 06a5f0d5b..910763848 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -293,6 +293,18 @@ else() message(WARNING "Currently running on Windows with no rust-utils file. Module code should work as expected, but client code may fail unexpectedly.") endif() +if (APPLE) + target_link_libraries(viam_rust_utils PUBLIC "-framework Security") +elseif (NOT WIN32) + target_link_libraries(viam_rust_utils PRIVATE dl) + target_link_libraries(viam_rust_utils PRIVATE rt) +else() + target_link_libraries(viam_rust_utils PRIVATE ncrypt) + target_link_libraries(viam_rust_utils PRIVATE secur32) + target_link_libraries(viam_rust_utils PRIVATE ntdll) + target_link_libraries(viam_rust_utils PRIVATE userenv) +endif() + if (NOT WIN32) # build `SHARED` on unix-based systems add_library(viam_rust_utils SHARED IMPORTED) target_link_directories(viam_rust_utils @@ -313,7 +325,7 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `STATIC` for windows endif() -if (NOT WIN32) # installing seems to be necessary for tests to pass in CI +if (BUILD_SHARED_LIBS) # installing seems to be necessary for tests to pass in CI install( IMPORTED_RUNTIME_ARTIFACTS viam_rust_utils LIBRARY COMPONENT viam-cpp-sdk_runtime diff --git a/conanfile.py b/conanfile.py index 45eaad6b8..44da75dd0 100644 --- a/conanfile.py +++ b/conanfile.py @@ -91,7 +91,8 @@ def package(self): def package_info(self): - self.cpp_info.components["viam_rust_utils"].libs = ["viam_rust_utils"] + if self.options.shared: + self.cpp_info.components["viam_rust_utils"].libs = ["viam_rust_utils"] self.cpp_info.components["viamsdk"].libs = ["viamsdk"] @@ -134,8 +135,9 @@ def package_info(self): "viamapi", ]) - self.cpp_info.components["viamsdk"].requires.extend([ - "viam_rust_utils" - ]) + if self.options.shared: + self.cpp_info.components["viamsdk"].requires.extend([ + "viam_rust_utils" + ]) self.cpp_info.components["viamsdk"].frameworks = ["Security"] From d43865bc488af8e16749f441f3e2bad48f9d2b4f Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 7 May 2025 15:19:46 -0400 Subject: [PATCH 60/88] fix ordering of link libraries for rust-utils --- CMakeLists.txt | 23 +++++++++++------------ src/viam/sdk/CMakeLists.txt | 22 +++++++++++----------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 910763848..d3f10ae4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -293,18 +293,6 @@ else() message(WARNING "Currently running on Windows with no rust-utils file. Module code should work as expected, but client code may fail unexpectedly.") endif() -if (APPLE) - target_link_libraries(viam_rust_utils PUBLIC "-framework Security") -elseif (NOT WIN32) - target_link_libraries(viam_rust_utils PRIVATE dl) - target_link_libraries(viam_rust_utils PRIVATE rt) -else() - target_link_libraries(viam_rust_utils PRIVATE ncrypt) - target_link_libraries(viam_rust_utils PRIVATE secur32) - target_link_libraries(viam_rust_utils PRIVATE ntdll) - target_link_libraries(viam_rust_utils PRIVATE userenv) -endif() - if (NOT WIN32) # build `SHARED` on unix-based systems add_library(viam_rust_utils SHARED IMPORTED) target_link_directories(viam_rust_utils @@ -324,6 +312,17 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `STATIC` for windows set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) endif() +if (APPLE) + target_link_libraries(viam_rust_utils INTERFACE "-framework Security") +elseif (NOT WIN32) + target_link_libraries(viam_rust_utils INTERFACE dl) + target_link_libraries(viam_rust_utils INTERFACE rt) +else() + target_link_libraries(viam_rust_utils INTERFACE ncrypt) + target_link_libraries(viam_rust_utils INTERFACE secur32) + target_link_libraries(viam_rust_utils INTERFACE ntdll) + target_link_libraries(viam_rust_utils INTERFACE userenv) +endif() if (BUILD_SHARED_LIBS) # installing seems to be necessary for tests to pass in CI install( diff --git a/src/viam/sdk/CMakeLists.txt b/src/viam/sdk/CMakeLists.txt index eae10cea2..c7d6469d5 100644 --- a/src/viam/sdk/CMakeLists.txt +++ b/src/viam/sdk/CMakeLists.txt @@ -287,17 +287,17 @@ else() target_sources(viamsdk PRIVATE rpc/private/viam_rust_utils_stubs.cpp) endif() -if (APPLE) - target_link_libraries(viamsdk PUBLIC "-framework Security") -elseif (NOT WIN32) - target_link_libraries(viamsdk PRIVATE dl) - target_link_libraries(viamsdk PRIVATE rt) -else() - target_link_libraries(viamsdk PRIVATE ncrypt) - target_link_libraries(viamsdk PRIVATE secur32) - target_link_libraries(viamsdk PRIVATE ntdll) - target_link_libraries(viamsdk PRIVATE userenv) -endif() +#if (APPLE) + #target_link_libraries(viamsdk PUBLIC "-framework Security") +#elseif (NOT WIN32) + #target_link_libraries(viamsdk PRIVATE dl) + #target_link_libraries(viamsdk PRIVATE rt) +#else() + #target_link_libraries(viamsdk PRIVATE ncrypt) + #target_link_libraries(viamsdk PRIVATE secur32) + #target_link_libraries(viamsdk PRIVATE ntdll) + #target_link_libraries(viamsdk PRIVATE userenv) +#endif() install( From b3a339a67662d3b11267336c5e0607903790c787 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 7 May 2025 15:43:41 -0400 Subject: [PATCH 61/88] rust-utils always static --- CMakeLists.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3f10ae4f..c4cded511 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -293,16 +293,16 @@ else() message(WARNING "Currently running on Windows with no rust-utils file. Module code should work as expected, but client code may fail unexpectedly.") endif() -if (NOT WIN32) # build `SHARED` on unix-based systems - add_library(viam_rust_utils SHARED IMPORTED) - target_link_directories(viam_rust_utils - INTERFACE - "$" - "$" - ) - set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) - -elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `STATIC` for windows +if (NOT WIN32 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `SHARED` on unix-based systems + #add_library(viam_rust_utils SHARED IMPORTED) + #target_link_directories(viam_rust_utils + #INTERFACE + #"$" + #"$" + #) + #set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) + +#elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `STATIC` for windows add_library(viam_rust_utils STATIC IMPORTED) target_link_directories(viam_rust_utils INTERFACE From 4b68fda1648a46f25584047a35ecf3070c2798bd Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 7 May 2025 15:45:22 -0400 Subject: [PATCH 62/88] invert check for installing rust-utils --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c4cded511..94fbb1b78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -324,7 +324,7 @@ else() target_link_libraries(viam_rust_utils INTERFACE userenv) endif() -if (BUILD_SHARED_LIBS) # installing seems to be necessary for tests to pass in CI +if (NOT BUILD_SHARED_LIBS) # installing seems to be necessary for tests to pass in CI install( IMPORTED_RUNTIME_ARTIFACTS viam_rust_utils LIBRARY COMPONENT viam-cpp-sdk_runtime From 952702b36aeef043b9029051bf513a6f3bfa229d Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 7 May 2025 16:15:23 -0400 Subject: [PATCH 63/88] revert to linking to viamsdk, not rust-utils --- CMakeLists.txt | 12 ------------ src/viam/sdk/CMakeLists.txt | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94fbb1b78..6c33dfd24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -312,18 +312,6 @@ if (NOT WIN32 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `SHARED` on set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) endif() -if (APPLE) - target_link_libraries(viam_rust_utils INTERFACE "-framework Security") -elseif (NOT WIN32) - target_link_libraries(viam_rust_utils INTERFACE dl) - target_link_libraries(viam_rust_utils INTERFACE rt) -else() - target_link_libraries(viam_rust_utils INTERFACE ncrypt) - target_link_libraries(viam_rust_utils INTERFACE secur32) - target_link_libraries(viam_rust_utils INTERFACE ntdll) - target_link_libraries(viam_rust_utils INTERFACE userenv) -endif() - if (NOT BUILD_SHARED_LIBS) # installing seems to be necessary for tests to pass in CI install( IMPORTED_RUNTIME_ARTIFACTS viam_rust_utils diff --git a/src/viam/sdk/CMakeLists.txt b/src/viam/sdk/CMakeLists.txt index c7d6469d5..eae10cea2 100644 --- a/src/viam/sdk/CMakeLists.txt +++ b/src/viam/sdk/CMakeLists.txt @@ -287,17 +287,17 @@ else() target_sources(viamsdk PRIVATE rpc/private/viam_rust_utils_stubs.cpp) endif() -#if (APPLE) - #target_link_libraries(viamsdk PUBLIC "-framework Security") -#elseif (NOT WIN32) - #target_link_libraries(viamsdk PRIVATE dl) - #target_link_libraries(viamsdk PRIVATE rt) -#else() - #target_link_libraries(viamsdk PRIVATE ncrypt) - #target_link_libraries(viamsdk PRIVATE secur32) - #target_link_libraries(viamsdk PRIVATE ntdll) - #target_link_libraries(viamsdk PRIVATE userenv) -#endif() +if (APPLE) + target_link_libraries(viamsdk PUBLIC "-framework Security") +elseif (NOT WIN32) + target_link_libraries(viamsdk PRIVATE dl) + target_link_libraries(viamsdk PRIVATE rt) +else() + target_link_libraries(viamsdk PRIVATE ncrypt) + target_link_libraries(viamsdk PRIVATE secur32) + target_link_libraries(viamsdk PRIVATE ntdll) + target_link_libraries(viamsdk PRIVATE userenv) +endif() install( From f1c1e4f952d2187bb984b83b1b3331c20801a1b8 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 7 May 2025 16:37:16 -0400 Subject: [PATCH 64/88] shift to install FILES --- CMakeLists.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c33dfd24..913f92f0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -310,13 +310,12 @@ if (NOT WIN32 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `SHARED` on "$" ) set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) -endif() -if (NOT BUILD_SHARED_LIBS) # installing seems to be necessary for tests to pass in CI - install( - IMPORTED_RUNTIME_ARTIFACTS viam_rust_utils - LIBRARY COMPONENT viam-cpp-sdk_runtime - ) + if (NOT BUILD_SHARED_LIBS) # installing seems to be necessary for tests to pass in CI + install( + FILES ${viam_rust_utils_file} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT viam-cpp-sdk_runtime + ) + endif() endif() # Install the license file From ec59387db5a1d35f80ef6ee040dd09a7d6339657 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 08:32:43 -0400 Subject: [PATCH 65/88] did I get conan stuff wrong --- conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conanfile.py b/conanfile.py index 44da75dd0..4504986e6 100644 --- a/conanfile.py +++ b/conanfile.py @@ -91,7 +91,7 @@ def package(self): def package_info(self): - if self.options.shared: + if not self.options.shared: self.cpp_info.components["viam_rust_utils"].libs = ["viam_rust_utils"] self.cpp_info.components["viamsdk"].libs = ["viamsdk"] @@ -135,7 +135,7 @@ def package_info(self): "viamapi", ]) - if self.options.shared: + if not self.options.shared: self.cpp_info.components["viamsdk"].requires.extend([ "viam_rust_utils" ]) From 5e15a9394bd8c3399301950f0085032f5fdc382d Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 09:15:41 -0400 Subject: [PATCH 66/88] always install --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 913f92f0d..7980ef77d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -311,10 +311,10 @@ if (NOT WIN32 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `SHARED` on ) set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) - if (NOT BUILD_SHARED_LIBS) # installing seems to be necessary for tests to pass in CI - install( - FILES ${viam_rust_utils_file} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT viam-cpp-sdk_runtime - ) + #if (NOT BUILD_SHARED_LIBS) # installing seems to be necessary for tests to pass in CI + install( + FILES ${viam_rust_utils_file} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT viam-cpp-sdk_runtime + ) endif() endif() From e5a3a5aa945f1df48203d3291fed20ed7d586b30 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 09:20:05 -0400 Subject: [PATCH 67/88] typo --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7980ef77d..f34e67c8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -315,7 +315,7 @@ if (NOT WIN32 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `SHARED` on install( FILES ${viam_rust_utils_file} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT viam-cpp-sdk_runtime ) - endif() + #endif() endif() # Install the license file From b843938558331af27d9190dbaa2c0cb110f326d1 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 10:14:49 -0400 Subject: [PATCH 68/88] workflow cleanup, print out info for to find where to copy from with conan build --- .github/workflows/conan.yml | 29 ++++++++++------------------- .github/workflows/release.yml | 25 ++++--------------------- 2 files changed, 14 insertions(+), 40 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index e6c95023d..fbeb33afe 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -40,9 +40,6 @@ jobs: github.event_name == 'schedule' && steps.git_info.outputs.current_commit == steps.last_successful_commit.outputs.commit-hash - # CR erodkin: we have (expected) working rust-utils builds now, but need to get that merged. - # once it is and we have a new release, try actually testing and delete the TODO. - # TODO(RSDK-10638) - uncomment and make all this work once we have good rust-utils windows builds build_windows: if: github.repository_owner == 'viamrobotics' needs: [prepare] @@ -57,22 +54,6 @@ jobs: - name: Checkout Code uses: actions/checkout@v4 - #- name: Install cmake - #uses: ssrobins/install-cmake@v1 - #with: - #version: 3.27.2 - - #- name: Install python - #uses: actions/setup-python@v5 - #with: - #python-version: '3.12' - - #- name: Install Scoop - #uses: MinoruSekine/setup-scoop@v4.0.1 - - #- name: install buf 'n stuff - #run: scoop install buf ninja - - name: Install dependencies uses: crazy-max/ghaction-chocolatey@v3 with: @@ -90,6 +71,11 @@ jobs: env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths + - name: list stuff + run: | + ls + ls build/ + tree build_macos: if: github.repository_owner == 'viamrobotics' @@ -123,6 +109,11 @@ jobs: export BUF_CONFIG_DIR=$(mktemp -d) conan profile detect conan create . --build=missing -s compiler.cppstd=17 + - name: list stuff + run: | + ls + ls build/ + tree build_linux_ubuntu_jammy: if: github.repository_owner == 'viamrobotics' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e87d00470..4345b204d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,10 +36,6 @@ jobs: uses: andymckay/cancel-action@0.2 if: steps.release_exists.outputs.id != '' - - # CR erodkin: we have (expected) working rust-utils builds now, but need to get that merged. - # once it is and we have a new release, try actually testing and delete the TODO. - # TODO (RSDK-10638) - uncomment and make all this work once we have good rust-utils windows builds build_windows: if: github.repository_owner == 'viamrobotics' needs: [prepare] @@ -56,22 +52,6 @@ jobs: with: ref: ${{ needs.prepare.outputs.sha }} - - name: Install cmake - uses: ssrobins/install-cmake@v1 - with: - version: 3.27.2 - - - name: Install python - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - - name: Install Scoop - uses: MinoruSekine/setup-scoop@v4.0.1 - - - name: install buf 'n stuff - run: scoop install buf ninja - - name: Install dependencies uses: crazy-max/ghaction-chocolatey@v3 with: @@ -83,7 +63,9 @@ jobs: Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv conan profile detect - conan create . + conan create . ` + --build=missing ` + -o "&:shared=False" env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths @@ -92,6 +74,7 @@ jobs: run: | ls ls build/ + tree - name: Copy run: | From 861a35c6b08293442d9296ed4647e79b1408e2f1 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 10:16:41 -0400 Subject: [PATCH 69/88] remove commented out stuff --- CMakeLists.txt | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f34e67c8c..d3b6b720b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -294,15 +294,6 @@ else() endif() if (NOT WIN32 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `SHARED` on unix-based systems - #add_library(viam_rust_utils SHARED IMPORTED) - #target_link_directories(viam_rust_utils - #INTERFACE - #"$" - #"$" - #) - #set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) - -#elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `STATIC` for windows add_library(viam_rust_utils STATIC IMPORTED) target_link_directories(viam_rust_utils INTERFACE @@ -311,11 +302,9 @@ if (NOT WIN32 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `SHARED` on ) set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file}) - #if (NOT BUILD_SHARED_LIBS) # installing seems to be necessary for tests to pass in CI install( FILES ${viam_rust_utils_file} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT viam-cpp-sdk_runtime ) - #endif() endif() # Install the license file From 6306025bc16030c88f5237e0f898d00a71e29750 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 10:23:49 -0400 Subject: [PATCH 70/88] cleanup --- BUILDING.md | 7 ++----- CMakeLists.txt | 2 +- .../mlmodel/example_audio_classification_client.cpp | 4 ---- src/viam/sdk/CMakeLists.txt | 8 ++++---- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 05feb75b9..bf7d26613 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -260,11 +260,11 @@ have a different version of `protoc` available in your `PATH`, it will silently fail and later cause compilation failures due to protobuf version mismatches. -## Building for Windows +## Building for ARM Windows The C++ SDK works well on windows for both client and module code provided there is internet connectivity. However, some manual work is -required to build for client code. +required to build for client code on ARM64 architecture. 1. (client code only) clone [rust-utils](https://github.com/viamrobotics/rust-utils) >= v0.3.0 and build locally with `cargo build --release`. Copy `target\release\viam_rust_utils.lib` @@ -277,9 +277,6 @@ cmake . --preset conan-default cmake --build --preset=conan-release -j ``` -NOTE: There is no current support for offline mode as a client, though -this is being worked on. - ## Options to Configure or Customize the Build ### Options for Package Search diff --git a/CMakeLists.txt b/CMakeLists.txt index d3b6b720b..42654147f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -293,7 +293,7 @@ else() message(WARNING "Currently running on Windows with no rust-utils file. Module code should work as expected, but client code may fail unexpectedly.") endif() -if (NOT WIN32 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") # build `SHARED` on unix-based systems +if (NOT WIN32 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") add_library(viam_rust_utils STATIC IMPORTED) target_link_directories(viam_rust_utils INTERFACE diff --git a/src/viam/examples/mlmodel/example_audio_classification_client.cpp b/src/viam/examples/mlmodel/example_audio_classification_client.cpp index b5078a599..27c084fd5 100644 --- a/src/viam/examples/mlmodel/example_audio_classification_client.cpp +++ b/src/viam/examples/mlmodel/example_audio_classification_client.cpp @@ -12,10 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifdef _WIN32 -#define NOMINMAX -#endif - #include #include #include diff --git a/src/viam/sdk/CMakeLists.txt b/src/viam/sdk/CMakeLists.txt index eae10cea2..fa15b6580 100644 --- a/src/viam/sdk/CMakeLists.txt +++ b/src/viam/sdk/CMakeLists.txt @@ -276,10 +276,10 @@ target_link_libraries(viamsdk PRIVATE Threads::Threads ) -# TODO(RSDK-10637): Currently, rust_utils for windows doesn't link correctly when built in CI, -# so don't link to it unless the user has provided a file for it. Instead, link a stub implementation -# that just calls `abort`. -if (NOT WIN32 OR num_viam_rust_utils_files GREATER 0) +# rust-utils doesn't build in CI on windows other than x86_64, so confirm that we're either not +# windows, or if we are windows that we're AMD64, or else that the user has provided their own +# build of rust_utils. +if (NOT WIN32 OR num_viam_rust_utils_files GREATER 0 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") target_link_libraries(viamsdk PRIVATE viam_rust_utils ) From 9de29130e26a5cc73cd17164f90708c009a5179e Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 10:57:19 -0400 Subject: [PATCH 71/88] fixup ls --- .github/workflows/conan.yml | 2 -- CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index fbeb33afe..dee1a3794 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -74,7 +74,6 @@ jobs: - name: list stuff run: | ls - ls build/ tree build_macos: @@ -112,7 +111,6 @@ jobs: - name: list stuff run: | ls - ls build/ tree build_linux_ubuntu_jammy: diff --git a/CMakeLists.txt b/CMakeLists.txt index 42654147f..f7831ec56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -293,7 +293,7 @@ else() message(WARNING "Currently running on Windows with no rust-utils file. Module code should work as expected, but client code may fail unexpectedly.") endif() -if (NOT WIN32 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") +if (NOT WIN32 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") add_library(viam_rust_utils STATIC IMPORTED) target_link_directories(viam_rust_utils INTERFACE From 1e042cf75e9425c070b798e52649d15198eff952 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 11:41:01 -0400 Subject: [PATCH 72/88] try cmake invocation for windows --- .github/workflows/conan.yml | 8 +++++--- .github/workflows/release.yml | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 24e13beaf..061433403 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -61,13 +61,15 @@ jobs: - name: Create package shell: powershell + #conan create . ` + #--build=missing ` + #-o "&:shared=False" run: | Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv conan profile detect - conan create . ` - --build=missing ` - -o "&:shared=False" + cmake . --preset conan-default + cmake --build --preset=conan-release -j env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4345b204d..7b91cbad1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -59,13 +59,15 @@ jobs: - name: Create package shell: powershell + #conan create . ` + #--build=missing ` + #-o "&:shared=False" run: | Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv conan profile detect - conan create . ` - --build=missing ` - -o "&:shared=False" + cmake . --preset conan-default + cmake --build --preset=conan-release -j env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths From c6382e1909033554b9d7003ba74d9a837fa872cd Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 11:44:41 -0400 Subject: [PATCH 73/88] conanfile always include rust-utils info --- conanfile.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/conanfile.py b/conanfile.py index 4504986e6..45eaad6b8 100644 --- a/conanfile.py +++ b/conanfile.py @@ -91,8 +91,7 @@ def package(self): def package_info(self): - if not self.options.shared: - self.cpp_info.components["viam_rust_utils"].libs = ["viam_rust_utils"] + self.cpp_info.components["viam_rust_utils"].libs = ["viam_rust_utils"] self.cpp_info.components["viamsdk"].libs = ["viamsdk"] @@ -135,9 +134,8 @@ def package_info(self): "viamapi", ]) - if not self.options.shared: - self.cpp_info.components["viamsdk"].requires.extend([ - "viam_rust_utils" - ]) + self.cpp_info.components["viamsdk"].requires.extend([ + "viam_rust_utils" + ]) self.cpp_info.components["viamsdk"].frameworks = ["Security"] From c4143afdc28add46ae97f160adcc1933b90bfb14 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 12:03:59 -0400 Subject: [PATCH 74/88] include .lib --- .github/workflows/conan.yml | 8 +++----- .github/workflows/release.yml | 8 +++----- src/viam/sdk/CMakeLists.txt | 8 ++++---- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 061433403..24e13beaf 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -61,15 +61,13 @@ jobs: - name: Create package shell: powershell - #conan create . ` - #--build=missing ` - #-o "&:shared=False" run: | Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv conan profile detect - cmake . --preset conan-default - cmake --build --preset=conan-release -j + conan create . ` + --build=missing ` + -o "&:shared=False" env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7b91cbad1..4345b204d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -59,15 +59,13 @@ jobs: - name: Create package shell: powershell - #conan create . ` - #--build=missing ` - #-o "&:shared=False" run: | Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv conan profile detect - cmake . --preset conan-default - cmake --build --preset=conan-release -j + conan create . ` + --build=missing ` + -o "&:shared=False" env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths diff --git a/src/viam/sdk/CMakeLists.txt b/src/viam/sdk/CMakeLists.txt index fa15b6580..759ff1490 100644 --- a/src/viam/sdk/CMakeLists.txt +++ b/src/viam/sdk/CMakeLists.txt @@ -293,10 +293,10 @@ elseif (NOT WIN32) target_link_libraries(viamsdk PRIVATE dl) target_link_libraries(viamsdk PRIVATE rt) else() - target_link_libraries(viamsdk PRIVATE ncrypt) - target_link_libraries(viamsdk PRIVATE secur32) - target_link_libraries(viamsdk PRIVATE ntdll) - target_link_libraries(viamsdk PRIVATE userenv) + target_link_libraries(viamsdk PRIVATE ncrypt.lib) + target_link_libraries(viamsdk PRIVATE secur32.lib) + target_link_libraries(viamsdk PRIVATE ntdll.lib) + target_link_libraries(viamsdk PRIVATE userenv.lib) endif() From 165ca0c6a3114b15111f7bc590939eee56a70be4 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 13:11:35 -0400 Subject: [PATCH 75/88] interface not private --- src/viam/sdk/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/viam/sdk/CMakeLists.txt b/src/viam/sdk/CMakeLists.txt index 759ff1490..12a749657 100644 --- a/src/viam/sdk/CMakeLists.txt +++ b/src/viam/sdk/CMakeLists.txt @@ -293,10 +293,10 @@ elseif (NOT WIN32) target_link_libraries(viamsdk PRIVATE dl) target_link_libraries(viamsdk PRIVATE rt) else() - target_link_libraries(viamsdk PRIVATE ncrypt.lib) - target_link_libraries(viamsdk PRIVATE secur32.lib) - target_link_libraries(viamsdk PRIVATE ntdll.lib) - target_link_libraries(viamsdk PRIVATE userenv.lib) + target_link_libraries(viamsdk INTERFACE Ncrypt.lib) + target_link_libraries(viamsdk INTERFACE Secur32.lib) + target_link_libraries(viamsdk INTERFACE Ntdll.lib) + target_link_libraries(viamsdk INTERFACE Userenv.lib) endif() From d2924178f6d65d4a44c989b84ad6e37fe7156a94 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 15:26:46 -0400 Subject: [PATCH 76/88] try cmake invocation again --- .github/workflows/conan.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 24e13beaf..9104c4cc0 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -61,13 +61,16 @@ jobs: - name: Create package shell: powershell + #conan create . ` + #--build=missing ` + #-o "&:shared=False" run: | Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv conan profile detect - conan create . ` - --build=missing ` - -o "&:shared=False" + conan install . --output-folder=build --build=missing -o "&:shared=false" + cmake . --preset conan-default + cmake --build --preset=conan-release env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths From 9095b7924f5c0db285edce8e19c75fc15cf96af6 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 15:33:05 -0400 Subject: [PATCH 77/88] typos --- .github/workflows/conan.yml | 2 +- .github/workflows/release.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 9104c4cc0..123e42427 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -68,7 +68,7 @@ jobs: Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv conan profile detect - conan install . --output-folder=build --build=missing -o "&:shared=false" + conan install . --output-folder=build-conan --build=missing -o "&:shared=False" cmake . --preset conan-default cmake --build --preset=conan-release env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4345b204d..6be08f6ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,9 +63,9 @@ jobs: Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv conan profile detect - conan create . ` - --build=missing ` - -o "&:shared=False" + conan install . --output-folder=build-conan --build=missing -o "&:shared=False" + cmake . --preset conan-default + cmake --build --preset=conan-release env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths @@ -78,7 +78,7 @@ jobs: - name: Copy run: | - cmake --install build --prefix builds/viam-cpp-sdk-${{ matrix.platform }} + cmake --install build-conan/build --prefix builds/viam-cpp-sdk-${{ matrix.platform }} - name: Create tar run: | From 84b1874b414c71ae6e54b9a97d3aa1c5fde500f9 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 16:31:44 -0400 Subject: [PATCH 78/88] actually install --- .github/workflows/conan.yml | 6 +----- .github/workflows/release.yml | 8 +------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 123e42427..5d2045f26 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -70,7 +70,7 @@ jobs: conan profile detect conan install . --output-folder=build-conan --build=missing -o "&:shared=False" cmake . --preset conan-default - cmake --build --preset=conan-release + cmake --build --preset=conan-release --target all install -j 8 env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths @@ -111,10 +111,6 @@ jobs: export BUF_CONFIG_DIR=$(mktemp -d) conan profile detect conan create . --build=missing -s compiler.cppstd=17 - - name: list stuff - run: | - ls - tree build_linux_ubuntu_jammy: if: github.repository_owner == 'viamrobotics' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6be08f6ef..aef7b5e18 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,17 +65,11 @@ jobs: conan profile detect conan install . --output-folder=build-conan --build=missing -o "&:shared=False" cmake . --preset conan-default - cmake --build --preset=conan-release + cmake --build --preset=conan-release --target all install -j 8 env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths - - name: list stuff - run: | - ls - ls build/ - tree - - name: Copy run: | cmake --install build-conan/build --prefix builds/viam-cpp-sdk-${{ matrix.platform }} From bfc6faf63f9a5ebe3bd243f9782930eb0104882b Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 18:36:53 -0400 Subject: [PATCH 79/88] no install --- .github/workflows/conan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 5d2045f26..6f58f8440 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -70,7 +70,7 @@ jobs: conan profile detect conan install . --output-folder=build-conan --build=missing -o "&:shared=False" cmake . --preset conan-default - cmake --build --preset=conan-release --target all install -j 8 + cmake --build --preset=conan-release --target all -j 8 env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths From 4ba53d5336c25c2564c64e2b54304794b42fc937 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 19:36:03 -0400 Subject: [PATCH 80/88] no all --- .github/workflows/conan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 6f58f8440..551adaaed 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -70,7 +70,7 @@ jobs: conan profile detect conan install . --output-folder=build-conan --build=missing -o "&:shared=False" cmake . --preset conan-default - cmake --build --preset=conan-release --target all -j 8 + cmake --build --preset=conan-release install -j 8 env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths From 7cb2dd7b658d3096e024016fd6ae1b39ece79976 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Thu, 8 May 2025 21:41:38 -0400 Subject: [PATCH 81/88] all-build --- .github/workflows/conan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 551adaaed..10f5cc617 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -70,7 +70,7 @@ jobs: conan profile detect conan install . --output-folder=build-conan --build=missing -o "&:shared=False" cmake . --preset conan-default - cmake --build --preset=conan-release install -j 8 + cmake --build --preset=conan-release --target ALL_BUILD install -j 8 env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths From 3186390fb7003994c22ff44b8f3fed213cba2f1f Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 9 May 2025 07:20:26 -0400 Subject: [PATCH 82/88] more comprehensive listing --- .github/workflows/conan.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 10f5cc617..5b956437b 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -77,7 +77,8 @@ jobs: - name: list stuff run: | ls - tree + ls build-conan + ls build-conan/build build_macos: if: github.repository_owner == 'viamrobotics' From 3d56cccd870ca398083872516a16f9c4502a57d2 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 9 May 2025 08:32:23 -0400 Subject: [PATCH 83/88] fix release, comment out windows conan build for now --- .github/workflows/conan.yml | 65 ++++++++++++++++------------------- .github/workflows/release.yml | 2 +- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 5b956437b..6e52d49fe 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -40,45 +40,38 @@ jobs: github.event_name == 'schedule' && steps.git_info.outputs.current_commit == steps.last_successful_commit.outputs.commit-hash - build_windows: - if: github.repository_owner == 'viamrobotics' - needs: [prepare] - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - include: - - target: x86_64-windows - platform: windows_x86_64 - steps: - - name: Checkout Code - uses: actions/checkout@v4 - - - name: Install dependencies - uses: crazy-max/ghaction-chocolatey@v3 - with: - args: install -y conan git - - - name: Create package - shell: powershell + # TODO (RSDK-10666) Uncomment and fix + #build_windows: + #if: github.repository_owner == 'viamrobotics' + #needs: [prepare] + #runs-on: windows-latest + #strategy: + #fail-fast: false + #matrix: + #include: + #- target: x86_64-windows + #platform: windows_x86_64 + #steps: + #- name: Checkout Code + #uses: actions/checkout@v4 + + #- name: Install dependencies + #uses: crazy-max/ghaction-chocolatey@v3 + #with: + #args: install -y conan git + + #- name: Create package + #shell: powershell + #run: | + #Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 + #refreshenv + #conan profile detect #conan create . ` #--build=missing ` #-o "&:shared=False" - run: | - Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 - refreshenv - conan profile detect - conan install . --output-folder=build-conan --build=missing -o "&:shared=False" - cmake . --preset conan-default - cmake --build --preset=conan-release --target ALL_BUILD install -j 8 - env: - CONAN_USER_HOME: c:/cache - CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths - - name: list stuff - run: | - ls - ls build-conan - ls build-conan/build + #env: + #CONAN_USER_HOME: c:/cache + #CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths build_macos: if: github.repository_owner == 'viamrobotics' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aef7b5e18..8158e36f2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,7 +65,7 @@ jobs: conan profile detect conan install . --output-folder=build-conan --build=missing -o "&:shared=False" cmake . --preset conan-default - cmake --build --preset=conan-release --target all install -j 8 + cmake --build --preset=conan-release --target ALL_BUILD install -j 8 env: CONAN_USER_HOME: c:/cache CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths From b710c7abdc732bbbf720a61a75294d6db2f7bcec Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 9 May 2025 10:47:53 -0400 Subject: [PATCH 84/88] remove unused code --- .github/workflows/conan.yml | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 6e52d49fe..fb5009415 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -40,38 +40,7 @@ jobs: github.event_name == 'schedule' && steps.git_info.outputs.current_commit == steps.last_successful_commit.outputs.commit-hash - # TODO (RSDK-10666) Uncomment and fix - #build_windows: - #if: github.repository_owner == 'viamrobotics' - #needs: [prepare] - #runs-on: windows-latest - #strategy: - #fail-fast: false - #matrix: - #include: - #- target: x86_64-windows - #platform: windows_x86_64 - #steps: - #- name: Checkout Code - #uses: actions/checkout@v4 - - #- name: Install dependencies - #uses: crazy-max/ghaction-chocolatey@v3 - #with: - #args: install -y conan git - - #- name: Create package - #shell: powershell - #run: | - #Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 - #refreshenv - #conan profile detect - #conan create . ` - #--build=missing ` - #-o "&:shared=False" - #env: - #CONAN_USER_HOME: c:/cache - #CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths + # TODO (RSDK-10666) add windows build testing build_macos: if: github.repository_owner == 'viamrobotics' From b56ab5c7b56f479f686ef017c1820e90212a4004 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 16 May 2025 09:21:34 -0400 Subject: [PATCH 85/88] cr comments --- .../examples/mlmodel/example_audio_classification_client.cpp | 2 +- src/viam/sdk/CMakeLists.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/viam/examples/mlmodel/example_audio_classification_client.cpp b/src/viam/examples/mlmodel/example_audio_classification_client.cpp index 27c084fd5..d528e0ab1 100644 --- a/src/viam/examples/mlmodel/example_audio_classification_client.cpp +++ b/src/viam/examples/mlmodel/example_audio_classification_client.cpp @@ -377,7 +377,7 @@ int main(int argc, char* argv[]) try { }); // Print out the top 5 (or fewer) label/score pairs. - for (size_t i = 0; i != std::min(5UL, scored_labels.size()); ++i) { + for (size_t i = 0; i != std::min(size_t{5}, scored_labels.size()); ++i) { // TODO: Avoid hardcoding the width here. VIAM_SDK_LOG(info) << boost::format("%1%: %2% %|40t|%3%\n") % i % *scored_labels[i].label % scored_labels[i].score; diff --git a/src/viam/sdk/CMakeLists.txt b/src/viam/sdk/CMakeLists.txt index 12a749657..d99edb17c 100644 --- a/src/viam/sdk/CMakeLists.txt +++ b/src/viam/sdk/CMakeLists.txt @@ -287,6 +287,9 @@ else() target_sources(viamsdk PRIVATE rpc/private/viam_rust_utils_stubs.cpp) endif() + +# TODO several of these dependencies should properly be attached to `viam_rust_utils`, +# not `viamsdk`. However, we currently are unable to do so while maintaining compilation if (APPLE) target_link_libraries(viamsdk PUBLIC "-framework Security") elseif (NOT WIN32) From 230b29d3113ad346650de743359a2001b67e2721 Mon Sep 17 00:00:00 2001 From: Abe Winter Date: Fri, 16 May 2025 11:59:17 -0400 Subject: [PATCH 86/88] cr comments, test direct choco invocation --- .github/workflows/conan.yml | 31 +++++++++++++++++++++++++++++++ .github/workflows/release.yml | 1 + src/viam/sdk/CMakeLists.txt | 2 +- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index fb5009415..99fc3a54f 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -41,6 +41,37 @@ jobs: steps.git_info.outputs.current_commit == steps.last_successful_commit.outputs.commit-hash # TODO (RSDK-10666) add windows build testing + build_windows: + if: github.repository_owner == 'viamrobotics' + needs: [prepare] + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-windows + platform: windows_x86_64 + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + ref: ${{ needs.prepare.outputs.sha }} + + - name: Install dependencies + run: choco install -y conan git + + - name: Create package + shell: powershell + run: | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 + refreshenv + conan profile detect + conan install . --output-folder=build-conan --build=missing -o "&:shared=False" + cmake . --preset conan-default + cmake --build --preset=conan-release --target ALL_BUILD install -j 8 + env: + CONAN_USER_HOME: c:/cache + CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths build_macos: if: github.repository_owner == 'viamrobotics' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8158e36f2..1224af1ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -59,6 +59,7 @@ jobs: - name: Create package shell: powershell + # TODO (RSDK-10666) Use conan invocations rather than cmake invocations here run: | Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 refreshenv diff --git a/src/viam/sdk/CMakeLists.txt b/src/viam/sdk/CMakeLists.txt index d99edb17c..bff6f5607 100644 --- a/src/viam/sdk/CMakeLists.txt +++ b/src/viam/sdk/CMakeLists.txt @@ -279,7 +279,7 @@ target_link_libraries(viamsdk # rust-utils doesn't build in CI on windows other than x86_64, so confirm that we're either not # windows, or if we are windows that we're AMD64, or else that the user has provided their own # build of rust_utils. -if (NOT WIN32 OR num_viam_rust_utils_files GREATER 0 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") +if (TARGET viam_rust_utils) target_link_libraries(viamsdk PRIVATE viam_rust_utils ) From cd7690baa1572b20ae810b9d5cac9e512114924b Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 16 May 2025 13:30:05 -0400 Subject: [PATCH 87/88] get primetime ready --- .github/workflows/conan.yml | 31 ------------------------------- .github/workflows/release.yml | 4 +--- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 99fc3a54f..fb5009415 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -41,37 +41,6 @@ jobs: steps.git_info.outputs.current_commit == steps.last_successful_commit.outputs.commit-hash # TODO (RSDK-10666) add windows build testing - build_windows: - if: github.repository_owner == 'viamrobotics' - needs: [prepare] - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - include: - - target: x86_64-windows - platform: windows_x86_64 - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - ref: ${{ needs.prepare.outputs.sha }} - - - name: Install dependencies - run: choco install -y conan git - - - name: Create package - shell: powershell - run: | - Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 - refreshenv - conan profile detect - conan install . --output-folder=build-conan --build=missing -o "&:shared=False" - cmake . --preset conan-default - cmake --build --preset=conan-release --target ALL_BUILD install -j 8 - env: - CONAN_USER_HOME: c:/cache - CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths build_macos: if: github.repository_owner == 'viamrobotics' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1224af1ec..63b8d5549 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,9 +53,7 @@ jobs: ref: ${{ needs.prepare.outputs.sha }} - name: Install dependencies - uses: crazy-max/ghaction-chocolatey@v3 - with: - args: install -y conan git + run: choco install -y conan git - name: Create package shell: powershell From fa063e4df078b76830a3f70b6bd114ffa5eda02b Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Fri, 16 May 2025 14:15:48 -0400 Subject: [PATCH 88/88] improve comment --- src/viam/sdk/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/viam/sdk/CMakeLists.txt b/src/viam/sdk/CMakeLists.txt index bff6f5607..5f7035b0a 100644 --- a/src/viam/sdk/CMakeLists.txt +++ b/src/viam/sdk/CMakeLists.txt @@ -276,9 +276,9 @@ target_link_libraries(viamsdk PRIVATE Threads::Threads ) -# rust-utils doesn't build in CI on windows other than x86_64, so confirm that we're either not -# windows, or if we are windows that we're AMD64, or else that the user has provided their own -# build of rust_utils. +# if the `viam_rust_utils` target exists then we should use it. If not then +# we're probably on a non-x86_64 windows build or some other platform without +# automated `rust-utils` builds, so we should use the stubs instead. if (TARGET viam_rust_utils) target_link_libraries(viamsdk PRIVATE viam_rust_utils