|
|
@@ -1,23 +1,22 @@
|
|
|
-set(srcs main.c
|
|
|
- binaries.c
|
|
|
- ../../common/example_common.c
|
|
|
-)
|
|
|
-
|
|
|
+set(srcs main.c ../../common/example_common.c)
|
|
|
set(include_dirs . ../../common)
|
|
|
|
|
|
if ("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER "4.0")
|
|
|
idf_component_register(SRCS ${srcs}
|
|
|
INCLUDE_DIRS ${include_dirs})
|
|
|
+ set(target ${COMPONENT_LIB})
|
|
|
else()
|
|
|
# remove when dropping IDF 3.3 support
|
|
|
set(COMPONENT_SRCS ${srcs})
|
|
|
set(COMPONENT_ADD_INCLUDEDIRS ${include_dirs})
|
|
|
register_component()
|
|
|
+ set(target ${COMPONENT_TARGET})
|
|
|
endif()
|
|
|
|
|
|
-set_property(SOURCE binaries.c PROPERTY GENERATED 1)
|
|
|
-
|
|
|
+# Embed binaries into the app.
|
|
|
+# In ESP-IDF this can also be done using EMBED_FILES option of idf_component_register.
|
|
|
+# Here an external tool is used to make file embedding similar with other ports.
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/../../common/bin2array.cmake)
|
|
|
-
|
|
|
-create_resources(${CMAKE_CURRENT_LIST_DIR}/../../binaries/Hello-world binaries.c)
|
|
|
-
|
|
|
+create_resources(${CMAKE_CURRENT_LIST_DIR}/../../binaries/Hello-world ${CMAKE_BINARY_DIR}/binaries.c)
|
|
|
+set_property(SOURCE ${CMAKE_BINARY_DIR}/binaries.c PROPERTY GENERATED 1)
|
|
|
+target_sources(${target} PRIVATE ${CMAKE_BINARY_DIR}/binaries.c)
|