Skip to content

Commit 197cf69

Browse files
Sacheta-NISacheta-NI
andauthored
gRPC upgrade to v1.62.0 (#432)
* updating grpc version to 62 Signed-off-by: Sacheta-NI <sacheta@ni.com> * updating cmake min version and a few changes for apis Signed-off-by: Sacheta-NI <sacheta@ni.com> * code review feedbacks Signed-off-by: Sacheta . <sacheta@ni.com> * disabling LVEfficient until it is good to go for upgrade Signed-off-by: Sacheta-NI <sacheta@emerson.com> * Overwriting value for LVMessageEfficient toggle to false to keep it disabled Signed-off-by: Sacheta-NI <sacheta@ni.com> * Adding comment Signed-off-by: Sacheta-NI <sacheta@ni.com> * adding issue ref for LVMessageEfficient disable tracking Signed-off-by: Sacheta . <sacheta@ni.com> * adding a few methods to ExportedFunctionList.json Signed-off-by: Sacheta-NI <sacheta@emerson.com> --------- Signed-off-by: Sacheta-NI <sacheta@ni.com> Signed-off-by: Sacheta . <sacheta@ni.com> Signed-off-by: Sacheta-NI <sacheta@emerson.com> Co-authored-by: Sacheta-NI <sacheta@emerson.com>
1 parent 25cddb1 commit 197cf69

19 files changed

+169
-102
lines changed

.github/workflows/build_on_rt.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
# improvements to hosting and exports of the NILRT toolchain are made.
2727
- name: Install NI Linux RT CC Toolchain
2828
run: |
29-
wget -nv https://download.ni.com/support/softlib/labview/labview_rt/2018/Linux%20Toolchains/linux/oecore-x86_64-core2-64-toolchain-6.0.sh
30-
sudo chmod a+x ./oecore-x86_64-core2-64-toolchain-6.0.sh
31-
sudo ./oecore-x86_64-core2-64-toolchain-6.0.sh -y -d ${GITHUB_WORKSPACE}/nilrt-toolchain/
29+
wget -nv https://download.ni.com/support/softlib/labview/labview_rt/2023Q4/LinuxToolchains/linux/oecore-x86_64-core2-64-toolchain-10.0.sh
30+
sudo chmod a+x ./oecore-x86_64-core2-64-toolchain-10.0.sh
31+
sudo ./oecore-x86_64-core2-64-toolchain-10.0.sh -y -d ${GITHUB_WORKSPACE}/nilrt-toolchain/
3232
echo "${GITHUB_WORKSPACE}/nilrt-toolchain/sysroots/x86_64-nilrtsdk-linux/usr/bin/x86_64-nilrt-linux" >> ${GITHUB_PATH}
3333
3434
- name: Update Submodules

.github/workflows/windows_x64_build.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ jobs:
1414
# well on Windows or Mac. You can convert this to a matrix build if you need
1515
# cross-platform coverage.
1616
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
17-
runs-on: windows-2019
17+
runs-on: windows-2022
1818

1919
steps:
2020
- uses: actions/checkout@v4
2121
- uses: ilammy/msvc-dev-cmd@v1
2222
- uses: ilammy/setup-nasm@v1.5.1
2323

24+
- name: Install Visual Studio 2022 Build Tools
25+
run: |
26+
choco install visualstudio2022-workload-vctools --yes || throw "Installation failed"
27+
2428
- name: Update Submodules
2529
working-directory: ${{runner.workspace}}/grpc-labview
2630
run: git submodule update --init --recursive
@@ -32,7 +36,7 @@ jobs:
3236

3337
- name: Configure CMake
3438
working-directory: ${{runner.workspace}}\grpc-labview\build
35-
run: cmake -G "Visual Studio 16 2019" ..
39+
run: cmake -G "Visual Studio 17 2022" -A x64 ..
3640

3741
- name: Build
3842
working-directory: ${{runner.workspace}}\grpc-labview\build

.github/workflows/windows_x86_build.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ env:
99

1010
jobs:
1111
build:
12-
runs-on: windows-2019
12+
runs-on: windows-2022
1313

1414
steps:
1515
- uses: actions/checkout@v4
@@ -18,6 +18,10 @@ jobs:
1818
arch: x86
1919
- uses: ilammy/setup-nasm@v1.5.1
2020

21+
- name: Install Visual Studio 2022 Build Tools
22+
run: |
23+
choco install visualstudio2022-workload-vctools --yes || throw "Installation failed"
24+
2125
- name: Update Submodules
2226
working-directory: ${{runner.workspace}}/grpc-labview
2327
run: git submodule update --init --recursive
@@ -27,7 +31,7 @@ jobs:
2731

2832
- name: Configure CMake
2933
working-directory: ${{runner.workspace}}\grpc-labview\build
30-
run: cmake -G "Visual Studio 16 2019" -A Win32 ..
34+
run: cmake -G "Visual Studio 17 2022" -A Win32 ..
3135

3236
- name: Build
3337
working-directory: ${{runner.workspace}}\grpc-labview\build

CMakeLists.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
#----------------------------------------------------------------------
22
#----------------------------------------------------------------------
3-
cmake_minimum_required(VERSION 3.5.1)
3+
cmake_minimum_required(VERSION 3.15)
44

55
cmake_policy(SET CMP0091 NEW)
66

77
project(labview-grpc C CXX)
8+
set(ABSL_ENABLE_INSTALL ON)
89

910
if(NOT MSVC)
10-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
11+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
1112
# Set default visibility to hidden, only export LIBRARY_EXPORT symbols from the shared library
1213
add_compile_options(-fvisibility=hidden)
1314
else()
1415
add_definitions(-D_WIN32_WINNT=0x600)
15-
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
16+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" CACHE STRING "Use static runtime" FORCE)
17+
set(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT "MultiThreaded$<$<CONFIG:Debug>:Debug>" CACHE STRING "Default MSVC runtime library to use static runtime")
18+
set(gRPC_MSVC_STATIC_RUNTIME ON CACHE BOOL "Use static runtime for gRPC" FORCE)
19+
set(protobuf_MSVC_STATIC_RUNTIME ON CACHE BOOL "Use static runtime for protobuf" FORCE)
20+
set(ABSL_MSVC_STATIC_RUNTIME ON CACHE BOOL "Use static runtime for Abseil")
21+
set(CARES_MSVC_STATIC_RUNTIME ON CACHE BOOL "Use static runtime for c-ares")
22+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
1623
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4244")
1724
add_compile_options("$<$<NOT:$<CONFIG:Debug>>:/Zi>")
1825
add_link_options("$<$<NOT:$<CONFIG:Debug>>:/DEBUG>")

nilrt-x86_64.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set(_GRPC_DEVICE_NILRT_LEGACY_TOOLCHAIN TRUE)
1010
#----------------------------------------------------------------------
1111
find_program(COMPILER_PATH x86_64-nilrt-linux-gcc)
1212
get_filename_component(toolchain_path ${COMPILER_PATH}/../../../../.. REALPATH DIRECTORY)
13-
set(include_path core2-64-nilrt-linux/usr/include/c++/6.3.0)
13+
set(include_path core2-64-nilrt-linux/usr/include/c++/10.0)
1414

1515
#----------------------------------------------------------------------
1616
# Compilers

src/cluster_copier.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ namespace grpc_labview {
257257
{
258258
if (metadata->isRepeated)
259259
{
260-
auto repeatedString = static_cast<const LVRepeatedMessageValue<std::string>&>(*value);
260+
auto repeatedString = static_cast<const LVRepeatedStringMessageValue&>(*value);
261261
if (repeatedString._value.size() != 0)
262262
{
263263
NumericArrayResize(GetTypeCodeForSize(sizeof(LStrHandle)), 1, start, repeatedString._value.size());
@@ -672,14 +672,14 @@ namespace grpc_labview {
672672
auto arraySize = (array && *array) ? (*array)->cnt : 0;
673673
if (arraySize != 0)
674674
{
675-
auto repeatedStringValue = std::make_shared<LVRepeatedMessageValue<std::string>>(metadata->protobufIndex);
675+
auto repeatedStringValue = std::make_shared<LVRepeatedStringMessageValue>(metadata->protobufIndex);
676676
message._values.emplace(metadata->protobufIndex, repeatedStringValue);
677677
auto lvStr = (*array)->bytes<LStrHandle>();
678678
repeatedStringValue->_value.Reserve(arraySize);
679679
for (int x = 0; x < arraySize; ++x)
680680
{
681681
auto str = GetLVString(*lvStr);
682-
repeatedStringValue->_value.AddAlreadyReserved(std::move(str));
682+
repeatedStringValue->_value.Add(std::move(str));
683683
lvStr += 1;
684684
}
685685
}

src/feature_toggles.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ namespace grpc_labview {
4646
}
4747

4848
configFile.close();
49+
//TODO: remove this post fixing LVMessageEfficient to let enable feature. See issue: #433
50+
if (featureFlags.find("data_EfficientMessageCopy") != featureFlags.end())
51+
featureFlags["data_EfficientMessageCopy"] = false;
4952
}
5053

5154
// Function to check if a feature is enabled

src/feature_toggles.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace grpc_labview {
1111
// Constructor to initialize with default values
1212
FeatureConfig() {
1313
featureFlags["gRPC"] = true; // Enable gRPC by default as an example, this will never be overridden by config file
14-
featureFlags["data_EfficientMessageCopy"] = true;
14+
featureFlags["data_EfficientMessageCopy"] = false;
1515
featureFlags["data_useOccurrence"] = true;
1616
}
1717

src/lv_message.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,16 +354,16 @@ namespace grpc_labview
354354
{
355355
if (fieldInfo.isRepeated)
356356
{
357-
std::shared_ptr<LVRepeatedMessageValue<std::string>> v;
357+
std::shared_ptr<LVRepeatedStringMessageValue> v;
358358
auto it = _values.find(index);
359359
if (it == _values.end())
360360
{
361-
v = std::make_shared<LVRepeatedMessageValue<std::string>>(index);
361+
v = std::make_shared<LVRepeatedStringMessageValue>(index);
362362
_values.emplace(index, v);
363363
}
364364
else
365365
{
366-
v = std::static_pointer_cast<LVRepeatedMessageValue<std::string>>((*it).second);
366+
v = std::static_pointer_cast<LVRepeatedStringMessageValue>((*it).second);
367367
}
368368

369369
auto tagSize = CalculateTagWireSize(tag);

src/lv_message.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ namespace grpc_labview
3333

3434
const char* _InternalParse(const char* ptr, google::protobuf::internal::ParseContext* ctx) override final;
3535
google::protobuf::uint8* _InternalSerialize(google::protobuf::uint8* target, google::protobuf::io::EpsCopyOutputStream* stream) const override final;
36-
void SetCachedSize(int size) const final;
37-
int GetCachedSize(void) const final;
36+
void SetCachedSize(int size) const ;
37+
int GetCachedSize(void) const ;
3838
size_t ByteSizeLong() const final;
3939
virtual void PostInteralParseAction() {};
4040

4141
void MergeFrom(const google::protobuf::Message &from) final;
4242
void MergeFrom(const LVMessage &from);
43-
void CopyFrom(const google::protobuf::Message &from) final;
43+
void CopyFrom(const google::protobuf::Message &from) ;
4444
void CopyFrom(const LVMessage &from);
4545
void CopyOneofIndicesToCluster(int8_t* cluster) const;
4646
void InternalSwap(LVMessage *other);

0 commit comments

Comments
 (0)