2 * Copyright (c) 2015 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
15 #include <vlib/vlib.h>
16 #include <vppinfra/cpu.h>
17 #include <vpp/app/version.h>
19 static char *vpe_version_string =
21 " built by " VPP_BUILD_USER " on " VPP_BUILD_HOST " at " VPP_BUILD_DATE;
23 static char *vpe_compiler =
24 #if defined(__INTEL_COMPILER)
27 "icc " _(__INTEL_COMPILER) " (" __VERSION__ ")";
30 #elif defined(__clang__)
31 "Clang/LLVM " __clang_version__;
32 #elif defined (__GNUC__)
39 show_vpe_version_command_fn (vlib_main_t * vm,
40 unformat_input_t * input,
41 vlib_cli_command_t * cmd)
43 if (unformat (input, "verbose"))
45 #define _(a,b,c) vlib_cli_output (vm, "%-25s " b, a ":", c);
46 _("Version", "%s", "v" VPP_BUILD_VER);
47 _("Compiled by", "%s", VPP_BUILD_USER);
48 _("Compile host", "%s", VPP_BUILD_HOST);
49 _("Compile date", "%s", VPP_BUILD_DATE);
50 _("Compile location", "%s", VPP_BUILD_TOPDIR);
51 _("Compiler", "%s", vpe_compiler);
52 _("Current PID", "%d", getpid ());
56 vlib_cli_output (vm, "%s", vpe_version_string);
61 VLIB_CLI_COMMAND (show_vpe_version_command, static) = {
62 .path = "show version",
63 .short_help = "show version information",
64 .function = show_vpe_version_command_fn,
69 vpe_api_get_build_directory (void)
71 return VPP_BUILD_TOPDIR;
75 vpe_api_get_version (void)
81 vpe_api_get_build_date (void)
83 return VPP_BUILD_DATE;
87 * fd.io coding-style-patch-verification: ON
90 * eval: (c-set-style "gnu")