Skip to content

RSDK-10366 - rust utils for windows #416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 95 commits into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
e9d3ea1
only prepend unix when using uds
stuqdog Apr 18, 2025
0e3b8af
untested download and install rust-utils for windows
stuqdog Apr 18, 2025
b968803
cr comments
stuqdog Apr 18, 2025
5d5bb2d
const correctness
stuqdog Apr 18, 2025
d9827e5
try windows build
stuqdog Apr 21, 2025
adff932
test it
stuqdog Apr 21, 2025
59fd83c
try getting all dependencies installed
stuqdog Apr 21, 2025
a8e1751
no setting buf_config_dir
stuqdog Apr 21, 2025
ff01f42
try earlier cmake
stuqdog Apr 21, 2025
96652c8
goldilocks cmake
stuqdog Apr 21, 2025
46dad50
set boost root
stuqdog Apr 21, 2025
1d1ad1e
set boost includedir, try to find librarydir
stuqdog Apr 21, 2025
3268789
try list better
stuqdog Apr 21, 2025
57e6d5d
set librarydir
stuqdog Apr 21, 2025
cb01ea7
set boost compiler
stuqdog Apr 21, 2025
5cf9590
12 not 13
stuqdog Apr 21, 2025
ff5a2bf
had boost compiler backwards
stuqdog Apr 21, 2025
bc83e5b
github action for grpc
stuqdog Apr 21, 2025
674e729
specify grpc version
stuqdog Apr 21, 2025
952c305
install grpc with vcpkg
stuqdog Apr 21, 2025
7e38e1b
powershell
stuqdog Apr 21, 2025
9eab8c5
typo
stuqdog Apr 21, 2025
d590eff
try conan instead
stuqdog Apr 22, 2025
2d7df41
build too
stuqdog Apr 22, 2025
f299251
py -m conan
stuqdog Apr 22, 2025
9e36c2f
fixup
stuqdog Apr 22, 2025
02660a3
refreshenv
stuqdog Apr 22, 2025
6728c57
more installs, set envvars, etc
stuqdog Apr 22, 2025
38667a8
format fix
stuqdog Apr 22, 2025
ae64216
specify cmake version
stuqdog Apr 22, 2025
1dd810f
syntax change
stuqdog Apr 22, 2025
15abea3
cleanup release a bit, print more info
stuqdog Apr 22, 2025
d6982be
get correct arch
stuqdog Apr 23, 2025
11e56e9
one more arch fix
stuqdog Apr 23, 2025
b1e8526
fix unix://, another arch fix
stuqdog Apr 23, 2025
e21ba06
hardcode lib prefix
stuqdog Apr 23, 2025
c7490e2
print system name
stuqdog Apr 23, 2025
758bacf
Merge branch 'main' into RSDK-10366-rust-utils-for-windows
stuqdog Apr 23, 2025
7e0953c
case sensitive
stuqdog Apr 26, 2025
c98af91
Merge branch 'RSDK-10366-rust-utils-for-windows' of ssh://github.com/…
stuqdog Apr 26, 2025
72004be
restart tests
stuqdog Apr 26, 2025
412cbb9
set shared library prefix earlier
stuqdog Apr 28, 2025
73c5410
cleaner
stuqdog Apr 28, 2025
b4c4b84
just hardcode lib
stuqdog Apr 28, 2025
de30df1
fixups from windows testing
stuqdog May 2, 2025
0b2512b
fix token
stuqdog May 2, 2025
4c29471
some cleanup
stuqdog May 2, 2025
add6916
remove comments to self
stuqdog May 2, 2025
d4cb253
a couple more comment cleanups
stuqdog May 2, 2025
89df7fb
add instructions for building on windows
stuqdog May 2, 2025
ba316a3
Merge branch 'main' of ssh://github.com/viamrobotics/viam-cpp-sdk int…
stuqdog May 2, 2025
f1ba0d3
try keeping shared for unix
stuqdog May 2, 2025
07470b2
try keeping shared for unix pt2
stuqdog May 2, 2025
3ee79d5
typo
stuqdog May 2, 2025
6e77560
static for windows only, import chrono
stuqdog May 2, 2025
59ed94e
nominmax for windows
stuqdog May 6, 2025
0f5812a
specify type
stuqdog May 6, 2025
c66a2e0
prepare for working rust-utils
stuqdog May 7, 2025
51de5d8
try stuff from CR comments
stuqdog May 7, 2025
a9b2337
dont install when static building
stuqdog May 7, 2025
7afa451
shared again
stuqdog May 7, 2025
1bd47b2
test from convo with drew
stuqdog May 7, 2025
d43865b
fix ordering of link libraries for rust-utils
stuqdog May 7, 2025
b3a339a
rust-utils always static
stuqdog May 7, 2025
4b68fda
invert check for installing rust-utils
stuqdog May 7, 2025
952702b
revert to linking to viamsdk, not rust-utils
stuqdog May 7, 2025
f1c1e4f
shift to install FILES
stuqdog May 7, 2025
ec59387
did I get conan stuff wrong
stuqdog May 8, 2025
5e15a93
always install
stuqdog May 8, 2025
e5a3a5a
typo
stuqdog May 8, 2025
b843938
workflow cleanup, print out info for to find where to copy from with …
stuqdog May 8, 2025
861a35c
remove commented out stuff
stuqdog May 8, 2025
6306025
cleanup
stuqdog May 8, 2025
9de2913
fixup ls
stuqdog May 8, 2025
2779b50
Merge branch 'main' of ssh://github.com/viamrobotics/viam-cpp-sdk int…
stuqdog May 8, 2025
1e042cf
try cmake invocation for windows
stuqdog May 8, 2025
c6382e1
conanfile always include rust-utils info
stuqdog May 8, 2025
c4143af
include .lib
stuqdog May 8, 2025
165ca0c
interface not private
stuqdog May 8, 2025
d292417
try cmake invocation again
stuqdog May 8, 2025
9095b79
typos
stuqdog May 8, 2025
84b1874
actually install
stuqdog May 8, 2025
bfc6faf
no install
stuqdog May 8, 2025
4ba53d5
no all
stuqdog May 8, 2025
7cb2dd7
all-build
stuqdog May 9, 2025
3186390
more comprehensive listing
stuqdog May 9, 2025
3d56ccc
fix release, comment out windows conan build for now
stuqdog May 9, 2025
b710c7a
remove unused code
stuqdog May 9, 2025
47aca71
Merge branch 'main' into RSDK-10366-rust-utils-for-windows
stuqdog May 9, 2025
b56ab5c
cr comments
stuqdog May 16, 2025
3693c60
Merge branch 'RSDK-10366-rust-utils-for-windows' of ssh://github.com/…
stuqdog May 16, 2025
9459e17
Merge branch 'main' into RSDK-10366-rust-utils-for-windows
stuqdog May 16, 2025
230b29d
cr comments, test direct choco invocation
abe-winter May 16, 2025
cd7690b
get primetime ready
stuqdog May 16, 2025
fa063e4
improve comment
stuqdog May 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/conan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,55 @@ 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

