Include Accelerate.h

Does anyone know how to get a plugin project to correctly include Accelerate.h? I get the error “Undefined symbols for architecture arm64: “_vDSP_vadd”, referenced from…” when running cmake. I figure I am missing something in my CMakeLists.txt file, but I don’t know what.

I could just avoid this, but I could possibly use a couple different vDSP functions, so there might be a nice efficiency gain…or not.

Thanks,

Sam

target_link_libraries(<plugin-name> "-framework Accelerate")

should do it. (:

Thanks Moss. There is an extra twist here, and it took me a hot minute to figure it out. It seems you have to link the library to all plugins being compiled (even if only one of the plugins is using it), at least if they are in the same file. I got it working like this:

add_library(BufFFT MODULE BufFFT.cpp)
add_library(BufIFFT MODULE BufFFT.cpp)
add_library(BufIFFT2 MODULE BufFFT.cpp)
add_library(BufFFTTrigger MODULE BufFFT.cpp)
add_library(BufFFTTrigger2 MODULE BufFFT.cpp)
add_library(BufFFT_BufCopy MODULE BufFFT.cpp)
add_library(PV_AccumPhase MODULE BufFFT.cpp)

if (APPLE)
	target_link_libraries(BufFFT "-framework Accelerate")
    target_link_libraries(BufIFFT "-framework Accelerate")
    target_link_libraries(BufIFFT2 "-framework Accelerate")
    target_link_libraries(BufFFTTrigger "-framework Accelerate")
    target_link_libraries(BufFFTTrigger2 "-framework Accelerate")
    target_link_libraries(BufFFT_BufCopy "-framework Accelerate")
    target_link_libraries(PV_AccumPhase "-framework Accelerate")
endif()

Maybe I am missing something, but this works.

Miss ya. I hope life is going well for you.

Sam