CMakeLists.txt 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. cmake_minimum_required (VERSION 3.6)
  2. cmake_policy(SET CMP0077 NEW)
  3. project(CMSISNN)
  4. # Needed to find the config modules
  5. list(APPEND CMAKE_MODULE_PATH ${ROOT}/CMSIS/DSP)
  6. # CMSIS-NN is dependent on features in the CMSIS-DSP
  7. # and must use similar logic for configuring the build
  8. list(APPEND CMAKE_MODULE_PATH ${ROOT}/CMSIS/DSP/Source)
  9. include(configLib)
  10. include(configDsp)
  11. # Select which parts of the CMSIS-DSP must be compiled.
  12. # There are some dependencies between the parts but they are not tracked
  13. # by this cmake. So, enabling some functions may require to enable some
  14. # other ones.
  15. option(CONCATENATION "Concatenation" ON)
  16. option(FULLYCONNECTED "Fully Connected" ON)
  17. option(CONVOLUTION "Convolutions" ON)
  18. option(ACTIVATION "Activations" ON)
  19. option(POOLING "Pooling" ON)
  20. option(SOFTMAX "Softmax" ON)
  21. option(BASICMATHSNN "Basic Maths for NN" ON)
  22. option(RESHAPE "Reshape" ON)
  23. # When OFF it is the default behavior : all tables are included.
  24. option(NNSUPPORT "NN Support" ON)
  25. ###########################
  26. #
  27. # CMSIS NN
  28. #
  29. ###########################
  30. # NN Sources
  31. SET(NN ${ROOT}/CMSIS/NN)
  32. list(APPEND CMAKE_MODULE_PATH ${NN}/Source)
  33. add_library(CMSISNN INTERFACE)
  34. if (BASICMATHSNN)
  35. add_subdirectory(BasicMathFunctions)
  36. target_link_libraries(CMSISNN INTERFACE CMSISNNBasicMaths)
  37. endif()
  38. if (CONCATENATION)
  39. add_subdirectory(ConcatenationFunctions)
  40. target_link_libraries(CMSISNN INTERFACE CMSISNNConcatenation)
  41. endif()
  42. if (FULLYCONNECTED)
  43. add_subdirectory(FullyConnectedFunctions)
  44. target_link_libraries(CMSISNN INTERFACE CMSISNNFullyConnected)
  45. endif()
  46. if (CONVOLUTION)
  47. add_subdirectory(ConvolutionFunctions)
  48. target_link_libraries(CMSISNN INTERFACE CMSISNNConvolutions)
  49. endif()
  50. if (ACTIVATION)
  51. add_subdirectory(ActivationFunctions)
  52. target_link_libraries(CMSISNN INTERFACE CMSISNNActivation)
  53. endif()
  54. if (POOLING)
  55. add_subdirectory(PoolingFunctions)
  56. target_link_libraries(CMSISNN INTERFACE CMSISNNPooling)
  57. endif()
  58. if (SOFTMAX)
  59. add_subdirectory(SoftmaxFunctions)
  60. target_link_libraries(CMSISNN INTERFACE CMSISNNSoftmax)
  61. endif()
  62. if (NNSUPPORT)
  63. add_subdirectory(NNSupportFunctions)
  64. target_link_libraries(CMSISNN INTERFACE CMSISNNSupport)
  65. endif()
  66. if (RESHAPE)
  67. add_subdirectory(ReshapeFunctions)
  68. target_link_libraries(CMSISNN INTERFACE CMSISNNReshape)
  69. endif()
  70. ### Includes
  71. target_include_directories(CMSISNN INTERFACE "${NN}/Include")