Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
rocm_bandwidth_test
Commits
945a8bef
Unverified
Commit
945a8bef
authored
Aug 13, 2019
by
Ramesh Errabolu
Committed by
GitHub
Aug 13, 2019
Browse files
Merge pull request #47 from RadeonOpenCompute/versionNaming
Update to support uniform naming of ROCm packages
parents
1e8b1b35
3d1c9a29
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
58 deletions
+83
-58
CMakeLists.txt
CMakeLists.txt
+5
-1
cmake_modules/utils.cmake
cmake_modules/utils.cmake
+78
-57
No files found.
CMakeLists.txt
View file @
945a8bef
...
...
@@ -170,7 +170,7 @@ include(utils)
# value track what is used in the test source. The code from utils
# module will parse the string into major, minor and patch sub-fields
#
get_version
(
"1.0.0"
)
get_version
()
# Bind the Major, Minor and Patch values
set
(
BUILD_VERSION_MAJOR
${
VERSION_MAJOR
}
)
...
...
@@ -209,8 +209,12 @@ set(CPACK_PACKAGE_CONTACT "Advanced Micro Devices Inc.")
set
(
CPACK_PACKAGE_DESCRIPTION_SUMMARY
"Test to measure PciE bandwidth on ROCm platforms"
)
# Debian package specific variables
set
(
CPACK_DEBIAN_PACKAGE_DEPENDS
"libstdc++6, hsa-rocr-dev"
)
set
(
CPACK_DEBIAN_PACKAGE_HOMEPAGE
"https://github.com/RadeonOpenCompute/rocm_bandwidth_test"
)
# RPM package specific variables
set
(
CPACK_RPM_PACKAGE_DEPENDS
"libstdc++6, hsa-rocr-dev"
)
# RPM package specific variables
if
(
DEFINED CPACK_PACKAGING_INSTALL_PREFIX
)
set
(
CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
"
${
CPACK_PACKAGING_INSTALL_PREFIX
}
${
CPACK_PACKAGING_INSTALL_PREFIX
}
/bin"
)
...
...
cmake_modules/utils.cmake
View file @
945a8bef
...
...
@@ -45,39 +45,64 @@
## the major, minor and patch variables.
function
(
parse_version VERSION_STRING
)
string
(
FIND
${
VERSION_STRING
}
"-"
STRING_INDEX
)
if
(
${
STRING_INDEX
}
GREATER -1
)
math
(
EXPR STRING_INDEX
"
${
STRING_INDEX
}
+ 1"
)
string
(
SUBSTRING
${
VERSION_STRING
}
${
STRING_INDEX
}
-1 VERSION_BUILD
)
endif
()
string
(
REGEX MATCHALL
"[0123456789]+"
VERSIONS
${
VERSION_STRING
}
)
list
(
LENGTH VERSIONS VERSION_COUNT
)
if
(
${
VERSION_COUNT
}
GREATER 0
)
list
(
GET VERSIONS 0 MAJOR
)
set
(
VERSION_MAJOR
${
MAJOR
}
PARENT_SCOPE
)
set
(
TEMP_VERSION_STRING
"
${
MAJOR
}
"
)
endif
()
if
(
${
VERSION_COUNT
}
GREATER 1
)
list
(
GET VERSIONS 1 MINOR
)
set
(
VERSION_MINOR
${
MINOR
}
PARENT_SCOPE
)
set
(
TEMP_VERSION_STRING
"
${
TEMP_VERSION_STRING
}
.
${
MINOR
}
"
)
endif
()
if
(
${
VERSION_COUNT
}
GREATER 2
)
list
(
GET VERSIONS 2 PATCH
)
set
(
VERSION_PATCH
${
PATCH
}
PARENT_SCOPE
)
set
(
TEMP_VERSION_STRING
"
${
TEMP_VERSION_STRING
}
.
${
PATCH
}
"
)
endif
()
if
(
DEFINED VERSION_BUILD
)
set
(
VERSION_BUILD
"
${
VERSION_BUILD
}
"
PARENT_SCOPE
)
endif
()
set
(
VERSION_STRING
"
${
TEMP_VERSION_STRING
}
"
PARENT_SCOPE
)
# Get index of '-' character in input string
string
(
FIND
${
VERSION_STRING
}
"-"
STRING_INDEX
)
# If there is string after '-' character, capture
# it in COMMIT_INFO string
if
(
${
STRING_INDEX
}
GREATER -1
)
math
(
EXPR STRING_INDEX
"
${
STRING_INDEX
}
+ 1"
)
string
(
SUBSTRING
${
VERSION_STRING
}
${
STRING_INDEX
}
-1 COMMIT_INFO
)
endif
()
# Parse string into tokens that consist of only numerical
# substrings and obtain it as a list
string
(
REGEX MATCHALL
"[0123456789]+"
TOKENS
${
VERSION_STRING
}
)
list
(
LENGTH TOKENS TOKEN_COUNT
)
# Get Major Id of the version
if
(
${
TOKEN_COUNT
}
GREATER 0
)
list
(
GET TOKENS 0 MAJOR
)
set
(
VERSION_MAJOR
${
MAJOR
}
PARENT_SCOPE
)
endif
()
# Get Minor Id of the version
if
(
${
TOKEN_COUNT
}
GREATER 1
)
list
(
GET TOKENS 1 MINOR
)
set
(
VERSION_MINOR
${
MINOR
}
PARENT_SCOPE
)
endif
()
# Get Patch Id of the version
if
(
${
TOKEN_COUNT
}
GREATER 2
)
list
(
GET TOKENS 2 PATCH
)
set
(
VERSION_PATCH
${
PATCH
}
PARENT_SCOPE
)
endif
()
# Return if commit info is not present
if
(
NOT DEFINED COMMIT_INFO
)
return
()
endif
()
# Parse Commit string if present into number of
# commits and hash of last commit
string
(
FIND
${
COMMIT_INFO
}
"-"
STRING_INDEX
)
if
(
${
STRING_INDEX
}
GREATER -1
)
math
(
EXPR STRING_INDEX
"
${
STRING_INDEX
}
+ 1"
)
string
(
SUBSTRING
${
COMMIT_INFO
}
${
STRING_INDEX
}
-1 COMMIT_HASH
)
endif
()
string
(
REGEX MATCHALL
"[0123456789]+"
TOKENS
${
COMMIT_INFO
}
)
list
(
LENGTH TOKENS TOKEN_COUNT
)
if
(
${
TOKEN_COUNT
}
GREATER 0
)
list
(
GET TOKENS 0 COMMIT_CNT
)
endif
()
# Add Build Info from Jenkins
set
(
ROCM_BUILD_ID
"DevBld"
CACHE STRING
"Jenkins Build Id"
)
# Update Version Patch to include Number of Commits and hash of HEAD
set
(
VERSION_PATCH
"
${
PATCH
}
.
${
COMMIT_CNT
}
-
${
ROCM_BUILD_ID
}
-
${
COMMIT_HASH
}
"
PARENT_SCOPE
)
endfunction
()
...
...
@@ -85,31 +110,27 @@ endfunction ()
## using versioning tags and git describe.
## Passes back a packaging version string
## and a library version string.
function
(
get_version DEFAULT_VERSION_STRING
)
parse_version
(
${
DEFAULT_VERSION_STRING
}
)
find_program
(
GIT NAMES git
)
if
(
GIT
)
execute_process
(
COMMAND
"git describe --dirty --long --match [0-9]* 2> /dev/null"
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
OUTPUT_VARIABLE GIT_TAG_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE RESULT
)
if
(
${
RESULT
}
EQUAL 0
)
parse_version
(
${
GIT_TAG_STRING
}
)
endif
()
function
(
get_version
)
# Bind the program git that will be
# used to query its tag that describes
find_program
(
GIT NAMES git
)
if
(
GIT
)
execute_process
(
COMMAND git describe --long --match [0-9]*
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
OUTPUT_VARIABLE GIT_TAG_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE RESULT
)
if
(
${
RESULT
}
EQUAL 0
)
parse_version
(
${
GIT_TAG_STRING
}
)
endif
()
endif
()
set
(
VERSION_STRING
"
${
VERSION_STRING
}
"
PARENT_SCOPE
)
set
(
VERSION_MAJOR
"
${
VERSION_MAJOR
}
"
PARENT_SCOPE
)
set
(
VERSION_MINOR
"
${
VERSION_MINOR
}
"
PARENT_SCOPE
)
set
(
VERSION_PATCH
"
${
VERSION_PATCH
}
"
PARENT_SCOPE
)
set
(
VERSION_BUILD
"
${
VERSION_BUILD
}
"
PARENT_SCOPE
)
# Propagate values bound to parent scope
set
(
VERSION_MAJOR
"
${
VERSION_MAJOR
}
"
PARENT_SCOPE
)
set
(
VERSION_MINOR
"
${
VERSION_MINOR
}
"
PARENT_SCOPE
)
set
(
VERSION_PATCH
"
${
VERSION_PATCH
}
"
PARENT_SCOPE
)
endfunction
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment