| 1 |
################################################################################ |
| 2 |
# |
| 3 |
# Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved. |
| 4 |
# |
| 5 |
# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 |
# of this software and associated documentation files (the "Software"), to deal |
| 7 |
# in the Software without restriction, including without limitation the rights |
| 8 |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 |
# copies of the Software, and to permit persons to whom the Software is |
| 10 |
# furnished to do so, subject to the following conditions: |
| 11 |
# |
| 12 |
# The above copyright notice and this permission notice shall be included in |
| 13 |
# all copies or substantial portions of the Software. |
| 14 |
# |
| 15 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 |
# SOFTWARE. |
| 22 |
# |
| 23 |
################################################################################ |
| 24 |
|
| 25 |
# hardcoded tensile version; also in Tensile/__init__.py |
| 26 |
set(TENSILE_VERSION_MAJOR 5) |
| 27 |
set(TENSILE_VERSION_MINOR 0) |
| 28 |
set(TENSILE_VERSION_PATCH 0) |
| 29 |
|
| 30 |
# export version |
| 31 |
set(PACKAGE_VERSION "${TENSILE_VERSION_MAJOR}.${TENSILE_VERSION_MINOR}.${TENSILE_VERSION_PATCH}") |
| 32 |
|
| 33 |
if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) |
| 34 |
set(PACKAGE_VERSION_EXACT TRUE) |
| 35 |
else() |
| 36 |
set(PACKAGE_VERSION_EXACT FALSE) |
| 37 |
endif() |
| 38 |
|
| 39 |
if(PACKAGE_VERSION_EXACT} OR (PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)) |
| 40 |
set(PACKAGE_VERSION_COMPATIBLE TRUE) |
| 41 |
else() |
| 42 |
set(PACKAGE_VERSION_COMPATIBLE FALSE) |
| 43 |
endif() |
| 44 |
|
| 45 |
if(PACKAGE_VERSION_COMPATIBLE) |
| 46 |
set(PACKAGE_VERSION_UNSUTABLE FALSE) |
| 47 |
else() |
| 48 |
set(PACKAGE_VERSION_UNSUTABLE TRUE) |
| 49 |
endif() |
| 50 |
|
| 51 |
if(false) |
| 52 |
# set to compatible, and switch to false below if necessary |
| 53 |
set(PACKAGE_VERSION_EXACT TRUE) |
| 54 |
set(PACKAGE_VERSION_COMPATIBLE TRUE) |
| 55 |
set(PACKAGE_VERSION_UNSUITABLE FALSE) |
| 56 |
|
| 57 |
# if major doesn't match |
| 58 |
if (NOT PACKAGE_FIND_VERSION_MAJOR STREQUAL TENSILE_VERSION_MAJOR) |
| 59 |
|
| 60 |
set(PACKAGE_VERSION_EXACT FALSE) |
| 61 |
set(PACKAGE_VERSION_COMPATIBLE FALSE) |
| 62 |
set(PACKAGE_VERSION_UNSUITABLE TRUE) |
| 63 |
return() |
| 64 |
endif() |
| 65 |
|
| 66 |
# if minor insufficient |
| 67 |
if (PACKAGE_FIND_VERSION_MINOR STRGREATER TENSILE_VERSION_MINOR) |
| 68 |
|
| 69 |
set(PACKAGE_VERSION_EXACT FALSE) |
| 70 |
set(PACKAGE_VERSION_COMPATIBLE FALSE) |
| 71 |
set(PACKAGE_VERSION_UNSUITABLE TRUE) |
| 72 |
return() |
| 73 |
endif() |
| 74 |
|
| 75 |
# if minor==minor but patch insufficient |
| 76 |
if (PACKAGE_FIND_VERSION_MINOR STREQUAL TENSILE_VERSION_MINOR) |
| 77 |
if (PACKAGE_FIND_VERSION_PATCH STRGREATER TENSILE_VERSION_PATCH) |
| 78 |
|
| 79 |
set(PACKAGE_VERSION_EXACT FALSE) |
| 80 |
set(PACKAGE_VERSION_COMPATIBLE FALSE) |
| 81 |
set(PACKAGE_VERSION_UNSUITABLE TRUE) |
| 82 |
return() |
| 83 |
endif() |
| 84 |
endif() |
| 85 |
|
| 86 |
# check exactness |
| 87 |
if (NOT (PACKAGE_FIND_VERSION_MINOR STREQUAL TENSILE_VERSION_MINOR |
| 88 |
AND PACKAGE_FIND_VERSION_MINOR STREQUAL TENSILE_VERSION_MINOR) ) |
| 89 |
|
| 90 |
set(PACKAGE_VERSION_EXACT FALSE) |
| 91 |
endif() |
| 92 |
endif() |