1cmake_minimum_required (VERSION 3.14) 2cmake_policy(SET CMP0077 NEW) 3project(CMSISDSP) 4 5# DSP Sources 6SET(DSP ${ROOT}/CMSIS/DSP) 7 8list(APPEND CMAKE_MODULE_PATH ${DSP}/Source) 9list(APPEND CMAKE_MODULE_PATH ${DSP}) 10 11 12include(configLib) 13 14 15option(NEON "Neon acceleration" OFF) 16option(NEONEXPERIMENTAL "Neon experimental acceleration" OFF) 17option(HELIUMEXPERIMENTAL "Helium experimental acceleration" OFF) 18option(LOOPUNROLL "Loop unrolling" ON) 19option(ROUNDING "Rounding" OFF) 20option(MATRIXCHECK "Matrix Checks" OFF) 21option(HELIUM "Helium acceleration (MVEF and MVEI supported)" OFF) 22option(MVEF "MVEF intrinsics supported" OFF) 23option(MVEI "MVEI intrinsics supported" OFF) 24option(MVEFLOAT16 "Float16 MVE intrinsics supported" OFF) 25option(DISABLEFLOAT16 "Disable building float16 kernels" OFF) 26option(HOST "Build for host" OFF) 27 28# Select which parts of the CMSIS-DSP must be compiled. 29# There are some dependencies between the parts but they are not tracked 30# by this cmake. So, enabling some functions may require to enable some 31# other ones. 32option(BASICMATH "Basic Math Functions" ON) 33option(COMPLEXMATH "Complex Math Functions" ON) 34option(CONTROLLER "Controller Functions" ON) 35option(FASTMATH "Fast Math Functions" ON) 36option(FILTERING "Filtering Functions" ON) 37option(MATRIX "Matrix Functions" ON) 38option(STATISTICS "Statistics Functions" ON) 39option(SUPPORT "Support Functions" ON) 40option(TRANSFORM "Transform Functions" ON) 41option(SVM "Support Vector Machine Functions" ON) 42option(BAYES "Bayesian Estimators" ON) 43option(DISTANCE "Distance Functions" ON) 44option(INTERPOLATION "Interpolation Functions" ON) 45option(QUATERNIONMATH "Quaternion Math Functions" ON) 46 47# When OFF it is the default behavior : all tables are included. 48option(CONFIGTABLE "Configuration of table allowed" OFF) 49 50# When CONFIGTABLE is ON, select if all interpolation tables must be included 51option(ALLFAST "All interpolation tables included" OFF) 52# When CONFIGTABLE is ON, select if all FFT tables must be included 53option(ALLFFT "All fft tables included" OFF) 54 55# Features which require inclusion of a data table. 56# Since some tables may be big, the corresponding feature can be 57# disabled. 58# Those options are taken into account only when CONFIGTABLE is ON 59option(ARM_COS_F32 "cos f32" OFF) 60option(ARM_COS_Q31 "cos q31" OFF) 61option(ARM_COS_Q15 "cos q15" OFF) 62option(ARM_SIN_F32 "sin f32" OFF) 63option(ARM_SIN_Q31 "sin q31" OFF) 64option(ARM_SIN_Q15 "sin q15" OFF) 65option(ARM_SIN_COS_F32 "sin cos f32" OFF) 66option(ARM_SIN_COS_Q31 "sin cos q31" OFF) 67 68option(ARM_LMS_NORM_Q31 "lms norm q31" OFF) 69option(ARM_LMS_NORM_Q15 "lms norm q15" OFF) 70 71option(CFFT_F64_16 "cfft f64 16" OFF) 72option(CFFT_F64_32 "cfft f64 32" OFF) 73option(CFFT_F64_64 "cfft f64 64" OFF) 74option(CFFT_F64_128 "cfft f64 128" OFF) 75option(CFFT_F64_256 "cfft f64 256" OFF) 76option(CFFT_F64_512 "cfft f64 512" OFF) 77option(CFFT_F64_1024 "cfft f64 1024" OFF) 78option(CFFT_F64_2048 "cfft f64 2048" OFF) 79option(CFFT_F64_4096 "cfft f64 4096" OFF) 80 81option(CFFT_F32_16 "cfft f32 16" OFF) 82option(CFFT_F32_32 "cfft f32 32" OFF) 83option(CFFT_F32_64 "cfft f32 64" OFF) 84option(CFFT_F32_128 "cfft f32 128" OFF) 85option(CFFT_F32_256 "cfft f32 256" OFF) 86option(CFFT_F32_512 "cfft f32 512" OFF) 87option(CFFT_F32_1024 "cfft f32 1024" OFF) 88option(CFFT_F32_2048 "cfft f32 2048" OFF) 89option(CFFT_F32_4096 "cfft f32 4096" OFF) 90 91option(CFFT_Q31_16 "cfft q31 16" OFF) 92option(CFFT_Q31_32 "cfft q31 32" OFF) 93option(CFFT_Q31_64 "cfft q31 64" OFF) 94option(CFFT_Q31_128 "cfft q31 128" OFF) 95option(CFFT_Q31_256 "cfft q31 256" OFF) 96option(CFFT_Q31_512 "cfft q31 512" OFF) 97option(CFFT_Q31_1024 "cfft q31 1024" OFF) 98option(CFFT_Q31_2048 "cfft q31 2048" OFF) 99option(CFFT_Q31_4096 "cfft q31 4096" OFF) 100 101option(CFFT_Q15_16 "cfft q15 16" OFF) 102option(CFFT_Q15_32 "cfft q15 32" OFF) 103option(CFFT_Q15_64 "cfft q15 64" OFF) 104option(CFFT_Q15_128 "cfft q15 128" OFF) 105option(CFFT_Q15_256 "cfft q15 256" OFF) 106option(CFFT_Q15_512 "cfft q15 512" OFF) 107option(CFFT_Q15_1024 "cfft q15 1024" OFF) 108option(CFFT_Q15_2048 "cfft q15 2048" OFF) 109option(CFFT_Q15_4096 "cfft q15 4096" OFF) 110 111option(RFFT_FAST_F32_32 "rfft fast f32 32" OFF) 112option(RFFT_FAST_F32_64 "rfft fast f32 64" OFF) 113option(RFFT_FAST_F32_128 "rfft fast f32 128" OFF) 114option(RFFT_FAST_F32_256 "rfft fast f32 256" OFF) 115option(RFFT_FAST_F32_512 "rfft fast f32 512" OFF) 116option(RFFT_FAST_F32_1024 "rfft fast f32 1024" OFF) 117option(RFFT_FAST_F32_2048 "rfft fast f32 2048" OFF) 118option(RFFT_FAST_F32_4096 "rfft fast f32 4096" OFF) 119 120 121option(RFFT_F32_128 "rfft f32 128" OFF) 122option(RFFT_F32_512 "rfft f32 512" OFF) 123option(RFFT_F32_2048 "rfft f32 2048" OFF) 124option(RFFT_F32_8192 "rfft f32 8192" OFF) 125 126option(RFFT_FAST_F64_32 "rfft fast f64 32" OFF) 127option(RFFT_FAST_F64_64 "rfft fast f64 64" OFF) 128option(RFFT_FAST_F64_128 "rfft fast f64 128" OFF) 129option(RFFT_FAST_F64_256 "rfft fast f64 256" OFF) 130option(RFFT_FAST_F64_512 "rfft fast f64 512" OFF) 131option(RFFT_FAST_F64_1024 "rfft fast f64 1024" OFF) 132option(RFFT_FAST_F64_2048 "rfft fast f64 2048" OFF) 133option(RFFT_FAST_F64_4096 "rfft fast f64 4096" OFF) 134 135 136option(RFFT_F64_128 "rfft f64 128" OFF) 137option(RFFT_F64_512 "rfft f64 512" OFF) 138option(RFFT_F64_2048 "rfft f64 2048" OFF) 139option(RFFT_F64_8192 "rfft f64 8192" OFF) 140 141option(RFFT_FAST_F16_32 "rfft fast f16 32" OFF) 142option(RFFT_FAST_F16_64 "rfft fast f16 64" OFF) 143option(RFFT_FAST_F16_128 "rfft fast f16 128" OFF) 144option(RFFT_FAST_F16_256 "rfft fast f16 256" OFF) 145option(RFFT_FAST_F16_512 "rfft fast f16 512" OFF) 146option(RFFT_FAST_F16_1024 "rfft fast f16 1024" OFF) 147option(RFFT_FAST_F16_2048 "rfft fast f16 2048" OFF) 148option(RFFT_FAST_F16_4096 "rfft fast f16 4096" OFF) 149 150option(RFFT_Q31_32 "rfft q31 32" OFF) 151option(RFFT_Q31_64 "rfft q31 64" OFF) 152option(RFFT_Q31_128 "rfft q31 128" OFF) 153option(RFFT_Q31_256 "rfft q31 256" OFF) 154option(RFFT_Q31_512 "rfft q31 512" OFF) 155option(RFFT_Q31_1024 "rfft q31 1024" OFF) 156option(RFFT_Q31_2048 "rfft q31 2048" OFF) 157option(RFFT_Q31_4096 "rfft q31 4096" OFF) 158option(RFFT_Q31_8192 "rfft q31 8192" OFF) 159 160option(RFFT_Q15_32 "rfft q15 32" OFF) 161option(RFFT_Q15_64 "rfft q15 64" OFF) 162option(RFFT_Q15_128 "rfft q15 128" OFF) 163option(RFFT_Q15_256 "rfft q15 256" OFF) 164option(RFFT_Q15_512 "rfft q15 512" OFF) 165option(RFFT_Q15_1024 "rfft q15 1024" OFF) 166option(RFFT_Q15_2048 "rfft q15 2048" OFF) 167option(RFFT_Q15_4096 "rfft q15 4096" OFF) 168option(RFFT_Q15_8192 "rfft q15 8192" OFF) 169 170option(DCT4_F32_128 "dct4 f32 128" OFF) 171option(DCT4_F32_512 "dct4 f32 512" OFF) 172option(DCT4_F32_2048 "dct4 f32 2048" OFF) 173option(DCT4_F32_8192 "dct4 f32 8192" OFF) 174 175option(DCT4_Q31_128 "dct4 q31 128" OFF) 176option(DCT4_Q31_512 "dct4 q31 512" OFF) 177option(DCT4_Q31_2048 "dct4 q31 2048" OFF) 178option(DCT4_Q31_8192 "dct4 q31 8192" OFF) 179 180option(DCT4_Q15_128 "dct4 q15 128" OFF) 181option(DCT4_Q15_512 "dct4 q15 512" OFF) 182option(DCT4_Q15_2048 "dct4 q15 2048" OFF) 183option(DCT4_Q15_8192 "dct4 q15 8192" OFF) 184 185option(ARM_CFFT_RADIX2_Q15 "deprecated q15 radix2 cfft" OFF) 186option(ARM_CFFT_RADIX4_Q15 "deprecated q15 radix4 cfft" OFF) 187 188option(ARM_CFFT_RADIX2_Q31 "deprecated q31 radix2 cfft" OFF) 189option(ARM_CFFT_RADIX4_Q31 "deprecated q31 radix4 cfft" OFF) 190 191########################### 192# 193# CMSIS DSP 194# 195########################### 196 197 198 199add_library(CMSISDSP INTERFACE) 200 201if (BASICMATH) 202 add_subdirectory(BasicMathFunctions) 203 target_link_libraries(CMSISDSP INTERFACE CMSISDSPBasicMath) 204endif() 205 206if (COMPLEXMATH) 207 add_subdirectory(ComplexMathFunctions) 208 target_link_libraries(CMSISDSP INTERFACE CMSISDSPComplexMath) 209endif() 210 211if (QUATERNIONMATH) 212 add_subdirectory(QuaternionMathFunctions) 213 target_link_libraries(CMSISDSP INTERFACE CMSISDSPQuaternionMath) 214endif() 215 216if (CONTROLLER) 217 add_subdirectory(ControllerFunctions) 218 # Fast tables inclusion is allowed 219 if (CONFIGTABLE) 220 target_compile_definitions(CMSISDSPController PUBLIC ARM_FAST_ALLOW_TABLES) 221 endif() 222 target_link_libraries(CMSISDSP INTERFACE CMSISDSPController) 223endif() 224 225if (FASTMATH) 226 add_subdirectory(FastMathFunctions) 227 # Fast tables inclusion is allowed 228 if (CONFIGTABLE) 229 target_compile_definitions(CMSISDSPFastMath PUBLIC ARM_FAST_ALLOW_TABLES) 230 endif() 231 target_link_libraries(CMSISDSP INTERFACE CMSISDSPFastMath) 232endif() 233 234if (FILTERING) 235 add_subdirectory(FilteringFunctions) 236 # Fast tables inclusion is allowed 237 if (CONFIGTABLE) 238 target_compile_definitions(CMSISDSPFiltering PUBLIC ARM_FAST_ALLOW_TABLES) 239 endif() 240 target_link_libraries(CMSISDSP INTERFACE CMSISDSPFiltering) 241endif() 242 243if (MATRIX) 244 add_subdirectory(MatrixFunctions) 245 target_link_libraries(CMSISDSP INTERFACE CMSISDSPMatrix) 246endif() 247 248if (STATISTICS) 249 add_subdirectory(StatisticsFunctions) 250 target_link_libraries(CMSISDSP INTERFACE CMSISDSPStatistics) 251endif() 252 253if (SUPPORT) 254 add_subdirectory(SupportFunctions) 255 target_link_libraries(CMSISDSP INTERFACE CMSISDSPSupport) 256endif() 257 258if (TRANSFORM) 259 add_subdirectory(TransformFunctions) 260 # FFT tables inclusion is allowed 261 if (CONFIGTABLE) 262 target_compile_definitions(CMSISDSPTransform PUBLIC ARM_FFT_ALLOW_TABLES) 263 endif() 264 target_link_libraries(CMSISDSP INTERFACE CMSISDSPTransform) 265endif() 266 267if (FILTERING OR CONTROLLER OR FASTMATH OR TRANSFORM OR SVM OR DISTANCE) 268 add_subdirectory(CommonTables) 269 if (TRANSFORM) 270 # FFT tables inclusion is allowed 271 if (CONFIGTABLE) 272 target_compile_definitions(CMSISDSPCommon PUBLIC ARM_FFT_ALLOW_TABLES) 273 endif() 274 endif() 275 if (FILTERING OR CONTROLLER OR FASTMATH) 276 # Select which tables to include 277 if (CONFIGTABLE) 278 target_compile_definitions(CMSISDSPCommon PUBLIC ARM_FAST_ALLOW_TABLES) 279 endif() 280 endif() 281 target_link_libraries(CMSISDSP INTERFACE CMSISDSPCommon) 282 # Common project is adding ComputeLibrary tables used by SVM and Distance 283 # when NEon is ON. 284endif() 285 286if (SVM) 287 add_subdirectory(SVMFunctions) 288 target_link_libraries(CMSISDSP INTERFACE CMSISDSPSVM) 289endif() 290 291if (BAYES) 292 add_subdirectory(BayesFunctions) 293 target_link_libraries(CMSISDSP INTERFACE CMSISDSPBayes) 294endif() 295 296if (DISTANCE) 297 add_subdirectory(DistanceFunctions) 298 target_link_libraries(CMSISDSP INTERFACE CMSISDSPDistance) 299endif() 300 301if (INTERPOLATION) 302 add_subdirectory(InterpolationFunctions) 303 target_link_libraries(CMSISDSP INTERFACE CMSISDSPInterpolation) 304endif() 305 306### Includes 307target_include_directories(CMSISDSP INTERFACE "${DSP}/Include") 308 309 310 311