summaryrefslogtreecommitdiff
path: root/extmod/extmod.cmake
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2021-04-08 23:45:28 +1000
committerDamien George <damien@micropython.org>2021-04-09 13:33:26 +1000
commit212fe7f33e7427899ee245cda5ab1776b38a79e2 (patch)
tree7f2ceb3285bb5440a9be47e6e95c57d704de6251 /extmod/extmod.cmake
parent5dcc9b3b16cf6a27acf01bdf8a7d23ae2aff56e3 (diff)
extmod/extmod.cmake: Add support to build btree module with CMake.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/extmod.cmake')
-rw-r--r--extmod/extmod.cmake48
1 files changed, 48 insertions, 0 deletions
diff --git a/extmod/extmod.cmake b/extmod/extmod.cmake
index 691c3ce9b..a54047519 100644
--- a/extmod/extmod.cmake
+++ b/extmod/extmod.cmake
@@ -4,6 +4,8 @@ set(MICROPY_EXTMOD_DIR "${MICROPY_DIR}/extmod")
set(MICROPY_OOFATFS_DIR "${MICROPY_DIR}/lib/oofatfs")
set(MICROPY_SOURCE_EXTMOD
+ ${MICROPY_DIR}/lib/embed/abort_.c
+ ${MICROPY_DIR}/lib/utils/printf.c
${MICROPY_EXTMOD_DIR}/machine_i2c.c
${MICROPY_EXTMOD_DIR}/machine_mem.c
${MICROPY_EXTMOD_DIR}/machine_pulse.c
@@ -43,3 +45,49 @@ set(MICROPY_SOURCE_EXTMOD
${MICROPY_EXTMOD_DIR}/virtpin.c
${MICROPY_EXTMOD_DIR}/nimble/modbluetooth_nimble.c
)
+
+# Library for btree module and associated code
+
+set(MICROPY_LIB_BERKELEY_DIR "${MICROPY_DIR}/lib/berkeley-db-1.xx")
+
+if(EXISTS "${MICROPY_LIB_BERKELEY_DIR}/btree/bt_close.c")
+ add_library(micropy_extmod_btree OBJECT
+ ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_close.c
+ ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_conv.c
+ ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_debug.c
+ ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_delete.c
+ ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_get.c
+ ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_open.c
+ ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_overflow.c
+ ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_page.c
+ ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_put.c
+ ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_search.c
+ ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_seq.c
+ ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_split.c
+ ${MICROPY_LIB_BERKELEY_DIR}/btree/bt_utils.c
+ ${MICROPY_LIB_BERKELEY_DIR}/mpool/mpool.c
+ )
+
+ target_include_directories(micropy_extmod_btree PRIVATE
+ ${MICROPY_LIB_BERKELEY_DIR}/PORT/include
+ )
+
+ target_compile_definitions(micropy_extmod_btree PRIVATE
+ __DBINTERFACE_PRIVATE=1
+ mpool_error=printf
+ abort=abort_
+ "virt_fd_t=void*"
+ )
+
+ # The include directories and compile definitions below are needed to build
+ # modbtree.c and should be added to the main MicroPython target.
+
+ list(APPEND MICROPY_INC_CORE
+ "${MICROPY_LIB_BERKELEY_DIR}/PORT/include"
+ )
+
+ list(APPEND MICROPY_DEF_CORE
+ __DBINTERFACE_PRIVATE=1
+ "virt_fd_t=void*"
+ )
+endif()