Skip to content

Commit f1180de

Browse files
KyllianAubryGitHub Enterprise
authored andcommitted
SKA-928: add --version option (#7)
1 parent f59937e commit f1180de

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ include(common/cmake/Building.cmake)
1414

1515
include(${CMAKE_CURRENT_LIST_DIR}/cmake/SilKitAdapterVersion.cmake)
1616
configure_silkit_adapter_version(${PROJECT_NAME})
17+
add_definitions(-DSILKIT_ADAPTER_VERSION="${PROJECT_VERSION}")
1718

1819
enable_address_sanitizer(${ENABLE_ASAN})
1920
enable_undefined_sanitizer(${ENABLE_UBSAN})

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ The application takes the following command line arguments (defaults in curly br
8181
|,<label key>=<mandatory label value>
8282
]]
8383
]]
84+
[--version]
85+
[--help]
8486

8587
There needs to be at least one ``--socket-to-byte-stream`` or ``--unix-socket-to-byte-stream`` argument, and each socket needs to be unique.
8688

adapter/SilKitAdapterByteStreamSocket.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ const std::string adapters::bytestreamArg = "--socket-to-byte-stream";
2020
const std::string adapters::unixBytestreamArg = "--unix-socket-to-byte-stream";
2121
const std::string adapters::defaultParticipantName = "SilKitAdapterByteStreamSocket";
2222

23+
void PrintVersion()
24+
{
25+
std::cout << "Vector SIL Kit Adapter Byte Stream Socket - version: " << SILKIT_ADAPTER_VERSION << std::endl;
26+
}
27+
2328
void print_help(bool userRequested = false)
2429
{
2530
std::cout << "Usage (defaults in curly braces if you omit the switch):" << std::endl
@@ -54,6 +59,8 @@ void print_help(bool userRequested = false)
5459
<< participantNameArg << " BytestreamAdapter " << bytestreamArg
5560
<< " localhost:12345,toSocket,fromSocket\n";
5661

62+
std::cout << "\nPass "<< versionArg <<" to get the version of the Adapter.\n";
63+
5764
if (!userRequested)
5865
std::cout << "\n"
5966
"Pass "
@@ -62,6 +69,14 @@ void print_help(bool userRequested = false)
6269

6370
int main(int argc, char** argv)
6471
{
72+
if (findArg(argc, argv, versionArg, argv) != NULL)
73+
{
74+
PrintVersion();
75+
return CodeSuccess;
76+
}
77+
78+
PrintVersion();
79+
6580
if (findArg(argc, argv, helpArg, argv) != NULL)
6681
{
6782
print_help(true);

cmake/SilKitAdapterVersion.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# SPDX-License-Identifier: MIT
33

44
macro(configure_silkit_adapter_version project_name)
5-
set(SILKIT_ADAPTER_VERSION_MAJOR 1)
6-
set(SILKIT_ADAPTER_VERSION_MINOR 0)
5+
set(SILKIT_ADAPTER_VERSION_MAJOR 0)
6+
set(SILKIT_ADAPTER_VERSION_MINOR 9)
77
set(SILKIT_ADAPTER_VERSION_PATCH 0)
88

99
set(VERSION_STRING "${SILKIT_ADAPTER_VERSION_MAJOR}.${SILKIT_ADAPTER_VERSION_MINOR}.${SILKIT_ADAPTER_VERSION_PATCH}")

0 commit comments

Comments
 (0)