5e04521251
This demonstrates how to add a sub-package in a user c module, as well as how to define the necessary qstrs and enable the feature in the build. This is used by the unix coverage build to test this feature. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
20 lines
612 B
CMake
20 lines
612 B
CMake
# Create an INTERFACE library for our C module.
|
|
add_library(usermod_subpackage_example INTERFACE)
|
|
|
|
# Add our source files to the lib
|
|
target_sources(usermod_subpackage_example INTERFACE
|
|
${CMAKE_CURRENT_LIST_DIR}/examplemodule.c
|
|
)
|
|
|
|
# Add the current directory as an include directory.
|
|
target_include_directories(usermod_subpackage_example INTERFACE
|
|
${CMAKE_CURRENT_LIST_DIR}
|
|
)
|
|
|
|
target_compile_definitions(usermod_subpackage_example INTERFACE
|
|
MICROPY_MODULE_BUILTIN_SUBPACKAGES=1
|
|
)
|
|
|
|
# Link our INTERFACE library to the usermod target.
|
|
target_link_libraries(usermod INTERFACE usermod_subpackage_example)
|