CMakeLists.txt 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #
  2. # Copyright (c) 2019-2021 Arm Limited. All rights reserved.
  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(CMSISNN INTERFACE)
  43. if (BASICMATHSNN)
  44. add_subdirectory(BasicMathFunctions)
  45. target_link_libraries(CMSISNN INTERFACE CMSISNNBasicMaths)
  46. endif()
  47. if (CONCATENATION)
  48. add_subdirectory(ConcatenationFunctions)
  49. target_link_libraries(CMSISNN INTERFACE CMSISNNConcatenation)
  50. endif()
  51. if (FULLYCONNECTED)
  52. add_subdirectory(FullyConnectedFunctions)
  53. target_link_libraries(CMSISNN INTERFACE CMSISNNFullyConnected)
  54. endif()
  55. if (CONVOLUTION)
  56. add_subdirectory(ConvolutionFunctions)
  57. target_link_libraries(CMSISNN INTERFACE CMSISNNConvolutions)
  58. endif()
  59. if (ACTIVATION)
  60. add_subdirectory(ActivationFunctions)
  61. target_link_libraries(CMSISNN INTERFACE CMSISNNActivation)
  62. endif()
  63. if (POOLING)
  64. add_subdirectory(PoolingFunctions)
  65. target_link_libraries(CMSISNN INTERFACE CMSISNNPooling)
  66. endif()
  67. if (SOFTMAX)
  68. add_subdirectory(SoftmaxFunctions)
  69. target_link_libraries(CMSISNN INTERFACE CMSISNNSoftmax)
  70. endif()
  71. if (SVDF)
  72. add_subdirectory(SVDFunctions)
  73. target_link_libraries(CMSISNN INTERFACE CMSISNNSVDF)
  74. endif()
  75. if (RESHAPE)
  76. add_subdirectory(ReshapeFunctions)
  77. target_link_libraries(CMSISNN INTERFACE CMSISNNReshape)
  78. endif()
  79. # Keep NNSUPPORT at the end
  80. if (NNSUPPORT)
  81. add_subdirectory(NNSupportFunctions)
  82. target_link_libraries(CMSISNN INTERFACE CMSISNNSupport)
  83. endif()
  84. ### Includes
  85. target_include_directories(CMSISNN INTERFACE "${NN}/Include")