configDsp.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. function(configDsp project)
  2. if (HOST)
  3. target_compile_definitions(${project} PUBLIC __GNUC_PYTHON__)
  4. endif()
  5. if (LOOPUNROLL)
  6. target_compile_definitions(${project} PRIVATE ARM_MATH_LOOPUNROLL)
  7. endif()
  8. if (ROUNDING)
  9. target_compile_definitions(${project} PRIVATE ARM_MATH_ROUNDING)
  10. endif()
  11. if (MATRIXCHECK)
  12. target_compile_definitions(${project} PRIVATE ARM_MATH_MATRIX_CHECK)
  13. endif()
  14. if (AUTOVECTORIZE)
  15. target_compile_definitions(${project} PRIVATE ARM_MATH_AUTOVECTORIZE)
  16. endif()
  17. if (NEON)
  18. # Used in arm_vec_math.h
  19. target_include_directories(${project} PUBLIC "${DSP}/ComputeLibrary/Include")
  20. target_compile_definitions(${project} PRIVATE ARM_MATH_NEON)
  21. endif()
  22. if (NEONEXPERIMENTAL)
  23. # Used in arm_vec_math.h
  24. target_include_directories(${project} PUBLIC "${DSP}/ComputeLibrary/Include")
  25. target_compile_definitions(${project} PRIVATE ARM_MATH_NEON_EXPERIMENTAL)
  26. endif()
  27. if (MVEFLOAT16)
  28. target_compile_definitions(${project} PRIVATE ARM_MATH_MVE_FLOAT16)
  29. endif()
  30. target_include_directories(${project} PRIVATE "${DSP}/PrivateInclude")
  31. if (MVEI OR MVEF OR HELIUM)
  32. # By default, GCC does not enable implicit conversion between vectors of different numbers or types of elements
  33. # which is required by some code in CMSIS-DSP
  34. if (LAXVECTORCONVERSIONS)
  35. target_compile_options(${project} PRIVATE $<$<STREQUAL:${CMAKE_C_COMPILER_ID},GNU>:-flax-vector-conversions>)
  36. target_compile_options(${project} PRIVATE $<$<STREQUAL:${CMAKE_C_COMPILER_ID},ARMClang>:-flax-vector-conversions=integer>)
  37. else()
  38. target_compile_options(${project} PRIVATE $<$<STREQUAL:${CMAKE_C_COMPILER_ID},GNU>:-fno-lax-vector-conversions>)
  39. target_compile_options(${project} PRIVATE $<$<STREQUAL:${CMAKE_C_COMPILER_ID},ARMClang>:-flax-vector-conversions=none>)
  40. endif()
  41. endif()
  42. if (DISABLEFLOAT16)
  43. target_compile_definitions(${project} PRIVATE DISABLEFLOAT16)
  44. endif()
  45. endfunction()