|
| 1 | +cmake_minimum_required(VERSION 3.21.0) |
| 2 | + |
| 3 | +project(lib_src LANGUAGES C ASM) |
| 4 | + |
| 5 | +if(PROJECT_IS_TOP_LEVEL) |
| 6 | + include(FetchContent) |
| 7 | + FetchContent_Declare( |
| 8 | + fwk_core |
| 9 | + GIT_REPOSITORY https://github.com/xmos/fwk_core.git |
| 10 | + GIT_TAG v1.0.0 |
| 11 | + ) |
| 12 | + FetchContent_MakeAvailable(fwk_core) |
| 13 | +endif() |
| 14 | + |
| 15 | +add_subdirectory(tests) |
| 16 | + |
| 17 | +# XS3 only libraries that use the Vector Processing Unit |
| 18 | +if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL XCORE_XS3A) |
| 19 | + ## Source files |
| 20 | + file(GLOB_RECURSE LIB_C_SOURCES_XS3 lib_src/src/fixed_factor_vpu_voice/*.c ) |
| 21 | + file(GLOB_RECURSE LIB_XC_SOURCES_XS3 lib_src/src/fixed_factor_vpu_voice/*.xc) |
| 22 | + file(GLOB_RECURSE LIB_ASM_SOURCES_XS3 lib_src/src/fixed_factor_vpu_voice/*.S ) |
| 23 | + |
| 24 | + set(ADDITIONAL_INCLUDE_DIRS_XS3 lib_src/src/fixed_factor_vpu_voice |
| 25 | + ) |
| 26 | +endif() |
| 27 | + |
| 28 | + |
| 29 | +if((${CMAKE_SYSTEM_PROCESSOR} STREQUAL XCORE_XS3A) OR (${CMAKE_SYSTEM_PROCESSOR} STREQUAL XCORE_XS2A)) |
| 30 | + ## Source files |
| 31 | + file(GLOB_RECURSE LIB_C_SOURCES lib_src/src/fixed_factor_of_3/*.c |
| 32 | + lib_src/src/fixed_factor_of_3_voice/*.c |
| 33 | + lib_src/src/multirate_hifi/*.c |
| 34 | + ) |
| 35 | + file(GLOB_RECURSE LIB_XC_SOURCES lib_src/src/fixed_factor_of_3/*.xc |
| 36 | + lib_src/src/fixed_factor_of_3_voice/*.xc |
| 37 | + lib_src/src/multirate_hifi/*.xc |
| 38 | + ) |
| 39 | + file(GLOB_RECURSE LIB_ASM_SOURCES lib_src/src/fixed_factor_of_3/*.S |
| 40 | + lib_src/src/fixed_factor_of_3_voice/*.S |
| 41 | + lib_src/src/multirate_hifi/*.S |
| 42 | + ) |
| 43 | + |
| 44 | + ## Create library target |
| 45 | + add_library(lib_src STATIC EXCLUDE_FROM_ALL ${LIB_C_SOURCES} |
| 46 | + ${LIB_C_SOURCES_XS3} |
| 47 | + ${LIB_ASM_SOURCES} |
| 48 | + ${LIB_XC_SOURCES_XS3} |
| 49 | + ${LIB_XC_SOURCES} |
| 50 | + ${LIB_ASM_SOURCES_XS3} |
| 51 | + ) |
| 52 | + |
| 53 | + target_include_directories(lib_src |
| 54 | + PUBLIC |
| 55 | + lib_src/api |
| 56 | + lib_src/src/fixed_factor_of_3 |
| 57 | + lib_src/src/fixed_factor_of_3/ds3 |
| 58 | + lib_src/src/fixed_factor_of_3/os3 |
| 59 | + lib_src/src/fixed_factor_of_3_voice |
| 60 | + lib_src/src/fixed_factor_of_3_voice/ds3_voice |
| 61 | + lib_src/src/fixed_factor_of_3_voice/us3_voice |
| 62 | + lib_src/src/multirate_hifi |
| 63 | + lib_src/src/multirate_hifi/asrc |
| 64 | + lib_src/src/multirate_hifi/ssrc |
| 65 | + ${ADDITIONAL_INCLUDE_DIRS_XS3} |
| 66 | + ) |
| 67 | + |
| 68 | + target_link_libraries(lib_src |
| 69 | + PUBLIC |
| 70 | + # defined in fwk_core |
| 71 | + framework_core_legacy_compat |
| 72 | + ) |
| 73 | + |
| 74 | + target_compile_options(lib_src |
| 75 | + PRIVATE |
| 76 | + -O3 |
| 77 | + -g |
| 78 | + ) |
| 79 | +endif() |
0 commit comments