1# CMake fragment for MicroPython extmod component 2 3set(MICROPY_EXTMOD_DIR "${MICROPY_DIR}/extmod") 4set(MICROPY_OOFATFS_DIR "${MICROPY_DIR}/lib/oofatfs") 5 6set(MICROPY_SOURCE_EXTMOD 7 ${MICROPY_DIR}/shared/libc/abort_.c 8 ${MICROPY_DIR}/shared/libc/printf.c 9 ${MICROPY_EXTMOD_DIR}/machine_bitstream.c 10 ${MICROPY_EXTMOD_DIR}/machine_i2c.c 11 ${MICROPY_EXTMOD_DIR}/machine_mem.c 12 ${MICROPY_EXTMOD_DIR}/machine_pulse.c 13 ${MICROPY_EXTMOD_DIR}/machine_signal.c 14 ${MICROPY_EXTMOD_DIR}/machine_spi.c 15 ${MICROPY_EXTMOD_DIR}/modbluetooth.c 16 ${MICROPY_EXTMOD_DIR}/modbtree.c 17 ${MICROPY_EXTMOD_DIR}/modframebuf.c 18 ${MICROPY_EXTMOD_DIR}/modonewire.c 19 ${MICROPY_EXTMOD_DIR}/moduasyncio.c 20 ${MICROPY_EXTMOD_DIR}/modubinascii.c 21 ${MICROPY_EXTMOD_DIR}/moducryptolib.c 22 ${MICROPY_EXTMOD_DIR}/moductypes.c 23 ${MICROPY_EXTMOD_DIR}/moduhashlib.c 24 ${MICROPY_EXTMOD_DIR}/moduheapq.c 25 ${MICROPY_EXTMOD_DIR}/modujson.c 26 ${MICROPY_EXTMOD_DIR}/modurandom.c 27 ${MICROPY_EXTMOD_DIR}/modure.c 28 ${MICROPY_EXTMOD_DIR}/moduselect.c 29 ${MICROPY_EXTMOD_DIR}/modussl_axtls.c 30 ${MICROPY_EXTMOD_DIR}/modussl_mbedtls.c 31 ${MICROPY_EXTMOD_DIR}/modutimeq.c 32 ${MICROPY_EXTMOD_DIR}/moduwebsocket.c 33 ${MICROPY_EXTMOD_DIR}/moduzlib.c 34 ${MICROPY_EXTMOD_DIR}/modwebrepl.c 35 ${MICROPY_EXTMOD_DIR}/uos_dupterm.c 36 ${MICROPY_EXTMOD_DIR}/utime_mphal.c 37 ${MICROPY_EXTMOD_DIR}/vfs.c 38 ${MICROPY_EXTMOD_DIR}/vfs_blockdev.c 39 ${MICROPY_EXTMOD_DIR}/vfs_fat.c 40 ${MICROPY_EXTMOD_DIR}/vfs_fat_diskio.c 41 ${MICROPY_EXTMOD_DIR}/vfs_fat_file.c 42 ${MICROPY_EXTMOD_DIR}/vfs_lfs.c 43 ${MICROPY_EXTMOD_DIR}/vfs_posix.c 44 ${MICROPY_EXTMOD_DIR}/vfs_posix_file.c 45 ${MICROPY_EXTMOD_DIR}/vfs_reader.c 46 ${MICROPY_EXTMOD_DIR}/virtpin.c 47 ${MICROPY_EXTMOD_DIR}/nimble/modbluetooth_nimble.c 48) 49 50# Library for btree module and associated code 51 52set(MICROPY_LIB_BERKELEY_DIR "${MICROPY_DIR}/lib/berkeley-db-1.xx") 53 54if(EXISTS "${MICROPY_LIB_BERKELEY_DIR}/btree/bt_close.c") 55 add_library(micropy_extmod_btree OBJECT 56 ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_close.c 57 ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_conv.c 58 ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_debug.c 59 ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_delete.c 60 ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_get.c 61 ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_open.c 62 ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_overflow.c 63 ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_page.c 64 ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_put.c 65 ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_search.c 66 ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_seq.c 67 ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_split.c 68 ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_utils.c 69 ${MICROPY_LIB_BERKELEY_DIR}/mpool/mpool.c 70 ) 71 72 target_include_directories(micropy_extmod_btree PRIVATE 73 ${MICROPY_LIB_BERKELEY_DIR}/PORT/include 74 ) 75 76 target_compile_definitions(micropy_extmod_btree PRIVATE 77 __DBINTERFACE_PRIVATE=1 78 mpool_error=printf 79 abort=abort_ 80 "virt_fd_t=void*" 81 ) 82 83 # The include directories and compile definitions below are needed to build 84 # modbtree.c and should be added to the main MicroPython target. 85 86 list(APPEND MICROPY_INC_CORE 87 "${MICROPY_LIB_BERKELEY_DIR}/PORT/include" 88 ) 89 90 list(APPEND MICROPY_DEF_CORE 91 __DBINTERFACE_PRIVATE=1 92 "virt_fd_t=void*" 93 ) 94endif() 95