Switch from extracting version with git to version from ebuild filename. --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,20 +33,17 @@ set(SHARE_INSTALL_PREFIX "share/${ROCM_SMI}" CACHE STRING "Tests and Example install directory") -# provide git to utilities -find_program (GIT NAMES git) - -## Setup the package version based on git tags. -set(PKG_VERSION_GIT_TAG_PREFIX "rsmi_pkg_ver") -get_package_version_number("7.0.0" ${PKG_VERSION_GIT_TAG_PREFIX} GIT) -message("Package version: ${PKG_VERSION_STR}") -set(${ROCM_SMI_LIBS_TARGET}_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}") -set(${ROCM_SMI_LIBS_TARGET}_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}") -set(${ROCM_SMI_LIBS_TARGET}_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}") -set(${ROCM_SMI_LIBS_TARGET}_VERSION_BUILD "0") -set(${ROCM_SMI_LIBS_TARGET}_VERSION_HASH "${PKG_VERSION_HASH}") - -set(${ROCM_SMI_LIBS_TARGET}_VERSION_STRING "${${ROCM_SMI_LIBS_TARGET}_VERSION_MAJOR}.${${ROCM_SMI_LIBS_TARGET}_VERSION_MINOR}.${${ROCM_SMI_LIBS_TARGET}_VERSION_PATCH}+${${ROCM_SMI_LIBS_TARGET}_VERSION_HASH}") +set(VERSION_MAJOR "@VERSION_MAJOR@") +set(VERSION_MINOR "@VERSION_MINOR@") +set(VERSION_PATCH "@VERSION_PATCH@") +set(PKG_VERSION_STR "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") +set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}") +set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}") +set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}") +set(rocm_smi_VERSION_MAJOR "${VERSION_MAJOR}") +set(rocm_smi_VERSION_MINOR "${VERSION_MINOR}") +set(rocm_smi_VERSION_PATCH "${VERSION_PATCH}") # The following default version values should be updated as appropriate for # ABI breaks (update MAJOR and MINOR), and ABI/API additions (update MINOR). --- a/oam/CMakeLists.txt +++ b/oam/CMakeLists.txt @@ -29,17 +29,6 @@ set(OAM_NAME "oam") set(OAM_COMPONENT "lib${OAM_NAME}") set(OAM_TARGET "${OAM_NAME}") -################# Determine the library version ######################### -set(SO_VERSION_GIT_TAG_PREFIX "oam_so_ver") - -# VERSION_* variables should be set by get_version_from_tag -message("Package version: ${PKG_VERSION_STR}") - -# Debian package specific variables -# Set a default value for the package version -get_version_from_tag("1.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT) - -# VERSION_* variables should be set by get_version_from_tag if ( ${ROCM_PATCH_VERSION} ) set ( VERSION_PATCH ${ROCM_PATCH_VERSION}) set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") --- a/python_smi_tools/rsmiBindings.py +++ b/python_smi_tools/rsmiBindings.py @@ -26,17 +26,7 @@ def initRsmiBindings(silent=False): if (rocm_smi_lib_path != None): path_librocm = rocm_smi_lib_path else: - path_librocm = os.path.dirname(os.path.realpath(__file__)) + '/../../lib/librocm_smi64.so.7' - - if not os.path.isfile(path_librocm): - print_silent('Unable to find %s . Trying /opt/rocm*' % path_librocm) - for root, dirs, files in os.walk('/opt', followlinks=True): - if 'librocm_smi64.so.7' in files: - path_librocm = os.path.join(os.path.realpath(root), 'librocm_smi64.so.7') - if os.path.isfile(path_librocm): - print_silent('Using lib from %s' % path_librocm) - else: - print('Unable to find librocm_smi64.so.7') + path_librocm = 'librocm_smi64.so' # ----------> TODO: Support static libs as well as SO try: @@ -44,7 +34,7 @@ def initRsmiBindings(silent=False): return CDLL(path_librocm) except OSError: print('Unable to load the rocm_smi library.\n'\ - 'Set LD_LIBRARY_PATH to the folder containing librocm_smi64.so.7\n'\ + 'Set LD_LIBRARY_PATH to the folder containing librocm_smi64.so\n'\ '{0}Please refer to https://github.com/'\ 'RadeonOpenCompute/rocm_smi_lib for the installation guide.{1}'\ .format('\33[33m', '\033[0m')) --- a/python_smi_tools/rsmiBindings.py.in +++ b/python_smi_tools/rsmiBindings.py.in @@ -26,17 +26,7 @@ def initRsmiBindings(silent=False): if (rocm_smi_lib_path != None): path_librocm = rocm_smi_lib_path else: - path_librocm = os.path.dirname(os.path.realpath(__file__)) + '/../../@CMAKE_INSTALL_LIBDIR@/librocm_smi64.so.@VERSION_MAJOR@' - - if not os.path.isfile(path_librocm): - print_silent('Unable to find %s . Trying /opt/rocm*' % path_librocm) - for root, dirs, files in os.walk('/opt', followlinks=True): - if 'librocm_smi64.so.@VERSION_MAJOR@' in files: - path_librocm = os.path.join(os.path.realpath(root), 'librocm_smi64.so.@VERSION_MAJOR@') - if os.path.isfile(path_librocm): - print_silent('Using lib from %s' % path_librocm) - else: - print('Unable to find librocm_smi64.so.@VERSION_MAJOR@') + path_librocm = 'librocm_smi64.so' # ----------> TODO: Support static libs as well as SO try: @@ -44,7 +34,7 @@ def initRsmiBindings(silent=False): return CDLL(path_librocm) except OSError: print('Unable to load the rocm_smi library.\n'\ - 'Set LD_LIBRARY_PATH to the folder containing librocm_smi64.so.@VERSION_MAJOR@\n'\ + 'Set LD_LIBRARY_PATH to the folder containing librocm_smi64.so\n'\ '{0}Please refer to https://github.com/'\ 'RadeonOpenCompute/rocm_smi_lib for the installation guide.{1}'\ .format('\33[33m', '\033[0m')) --- a/python_smi_tools/rsmiBindingsInit.py.in +++ b/python_smi_tools/rsmiBindingsInit.py.in @@ -26,17 +26,7 @@ def initRsmiBindings(silent=False): if (rocm_smi_lib_path != None): path_librocm = rocm_smi_lib_path else: - path_librocm = os.path.dirname(os.path.realpath(__file__)) + '/../../@CMAKE_INSTALL_LIBDIR@/librocm_smi64.so.@VERSION_MAJOR@' - - if not os.path.isfile(path_librocm): - print_silent('Unable to find %s . Trying /opt/rocm*' % path_librocm) - for root, dirs, files in os.walk('/opt', followlinks=True): - if 'librocm_smi64.so.@VERSION_MAJOR@' in files: - path_librocm = os.path.join(os.path.realpath(root), 'librocm_smi64.so.@VERSION_MAJOR@') - if os.path.isfile(path_librocm): - print_silent('Using lib from %s' % path_librocm) - else: - print('Unable to find librocm_smi64.so.@VERSION_MAJOR@') + path_librocm = 'librocm_smi64.so' # ----------> TODO: Support static libs as well as SO try: @@ -44,7 +34,7 @@ def initRsmiBindings(silent=False): return CDLL(path_librocm) except OSError: print('Unable to load the rocm_smi library.\n'\ - 'Set LD_LIBRARY_PATH to the folder containing librocm_smi64.so.@VERSION_MAJOR@\n'\ + 'Set LD_LIBRARY_PATH to the folder containing librocm_smi64.so\n'\ '{0}Please refer to https://github.com/'\ 'RadeonOpenCompute/rocm_smi_lib for the installation guide.{1}'\ .format('\33[33m', '\033[0m')) --- a/rocm_smi/CMakeLists.txt +++ b/rocm_smi/CMakeLists.txt @@ -31,17 +31,6 @@ set(ROCM_SMI_TARGET "${ROCM_SMI}64") ## Include common cmake modules include(utils) -################# Determine the library version ######################### -set(SO_VERSION_GIT_TAG_PREFIX "rsmi_so_ver") - -# VERSION_* variables should be set by get_version_from_tag -message("Package version: ${PKG_VERSION_STR}") - -# Debian package specific variables -# Set a default value for the package version -get_version_from_tag("1.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT) - -# VERSION_* variables should be set by get_version_from_tag if ( ${ROCM_PATCH_VERSION} ) set ( VERSION_PATCH ${ROCM_PATCH_VERSION}) set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")