CMakeLists.txt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. idf_build_get_property(target IDF_TARGET)
  2. set(srcs
  3. "unity/src/unity.c")
  4. set(includes
  5. "include"
  6. "unity/src")
  7. set(requires "")
  8. if(CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL)
  9. list(APPEND COMPONENT_PRIV_INCLUDEDIRS "include/priv")
  10. endif()
  11. if(CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER)
  12. list(APPEND srcs "unity_runner.c")
  13. # Note the following files are not compatible with the Linux target.
  14. # On Linux, these are masked because we also don't use the IDF test runner there
  15. list(APPEND srcs "unity_utils_freertos.c")
  16. list(APPEND requires "freertos")
  17. endif()
  18. if(CONFIG_UNITY_ENABLE_FIXTURE)
  19. list(APPEND srcs "unity/extras/fixture/src/unity_fixture.c")
  20. list(APPEND includes "unity/extras/fixture/src")
  21. endif()
  22. list(APPEND srcs "unity_utils_memory.c")
  23. if(NOT "${target}" STREQUAL "linux")
  24. list(APPEND srcs "unity_port_esp32.c")
  25. list(APPEND srcs "port/esp/unity_utils_memory_esp.c")
  26. else()
  27. list(APPEND srcs "port/linux/unity_utils_memory_linux.c")
  28. endif()
  29. idf_component_register(SRCS "${srcs}"
  30. INCLUDE_DIRS ${includes}
  31. REQUIRES ${requires})
  32. if(NOT "${target}" STREQUAL "linux")
  33. target_compile_definitions(${COMPONENT_LIB} PUBLIC
  34. -DUNITY_INCLUDE_CONFIG_H
  35. )
  36. endif()
  37. target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-unused-const-variable)