|
1 | 1 | # ****************************************************************************** |
2 | | -# Copyright 2020-2024 Arm Limited and affiliates. |
| 2 | +# Copyright 2020-2025 Arm Limited and affiliates. |
3 | 3 | # SPDX-License-Identifier: Apache-2.0 |
4 | 4 | # |
5 | 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
@@ -31,31 +31,62 @@ endif() |
31 | 31 |
|
32 | 32 | find_package(ACL REQUIRED) |
33 | 33 |
|
34 | | -set(ACL_MINIMUM_VERSION "24.11.1") |
| 34 | +# Required. The minimum compatible major-version as per Semantic Versioning. |
| 35 | +set(ACL_MIN_MAJOR_VERSION "52") |
| 36 | + |
| 37 | +# Optional. Maximum known compatible version if any. |
| 38 | +# Set to an empty-string if none. |
| 39 | +set(ACL_MAX_MAJOR_VERSION "") |
35 | 40 |
|
36 | 41 | if(ACL_FOUND) |
37 | 42 | file(GLOB_RECURSE ACL_VERSION_FILE ${ACL_INCLUDE_DIR}/*/arm_compute_version.embed) |
38 | 43 | if ("${ACL_VERSION_FILE}" STREQUAL "") |
39 | 44 | message(WARNING |
40 | 45 | "Build may fail. Could not determine ACL version.\n" |
41 | | - "Supported ACL versions:\n" |
42 | | - "- minimum required is ${ACL_MINIMUM_VERSION}\n" |
| 46 | + "File 'arm_compute_version.embed' not found in ${ACL_INCLUDE_DIR}/**\n" |
| 47 | + "Minimum compatible ACL version is ${ACL_MIN_MAJOR_VERSION}\n" |
43 | 48 | ) |
44 | 49 | else() |
45 | 50 | file(READ ${ACL_VERSION_FILE} ACL_VERSION_STRING) |
46 | | - string(REGEX MATCH "v([0-9]+\\.[0-9]+\\.?[0-9]*)" ACL_VERSION "${ACL_VERSION_STRING}") |
47 | | - set(ACL_VERSION "${CMAKE_MATCH_1}") |
48 | | - if ("${ACL_VERSION}" VERSION_EQUAL "0.0") |
49 | | - # Unreleased ACL versions come with version string "v0.0-unreleased", and may not be compatible with oneDNN. |
50 | | - # It is recommended to use the latest release of ACL. |
| 51 | + |
| 52 | + if("${ACL_VERSION_STRING}" MATCHES "arm_compute_version=v([0-9]+)\\.([0-9]+)\\.?([0-9]*)") |
| 53 | + set(ACL_MAJOR_VERSION "${CMAKE_MATCH_1}") |
| 54 | + set(ACL_MINOR_VERSION "${CMAKE_MATCH_2}") |
| 55 | + |
| 56 | + if ("${ACL_MAJOR_VERSION}.${ACL_MINOR_VERSION}" VERSION_EQUAL "0.0") |
| 57 | + # Unreleased ACL versions come with version string "v0.0-unreleased", and may not be compatible with oneDNN. |
| 58 | + # It is recommended to use a supported major-version of ACL. |
| 59 | + message(WARNING |
| 60 | + "Build may fail. Using an unreleased ACL version.\n" |
| 61 | + "Minimum compatible ACL version is ${ACL_MIN_MAJOR_VERSION}\n" |
| 62 | + ) |
| 63 | + elseif("${ACL_MAJOR_VERSION}" LESS "${ACL_MIN_MAJOR_VERSION}") |
| 64 | + message(FATAL_ERROR |
| 65 | + "Detected ACL version ${ACL_MAJOR_VERSION}, but minimum " |
| 66 | + "compatible is ${ACL_MIN_MAJOR_VERSION}\n" |
| 67 | + ) |
| 68 | + elseif("${ACL_MAJOR_VERSION}" GREATER "${ACL_MIN_MAJOR_VERSION}") |
| 69 | + # This is not necessarily an error. Need to check if there is a |
| 70 | + # known incompatible maximum version: |
| 71 | + if("${ACL_MAX_MAJOR_VERSION}" STREQUAL "") |
| 72 | + message(WARNING |
| 73 | + "Build may fail. Using a newer ACL version than officially supported.\n" |
| 74 | + "Detected ACL version ${ACL_MAJOR_VERSION}, but " |
| 75 | + "supported version is ${ACL_MIN_MAJOR_VERSION}\n" |
| 76 | + ) |
| 77 | + else() |
| 78 | + if("${ACL_MAJOR_VERSION}" GREATER "${ACL_MAX_MAJOR_VERSION}") |
| 79 | + message(FATAL_ERROR |
| 80 | + "Detected ACL version ${ACL_MAJOR_VERSION}, but maximum " |
| 81 | + "compatible version is ${ACL_MAX_MAJOR_VERSION}\n" |
| 82 | + ) |
| 83 | + endif() |
| 84 | + endif() |
| 85 | + endif() |
| 86 | + else() |
51 | 87 | message(WARNING |
52 | | - "Build may fail. Using unreleased ACL version.\n" |
53 | | - "Supported ACL versions:\n" |
54 | | - "- minimum required is ${ACL_MINIMUM_VERSION}\n" |
55 | | - ) |
56 | | - elseif("${ACL_VERSION}" VERSION_LESS "${ACL_MINIMUM_VERSION}") |
57 | | - message(FATAL_ERROR |
58 | | - "Detected ACL version ${ACL_VERSION}, but minimum required is ${ACL_MINIMUM_VERSION}\n" |
| 88 | + "Build may fail. Could not determine ACL version.\n" |
| 89 | + "Unexpected version string format in ${ACL_VERSION_FILE}.\n" |
59 | 90 | ) |
60 | 91 | endif() |
61 | 92 | endif() |
|
0 commit comments