Skip to content

Commit d9d98ff

Browse files
authored
Merge branch 'main' into RSDK-10768-single-input-tensor-naming
2 parents cf9b563 + 777f1fd commit d9d98ff

File tree

25 files changed

+719
-144
lines changed

25 files changed

+719
-144
lines changed

.github/workflows/conan.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040
github.event_name == 'schedule' &&
4141
steps.git_info.outputs.current_commit == steps.last_successful_commit.outputs.commit-hash
4242
43+
# TODO (RSDK-10666) add windows build testing
44+
4345
build_macos:
4446
if: github.repository_owner == 'viamrobotics'
4547
needs: [prepare]

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,53 @@ jobs:
3636
uses: andymckay/[email protected]
3737
if: steps.release_exists.outputs.id != ''
3838

39+
build_windows:
40+
if: github.repository_owner == 'viamrobotics'
41+
needs: [prepare]
42+
runs-on: windows-latest
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
include:
47+
- target: x86_64-windows
48+
platform: windows_x86_64
49+
steps:
50+
- name: Checkout Code
51+
uses: actions/checkout@v4
52+
with:
53+
ref: ${{ needs.prepare.outputs.sha }}
54+
55+
- name: Install dependencies
56+
run: choco install -y conan git
57+
58+
- name: Create package
59+
shell: powershell
60+
# TODO (RSDK-10666) Use conan invocations rather than cmake invocations here
61+
run: |
62+
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
63+
refreshenv
64+
conan profile detect
65+
conan install . --output-folder=build-conan --build=missing -o "&:shared=False"
66+
cmake . --preset conan-default
67+
cmake --build --preset=conan-release --target ALL_BUILD install -j 8
68+
env:
69+
CONAN_USER_HOME: c:/cache
70+
CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths
71+
72+
- name: Copy
73+
run: |
74+
cmake --install build-conan/build --prefix builds/viam-cpp-sdk-${{ matrix.platform }}
75+
76+
- name: Create tar
77+
run: |
78+
tar -czvf builds/viam-cpp-sdk-${{ matrix.platform }}.tar.gz builds/viam-cpp-sdk-${{ matrix.platform }}
79+
80+
- name: Upload artifacts
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: viam-cpp-sdk-${{ matrix.platform }}.tar.gz
84+
path: builds/viam-cpp-sdk-${{ matrix.platform }}.tar.gz
85+
3986
build_macos:
4087
if: github.repository_owner == 'viamrobotics'
4188
needs: [prepare]

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Test
22

