-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
66 additions
and
93 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,45 @@ | ||
# `py.cmake` for `micropy_gather_target_properties` macro usage | ||
# Include the py.cmake for additional macro micropy_gather_target_properties usage | ||
include(${MICROPY_DIR}/py/py.cmake) | ||
|
||
# Create an INTERFACE library for the camera module and sdd source files to the library | ||
add_library(usermod_mp_camera INTERFACE) | ||
|
||
target_sources(usermod_mp_camera INTERFACE | ||
${CMAKE_CURRENT_LIST_DIR}/modcamera.c | ||
${CMAKE_CURRENT_LIST_DIR}/modcamera_api.c | ||
) | ||
|
||
if(EXISTS "${IDF_PATH}/components/esp32-camera") | ||
target_include_directories(usermod_mp_camera INTERFACE | ||
${CMAKE_CURRENT_LIST_DIR} | ||
${IDF_PATH}/components/esp32-camera/driver/include | ||
${IDF_PATH}/components/esp32-camera/driver/private_include | ||
${IDF_PATH}/components/esp32-camera/conversions/include | ||
${IDF_PATH}/components/esp32-camera/conversions/private_include | ||
${IDF_PATH}/components/esp32-camera/sensors/private_include | ||
) | ||
else() | ||
target_include_directories(usermod_mp_camera INTERFACE | ||
${CMAKE_CURRENT_LIST_DIR}) | ||
# Dynamically gather include directories for the esp32-camera component | ||
idf_component_get_property(CAMERA_INCLUDES esp32-camera INCLUDE_DIRS) | ||
idf_component_get_property(CAMERA_PRIV_INCLUDES esp32-camera PRIV_INCLUDE_DIRS) | ||
idf_component_get_property(CAMERA_DIR esp32-camera COMPONENT_DIR) | ||
|
||
# Create a list for include directories | ||
set(MOD_INCLUDES ${CMAKE_CURRENT_LIST_DIR}) | ||
|
||
# Add dynamically discovered include paths | ||
if (CAMERA_INCLUDES) | ||
list(TRANSFORM CAMERA_INCLUDES PREPEND ${CAMERA_DIR}/) | ||
list(APPEND MOD_INCLUDES ${CAMERA_INCLUDES}) | ||
endif() | ||
if (CAMERA_PRIV_INCLUDES) | ||
list(TRANSFORM CAMERA_PRIV_INCLUDES PREPEND ${CAMERA_DIR}/) | ||
list(APPEND MOD_INCLUDES ${CAMERA_PRIV_INCLUDES}) | ||
endif() | ||
|
||
# Add the include directories to the target | ||
target_include_directories(usermod_mp_camera INTERFACE ${MOD_INCLUDES}) | ||
|
||
# Add compile definitions if MICROPY_CAMERA_MODEL is defined | ||
if (MICROPY_CAMERA_MODEL) | ||
target_compile_definitions(usermod_mp_camera INTERFACE MICROPY_CAMERA_MODEL_${MICROPY_CAMERA_MODEL}=1) | ||
endif() | ||
|
||
# Add compile definitions if MP_CAMERA_DRIVER_VERSION is defined | ||
if (MP_CAMERA_DRIVER_VERSION) | ||
target_compile_definitions(usermod_mp_camera INTERFACE MP_CAMERA_DRIVER_VERSION=\"${MP_CAMERA_DRIVER_VERSION}\") | ||
endif() | ||
|
||
# Link the usermod_mp_camera library to the main usermod target | ||
target_link_libraries(usermod INTERFACE usermod_mp_camera) | ||
|
||
micropy_gather_target_properties(usermod_mp_camera) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters