Skip to content

Commit

Permalink
Lib/MicroPython: Add support for QSTR extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviermartin committed Feb 27, 2017
1 parent ede16a9 commit 5e5ee79
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Lib/MicroPython/CMakeLists.txt
Expand Up @@ -71,8 +71,14 @@ foreach(dir ${dirs})
set(LIBMICROPYTHON_CFLAGS "${LIBMICROPYTHON_CFLAGS} -I${dir}")
endforeach()

# List files for QSTR extraction
set(SOURCE_QSTR "")
foreach(_src ${micropython_lib_SRCS})
set(SOURCE_QSTR "${SOURCE_QSTR} ${CMAKE_CURRENT_SOURCE_DIR}/${_src}")
endforeach()

add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/libmicropython.a
COMMAND make V=1 CC=${CMAKE_C_COMPILER} CFLAGS=${LIBMICROPYTHON_CFLAGS} libmicropython.a
COMMAND make V=1 CC=${CMAKE_C_COMPILER} CFLAGS=${LIBMICROPYTHON_CFLAGS} SOURCE_QSTR=${SOURCE_QSTR} libmicropython.a
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${micropython_lib_SRCS} mpconfigport.h
COMMENT "Build MicroPython main library"
Expand Down
3 changes: 3 additions & 0 deletions Lib/MicroPython/Makefile
Expand Up @@ -6,6 +6,9 @@ QSTR_DEFS = qstrdefsport.h
# include py core make definitions
include src/py/py.mk

# List of sources for qstr extraction
SRC_QSTR += $(SOURCE_QSTR)

OBJ = $(PY_O)

$(BUILD)/_frozen_mpy.c: frozentest.mpy $(BUILD)/genhdr/qstrdefs.generated.h
Expand Down

0 comments on commit 5e5ee79

Please sign in to comment.