- name: Install python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Scoop
uses: MinoruSekine/[email protected]

- name: install buf 'n stuff
run: scoop install buf ninja
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you still need any of this if you have choco?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately I think so. possibly choco can take care of ninja for us but I was unable to install buf with anything except scoop (in fact, the official instructions for buf are to use scoop).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little puzzled about this, because as far as I know I was able to build the C++ SDK as part of the windows tflite build without scoop, or many of these other steps.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this page, describing windows-latest claims that cmake, python, and choco come pre-installed:

https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh: I made it so the C++ SDK downloads buf. So you shouldn't need to install it at all!:

https://github.com/viamrobotics/viam-cpp-sdk/blob/main/src/viam/api/CMakeLists.txt#L64-L94


- 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

build_macos:
if: github.repository_owner == 'viamrobotics'
needs: [prepare]
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,77 @@ jobs:
uses: andymckay/[email protected]
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/[email protected]

- 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still surprised you need this. Chocolatey is pre-installed on windows builders, from what I know. The tflite cpu build uses choco to install conan without doing anything special to install choco itself:

https://github.com/viam-modules/mlmodel-tflite/blob/main/bin/setup.ps1#L5

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you're probably right that it's not necessary! I kept it in just because we needed to do a choco install some way or another, it seemed totally innocuous to include, and I didn't want to do another round of testing to confirm. If you think there's a good reason to switch to a choco install invocation instead, let me know!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without knowing exactly what it does, it likely is innocuous until "crazy max"'s repo ends up being a vector for / victim of a supply chain attack.

At least when run on windows, all it actually seems to do is call choco with args:

https://github.com/crazy-max/ghaction-chocolatey/blob/master/src/main.ts#L22

So, from a risk / reward ratio it looks to me like it shouldn't stay. However, I'm fine with leaving it in for now since I know there has been a lot of back and forth on this and testing is slow. If you end up leaving it in, could you please file a ticket to remove it and add a TODO here before merging?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh that's a good point! this is reason enough to just make the change now imo, tested and it works.


