CMakeLists.txt 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. SET(ROOT ${CMSIS_PATH})
  19. # Select which parts of the CMSIS-DSP must be compiled.
  20. # There are some dependencies between the parts but they are not tracked
  21. # by this cmake. So, enabling some functions may require to enable some
  22. # other ones.
  23. option(CONCATENATION "Concatenation" ON)
  24. option(FULLYCONNECTED "Fully Connected" ON)
  25. option(CONVOLUTION "Convolutions" ON)
  26. option(ACTIVATION "Activations" ON)
  27. option(POOLING "Pooling" ON)
  28. option(SOFTMAX "Softmax" ON)
  29. option(BASICMATHSNN "Basic Maths for NN" ON)
  30. option(RESHAPE "Reshape" ON)
  31. option(SVDF "SVDF" ON)
  32. # When OFF it is the default behavior : all tables are included.
  33. option(NNSUPPORT "NN Support" ON)
  34. ###########################
  35. #
  36. # CMSIS NN
  37. #
  38. ###########################
  39. # NN Sources
  40. SET(NN ${ROOT}/CMSIS/NN)
  41. list(APPEND CMAKE_MODULE_PATH ${NN}/Source)
  42. add_library(cmsis-nn STATIC)
  43. target_compile_options(cmsis-nn PRIVATE -Ofast)
  44. ### Includes
  45. target_include_directories(cmsis-nn PUBLIC "${NN}/Include")
  46. target_include_directories(cmsis-nn PUBLIC "${ROOT}/CMSIS/Core/Include")
  47. target_include_directories(cmsis-nn PUBLIC "${ROOT}/CMSIS/DSP/Include")
  48. if (BASICMATHSNN)
  49. add_subdirectory(BasicMathFunctions)
  50. endif()
  51. if (CONCATENATION)
  52. add_subdirectory(ConcatenationFunctions)
  53. endif()
  54. if (FULLYCONNECTED)
  55. add_subdirectory(FullyConnectedFunctions)
  56. endif()
  57. if (CONVOLUTION)
  58. add_subdirectory(ConvolutionFunctions)
  59. endif()
  60. if (ACTIVATION)
  61. add_subdirectory(ActivationFunctions)
  62. endif()
  63. if (POOLING)
  64. add_subdirectory(PoolingFunctions)
  65. endif()
  66. if (SOFTMAX)
  67. add_subdirectory(SoftmaxFunctions)
  68. endif()
  69. if (SVDF)
  70. add_subdirectory(SVDFunctions)
  71. endif()
  72. if (RESHAPE)
  73. add_subdirectory(ReshapeFunctions)
  74. endif()
  75. # Keep NNSUPPORT at the end
  76. if (NNSUPPORT)
  77. add_subdirectory(NNSupportFunctions)
  78. endif()