CMakeLists.txt 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # get IDF version for comparison
  2. set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}")
  3. # set conversion sources
  4. set(srcs
  5. conversions/yuv.c
  6. conversions/to_jpg.cpp
  7. conversions/to_bmp.c
  8. conversions/jpge.cpp
  9. conversions/esp_jpg_decode.c
  10. )
  11. set(priv_include_dirs
  12. conversions/private_include
  13. )
  14. set(include_dirs
  15. driver/include
  16. conversions/include
  17. )
  18. set(COMPONENT_REQUIRES driver)
  19. # set driver sources only for supported platforms
  20. if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
  21. list(APPEND srcs
  22. driver/esp_camera.c
  23. driver/cam_hal.c
  24. driver/sensor.c
  25. sensors/ov2640.c
  26. sensors/ov3660.c
  27. sensors/ov5640.c
  28. sensors/ov7725.c
  29. sensors/ov7670.c
  30. sensors/nt99141.c
  31. sensors/gc0308.c
  32. sensors/gc2145.c
  33. sensors/gc032a.c
  34. sensors/bf3005.c
  35. sensors/bf20a6.c
  36. sensors/sc101iot.c
  37. sensors/sc030iot.c
  38. sensors/sc031gs.c
  39. sensors/mega_ccm.c
  40. )
  41. list(APPEND priv_include_dirs
  42. driver/private_include
  43. sensors/private_include
  44. target/private_include
  45. )
  46. if(IDF_TARGET STREQUAL "esp32")
  47. list(APPEND srcs
  48. target/xclk.c
  49. target/esp32/ll_cam.c
  50. )
  51. endif()
  52. if(IDF_TARGET STREQUAL "esp32s2")
  53. list(APPEND srcs
  54. target/xclk.c
  55. target/esp32s2/ll_cam.c
  56. target/tjpgd.c
  57. )
  58. list(APPEND priv_include_dirs
  59. target/esp32s2/private_include
  60. )
  61. endif()
  62. if(IDF_TARGET STREQUAL "esp32s3")
  63. list(APPEND srcs
  64. target/esp32s3/ll_cam.c
  65. )
  66. endif()
  67. set(priv_requires freertos nvs_flash)
  68. set(min_version_for_esp_timer "4.2")
  69. if (idf_version VERSION_GREATER_EQUAL min_version_for_esp_timer)
  70. list(APPEND priv_requires esp_timer)
  71. endif()
  72. # include the SCCB I2C driver
  73. # this uses either the legacy I2C API or the newwer version from IDF v5.4
  74. # as this features a method to obtain the I2C driver from a port number
  75. if (idf_version VERSION_GREATER_EQUAL "5.4")
  76. list(APPEND srcs driver/sccb-ng.c)
  77. else()
  78. list(APPEND srcs driver/sccb.c)
  79. endif()
  80. endif()
  81. # CONFIG_ESP_ROM_HAS_JPEG_DECODE is available from IDF v4.4 but
  82. # previous IDF supported chips already support JPEG decoder, hence okay to use this
  83. if(idf_version VERSION_GREATER_EQUAL "4.4" AND NOT CONFIG_ESP_ROM_HAS_JPEG_DECODE)
  84. list(APPEND srcs
  85. target/tjpgd.c
  86. )
  87. list(APPEND priv_include_dirs
  88. target/jpeg_include/
  89. )
  90. endif()
  91. idf_component_register(
  92. SRCS ${srcs}
  93. INCLUDE_DIRS ${include_dirs}
  94. PRIV_INCLUDE_DIRS ${priv_include_dirs}
  95. REQUIRES driver # due to include of driver/gpio.h in esp_camera.h
  96. PRIV_REQUIRES ${priv_requires}
  97. )