33
on:
44
pull_request:
5+
paths-ignore:
6+
- conanfile.py
7+
- '**.md'
58
workflow_dispatch:
69
inputs:
710
no-tidy:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
/build/*
66

77
# For now, ignore any viam_rust_utils library in the root.
8+
# The `lib` prefix is on unix-based systems only
89
/libviam_rust_utils*
10+
/viam_rust_utils*
911

1012
# Ignore clang cache.
1113
/.cache/

BUILDING.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,23 @@ have a different version of `protoc` available in your `PATH`, it will
260260
silently fail and later cause compilation failures due to protobuf
261261
version mismatches.
262262

263+
## Building for ARM Windows
264+
265+
The C++ SDK works well on windows for both client and module code
266+
provided there is internet connectivity. However, some manual work is
267+
required to build for client code on ARM64 architecture.
268+
269+
1. (client code only) clone [rust-utils](https://github.com/viamrobotics/rust-utils) >= v0.3.0 and
270+
build locally with `cargo build --release`. Copy `target\release\viam_rust_utils.lib`
271+
to the root of the C++ SDK directory.
272+
2. Ensure `conan` is installed (see `Building with Conan` above).
273+
3. Run the following:
274+
```
275+
conan profile detect
276+
cmake . --preset conan-default <cmake args>
277+
cmake --build --preset=conan-release -j
278+
```
279+
263280
## Options to Configure or Customize the Build
264281

265282
### Options for Package Search

CMakeLists.txt

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ else()
4141
cmake_minimum_required(VERSION 3.25 FATAL_ERROR)
4242
endif()
4343

44-
set(CMAKE_PROJECT_VERSION 0.11.0)
44+
set(CMAKE_PROJECT_VERSION 0.12.0)
4545

4646
# Identify the project.
4747
project(viam-cpp-sdk
@@ -266,14 +266,20 @@ if (viam_rust_utils_files)
266266
${viam_rust_utils_file}
267267
ONLY_IF_DIFFERENT
268268
)
269-
elseif(NOT WIN32) # TODO(RSDK-10366): Currently, rust_utils is not published for windows, so don't even try downloading
269+
elseif(NOT WIN32 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
270270
set(lvru_system_name ${CMAKE_SYSTEM_NAME})
271271
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
272272
set(lvru_system_name "macosx")
273273
endif()
274+
275+
set(lvru_system_processor ${CMAKE_SYSTEM_PROCESSOR})
276+
if(WIN32)
277+
set(lvru_system_processor "x86_64")
278+
endif()
279+
274280
file(
275281
DOWNLOAD
276-
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}
282+
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}
277283
${viam_rust_utils_file}
278284
STATUS lvru_status
279285
)
@@ -283,24 +289,21 @@ elseif(NOT WIN32) # TODO(RSDK-10366): Currently, rust_utils is not published for
283289
if(NOT lvru_status_code EQUAL 0)
284290
message(FATAL_ERROR "No local viam_rust_utils found and failed to download: ${lvru_status_string}")
285291
endif()
286-
292+
else()
293+
message(WARNING "Currently running on Windows with no rust-utils file. Module code should work as expected, but client code may fail unexpectedly.")
287294
endif()
288295

289-
# TODO(RSDK-10366): Currently, rust_utils is not published for windows, so don't even declare the library
290-
if (NOT WIN32)
291-
add_library(viam_rust_utils SHARED IMPORTED)
292-
296+
if (NOT WIN32 OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
297+
add_library(viam_rust_utils STATIC IMPORTED)
293298
target_link_directories(viam_rust_utils
294299
INTERFACE
295300
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
296301
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}>"
297302
)
298-
299303
set_property(TARGET viam_rust_utils PROPERTY IMPORTED_LOCATION ${viam_rust_utils_file})
300304

301305
install(
302-
IMPORTED_RUNTIME_ARTIFACTS viam_rust_utils
303-
LIBRARY COMPONENT viam-cpp-sdk_runtime
306+
FILES ${viam_rust_utils_file} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT viam-cpp-sdk_runtime
304307
)
305308
endif()
306309

conanfile.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,31 @@ def configure(self):
4242
for lib in ["grpc", "protobuf", "abseil"]:
4343
self.options[lib].shared = True
4444

45+
def _xtensor_requires(self):
46+
if self.settings.compiler.cppstd in ["14", "gnu14"]:
47+
return 'xtensor/[>=0.24.3 <0.26.0]'
48+
49+
return 'xtensor/[>=0.24.3]'
50+
51+
def _grpc_requires(self):
52+
if self.settings.compiler.cppstd in ["14", "gnu14"]:
53+
return 'grpc/[>=1.48.4 <1.70.0]'
54+
55+
return 'grpc/[>=1.48.4]'
56+
4557
def requirements(self):
4658
self.requires('boost/[>=1.74.0]', transitive_headers=True)
4759

4860
# The SDK supports older grpc and protobuf, but these are the oldest
4961
# maintained conan packages.
50-
self.requires('grpc/[>=1.48.4]')
51-
self.requires('protobuf/[>=3.17.1]')
52-
self.requires('xtensor/[>=0.24.3]', transitive_headers=True)
62+
self.requires(self._grpc_requires())
63+
self.requires('protobuf/[>=3.17.1 <6.30.0]')
64+
self.requires(self._xtensor_requires(), transitive_headers=True)
5365

5466
def build_requirements(self):
5567
if self.options.offline_proto_generation:
56-
self.tool_requires('grpc/[>=1.48.4]')
57-
self.tool_requires('protobuf/[>=3.17.1]')
68+
self.tool_requires(self._grpc_requires())
69+
self.tool_requires('protobuf/[>=3.17.1 <6.30.0]')
5870

5971
def layout(self):
6072
cmake_layout(self)
@@ -91,10 +103,7 @@ def package(self):
91103

92104
def package_info(self):
93105

94-
# TODO(RSDK-10366): Currently, rust_utils is not published for windows
95-
# and the C++ SDK just doesn't include it as a dependency on that platform
96-
if not self.settings.os == "Windows":
97-
self.cpp_info.components["viam_rust_utils"].libs = ["viam_rust_utils"]
106+
self.cpp_info.components["viam_rust_utils"].libs = ["viam_rust_utils"]
98107

99108
self.cpp_info.components["viamsdk"].libs = ["viamsdk"]
100109

@@ -137,11 +146,8 @@ def package_info(self):
137146
"viamapi",
138147
])
139148

140-
# TODO(RSDK-10366): Currently, rust_utils is not published for windows
141-
# and the C++ SDK just doesn't include it as a dependency on that platform
142-
if self.settings.os != "Windows":
143-
self.cpp_info.components["viamsdk"].requires.extend([
144-
"viam_rust_utils"
145-
])
149+
self.cpp_info.components["viamsdk"].requires.extend([
150+
"viam_rust_utils"
151+
])
146152

147153
self.cpp_info.components["viamsdk"].frameworks = ["Security"]

src/viam/api/api_proto_tag.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.1.436
1+
v0.1.438

0 commit comments

Comments
 (0)