- 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'
needs: [prepare]
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
20 changes: 20 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 args>
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
Expand Down
27 changes: 21 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,20 @@ 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 "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
)
Expand All @@ -283,21 +289,30 @@ elseif(NOT WIN32) # TODO(RSDK-10366): Currently, rust_utils is not published for
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 "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)
if (NOT WIN32) # build `SHARED` on unix-based systems
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building STATIC here caused tests to fail. So I reverted to SHARED (which we were already doing). But, building SHARED causes the builds to fail entirely on windows! So, we build STATIC on windows, below.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not shared though, so I don't really understand how this is working. I think this said SHARED when it originally did pull down the shared library, but when it was switched to pull the static library this didn't get updated. Can you elaborate on what goes wrong in the tests when this is changed to STATIC?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't immediately recall, but I'll switch back to STATIC now and see if/how it fails!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMake Error at /__w/viam-cpp-sdk/viam-cpp-sdk/test_package/build/gcc-12-x86_64-14-release/generators/cmakedeps_macros.cmake:66 (message):
  Library 'viam_rust_utils' not found in package.  If 'viam_rust_utils' is a
  system library, declare it with 'cpp_info.system_libs' property

add_library(viam_rust_utils SHARED IMPORTED)

target_link_directories(viam_rust_utils
INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}>"
)
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
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies: I've changed my mind here, I think you still do need INSTALL_INTERFACE here for the BUILD_SHARED_LIBS=OFF case.

)
set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file})
endif()


if (NOT WIN32) # installing seems to be necessary for tests to pass in CI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd imagine that it should only be necessary to install viam_rust_utils for a static build of the C++ SDK. In BUILD_SHARED_LIBS=ON mode, the whole of viam_rust_utils will get baked into the libviamsdk shared library

install(
IMPORTED_RUNTIME_ARTIFACTS viam_rust_utils
LIBRARY COMPONENT viam-cpp-sdk_runtime
Expand Down
14 changes: 4 additions & 10 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ 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
if not self.settings.os == "Windows":
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lia-viam can you help me understand what this is doing? Based on testing on the windows laptop, it doesn't seem to matter whether we run this always or not. Same below.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://docs.conan.io/2/examples/conanfile/package_info/components.html for more info, but basically we are telling conan that the SDK depends on a library called viam_rust_utils, and the name of the library to be linked is also viam_rust_utils

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"]

Expand Down Expand Up @@ -137,11 +134,8 @@ 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
if self.settings.os != "Windows":
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"]
2 changes: 1 addition & 1 deletion src/viam/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ char *path = dial("<your robot uri here>", "<your authentication type>", "<your
Then to obtain a robot client do :

``` c++
std::string address("unix://");
std::string address("unix:");
address += path;
RobotServiceClient client(grpc::CreateChannel(address, grpc::InsecureChannelCredentials()));
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifdef _WIN32
#define NOMINMAX
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this may no longer be necessary because of the std::min<std::size_t> below

#endif

#include <chrono>
#include <cstdlib>
#include <fstream>
Expand Down Expand Up @@ -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 != std::min(5UL, scored_labels.size()); ++i) {
for (size_t i = 0; i != std::min<std::size_t>(5UL, scored_labels.size()); ++i) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the explicit std::size_t?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On windows specifically, it was necessary to specify the type. Otherwise, there was a no matching overloaded function found compilation error.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acmorrow since the template wants both its arguments to be the same typename T, a call to std::min(5UL, std::size_t{}) was ambiguous...vexing but I think MSVC may have been right there since size_t is unsigned long long not unsigned long

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just make the 5 a size_t? I'd expect std::min(size_t{5}, scored_labels.size()) to do the right thing.

// 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;
Expand Down
6 changes: 4 additions & 2 deletions src/viam/examples/modules/complex/gizmo/api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ class Gizmo : public Component {
explicit Gizmo(std::string name);
};

namespace viam::sdk {
namespace viam {
namespace sdk {
Comment on lines +33 to +34
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make compiles on C++14.

template <>
struct API::traits<Gizmo> {
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 {
Expand Down
6 changes: 4 additions & 2 deletions src/viam/examples/modules/complex/summation/api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ class Summation : public Service {
explicit Summation(std::string name);
};

namespace viam::sdk {
namespace viam {
namespace sdk {
Comment on lines +32 to +33
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make compile on C++14

template <>
struct API::traits<Summation> {
static API api();
};
} // namespace viam::sdk
} // namespace sdk
} // namespace viam

// `SummationClient` is the gRPC client implementation of a `Summation`
// service.
Expand Down
13 changes: 9 additions & 4 deletions src/viam/sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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()


Expand Down
2 changes: 1 addition & 1 deletion src/viam/sdk/robot/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ std::shared_ptr<RobotClient> RobotClient::at_address(const std::string& address,

std::shared_ptr<RobotClient> RobotClient::at_local_socket(const std::string& address,
const Options& options) {
const std::string addr = "unix://" + address;
const std::string addr = "unix:" + address;
auto robot = RobotClient::with_channel(
ViamChannel(sdk::impl::create_viam_channel(addr, grpc::InsecureChannelCredentials())),
options);
Expand Down
2 changes: 1 addition & 1 deletion src/viam/sdk/robot/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,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<RobotClient> at_local_socket(const std::string& address,
const Options& options);
Expand Down
Loading
Loading