// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2019-2021 Xilinx, Inc. All rights reserved.
// Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
#ifndef XRT_VERSION_H_
#define XRT_VERSION_H_

static const char xrt_build_version[] = "2.20.0";

static const char xrt_build_version_branch[] = "2025.2";

static const char xrt_build_version_hash[] = "74dec3c9c4f6dd9bfb62ae11e71ec96bcc4859eb";

static const char xrt_build_version_hash_date[] = "Tue, 11 Nov 2025 14:38:22 -0800";

static const char xrt_build_version_date_rfc[] = "Sat, 15 Nov 2025 23:31:28 +0000";

static const char xrt_build_version_date[] = "2025-11-11 22:38:22";

static const char xrt_modified_files[] = "";

#define XRT_DRIVER_VERSION "2.20.0,74dec3c9c4f6dd9bfb62ae11e71ec96bcc4859eb"
#define XRT_PATCH 0
#define XRT_HEAD_COMMITS 8546
#define XRT_BRANCH_COMMITS 24

#include "xrt/detail/version-slim.h"

#ifdef __cplusplus
#include <iostream>
#include <string>

namespace xrt::version {

inline void
print(std::ostream & output)
{
  output << "       XRT Build Version: " << xrt_build_version << std::endl;
  output << "    Build Version Branch: " << xrt_build_version_branch << std::endl;
  output << "      Build Version Hash: " << xrt_build_version_hash << std::endl;
  output << " Build Version Hash Date: " << xrt_build_version_hash_date << std::endl;
  output << "      Build Version Date: " << xrt_build_version_date_rfc << std::endl;

  std::string modified_files(xrt_modified_files);
  if (modified_files.empty())
    return;

  const std::string& delimiters = ",";      // Our delimiter
  std::string::size_type last_pos = 0;
  int running_index = 1;
  while (last_pos < modified_files.length() + 1) {
    if (running_index == 1)
      output << "  Current Modified Files: ";
    else 
      output << "                          ";

    output << running_index++ << ") ";

    auto pos = modified_files.find_first_of(delimiters, last_pos);

    if (pos == std::string::npos)
      pos = modified_files.length();

    output << modified_files.substr(last_pos, pos - last_pos) << std::endl;
    
    last_pos = pos + 1;
  }
}

} // namespace xrt::version 
#endif // __cplusplus

#endif

