| 1 | #
|
|---|
| 2 | # Copyright (c) 2019-2021 Arm Limited.
|
|---|
| 3 | #
|
|---|
| 4 | # SPDX-License-Identifier: Apache-2.0
|
|---|
| 5 | #
|
|---|
| 6 | # Licensed under the Apache License, Version 2.0 (the License); you may
|
|---|
| 7 | # not use this file except in compliance with the License.
|
|---|
| 8 | # You may obtain a copy of the License at
|
|---|
| 9 | #
|
|---|
| 10 | # www.apache.org/licenses/LICENSE-2.0
|
|---|
| 11 | #
|
|---|
| 12 | # Unless required by applicable law or agreed to in writing, software
|
|---|
| 13 | # distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
|---|
| 14 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|---|
| 15 | # See the License for the specific language governing permissions and
|
|---|
| 16 | # limitations under the License.
|
|---|
| 17 | #
|
|---|
| 18 |
|
|---|
| 19 | SET(ROOT ${CMSIS_PATH})
|
|---|
| 20 |
|
|---|
| 21 | # Select which parts of the CMSIS-DSP must be compiled.
|
|---|
| 22 | # There are some dependencies between the parts but they are not tracked
|
|---|
| 23 | # by this cmake. So, enabling some functions may require to enable some
|
|---|
| 24 | # other ones.
|
|---|
| 25 | option(CONCATENATION "Concatenation" ON)
|
|---|
| 26 | option(FULLYCONNECTED "Fully Connected" ON)
|
|---|
| 27 | option(CONVOLUTION "Convolutions" ON)
|
|---|
| 28 | option(ACTIVATION "Activations" ON)
|
|---|
| 29 | option(POOLING "Pooling" ON)
|
|---|
| 30 | option(SOFTMAX "Softmax" ON)
|
|---|
| 31 | option(BASICMATHSNN "Basic Maths for NN" ON)
|
|---|
| 32 | option(RESHAPE "Reshape" ON)
|
|---|
| 33 | option(SVDF "SVDF" ON)
|
|---|
| 34 |
|
|---|
| 35 | # When OFF it is the default behavior : all tables are included.
|
|---|
| 36 | option(NNSUPPORT "NN Support" ON)
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | ###########################
|
|---|
| 40 | #
|
|---|
| 41 | # CMSIS NN
|
|---|
| 42 | #
|
|---|
| 43 | ###########################
|
|---|
| 44 |
|
|---|
| 45 | # NN Sources
|
|---|
| 46 | SET(NN ${ROOT}/CMSIS/NN)
|
|---|
| 47 |
|
|---|
| 48 | list(APPEND CMAKE_MODULE_PATH ${NN}/Source)
|
|---|
| 49 |
|
|---|
| 50 | add_library(cmsis-nn STATIC)
|
|---|
| 51 |
|
|---|
| 52 | target_compile_options(cmsis-nn PRIVATE -Ofast)
|
|---|
| 53 |
|
|---|
| 54 | ### Includes
|
|---|
| 55 | target_include_directories(cmsis-nn PUBLIC "${NN}/Include")
|
|---|
| 56 | target_include_directories(cmsis-nn PUBLIC "${ROOT}/CMSIS/Core/Include")
|
|---|
| 57 | target_include_directories(cmsis-nn PUBLIC "${ROOT}/CMSIS/DSP/Include")
|
|---|
| 58 |
|
|---|
| 59 | if (BASICMATHSNN)
|
|---|
| 60 | add_subdirectory(BasicMathFunctions)
|
|---|
| 61 | endif()
|
|---|
| 62 |
|
|---|
| 63 | if (CONCATENATION)
|
|---|
| 64 | add_subdirectory(ConcatenationFunctions)
|
|---|
| 65 | endif()
|
|---|
| 66 |
|
|---|
| 67 | if (FULLYCONNECTED)
|
|---|
| 68 | add_subdirectory(FullyConnectedFunctions)
|
|---|
| 69 | endif()
|
|---|
| 70 |
|
|---|
| 71 | if (CONVOLUTION)
|
|---|
| 72 | add_subdirectory(ConvolutionFunctions)
|
|---|
| 73 | endif()
|
|---|
| 74 |
|
|---|
| 75 | if (ACTIVATION)
|
|---|
| 76 | add_subdirectory(ActivationFunctions)
|
|---|
| 77 | endif()
|
|---|
| 78 |
|
|---|
| 79 | if (POOLING)
|
|---|
| 80 | add_subdirectory(PoolingFunctions)
|
|---|
| 81 | endif()
|
|---|
| 82 |
|
|---|
| 83 | if (SOFTMAX)
|
|---|
| 84 | add_subdirectory(SoftmaxFunctions)
|
|---|
| 85 | endif()
|
|---|
| 86 |
|
|---|
| 87 | if (SVDF)
|
|---|
| 88 | add_subdirectory(SVDFunctions)
|
|---|
| 89 | endif()
|
|---|
| 90 |
|
|---|
| 91 | if (RESHAPE)
|
|---|
| 92 | add_subdirectory(ReshapeFunctions)
|
|---|
| 93 | endif()
|
|---|
| 94 |
|
|---|
| 95 | # Keep NNSUPPORT at the end
|
|---|
| 96 | if (NNSUPPORT)
|
|---|
| 97 | add_subdirectory(NNSupportFunctions)
|
|---|
| 98 | endif()
|
|---|