diff --git a/components/app_trace/CMakeLists.txt b/components/app_trace/CMakeLists.txt index 5a6f19dbbe..56ad263699 100644 --- a/components/app_trace/CMakeLists.txt +++ b/components/app_trace/CMakeLists.txt @@ -1,4 +1,7 @@ -set(COMPONENT_SRCDIRS "." "gcov") +set(COMPONENT_SRCS "app_trace.c" + "app_trace_util.c" + "gcov/gcov_rtio.c" + "host_file_io.c") set(COMPONENT_ADD_INCLUDEDIRS "include") if(CONFIG_SYSVIEW_ENABLE) @@ -7,11 +10,10 @@ if(CONFIG_SYSVIEW_ENABLE) sys_view/SEGGER sys_view/Sample/OS) - list(APPEND COMPONENT_SRCDIRS - "sys_view/SEGGER" - "sys_view/Sample/OS" - "sys_view/Sample/Config" - "sys_view/esp32") + set(COMPONENT_SRCS "SEGGER/SEGGER_SYSVIEW.c" + "esp32/SEGGER_RTT_esp32.c" + "Sample/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c" + "Sample/OS/SEGGER_SYSVIEW_FreeRTOS.c") endif() set(COMPONENT_REQUIRES) diff --git a/components/app_update/CMakeLists.txt b/components/app_update/CMakeLists.txt index e1401c6859..f2bcb9e8c2 100644 --- a/components/app_update/CMakeLists.txt +++ b/components/app_update/CMakeLists.txt @@ -1,4 +1,4 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "esp_ota_ops.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_REQUIRES spi_flash) diff --git a/components/aws_iot/CMakeLists.txt b/components/aws_iot/CMakeLists.txt index f7644bd7a3..c6898ae54a 100644 --- a/components/aws_iot/CMakeLists.txt +++ b/components/aws_iot/CMakeLists.txt @@ -1,6 +1,21 @@ if(CONFIG_AWS_IOT_SDK) set(COMPONENT_ADD_INCLUDEDIRS "include aws-iot-device-sdk-embedded-C/include") - set(COMPONENT_SRCDIRS "aws-iot-device-sdk-embedded-C/src port") + set(aws_sdk_src aws-iot-device-sdk-embedded-C/src) + set(COMPONENT_SRCS "${aws_sdk_src}/aws_iot_json_utils.c" + "${aws_sdk_src}/aws_iot_mqtt_client.c" + "${aws_sdk_src}/aws_iot_mqtt_client_common_internal.c" + "${aws_sdk_src}/aws_iot_mqtt_client_connect.c" + "${aws_sdk_src}/aws_iot_mqtt_client_publish.c" + "${aws_sdk_src}/aws_iot_mqtt_client_subscribe.c" + "${aws_sdk_src}/aws_iot_mqtt_client_unsubscribe.c" + "${aws_sdk_src}/aws_iot_mqtt_client_yield.c" + "${aws_sdk_src}/aws_iot_shadow.c" + "${aws_sdk_src}/aws_iot_shadow_actions.c" + "${aws_sdk_src}/aws_iot_shadow_json.c" + "${aws_sdk_src}/aws_iot_shadow_records.c" + "port/network_mbedtls_wrapper.c" + "port/threads_freertos.c" + "port/timer.c") else() message(STATUS "Building empty aws_iot component due to configuration") endif() diff --git a/components/bootloader/subproject/CMakeLists.txt b/components/bootloader/subproject/CMakeLists.txt index 7a34d8ea22..6d3c44c449 100644 --- a/components/bootloader/subproject/CMakeLists.txt +++ b/components/bootloader/subproject/CMakeLists.txt @@ -10,14 +10,12 @@ if(NOT IDF_PATH) "in by the parent build process.") endif() -set(COMPONENTS bootloader esptool_py esp32 partition_table soc bootloader_support log spi_flash micro-ecc soc) +set(COMPONENTS bootloader esptool_py esp32 partition_table soc bootloader_support log spi_flash micro-ecc soc main) set(BOOTLOADER_BUILD 1) add_definitions(-DBOOTLOADER_BUILD=1) set(COMPONENT_REQUIRES_COMMON log esp32 soc) -set(MAIN_SRCS main/bootloader_start.c) - include("${IDF_PATH}/tools/cmake/project.cmake") project(bootloader) diff --git a/components/bootloader/subproject/main/CMakeLists.txt b/components/bootloader/subproject/main/CMakeLists.txt new file mode 100644 index 0000000000..d090e9757a --- /dev/null +++ b/components/bootloader/subproject/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "bootloader_start.c") +set(COMPONENT_ADD_INCLUDEDIRS "") +set(COMPONENT_REQUIRES "bootloader bootloader_support") +register_component() diff --git a/components/bootloader_support/CMakeLists.txt b/components/bootloader_support/CMakeLists.txt index 21978397e8..1f28854108 100644 --- a/components/bootloader_support/CMakeLists.txt +++ b/components/bootloader_support/CMakeLists.txt @@ -1,4 +1,17 @@ -set(COMPONENT_SRCDIRS "src") +set(COMPONENT_SRCS "src/bootloader_clock.c" + "src/bootloader_common.c" + "src/bootloader_flash.c" + "src/bootloader_init.c" + "src/bootloader_random.c" + "src/bootloader_sha.c" + "src/bootloader_utility.c" + "src/efuse.c" + "src/esp_image_format.c" + "src/flash_encrypt.c" + "src/flash_partitions.c" + "src/flash_qio_mode.c" + "src/secure_boot.c" + "src/secure_boot_signatures.c") if(${BOOTLOADER_BUILD}) set(COMPONENT_ADD_INCLUDEDIRS "include include_priv") diff --git a/components/bt/CMakeLists.txt b/components/bt/CMakeLists.txt index f64668f9f5..df6fa250d4 100644 --- a/components/bt/CMakeLists.txt +++ b/components/bt/CMakeLists.txt @@ -1,6 +1,6 @@ if(CONFIG_BT_ENABLED) - set(COMPONENT_SRCDIRS .) + set(COMPONENT_SRCS "bt.c") set(COMPONENT_ADD_INCLUDEDIRS include) if(CONFIG_BLUEDROID_ENABLED) @@ -41,43 +41,234 @@ if(CONFIG_BT_ENABLED) list(APPEND COMPONENT_ADD_INCLUDEDIRS bluedroid/api/include/api) - list(APPEND COMPONENT_SRCDIRS - bluedroid/bta/dm - bluedroid/bta/gatt - bluedroid/bta/hh - bluedroid/bta/sdp - bluedroid/bta/av - bluedroid/bta/ar - bluedroid/bta/sys - bluedroid/bta/jv - bluedroid/device - bluedroid/hci - bluedroid/main - bluedroid/osi - bluedroid/external/sbc/decoder/srce - bluedroid/external/sbc/encoder/srce - bluedroid/btc/core - bluedroid/btc/profile/esp/blufi - bluedroid/btc/profile/std/gap - bluedroid/btc/profile/std/gatt - bluedroid/btc/profile/std/a2dp - bluedroid/btc/profile/std/avrc - bluedroid/btc/profile/std/spp - bluedroid/stack/btm - bluedroid/stack/btu - bluedroid/stack/gap - bluedroid/stack/gatt - bluedroid/stack/hcic - bluedroid/stack/l2cap - bluedroid/stack/sdp - bluedroid/stack/smp - bluedroid/stack/avct - bluedroid/stack/avrc - bluedroid/stack/avdt - bluedroid/stack/a2dp - bluedroid/stack/rfcomm - bluedroid/api - ) + list(APPEND COMPONENT_SRCS "bluedroid/api/esp_a2dp_api.c" + "bluedroid/api/esp_avrc_api.c" + "bluedroid/api/esp_blufi_api.c" + "bluedroid/api/esp_bt_device.c" + "bluedroid/api/esp_bt_main.c" + "bluedroid/api/esp_gap_ble_api.c" + "bluedroid/api/esp_gap_bt_api.c" + "bluedroid/api/esp_gatt_common_api.c" + "bluedroid/api/esp_gattc_api.c" + "bluedroid/api/esp_gatts_api.c" + "bluedroid/api/esp_hf_client_api.c" + "bluedroid/api/esp_spp_api.c" + "bluedroid/bta/ar/bta_ar.c" + "bluedroid/bta/av/bta_av_aact.c" + "bluedroid/bta/av/bta_av_act.c" + "bluedroid/bta/av/bta_av_api.c" + "bluedroid/bta/av/bta_av_cfg.c" + "bluedroid/bta/av/bta_av_ci.c" + "bluedroid/bta/av/bta_av_main.c" + "bluedroid/bta/av/bta_av_sbc.c" + "bluedroid/bta/av/bta_av_ssm.c" + "bluedroid/bta/dm/bta_dm_act.c" + "bluedroid/bta/dm/bta_dm_api.c" + "bluedroid/bta/dm/bta_dm_cfg.c" + "bluedroid/bta/dm/bta_dm_ci.c" + "bluedroid/bta/dm/bta_dm_co.c" + "bluedroid/bta/dm/bta_dm_main.c" + "bluedroid/bta/dm/bta_dm_pm.c" + "bluedroid/bta/dm/bta_dm_sco.c" + "bluedroid/bta/gatt/bta_gatt_common.c" + "bluedroid/bta/gatt/bta_gattc_act.c" + "bluedroid/bta/gatt/bta_gattc_api.c" + "bluedroid/bta/gatt/bta_gattc_cache.c" + "bluedroid/bta/gatt/bta_gattc_ci.c" + "bluedroid/bta/gatt/bta_gattc_co.c" + "bluedroid/bta/gatt/bta_gattc_main.c" + "bluedroid/bta/gatt/bta_gattc_utils.c" + "bluedroid/bta/gatt/bta_gatts_act.c" + "bluedroid/bta/gatt/bta_gatts_api.c" + "bluedroid/bta/gatt/bta_gatts_co.c" + "bluedroid/bta/gatt/bta_gatts_main.c" + "bluedroid/bta/gatt/bta_gatts_utils.c" + "bluedroid/bta/hh/bta_hh_act.c" + "bluedroid/bta/hh/bta_hh_api.c" + "bluedroid/bta/hh/bta_hh_cfg.c" + "bluedroid/bta/hh/bta_hh_le.c" + "bluedroid/bta/hh/bta_hh_main.c" + "bluedroid/bta/hh/bta_hh_utils.c" + "bluedroid/bta/jv/bta_jv_act.c" + "bluedroid/bta/jv/bta_jv_api.c" + "bluedroid/bta/jv/bta_jv_cfg.c" + "bluedroid/bta/jv/bta_jv_main.c" + "bluedroid/bta/sdp/bta_sdp.c" + "bluedroid/bta/sdp/bta_sdp_act.c" + "bluedroid/bta/sdp/bta_sdp_api.c" + "bluedroid/bta/sdp/bta_sdp_cfg.c" + "bluedroid/bta/sys/bta_sys_conn.c" + "bluedroid/bta/sys/bta_sys_main.c" + "bluedroid/bta/sys/utl.c" + "bluedroid/btc/core/btc_alarm.c" + "bluedroid/btc/core/btc_ble_storage.c" + "bluedroid/btc/core/btc_config.c" + "bluedroid/btc/core/btc_dev.c" + "bluedroid/btc/core/btc_dm.c" + "bluedroid/btc/core/btc_main.c" + "bluedroid/btc/core/btc_manage.c" + "bluedroid/btc/core/btc_profile_queue.c" + "bluedroid/btc/core/btc_sec.c" + "bluedroid/btc/core/btc_sm.c" + "bluedroid/btc/core/btc_storage.c" + "bluedroid/btc/core/btc_task.c" + "bluedroid/btc/core/btc_util.c" + "bluedroid/btc/profile/esp/blufi/blufi_prf.c" + "bluedroid/btc/profile/esp/blufi/blufi_protocol.c" + "bluedroid/btc/profile/std/a2dp/bta_av_co.c" + "bluedroid/btc/profile/std/a2dp/btc_a2dp.c" + "bluedroid/btc/profile/std/a2dp/btc_a2dp_control.c" + "bluedroid/btc/profile/std/a2dp/btc_a2dp_sink.c" + "bluedroid/btc/profile/std/a2dp/btc_a2dp_source.c" + "bluedroid/btc/profile/std/a2dp/btc_av.c" + "bluedroid/btc/profile/std/avrc/btc_avrc.c" + "bluedroid/btc/profile/std/gap/btc_gap_ble.c" + "bluedroid/btc/profile/std/gap/btc_gap_bt.c" + "bluedroid/btc/profile/std/gatt/btc_gatt_common.c" + "bluedroid/btc/profile/std/gatt/btc_gatt_util.c" + "bluedroid/btc/profile/std/gatt/btc_gattc.c" + "bluedroid/btc/profile/std/gatt/btc_gatts.c" + "bluedroid/btc/profile/std/spp/btc_spp.c" + "bluedroid/device/bdaddr.c" + "bluedroid/device/controller.c" + "bluedroid/device/interop.c" + "bluedroid/external/sbc/decoder/srce/alloc.c" + "bluedroid/external/sbc/decoder/srce/bitalloc-sbc.c" + "bluedroid/external/sbc/decoder/srce/bitalloc.c" + "bluedroid/external/sbc/decoder/srce/bitstream-decode.c" + "bluedroid/external/sbc/decoder/srce/decoder-oina.c" + "bluedroid/external/sbc/decoder/srce/decoder-private.c" + "bluedroid/external/sbc/decoder/srce/decoder-sbc.c" + "bluedroid/external/sbc/decoder/srce/dequant.c" + "bluedroid/external/sbc/decoder/srce/framing-sbc.c" + "bluedroid/external/sbc/decoder/srce/framing.c" + "bluedroid/external/sbc/decoder/srce/oi_codec_version.c" + "bluedroid/external/sbc/decoder/srce/synthesis-8-generated.c" + "bluedroid/external/sbc/decoder/srce/synthesis-dct8.c" + "bluedroid/external/sbc/decoder/srce/synthesis-sbc.c" + "bluedroid/external/sbc/encoder/srce/sbc_analysis.c" + "bluedroid/external/sbc/encoder/srce/sbc_dct.c" + "bluedroid/external/sbc/encoder/srce/sbc_dct_coeffs.c" + "bluedroid/external/sbc/encoder/srce/sbc_enc_bit_alloc_mono.c" + "bluedroid/external/sbc/encoder/srce/sbc_enc_bit_alloc_ste.c" + "bluedroid/external/sbc/encoder/srce/sbc_enc_coeffs.c" + "bluedroid/external/sbc/encoder/srce/sbc_encoder.c" + "bluedroid/external/sbc/encoder/srce/sbc_packing.c" + "bluedroid/hci/buffer_allocator.c" + "bluedroid/hci/hci_audio.c" + "bluedroid/hci/hci_hal_h4.c" + "bluedroid/hci/hci_layer.c" + "bluedroid/hci/hci_packet_factory.c" + "bluedroid/hci/hci_packet_parser.c" + "bluedroid/hci/packet_fragmenter.c" + "bluedroid/main/bte_init.c" + "bluedroid/main/bte_main.c" + "bluedroid/osi/alarm.c" + "bluedroid/osi/allocator.c" + "bluedroid/osi/buffer.c" + "bluedroid/osi/config.c" + "bluedroid/osi/fixed_queue.c" + "bluedroid/osi/future.c" + "bluedroid/osi/hash_functions.c" + "bluedroid/osi/hash_map.c" + "bluedroid/osi/list.c" + "bluedroid/osi/mutex.c" + "bluedroid/osi/osi.c" + "bluedroid/osi/semaphore.c" + "bluedroid/stack/a2dp/a2d_api.c" + "bluedroid/stack/a2dp/a2d_sbc.c" + "bluedroid/stack/avct/avct_api.c" + "bluedroid/stack/avct/avct_ccb.c" + "bluedroid/stack/avct/avct_l2c.c" + "bluedroid/stack/avct/avct_lcb.c" + "bluedroid/stack/avct/avct_lcb_act.c" + "bluedroid/stack/avdt/avdt_ad.c" + "bluedroid/stack/avdt/avdt_api.c" + "bluedroid/stack/avdt/avdt_ccb.c" + "bluedroid/stack/avdt/avdt_ccb_act.c" + "bluedroid/stack/avdt/avdt_l2c.c" + "bluedroid/stack/avdt/avdt_msg.c" + "bluedroid/stack/avdt/avdt_scb.c" + "bluedroid/stack/avdt/avdt_scb_act.c" + "bluedroid/stack/avrc/avrc_api.c" + "bluedroid/stack/avrc/avrc_bld_ct.c" + "bluedroid/stack/avrc/avrc_bld_tg.c" + "bluedroid/stack/avrc/avrc_opt.c" + "bluedroid/stack/avrc/avrc_pars_ct.c" + "bluedroid/stack/avrc/avrc_pars_tg.c" + "bluedroid/stack/avrc/avrc_sdp.c" + "bluedroid/stack/avrc/avrc_utils.c" + "bluedroid/stack/btm/btm_acl.c" + "bluedroid/stack/btm/btm_ble.c" + "bluedroid/stack/btm/btm_ble_addr.c" + "bluedroid/stack/btm/btm_ble_adv_filter.c" + "bluedroid/stack/btm/btm_ble_batchscan.c" + "bluedroid/stack/btm/btm_ble_bgconn.c" + "bluedroid/stack/btm/btm_ble_cont_energy.c" + "bluedroid/stack/btm/btm_ble_gap.c" + "bluedroid/stack/btm/btm_ble_multi_adv.c" + "bluedroid/stack/btm/btm_ble_privacy.c" + "bluedroid/stack/btm/btm_dev.c" + "bluedroid/stack/btm/btm_devctl.c" + "bluedroid/stack/btm/btm_inq.c" + "bluedroid/stack/btm/btm_main.c" + "bluedroid/stack/btm/btm_pm.c" + "bluedroid/stack/btm/btm_sco.c" + "bluedroid/stack/btm/btm_sec.c" + "bluedroid/stack/btu/btu_hcif.c" + "bluedroid/stack/btu/btu_init.c" + "bluedroid/stack/btu/btu_task.c" + "bluedroid/stack/gap/gap_api.c" + "bluedroid/stack/gap/gap_ble.c" + "bluedroid/stack/gap/gap_conn.c" + "bluedroid/stack/gap/gap_utils.c" + "bluedroid/stack/gatt/att_protocol.c" + "bluedroid/stack/gatt/gatt_api.c" + "bluedroid/stack/gatt/gatt_attr.c" + "bluedroid/stack/gatt/gatt_auth.c" + "bluedroid/stack/gatt/gatt_cl.c" + "bluedroid/stack/gatt/gatt_db.c" + "bluedroid/stack/gatt/gatt_main.c" + "bluedroid/stack/gatt/gatt_sr.c" + "bluedroid/stack/gatt/gatt_utils.c" + "bluedroid/stack/hcic/hciblecmds.c" + "bluedroid/stack/hcic/hcicmds.c" + "bluedroid/stack/l2cap/l2c_api.c" + "bluedroid/stack/l2cap/l2c_ble.c" + "bluedroid/stack/l2cap/l2c_csm.c" + "bluedroid/stack/l2cap/l2c_fcr.c" + "bluedroid/stack/l2cap/l2c_link.c" + "bluedroid/stack/l2cap/l2c_main.c" + "bluedroid/stack/l2cap/l2c_ucd.c" + "bluedroid/stack/l2cap/l2c_utils.c" + "bluedroid/stack/l2cap/l2cap_client.c" + "bluedroid/stack/rfcomm/port_api.c" + "bluedroid/stack/rfcomm/port_rfc.c" + "bluedroid/stack/rfcomm/port_utils.c" + "bluedroid/stack/rfcomm/rfc_l2cap_if.c" + "bluedroid/stack/rfcomm/rfc_mx_fsm.c" + "bluedroid/stack/rfcomm/rfc_port_fsm.c" + "bluedroid/stack/rfcomm/rfc_port_if.c" + "bluedroid/stack/rfcomm/rfc_ts_frames.c" + "bluedroid/stack/rfcomm/rfc_utils.c" + "bluedroid/stack/sdp/sdp_api.c" + "bluedroid/stack/sdp/sdp_db.c" + "bluedroid/stack/sdp/sdp_discovery.c" + "bluedroid/stack/sdp/sdp_main.c" + "bluedroid/stack/sdp/sdp_server.c" + "bluedroid/stack/sdp/sdp_utils.c" + "bluedroid/stack/smp/aes.c" + "bluedroid/stack/smp/p_256_curvepara.c" + "bluedroid/stack/smp/p_256_ecc_pp.c" + "bluedroid/stack/smp/p_256_multprecision.c" + "bluedroid/stack/smp/smp_act.c" + "bluedroid/stack/smp/smp_api.c" + "bluedroid/stack/smp/smp_br_main.c" + "bluedroid/stack/smp/smp_cmac.c" + "bluedroid/stack/smp/smp_keys.c" + "bluedroid/stack/smp/smp_l2c.c" + "bluedroid/stack/smp/smp_main.c" + "bluedroid/stack/smp/smp_utils.c") endif() endif() diff --git a/components/coap/CMakeLists.txt b/components/coap/CMakeLists.txt index 90b0c26e60..fe51b291d3 100644 --- a/components/coap/CMakeLists.txt +++ b/components/coap/CMakeLists.txt @@ -1,23 +1,21 @@ set(COMPONENT_ADD_INCLUDEDIRS port/include port/include/coap libcoap/include libcoap/include/coap) -set(COMPONENT_SRCS - libcoap/src/address.c - libcoap/src/async.c - libcoap/src/block.c - libcoap/src/coap_time.c - libcoap/src/debug.c - libcoap/src/encode.c - libcoap/src/hashkey.c - libcoap/src/mem.c - libcoap/src/net.c - libcoap/src/option.c - libcoap/src/pdu.c - libcoap/src/resource.c - libcoap/src/str.c - libcoap/src/subscribe.c - libcoap/src/uri.c - port/coap_io_socket.c - ) +set(COMPONENT_SRCS "libcoap/src/address.c" + "libcoap/src/async.c" + "libcoap/src/block.c" + "libcoap/src/coap_time.c" + "libcoap/src/debug.c" + "libcoap/src/encode.c" + "libcoap/src/hashkey.c" + "libcoap/src/mem.c" + "libcoap/src/net.c" + "libcoap/src/option.c" + "libcoap/src/pdu.c" + "libcoap/src/resource.c" + "libcoap/src/str.c" + "libcoap/src/subscribe.c" + "libcoap/src/uri.c" + "port/coap_io_socket.c") set(COMPONENT_REQUIRES lwip) diff --git a/components/console/CMakeLists.txt b/components/console/CMakeLists.txt index 0b0da5394a..1aa4ce020d 100644 --- a/components/console/CMakeLists.txt +++ b/components/console/CMakeLists.txt @@ -1,5 +1,8 @@ set(COMPONENT_ADD_INCLUDEDIRS .) -set(COMPONENT_SRCDIRS linenoise argtable3 .) +set(COMPONENT_SRCS "argtable3/argtable3.c" + "commands.c" + "linenoise/linenoise.c" + "split_argv.c") set(COMPONENT_REQUIRES) diff --git a/components/cxx/CMakeLists.txt b/components/cxx/CMakeLists.txt index a797640cc0..29ee8016ef 100644 --- a/components/cxx/CMakeLists.txt +++ b/components/cxx/CMakeLists.txt @@ -1,4 +1,5 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "cxx_exception_stubs.cpp" + "cxx_guards.cpp") set(COMPONENT_REQUIRES) register_component() diff --git a/components/driver/CMakeLists.txt b/components/driver/CMakeLists.txt index 0c72aecc43..689c7638d1 100644 --- a/components/driver/CMakeLists.txt +++ b/components/driver/CMakeLists.txt @@ -1,4 +1,24 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "gpio.c" + "i2c.c" + "i2s.c" + "ledc.c" + "mcpwm.c" + "pcnt.c" + "periph_ctrl.c" + "rmt.c" + "rtc_module.c" + "sdio_slave.c" + "sdmmc_host.c" + "sdmmc_transaction.c" + "sdspi_crc.c" + "sdspi_host.c" + "sdspi_transaction.c" + "sigmadelta.c" + "spi_common.c" + "spi_master.c" + "spi_slave.c" + "timer.c" + "uart.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_PRIV_INCLUDEDIRS "include/driver") diff --git a/components/esp-tls/CMakeLists.txt b/components/esp-tls/CMakeLists.txt index 9bad428680..23f953d940 100644 --- a/components/esp-tls/CMakeLists.txt +++ b/components/esp-tls/CMakeLists.txt @@ -1,4 +1,4 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "esp_tls.c") set(COMPONENT_ADD_INCLUDEDIRS ".") set(COMPONENT_REQUIRES mbedtls) diff --git a/components/esp32/CMakeLists.txt b/components/esp32/CMakeLists.txt index b26f5efe27..8bfad700b7 100644 --- a/components/esp32/CMakeLists.txt +++ b/components/esp32/CMakeLists.txt @@ -2,7 +2,7 @@ if(BOOTLOADER_BUILD) # For bootloader, all we need from esp32 is headers set(COMPONENT_ADD_INCLUDEDIRS include) set(COMPONENT_REQUIRES ${COMPONENTS}) - set(COMPONENT_SRCDIRS "") + set(COMPONENT_SRCS ) register_component(esp32) # as cmake won't attach linker args to a header-only library, attach @@ -17,7 +17,46 @@ if(BOOTLOADER_BUILD) else() # Regular app build - set(COMPONENT_SRCDIRS ". hwcrypto") + set(COMPONENT_SRCS "brownout.c" + "cache_err_int.c" + "clk.c" + "coexist.c" + "core_dump.c" + "cpu_start.c" + "crosscore_int.c" + "dbg_stubs.c" + "dport_access.c" + "dport_panic_highint_hdl.S" + "esp_err_to_name.c" + "esp_timer.c" + "esp_timer_esp32.c" + "ets_timer_legacy.c" + "event_default_handlers.c" + "event_loop.c" + "fast_crypto_ops.c" + "freertos_hooks.c" + "gdbstub.c" + "hw_random.c" + "hwcrypto/aes.c" + "hwcrypto/sha.c" + "int_wdt.c" + "intr_alloc.c" + "ipc.c" + "lib_printf.c" + "panic.c" + "phy_init.c" + "pm_esp32.c" + "pm_locks.c" + "pm_trace.c" + "restore.c" + "sleep_modes.c" + "spiram.c" + "spiram_psram.c" + "stack_check.c" + "system_api.c" + "task_wdt.c" + "wifi_init.c" + "wifi_os_adapter.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_REQUIRES driver tcpip_adapter) diff --git a/components/esp_adc_cal/CMakeLists.txt b/components/esp_adc_cal/CMakeLists.txt index fc21f1ecac..8bb99092e2 100644 --- a/components/esp_adc_cal/CMakeLists.txt +++ b/components/esp_adc_cal/CMakeLists.txt @@ -1,4 +1,4 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "esp_adc_cal.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_REQUIRES) diff --git a/components/esp_http_client/CMakeLists.txt b/components/esp_http_client/CMakeLists.txt index f95c657abb..72caec4d56 100644 --- a/components/esp_http_client/CMakeLists.txt +++ b/components/esp_http_client/CMakeLists.txt @@ -1,4 +1,10 @@ -set(COMPONENT_SRCDIRS "." "lib") +set(COMPONENT_SRCS "esp_http_client.c" + "lib/http_auth.c" + "lib/http_header.c" + "lib/http_utils.c" + "lib/transport.c" + "lib/transport_ssl.c" + "lib/transport_tcp.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_PRIV_INCLUDEDIRS "lib/include") diff --git a/components/esp_https_ota/CMakeLists.txt b/components/esp_https_ota/CMakeLists.txt index bfc6c12054..6ef0a5c9e0 100644 --- a/components/esp_https_ota/CMakeLists.txt +++ b/components/esp_https_ota/CMakeLists.txt @@ -1,5 +1,5 @@ set(COMPONENT_ADD_INCLUDEDIRS include) -set(COMPONENT_SRCDIRS "src") +set(COMPONENT_SRCS "src/esp_https_ota.c") set(COMPONENT_REQUIRES esp_http_client) set(COMPONENT_PRIV_REQUIRES log app_update) diff --git a/components/ethernet/CMakeLists.txt b/components/ethernet/CMakeLists.txt index 165d89fbe1..ef7c9a0f9a 100644 --- a/components/ethernet/CMakeLists.txt +++ b/components/ethernet/CMakeLists.txt @@ -1,4 +1,8 @@ -set(COMPONENT_SRCDIRS . eth_phy) +set(COMPONENT_SRCS "emac_dev.c" + "emac_main.c" + "eth_phy/phy_common.c" + "eth_phy/phy_lan8720.c" + "eth_phy/phy_tlk110.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_REQUIRES) diff --git a/components/expat/CMakeLists.txt b/components/expat/CMakeLists.txt index 0241ae34f1..8a6e06558c 100644 --- a/components/expat/CMakeLists.txt +++ b/components/expat/CMakeLists.txt @@ -1,5 +1,12 @@ set(COMPONENT_ADD_INCLUDEDIRS port/include include/expat) -set(COMPONENT_SRCDIRS library port) +set(COMPONENT_SRCS "library/xmlparse.c" + "library/xmlrole.c" + "library/xmltok.c" + "library/xmltok_impl.c" + "library/xmltok_ns.c" + "port/chardata.c" + "port/expat_element.c" + "port/minicheck.c") set(COMPONENT_REQUIRES) diff --git a/components/fatfs/CMakeLists.txt b/components/fatfs/CMakeLists.txt index 3d24c50bf9..4df07d30b9 100644 --- a/components/fatfs/CMakeLists.txt +++ b/components/fatfs/CMakeLists.txt @@ -1,4 +1,13 @@ -set(COMPONENT_SRCDIRS src) +set(COMPONENT_SRCS "src/diskio.c" + "src/diskio_rawflash.c" + "src/diskio_sdmmc.c" + "src/diskio_wl.c" + "src/ff.c" + "src/ffsystem.c" + "src/ffunicode.c" + "src/vfs_fat.c" + "src/vfs_fat_sdmmc.c" + "src/vfs_fat_spiflash.c") set(COMPONENT_ADD_INCLUDEDIRS src) set(COMPONENT_REQUIRES wear_levelling sdmmc) diff --git a/components/freertos/CMakeLists.txt b/components/freertos/CMakeLists.txt index e0618d4a94..bcd9b0c42e 100644 --- a/components/freertos/CMakeLists.txt +++ b/components/freertos/CMakeLists.txt @@ -1,6 +1,22 @@ set(COMPONENT_ADD_INCLUDEDIRS include) set(COMPONENT_PRIV_INCLUDEDIRS include/freertos) -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "FreeRTOS-openocd.c" + "croutine.c" + "event_groups.c" + "list.c" + "port.c" + "portasm.S" + "queue.c" + "ringbuf.c" + "tasks.c" + "timers.c" + "xtensa_context.S" + "xtensa_init.c" + "xtensa_intr.c" + "xtensa_intr_asm.S" + "xtensa_overlay_os_hook.c" + "xtensa_vector_defaults.S" + "xtensa_vectors.S") set(COMPONENT_REQUIRES) register_component() diff --git a/components/heap/CMakeLists.txt b/components/heap/CMakeLists.txt index 9c4ccf16d9..f71ed9d840 100644 --- a/components/heap/CMakeLists.txt +++ b/components/heap/CMakeLists.txt @@ -1,4 +1,7 @@ -set(COMPONENT_SRCS heap_caps_init.c heap_caps.c multi_heap.c heap_trace.c) +set(COMPONENT_SRCS "heap_caps.c" + "heap_caps_init.c" + "heap_trace.c" + "multi_heap.c") if(NOT CONFIG_HEAP_POISONING_DISABLED) set(COMPONENT_SRCS ${COMPONENT_SRCS} multi_heap_poisoning.c) diff --git a/components/jsmn/CMakeLists.txt b/components/jsmn/CMakeLists.txt index 7c19d9ccba..f6776023f9 100644 --- a/components/jsmn/CMakeLists.txt +++ b/components/jsmn/CMakeLists.txt @@ -1,4 +1,4 @@ -set(COMPONENT_SRCDIRS "src") +set(COMPONENT_SRCS "src/jsmn.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_REQUIRES "") diff --git a/components/json/CMakeLists.txt b/components/json/CMakeLists.txt index 0b8ba83d66..9535315e5b 100644 --- a/components/json/CMakeLists.txt +++ b/components/json/CMakeLists.txt @@ -1,4 +1,6 @@ -set(COMPONENT_SRCDIRS cJSON) +set(COMPONENT_SRCS "cJSON/cJSON.c" + "cJSON/cJSON_Utils.c" + "cJSON/test.c") set(COMPONENT_ADD_INCLUDEDIRS cJSON) set(COMPONENT_REQUIRES "") diff --git a/components/libsodium/CMakeLists.txt b/components/libsodium/CMakeLists.txt index 0ad301662e..8dd6523446 100644 --- a/components/libsodium/CMakeLists.txt +++ b/components/libsodium/CMakeLists.txt @@ -2,71 +2,88 @@ set(SRC libsodium/src/libsodium) set(COMPONENT_REQUIRES "mbedtls") -set(COMPONENT_SRCDIRS - port - - # Derived from libsodium/src/libsodium/Makefile.am - # (ignoring the !MINIMAL set) - ${SRC}/crypto_aead/chacha20poly1305/sodium - ${SRC}/crypto_aead/xchacha20poly1305/sodium - ${SRC}/crypto_auth - ${SRC}/crypto_auth/hmacsha256 - ${SRC}/crypto_auth/hmacsha512 - ${SRC}/crypto_auth/hmacsha512256 - ${SRC}/crypto_box - ${SRC}/crypto_box/curve25519xsalsa20poly1305 - ${SRC}/crypto_core/curve25519/ref10 - ${SRC}/crypto_core/hchacha20 - ${SRC}/crypto_core/hsalsa20/ref2 - ${SRC}/crypto_core/hsalsa20 - ${SRC}/crypto_core/salsa/ref - ${SRC}/crypto_generichash - ${SRC}/crypto_generichash/blake2b - ${SRC}/crypto_generichash/blake2b/ref - ${SRC}/crypto_hash - ${SRC}/crypto_hash/sha256 - ${SRC}/crypto_hash/sha512 - ${SRC}/crypto_kdf/blake2b - ${SRC}/crypto_kdf - ${SRC}/crypto_kx - ${SRC}/crypto_onetimeauth - ${SRC}/crypto_onetimeauth/poly1305 - ${SRC}/crypto_onetimeauth/poly1305/donna - ${SRC}/crypto_pwhash/argon2 - ${SRC}/crypto_pwhash - ${SRC}/crypto_pwhash/scryptsalsa208sha256 - ${SRC}/crypto_pwhash/scryptsalsa208sha256/nosse - ${SRC}/crypto_scalarmult - ${SRC}/crypto_scalarmult/curve25519 - ${SRC}/crypto_scalarmult/curve25519/ref10 - ${SRC}/crypto_secretbox - ${SRC}/crypto_secretbox/xsalsa20poly1305 - ${SRC}/crypto_shorthash - ${SRC}/crypto_shorthash/siphash24 - ${SRC}/crypto_shorthash/siphash24/ref - ${SRC}/crypto_sign - ${SRC}/crypto_sign/ed25519 - ${SRC}/crypto_sign/ed25519/ref10 - ${SRC}/crypto_stream/chacha20 - ${SRC}/crypto_stream/chacha20/ref - ${SRC}/crypto_stream - ${SRC}/crypto_stream/salsa20 - ${SRC}/crypto_stream/salsa20/ref - ${SRC}/crypto_stream/xsalsa20 - ${SRC}/crypto_verify/sodium - ${SRC}/randombytes - ${SRC}/sodium - ) +set(COMPONENT_SRCS "${SRC}/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c" + "${SRC}/crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c" + "${SRC}/crypto_auth/crypto_auth.c" + "${SRC}/crypto_auth/hmacsha256/auth_hmacsha256.c" + "${SRC}/crypto_auth/hmacsha512/auth_hmacsha512.c" + "${SRC}/crypto_auth/hmacsha512256/auth_hmacsha512256.c" + "${SRC}/crypto_box/crypto_box.c" + "${SRC}/crypto_box/crypto_box_easy.c" + "${SRC}/crypto_box/crypto_box_seal.c" + "${SRC}/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c" + "${SRC}/crypto_core/curve25519/ref10/curve25519_ref10.c" + "${SRC}/crypto_core/hchacha20/core_hchacha20.c" + "${SRC}/crypto_core/hsalsa20/core_hsalsa20.c" + "${SRC}/crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c" + "${SRC}/crypto_core/salsa/ref/core_salsa_ref.c" + "${SRC}/crypto_generichash/crypto_generichash.c" + "${SRC}/crypto_generichash/blake2b/generichash_blake2.c" + "${SRC}/crypto_generichash/blake2b/ref/blake2b-compress-avx2.c" + "${SRC}/crypto_generichash/blake2b/ref/blake2b-compress-ref.c" + "${SRC}/crypto_generichash/blake2b/ref/blake2b-compress-sse41.c" + "${SRC}/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c" + "${SRC}/crypto_generichash/blake2b/ref/blake2b-ref.c" + "${SRC}/crypto_generichash/blake2b/ref/generichash_blake2b.c" + "${SRC}/crypto_hash/crypto_hash.c" + "${SRC}/crypto_hash/sha256/hash_sha256.c" + "${SRC}/crypto_hash/sha512/hash_sha512.c" + "${SRC}/crypto_kdf/crypto_kdf.c" + "${SRC}/crypto_kdf/blake2b/kdf_blake2b.c" + "${SRC}/crypto_kx/crypto_kx.c" + "${SRC}/crypto_onetimeauth/crypto_onetimeauth.c" + "${SRC}/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c" + "${SRC}/crypto_onetimeauth/poly1305/donna/poly1305_donna.c" + "${SRC}/crypto_pwhash/crypto_pwhash.c" + "${SRC}/crypto_pwhash/argon2/argon2-core.c" + "${SRC}/crypto_pwhash/argon2/argon2-encoding.c" + "${SRC}/crypto_pwhash/argon2/argon2-fill-block-ref.c" + "${SRC}/crypto_pwhash/argon2/argon2-fill-block-ssse3.c" + "${SRC}/crypto_pwhash/argon2/argon2.c" + "${SRC}/crypto_pwhash/argon2/blake2b-long.c" + "${SRC}/crypto_pwhash/argon2/pwhash_argon2i.c" + "${SRC}/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c" + "${SRC}/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c" + "${SRC}/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c" + "${SRC}/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c" + "${SRC}/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c" + "${SRC}/crypto_scalarmult/crypto_scalarmult.c" + "${SRC}/crypto_scalarmult/curve25519/scalarmult_curve25519.c" + "${SRC}/crypto_scalarmult/curve25519/ref10/x25519_ref10.c" + "${SRC}/crypto_secretbox/crypto_secretbox.c" + "${SRC}/crypto_secretbox/crypto_secretbox_easy.c" + "${SRC}/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c" + "${SRC}/crypto_shorthash/crypto_shorthash.c" + "${SRC}/crypto_shorthash/siphash24/shorthash_siphash24.c" + "${SRC}/crypto_shorthash/siphash24/shorthash_siphashx24.c" + "${SRC}/crypto_shorthash/siphash24/ref/shorthash_siphash24_ref.c" + "${SRC}/crypto_shorthash/siphash24/ref/shorthash_siphashx24_ref.c" + "${SRC}/crypto_sign/crypto_sign.c" + "${SRC}/crypto_sign/ed25519/sign_ed25519.c" + "${SRC}/crypto_sign/ed25519/ref10/keypair.c" + "${SRC}/crypto_sign/ed25519/ref10/obsolete.c" + "${SRC}/crypto_sign/ed25519/ref10/open.c" + "${SRC}/crypto_sign/ed25519/ref10/sign.c" + "${SRC}/crypto_stream/crypto_stream.c" + "${SRC}/crypto_stream/chacha20/stream_chacha20.c" + "${SRC}/crypto_stream/chacha20/ref/chacha20_ref.c" + "${SRC}/crypto_stream/salsa20/stream_salsa20.c" + "${SRC}/crypto_stream/salsa20/ref/salsa20_ref.c" + "${SRC}/crypto_stream/xsalsa20/stream_xsalsa20.c" + "${SRC}/crypto_verify/sodium/verify.c" + "${SRC}/randombytes/randombytes.c" + "${SRC}/sodium/core.c" + "${SRC}/sodium/runtime.c" + "${SRC}/sodium/utils.c" + "${SRC}/sodium/version.c" + "port/randombytes_esp32.c") if(CONFIG_LIBSODIUM_USE_MBEDTLS_SHA) - set(COMPONENT_SRCDIRS ${COMPONENT_SRCDIRS} - port/crypto_hash_mbedtls - ) + set(COMPONENT_SRCS "port/crypto_hash_mbedtls/crypto_hash_sha256_mbedtls.c" + "port/crypto_hash_mbedtls/crypto_hash_sha512_mbedtls.c") else() - set(COMPONENT_SRCDIRS ${COMPONENT_SRCDIRS} - ${SRC}/crypto_hash/sha256/cp - ${SRC}/crypto_hash/sha512/cp - ) + set(COMPONENT_SRCS "port/crypto_hash_mbedtls/crypto_hash_sha256_mbedtls.c" + "port/crypto_hash_mbedtls/crypto_hash_sha512_mbedtls.c") endif() set(COMPONENT_ADD_INCLUDEDIRS ${SRC}/include port_include) diff --git a/components/log/CMakeLists.txt b/components/log/CMakeLists.txt index ad162fe1e1..84b6cf4607 100644 --- a/components/log/CMakeLists.txt +++ b/components/log/CMakeLists.txt @@ -1,4 +1,4 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "log.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_REQUIRES) register_component() diff --git a/components/lwip/CMakeLists.txt b/components/lwip/CMakeLists.txt index 2d362f288c..5878e64676 100644 --- a/components/lwip/CMakeLists.txt +++ b/components/lwip/CMakeLists.txt @@ -5,16 +5,94 @@ set(COMPONENT_ADD_INCLUDEDIRS apps/ping ) -if(CONFIG_PPP_SUPPORT) - set(LWIP_PPP_DIRS netif/ppp/polarssl netif/ppp) -endif() +set(COMPONENT_SRCS "api/api_lib.c" + "api/api_msg.c" + "api/err.c" + "api/netbuf.c" + "api/netdb.c" + "api/netifapi.c" + "api/pppapi.c" + "api/sockets.c" + "api/tcpip.c" + "apps/dhcpserver.c" + "apps/ping/esp_ping.c" + "apps/ping/ping.c" + "apps/sntp/sntp.c" + "core/def.c" + "core/dns.c" + "core/inet_chksum.c" + "core/init.c" + "core/ip.c" + "core/mem.c" + "core/memp.c" + "core/netif.c" + "core/pbuf.c" + "core/raw.c" + "core/stats.c" + "core/sys.c" + "core/tcp.c" + "core/tcp_in.c" + "core/tcp_out.c" + "core/timers.c" + "core/udp.c" + "core/ipv4/autoip.c" + "core/ipv4/dhcp.c" + "core/ipv4/icmp.c" + "core/ipv4/igmp.c" + "core/ipv4/ip4.c" + "core/ipv4/ip4_addr.c" + "core/ipv4/ip_frag.c" + "core/ipv6/dhcp6.c" + "core/ipv6/ethip6.c" + "core/ipv6/icmp6.c" + "core/ipv6/inet6.c" + "core/ipv6/ip6.c" + "core/ipv6/ip6_addr.c" + "core/ipv6/ip6_frag.c" + "core/ipv6/mld6.c" + "core/ipv6/nd6.c" + "netif/etharp.c" + "netif/ethernet.c" + "netif/ethernetif.c" + "netif/lowpan6.c" + "netif/slipif.c" + "port/vfs_lwip.c" + "port/debug/lwip_debug.c" + "port/freertos/sys_arch.c" + "port/netif/ethernetif.c" + "port/netif/wlanif.c") -set(COMPONENT_SRCDIRS - api - apps apps/sntp apps/ping - core core/ipv4 core/ipv6 - ${LWIP_PPP_DIRS} netif - port/freertos port/netif port/debug port) +if(CONFIG_PPP_SUPPORT) + list(APPEND COMPONENT_SRCS "netif/ppp/auth.c" + "netif/ppp/ccp.c" + "netif/ppp/chap-md5.c" + "netif/ppp/chap-new.c" + "netif/ppp/chap_ms.c" + "netif/ppp/demand.c" + "netif/ppp/eap.c" + "netif/ppp/ecp.c" + "netif/ppp/eui64.c" + "netif/ppp/fsm.c" + "netif/ppp/ipcp.c" + "netif/ppp/ipv6cp.c" + "netif/ppp/lcp.c" + "netif/ppp/magic.c" + "netif/ppp/mppe.c" + "netif/ppp/multilink.c" + "netif/ppp/ppp.c" + "netif/ppp/pppcrypt.c" + "netif/ppp/pppoe.c" + "netif/ppp/pppol2tp.c" + "netif/ppp/pppos.c" + "netif/ppp/upap.c" + "netif/ppp/utils.c" + "netif/ppp/vj.c" + "netif/ppp/polarssl/arc4.c" + "netif/ppp/polarssl/des.c" + "netif/ppp/polarssl/md4.c" + "netif/ppp/polarssl/md5.c" + "netif/ppp/polarssl/sha1.c") +endif() set(COMPONENT_REQUIRES vfs) set(COMPONENT_PRIV_REQUIRES ethernet tcpip_adapter) diff --git a/components/mbedtls/CMakeLists.txt b/components/mbedtls/CMakeLists.txt index ffac9fea8e..aca00dddb7 100644 --- a/components/mbedtls/CMakeLists.txt +++ b/components/mbedtls/CMakeLists.txt @@ -1,7 +1,90 @@ set(COMPONENT_ADD_INCLUDEDIRS port/include mbedtls/include) -set(COMPONENT_SRCDIRS mbedtls/library port) - -set(COMPONENT_SRCEXCLUDE mbedtls/library/net_sockets.c) +set(COMPONENT_SRCS "mbedtls/library/aes.c" + "mbedtls/library/aesni.c" + "mbedtls/library/arc4.c" + "mbedtls/library/aria.c" + "mbedtls/library/asn1parse.c" + "mbedtls/library/asn1write.c" + "mbedtls/library/base64.c" + "mbedtls/library/bignum.c" + "mbedtls/library/blowfish.c" + "mbedtls/library/camellia.c" + "mbedtls/library/ccm.c" + "mbedtls/library/certs.c" + "mbedtls/library/chacha20.c" + "mbedtls/library/chachapoly.c" + "mbedtls/library/cipher.c" + "mbedtls/library/cipher_wrap.c" + "mbedtls/library/cmac.c" + "mbedtls/library/ctr_drbg.c" + "mbedtls/library/debug.c" + "mbedtls/library/des.c" + "mbedtls/library/dhm.c" + "mbedtls/library/ecdh.c" + "mbedtls/library/ecdsa.c" + "mbedtls/library/ecjpake.c" + "mbedtls/library/ecp.c" + "mbedtls/library/ecp_curves.c" + "mbedtls/library/entropy.c" + "mbedtls/library/entropy_poll.c" + "mbedtls/library/error.c" + "mbedtls/library/gcm.c" + "mbedtls/library/havege.c" + "mbedtls/library/hkdf.c" + "mbedtls/library/hmac_drbg.c" + "mbedtls/library/md.c" + "mbedtls/library/md2.c" + "mbedtls/library/md4.c" + "mbedtls/library/md5.c" + "mbedtls/library/md_wrap.c" + "mbedtls/library/memory_buffer_alloc.c" + "mbedtls/library/net_sockets.c" + "mbedtls/library/nist_kw.c" + "mbedtls/library/oid.c" + "mbedtls/library/padlock.c" + "mbedtls/library/pem.c" + "mbedtls/library/pk.c" + "mbedtls/library/pk_wrap.c" + "mbedtls/library/pkcs11.c" + "mbedtls/library/pkcs12.c" + "mbedtls/library/pkcs5.c" + "mbedtls/library/pkparse.c" + "mbedtls/library/pkwrite.c" + "mbedtls/library/platform.c" + "mbedtls/library/platform_util.c" + "mbedtls/library/poly1305.c" + "mbedtls/library/ripemd160.c" + "mbedtls/library/rsa.c" + "mbedtls/library/rsa_internal.c" + "mbedtls/library/sha1.c" + "mbedtls/library/sha256.c" + "mbedtls/library/sha512.c" + "mbedtls/library/ssl_cache.c" + "mbedtls/library/ssl_ciphersuites.c" + "mbedtls/library/ssl_cli.c" + "mbedtls/library/ssl_cookie.c" + "mbedtls/library/ssl_srv.c" + "mbedtls/library/ssl_ticket.c" + "mbedtls/library/ssl_tls.c" + "mbedtls/library/threading.c" + "mbedtls/library/timing.c" + "mbedtls/library/version.c" + "mbedtls/library/version_features.c" + "mbedtls/library/x509.c" + "mbedtls/library/x509_create.c" + "mbedtls/library/x509_crl.c" + "mbedtls/library/x509_crt.c" + "mbedtls/library/x509_csr.c" + "mbedtls/library/x509write_crt.c" + "mbedtls/library/x509write_csr.c" + "mbedtls/library/xtea.c" + "port/esp_bignum.c" + "port/esp_hardware.c" + "port/esp_sha1.c" + "port/esp_sha256.c" + "port/esp_sha512.c" + "port/mbedtls_debug.c" + "port/net_sockets.c") set(COMPONENT_REQUIRES lwip) diff --git a/components/mdns/CMakeLists.txt b/components/mdns/CMakeLists.txt index 4ab6641109..0933e30059 100644 --- a/components/mdns/CMakeLists.txt +++ b/components/mdns/CMakeLists.txt @@ -1,4 +1,6 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "mdns.c" + "mdns_console.c" + "mdns_networking.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_PRIV_INCLUDEDIRS "private_include") set(COMPONENT_REQUIRES lwip mbedtls console tcpip_adapter) diff --git a/components/micro-ecc/CMakeLists.txt b/components/micro-ecc/CMakeLists.txt index 24e0a9e6f6..a0e1693b11 100644 --- a/components/micro-ecc/CMakeLists.txt +++ b/components/micro-ecc/CMakeLists.txt @@ -1,5 +1,5 @@ -# only compile the micro-ecc/uECC.c source file -set(COMPONENT_SRCS micro-ecc/uECC.c) +# only compile the "micro-ecc/uECC.c" source file +set(COMPONENT_SRCS "micro-ecc/uECC.c") set(COMPONENT_ADD_INCLUDEDIRS micro-ecc) diff --git a/components/newlib/CMakeLists.txt b/components/newlib/CMakeLists.txt index 4bc0db3f90..3a726da56e 100644 --- a/components/newlib/CMakeLists.txt +++ b/components/newlib/CMakeLists.txt @@ -1,4 +1,9 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "locks.c" + "reent_init.c" + "select.c" + "syscall_table.c" + "syscalls.c" + "time.c") set(COMPONENT_ADD_INCLUDEDIRS platform_include include) if(CONFIG_SPIRAM_CACHE_WORKAROUND) diff --git a/components/nghttp/CMakeLists.txt b/components/nghttp/CMakeLists.txt index c7e4b754b8..b1a4b16421 100644 --- a/components/nghttp/CMakeLists.txt +++ b/components/nghttp/CMakeLists.txt @@ -1,4 +1,26 @@ set(COMPONENT_ADD_INCLUDEDIRS port/include nghttp2/lib/includes) -set(COMPONENT_SRCDIRS nghttp2/lib port) +set(COMPONENT_SRCS "nghttp2/lib/nghttp2_buf.c" + "nghttp2/lib/nghttp2_callbacks.c" + "nghttp2/lib/nghttp2_debug.c" + "nghttp2/lib/nghttp2_frame.c" + "nghttp2/lib/nghttp2_hd.c" + "nghttp2/lib/nghttp2_hd_huffman.c" + "nghttp2/lib/nghttp2_hd_huffman_data.c" + "nghttp2/lib/nghttp2_helper.c" + "nghttp2/lib/nghttp2_http.c" + "nghttp2/lib/nghttp2_map.c" + "nghttp2/lib/nghttp2_mem.c" + "nghttp2/lib/nghttp2_npn.c" + "nghttp2/lib/nghttp2_option.c" + "nghttp2/lib/nghttp2_outbound_item.c" + "nghttp2/lib/nghttp2_pq.c" + "nghttp2/lib/nghttp2_priority_spec.c" + "nghttp2/lib/nghttp2_queue.c" + "nghttp2/lib/nghttp2_rcbuf.c" + "nghttp2/lib/nghttp2_session.c" + "nghttp2/lib/nghttp2_stream.c" + "nghttp2/lib/nghttp2_submit.c" + "nghttp2/lib/nghttp2_version.c" + "port/http_parser.c") register_component() diff --git a/components/nvs_flash/CMakeLists.txt b/components/nvs_flash/CMakeLists.txt index 1fe5ecf26e..ce7efbb14b 100644 --- a/components/nvs_flash/CMakeLists.txt +++ b/components/nvs_flash/CMakeLists.txt @@ -1,4 +1,9 @@ -set(COMPONENT_SRCDIRS src) +set(COMPONENT_SRCS "src/nvs_api.cpp" + "src/nvs_item_hash_list.cpp" + "src/nvs_page.cpp" + "src/nvs_pagemanager.cpp" + "src/nvs_storage.cpp" + "src/nvs_types.cpp") set(COMPONENT_ADD_INCLUDEDIRS include) set(COMPONENT_REQUIRES spi_flash) diff --git a/components/openssl/CMakeLists.txt b/components/openssl/CMakeLists.txt index 84d02ffe88..3a96598f01 100644 --- a/components/openssl/CMakeLists.txt +++ b/components/openssl/CMakeLists.txt @@ -1,6 +1,13 @@ set(COMPONENT_ADD_INCLUDEDIRS include) set(COMPONENT_PRIV_INCLUDEDIRS include/internal include/platform include/openssl) -set(COMPONENT_SRCDIRS library platform) +set(COMPONENT_SRCS "library/ssl_cert.c" + "library/ssl_lib.c" + "library/ssl_methods.c" + "library/ssl_pkey.c" + "library/ssl_stack.c" + "library/ssl_x509.c" + "platform/ssl_pm.c" + "platform/ssl_port.c") set(COMPONENT_REQUIRES mbedtls) diff --git a/components/pthread/CMakeLists.txt b/components/pthread/CMakeLists.txt index 0b93e09ed4..157793707f 100644 --- a/components/pthread/CMakeLists.txt +++ b/components/pthread/CMakeLists.txt @@ -1,4 +1,6 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "pthread.c" + "pthread_cond_var.c" + "pthread_local_storage.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_REQUIRES) register_component() diff --git a/components/sdmmc/CMakeLists.txt b/components/sdmmc/CMakeLists.txt index 58b9aeb679..beb6902038 100644 --- a/components/sdmmc/CMakeLists.txt +++ b/components/sdmmc/CMakeLists.txt @@ -1,4 +1,4 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "sdmmc_cmd.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_REQUIRES driver) register_component() diff --git a/components/smartconfig_ack/CMakeLists.txt b/components/smartconfig_ack/CMakeLists.txt index 8b18007dea..1518776ce9 100644 --- a/components/smartconfig_ack/CMakeLists.txt +++ b/components/smartconfig_ack/CMakeLists.txt @@ -1,4 +1,4 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "smartconfig_ack.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_PRIV_REQUIRES lwip tcpip_adapter) diff --git a/components/soc/CMakeLists.txt b/components/soc/CMakeLists.txt index b4c088edd7..6c6e5ee36b 100644 --- a/components/soc/CMakeLists.txt +++ b/components/soc/CMakeLists.txt @@ -1,9 +1,13 @@ set(SOC_NAME esp32) -set(COMPONENT_SRCDIRS ${SOC_NAME}) +set(COMPONENT_ADD_INCLUDEDIRS ${SOC_NAME}/include include) + +include(${IDF_PATH}/components/soc/${SOC_NAME}/sources.cmake) + +spaces2list(SOC_SRCS) +add_prefix(COMPONENT_SRCS "${SOC_NAME}/" ${SOC_SRCS}) + set(COMPONENT_ADD_INCLUDEDIRS ${SOC_NAME}/include include) set(COMPONENT_REQUIRES) - - -register_component() +register_component() \ No newline at end of file diff --git a/components/soc/esp32/sources.cmake b/components/soc/esp32/sources.cmake new file mode 100644 index 0000000000..9b6cc28f5c --- /dev/null +++ b/components/soc/esp32/sources.cmake @@ -0,0 +1,10 @@ +set(SOC_SRCS "cpu_util.c" + "gpio_periph.c" + "rtc_clk.c" + "rtc_init.c" + "rtc_periph.c" + "rtc_pm.c" + "rtc_sleep.c" + "rtc_time.c" + "soc_memory_layout.c" + "spi_periph.c") diff --git a/components/spi_flash/CMakeLists.txt b/components/spi_flash/CMakeLists.txt index 1eafba54d4..0445b53347 100644 --- a/components/spi_flash/CMakeLists.txt +++ b/components/spi_flash/CMakeLists.txt @@ -1,10 +1,14 @@ if(BOOTLOADER_BUILD) # Bootloader needs SPIUnlock from this file, but doesn't # need other parts of this component - set(COMPONENT_SRCS spi_flash_rom_patch.c) + set(COMPONENT_SRCS "spi_flash_rom_patch.c") set(COMPONENT_PRIV_REQUIRES bootloader_support) else() - set(COMPONENT_SRCDIRS .) + set(COMPONENT_SRCS "cache_utils.c" + "flash_mmap.c" + "flash_ops.c" + "partition.c" + "spi_flash_rom_patch.c") set(COMPONENT_PRIV_REQUIRES bootloader_support app_update) endif() diff --git a/components/spiffs/CMakeLists.txt b/components/spiffs/CMakeLists.txt index 54356cb0d6..c0903655d8 100644 --- a/components/spiffs/CMakeLists.txt +++ b/components/spiffs/CMakeLists.txt @@ -1,6 +1,12 @@ set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_PRIV_INCLUDEDIRS "." "spiffs/src") -set(COMPONENT_SRCDIRS "." "spiffs/src") +set(COMPONENT_SRCS "esp_spiffs.c" + "spiffs/src/spiffs_cache.c" + "spiffs/src/spiffs_check.c" + "spiffs/src/spiffs_gc.c" + "spiffs/src/spiffs_hydrogen.c" + "spiffs/src/spiffs_nucleus.c" + "spiffs_api.c") set(COMPONENT_REQUIRES spi_flash) set(COMPONENT_PRIV_REQUIRES bootloader_support) diff --git a/components/tcpip_adapter/CMakeLists.txt b/components/tcpip_adapter/CMakeLists.txt index 24deb2f247..2868696ac7 100644 --- a/components/tcpip_adapter/CMakeLists.txt +++ b/components/tcpip_adapter/CMakeLists.txt @@ -1,4 +1,4 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "tcpip_adapter_lwip.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_REQUIRES lwip) diff --git a/components/ulp/CMakeLists.txt b/components/ulp/CMakeLists.txt index fc21f1ecac..9c71467b39 100644 --- a/components/ulp/CMakeLists.txt +++ b/components/ulp/CMakeLists.txt @@ -1,4 +1,5 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "ulp.c" + "ulp_macro.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_REQUIRES) diff --git a/components/vfs/CMakeLists.txt b/components/vfs/CMakeLists.txt index fc21f1ecac..77083dc202 100644 --- a/components/vfs/CMakeLists.txt +++ b/components/vfs/CMakeLists.txt @@ -1,4 +1,5 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "vfs.c" + "vfs_uart.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_REQUIRES) diff --git a/components/wear_levelling/CMakeLists.txt b/components/wear_levelling/CMakeLists.txt index 8b5db6231d..59b81ccfaa 100644 --- a/components/wear_levelling/CMakeLists.txt +++ b/components/wear_levelling/CMakeLists.txt @@ -1,4 +1,10 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "Partition.cpp" + "SPI_Flash.cpp" + "WL_Ext_Perf.cpp" + "WL_Ext_Safe.cpp" + "WL_Flash.cpp" + "crc32.cpp" + "wear_levelling.cpp") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_PRIV_INCLUDEDIRS private_include) set(COMPONENT_REQUIRES spi_flash) diff --git a/components/wpa_supplicant/CMakeLists.txt b/components/wpa_supplicant/CMakeLists.txt index 2f63ff398f..8564f1ba02 100644 --- a/components/wpa_supplicant/CMakeLists.txt +++ b/components/wpa_supplicant/CMakeLists.txt @@ -1,4 +1,76 @@ -set(COMPONENT_SRCDIRS src/crypto port src/fast_crypto src/wpa2/eap_peer src/wpa2/tls src/wpa2/utils src/wps) +set(COMPONENT_SRCS "port/os_xtensa.c" + "src/crypto/aes-cbc.c" + "src/crypto/aes-internal-dec.c" + "src/crypto/aes-internal-enc.c" + "src/crypto/aes-internal.c" + "src/crypto/aes-unwrap.c" + "src/crypto/aes-wrap.c" + "src/crypto/bignum.c" + "src/crypto/crypto_internal-cipher.c" + "src/crypto/crypto_internal-modexp.c" + "src/crypto/crypto_internal-rsa.c" + "src/crypto/crypto_internal.c" + "src/crypto/des-internal.c" + "src/crypto/dh_group5.c" + "src/crypto/dh_groups.c" + "src/crypto/md4-internal.c" + "src/crypto/md5-internal.c" + "src/crypto/md5.c" + "src/crypto/ms_funcs.c" + "src/crypto/rc4.c" + "src/crypto/sha1-internal.c" + "src/crypto/sha1-pbkdf2.c" + "src/crypto/sha1.c" + "src/crypto/sha256-internal.c" + "src/crypto/sha256.c" + "src/fast_crypto/fast_aes-cbc.c" + "src/fast_crypto/fast_aes-unwrap.c" + "src/fast_crypto/fast_aes-wrap.c" + "src/fast_crypto/fast_crypto_internal-cipher.c" + "src/fast_crypto/fast_crypto_internal-modexp.c" + "src/fast_crypto/fast_crypto_internal.c" + "src/fast_crypto/fast_sha256-internal.c" + "src/fast_crypto/fast_sha256.c" + "src/wpa2/eap_peer/chap.c" + "src/wpa2/eap_peer/eap.c" + "src/wpa2/eap_peer/eap_common.c" + "src/wpa2/eap_peer/eap_mschapv2.c" + "src/wpa2/eap_peer/eap_peap.c" + "src/wpa2/eap_peer/eap_peap_common.c" + "src/wpa2/eap_peer/eap_tls.c" + "src/wpa2/eap_peer/eap_tls_common.c" + "src/wpa2/eap_peer/eap_ttls.c" + "src/wpa2/eap_peer/mschapv2.c" + "src/wpa2/tls/asn1.c" + "src/wpa2/tls/bignum.c" + "src/wpa2/tls/pkcs1.c" + "src/wpa2/tls/pkcs5.c" + "src/wpa2/tls/pkcs8.c" + "src/wpa2/tls/rsa.c" + "src/wpa2/tls/tls_internal.c" + "src/wpa2/tls/tlsv1_client.c" + "src/wpa2/tls/tlsv1_client_read.c" + "src/wpa2/tls/tlsv1_client_write.c" + "src/wpa2/tls/tlsv1_common.c" + "src/wpa2/tls/tlsv1_cred.c" + "src/wpa2/tls/tlsv1_record.c" + "src/wpa2/tls/tlsv1_server.c" + "src/wpa2/tls/tlsv1_server_read.c" + "src/wpa2/tls/tlsv1_server_write.c" + "src/wpa2/tls/x509v3.c" + "src/wpa2/utils/base64.c" + "src/wpa2/utils/ext_password.c" + "src/wps/eap_common.c" + "src/wps/uuid.c" + "src/wps/wps.c" + "src/wps/wps_attr_build.c" + "src/wps/wps_attr_parse.c" + "src/wps/wps_attr_process.c" + "src/wps/wps_common.c" + "src/wps/wps_dev_attr.c" + "src/wps/wps_enrollee.c" + "src/wps/wps_registrar.c" + "src/wps/wps_validate.c") set(COMPONENT_ADD_INCLUDEDIRS include port/include) set(COMPONENT_REQUIRES "") diff --git a/components/xtensa-debug-module/CMakeLists.txt b/components/xtensa-debug-module/CMakeLists.txt index 810d299d13..465690d822 100644 --- a/components/xtensa-debug-module/CMakeLists.txt +++ b/components/xtensa-debug-module/CMakeLists.txt @@ -1,4 +1,5 @@ -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "eri.c" + "trax.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_REQUIRES "") diff --git a/docs/en/api-guides/build-system-cmake.rst b/docs/en/api-guides/build-system-cmake.rst index b7aae2ddaa..b4a0d007a8 100644 --- a/docs/en/api-guides/build-system-cmake.rst +++ b/docs/en/api-guides/build-system-cmake.rst @@ -170,14 +170,14 @@ An example project directory tree might look like this:: This example "myProject" contains the following elements: -- A top-level project CMakeLists.txt file. This is the primary file which CMake uses to learn how to build the project. The project CMakeLists.txt file sets the ``MAIN_SRCS`` variable which lists all of the source files in the "main" directory (part of this project's executable). It may set other project-wide CMake variables, as well. Then it includes the file :idf_file:`/tools/cmake/project.cmake` which +- A top-level project CMakeLists.txt file. This is the primary file which CMake uses to learn how to build the project; and may set project-wide CMake variables. It includes the file :idf_file:`/tools/cmake/project.cmake` which implements the rest of the build system. Finally, it sets the project name and defines the project. - "sdkconfig" project configuration file. This file is created/updated when ``idf.py menuconfig`` runs, and holds configuration for all of the components in the project (including ESP-IDF itself). The "sdkconfig" file may or may not be added to the source control system of the project. - Optional "components" directory contains components that are part of the project. A project does not have to contain custom components of this kind, but it can be useful for structuring reusable code or including third party components that aren't part of ESP-IDF. -- "main" directory is a special "by convention" directory that contains source code for the project executable itself. These source files are listed in the project's CMakeLists file. You don't need to name this directory "main", but we recommend you follow this convention. If you have a lot of source files in your project, we recommend grouping most into components instead of putting them all in "main". +- "main" directory is a special "pseudo-component" that contains source code for the project itself. "main" is a default name, the CMake variable ``COMPONENT_DIRS`` includes this component but you can modify this variable (or set ``EXTRA_COMPONENT_DIRS`` in the top-level CMakeLists.txt) to look for components in other places. If you have a lot of source files in your project, we recommend grouping most into components instead of putting them all in "main". - "build" directory is where build output is created. This directory is created by ``idf.py`` if it doesn't already exist. CMake configures the project and generates interim build files in this directory. Then, after the main build process is run, this directory will also contain interim object files and libraries as well as final binary output files. This directory is usually not added to source control or distributed with the project source code. @@ -200,8 +200,6 @@ Minimal project:: cmake_minimum_required(VERSION 3.5) - set(MAIN_SRCS main/src1.c main/src2.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(myProject) @@ -214,11 +212,6 @@ Mandatory Parts The inclusion of these four lines, in the order shown above, is necessary for every project: - ``cmake_minimum_required(VERSION 3.5)`` tells CMake what version is required to build the project. ESP-IDF is designed to work with CMake 3.5 or newer. This line must be the first line in the CMakeLists.txt file. -- ``set(MAIN_SRCS xxx)`` sets a variable - ``MAIN_SRCS`` to be a list of the "main" source files in the project. Paths are relative to the CMakeLists. They don't specifically need to be under the "main" sub-directory, but this structure is encouraged. - - It is *strongly recommended not to add a lot of files to the MAIN_SRCS list*. If you have a lot of source files then it recommended to organise them functionally into individual components under the project "components" directory. This will make your project more maintainable, reusable, and easier to configure. Components are further explained below. - - ``MAIN_SRCS`` must name at least one source file (although that file doesn't need to necessarily include an ``app_main()`` function or anything else). - ``include($ENV{IDF_PATH}/tools/cmake/project.cmake)`` pulls in the rest of the CMake functionality to configure the project, discover all the components, etc. - ``project(myProject)`` creates the project itself, and specifies the project name. The project name is used for the final binary output files of the app - ie ``myProject.elf``, ``myProject.bin``. Only one project can be defined per CMakeLists file. @@ -268,11 +261,11 @@ Minimal Component CMakeLists The minimal component ``CMakeLists.txt`` file is as follows:: - set(COMPONENT_SRCDIRS ".") + set(COMPONENT_SRCS "foo.c") set(COMPONENT_ADD_INCLUDEDIRS "include") register_component() -- ``COMPONENT_SRCDIRS`` is a (space-separated) list of directories to search for source files. Source files (``*.c``, ``*.cpp``, ``*.cc``, ``*.S``) in these directories will be compiled into the component library. +- ``COMPONENT_SRCS`` is a (space-separated) list of source files (``*.c``, ``*.cpp``, ``*.cc``, ``*.S``). These source files will be compiled into the component library. - ``COMPONENT_ADD_INCLUDEDIRS`` is a (space-separated) list of directories to add to the global include search path for any component which requires this component, and also the main source files. - ``register_component()`` is required to add the component (using the variables set above) to the build. A library with the name of the component will be built and linked into the final app. If this step is skipped (perhaps due to use of a CMake `if function `_ or similar), this component will not be part of the build. @@ -320,12 +313,17 @@ The following variables can be set inside ``component.mk`` to control the build the component directory, which will be added to the include search path for this component's source files only. - ``COMPONENT_PRIV_REQUIRES`` is a (space-separated) list of components that are required to either compile or link this component's source files. These components' header paths do not propagate to other components which require it, they are only used to compile this component's sources. See `Component Requirements`_ for more details. +- ``COMPONENT_SRCS``: Paths to individual source files to compile as part of the component. This is the recommended way of adding source files to the build. - ``COMPONENT_SRCDIRS``: Directory paths, must be relative to the component directory, which will be searched for source files (``*.cpp``, - ``*.c``, ``*.S``). Set this to specify a list of directories which contain source files. -- ``COMPONENT_SRCS``: Paths to individual source files to compile. Setting this causes ``COMPONENT_SRCDIRS`` to be ignored. Setting this variable instead gives you finer grained control over which files are compiled. - If you don't set ``COMPONENT_SRCDIRS`` or ``COMPONENT_SRCS``, your component won't compile a library but it may still add include paths for use when compiling other components or the source files listed in ``MAIN_SRCS``. + ``*.c``, ``*.S``). Source files are globbed from the listed directories and compiled as part of the component in place of ``COMPONENT_SRCS``, i.e. setting this will cause ``COMPONENT_SRCS`` to be ignored. + This can be a convenient way of including source files to the components en masse, but is generally not recommended due to caveats attached to CMake globbing (see `File Globbing & Incremental Builds`). - ``COMPONENT_SRCEXCLUDE``: Paths to source files to exclude from component. Can be set in conjunction with ``COMPONENT_SRCDIRS`` if there is a directory with a large number of source files to include in the component but one or more source files which should not be. Paths can be specified relative to the component directory or absolute. +.. note:: + + If you don't set ``COMPONENT_SRCDIRS`` or ``COMPONENT_SRCS``, your component won't compile a library but it may still add include paths for use when compiling other components. + + Controlling Component Compilation --------------------------------- @@ -399,7 +397,6 @@ When creating a project - Those components' requirements (evaluated recursively). - The "common" components that every component depends on. - Setting ``COMPONENTS`` to the minimal list of required components can significantly reduce compile times. -- When compiling the project's source files (``MAIN_SRCS``), the public header directories (``COMPONENT_ADD_INCLUDEDIRS`` list) of all components included in the build are available. .. _component-requirements-implementation: @@ -760,22 +757,20 @@ File Globbing & Incremental Builds .. highlight:: cmake -The preferred way to include source files in an ESP-IDF component is to set ``COMPONENT_SRC_DIRS``:: - - set(COMPONENT_SRCDIRS library platform) - -The build system will automatically find (via "file globbing") all source files in this directory. Alternatively, files can be specified individually:: +The preferred way to include source files in an ESP-IDF component is to list them manually in COMPONENT_SRCS:: set(COMPONENT_SRCS library/a.c library/b.c platform/platform.c) -CMake_ recommends always to name all files individually (ie ``COMPONENT_SRCS``). This is because CMake is automatically re-run whenever a CMakeLists file changes. If a new source file is added and file globbing is used, then CMake won't know to automatically re-run and this file won't be added to the build. +This preference reflects the `CMake best practice `_ of manually listing source files. This could, however, be inconvenient when there are lots of source files to add to the build. The ESP-IDF build system provides an alternative way for specifying source files using ``COMPONENT_SRCDIRS``:: + + set(COMPONENT_SRCDIRS library platform) + +This uses globbing behind the scenes to find source files in the specified directories. Be aware, however, that if a new source file is added and this method is used, then CMake won't know to automatically re-run and this file won't be added to the build. The trade-off is acceptable when you're adding the file yourself, because you can trigger a clean build or run ``idf.py reconfigure`` to manually re-run CMake_. However, the problem gets harder when you share your project with others who may check out a new version using a source control tool like Git... For components which are part of ESP-IDF, we use a third party Git CMake integration module (:idf_file:`/tools/cmake/third_party/GetGitRevisionDescription.cmake`) which automatically re-runs CMake any time the repository commit changes. This means if you check out a new ESP-IDF version, CMake will automatically rerun. -For project CMakeLists files, ``MAIN_SRCS`` is a list of source files. Therefore if a new file is added, CMakeLists will change and this triggers a re-run of CMake. (This is the approach which CMake_ recommends.) - For project components (not part of ESP-IDF), there are a few different options: - If keeping your project file in Git, ESP-IDF will automatically track the Git revision and re-run CMake if the revision changes. @@ -872,15 +867,6 @@ It does so by running ``make`` to expand the ESP-IDF build system variables whic The conversion tool is not capable of dealing with complex Makefile logic or unusual targets. These will need to be converted by hand. -'main' is no longer a component -------------------------------- - -In the GNU Make build system ``main`` is a component with a ``component.mk`` file like other components. - -Due to CMake requirements for building executables, ``main`` source files are now linked directly into the final binary. The source files in ``main`` must be listed in the ``MAIN_SRCS`` variable (see :ref:`project mandatory variables ` for more details). At least one source file has to be listed here (although it doesn't need to contain anything in particular). - -In general, it's better not to have too many source files in ``MAIN_SRCS``. If you find that you are adding many source files here, see if you can reorganize and group some into project components (see the :ref:`example project structure `, above). - No Longer Available in CMake ---------------------------- @@ -913,8 +899,7 @@ The following variables no longer have default values: No Longer Necessary ------------------- -It is no longer necessary to set ``COMPONENT_SRCDIRS`` if setting ``COMPONENT_SRCS`` (in fact, in the CMake-based system ``COMPONENT_SRCDIRS`` is ignored if ``COMPONENT_SRCS`` is set). - +It is no longer necessary to set ``COMPONENT_SRCDIRS`` if setting ``COMPONENT_SRCS`` (in fact, in the CMake-based system ``COMPONENT_SRCS`` is ignored if ``COMPONENT_SRCDIRS`` is set). .. _esp-idf-template: https://github.com/espressif/esp-idf-template .. _cmake: https://cmake.org diff --git a/examples/bluetooth/a2dp_gatts_coex/CMakeLists.txt b/examples/bluetooth/a2dp_gatts_coex/CMakeLists.txt index 3243515f39..3c9fa474c1 100644 --- a/examples/bluetooth/a2dp_gatts_coex/CMakeLists.txt +++ b/examples/bluetooth/a2dp_gatts_coex/CMakeLists.txt @@ -2,11 +2,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS - main/bt_app_av.c - main/bt_app_core.c - main/main.c - ) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(bt_ble_coex) diff --git a/examples/bluetooth/a2dp_gatts_coex/main/CMakeLists.txt b/examples/bluetooth/a2dp_gatts_coex/main/CMakeLists.txt new file mode 100644 index 0000000000..a55538b5fb --- /dev/null +++ b/examples/bluetooth/a2dp_gatts_coex/main/CMakeLists.txt @@ -0,0 +1,6 @@ +set(COMPONENT_SRCS "bt_app_av.c" + "bt_app_core.c" + "main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/a2dp_sink/CMakeLists.txt b/examples/bluetooth/a2dp_sink/CMakeLists.txt index 4d14857a02..cc8e45027d 100644 --- a/examples/bluetooth/a2dp_sink/CMakeLists.txt +++ b/examples/bluetooth/a2dp_sink/CMakeLists.txt @@ -2,11 +2,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS - main/bt_app_av.c - main/bt_app_core.c - main/main.c - ) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(a2dp_sink) diff --git a/examples/bluetooth/a2dp_sink/main/CMakeLists.txt b/examples/bluetooth/a2dp_sink/main/CMakeLists.txt new file mode 100644 index 0000000000..a55538b5fb --- /dev/null +++ b/examples/bluetooth/a2dp_sink/main/CMakeLists.txt @@ -0,0 +1,6 @@ +set(COMPONENT_SRCS "bt_app_av.c" + "bt_app_core.c" + "main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/a2dp_source/CMakeLists.txt b/examples/bluetooth/a2dp_source/CMakeLists.txt index 1b4c447998..7c4e215288 100644 --- a/examples/bluetooth/a2dp_source/CMakeLists.txt +++ b/examples/bluetooth/a2dp_source/CMakeLists.txt @@ -2,10 +2,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS - main/bt_app_core.c - main/main.c - ) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(a2dp_source) diff --git a/examples/bluetooth/a2dp_source/main/CMakeLists.txt b/examples/bluetooth/a2dp_source/main/CMakeLists.txt new file mode 100644 index 0000000000..98b05a101b --- /dev/null +++ b/examples/bluetooth/a2dp_source/main/CMakeLists.txt @@ -0,0 +1,5 @@ +set(COMPONENT_SRCS "bt_app_core.c" + "main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/ble_adv/CMakeLists.txt b/examples/bluetooth/ble_adv/CMakeLists.txt index 04715a8583..22b94847f6 100644 --- a/examples/bluetooth/ble_adv/CMakeLists.txt +++ b/examples/bluetooth/ble_adv/CMakeLists.txt @@ -2,9 +2,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS - main/app_bt.c - ) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ble_adv) diff --git a/examples/bluetooth/ble_adv/main/CMakeLists.txt b/examples/bluetooth/ble_adv/main/CMakeLists.txt new file mode 100644 index 0000000000..d005e60123 --- /dev/null +++ b/examples/bluetooth/ble_adv/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "app_bt.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/ble_eddystone/CMakeLists.txt b/examples/bluetooth/ble_eddystone/CMakeLists.txt index 05d77c7c6f..9c5943ef06 100644 --- a/examples/bluetooth/ble_eddystone/CMakeLists.txt +++ b/examples/bluetooth/ble_eddystone/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/esp_eddystone_api.c main/esp_eddystone_demo.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ble_eddystone_demo) diff --git a/examples/bluetooth/ble_eddystone/main/CMakeLists.txt b/examples/bluetooth/ble_eddystone/main/CMakeLists.txt new file mode 100644 index 0000000000..66a4e1aa6c --- /dev/null +++ b/examples/bluetooth/ble_eddystone/main/CMakeLists.txt @@ -0,0 +1,5 @@ +set(COMPONENT_SRCS "esp_eddystone_api.c" + "esp_eddystone_demo.c") +set(COMPONENT_ADD_INCLUDEDIRS "") + +register_component() diff --git a/examples/bluetooth/ble_hid_device_demo/CMakeLists.txt b/examples/bluetooth/ble_hid_device_demo/CMakeLists.txt index 9cacc34898..f8c948007c 100644 --- a/examples/bluetooth/ble_hid_device_demo/CMakeLists.txt +++ b/examples/bluetooth/ble_hid_device_demo/CMakeLists.txt @@ -1,11 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/ble_hidd_demo_main.c - main/hid_dev.c - main/hid_device_le_prf.c - main/esp_hidd_prf_api.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(hidd_demos) diff --git a/examples/bluetooth/ble_hid_device_demo/main/CMakeLists.txt b/examples/bluetooth/ble_hid_device_demo/main/CMakeLists.txt new file mode 100644 index 0000000000..cada4eb3cd --- /dev/null +++ b/examples/bluetooth/ble_hid_device_demo/main/CMakeLists.txt @@ -0,0 +1,7 @@ +set(COMPONENT_SRCS "ble_hidd_demo_main.c" + "esp_hidd_prf_api.c" + "hid_dev.c" + "hid_device_le_prf.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/ble_ibeacon/CMakeLists.txt b/examples/bluetooth/ble_ibeacon/CMakeLists.txt index 5eb1d7363e..dce22425d5 100644 --- a/examples/bluetooth/ble_ibeacon/CMakeLists.txt +++ b/examples/bluetooth/ble_ibeacon/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/ibeacon_demo.c main/esp_ibeacon_api.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ble_ibeacon_demo) diff --git a/examples/bluetooth/ble_ibeacon/main/CMakeLists.txt b/examples/bluetooth/ble_ibeacon/main/CMakeLists.txt new file mode 100644 index 0000000000..1ae1a02e64 --- /dev/null +++ b/examples/bluetooth/ble_ibeacon/main/CMakeLists.txt @@ -0,0 +1,5 @@ +set(COMPONENT_SRCS "esp_ibeacon_api.c" + "ibeacon_demo.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/ble_spp_client/CMakeLists.txt b/examples/bluetooth/ble_spp_client/CMakeLists.txt index 93abbbfb3a..301d8408e7 100644 --- a/examples/bluetooth/ble_spp_client/CMakeLists.txt +++ b/examples/bluetooth/ble_spp_client/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/spp_client_demo.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(spp_client_demo) diff --git a/examples/bluetooth/ble_spp_client/main/CMakeLists.txt b/examples/bluetooth/ble_spp_client/main/CMakeLists.txt new file mode 100644 index 0000000000..de584f3977 --- /dev/null +++ b/examples/bluetooth/ble_spp_client/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "spp_client_demo.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/ble_spp_server/CMakeLists.txt b/examples/bluetooth/ble_spp_server/CMakeLists.txt index c0508f8018..b4dcebe6af 100644 --- a/examples/bluetooth/ble_spp_server/CMakeLists.txt +++ b/examples/bluetooth/ble_spp_server/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/ble_spp_server_demo.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ble_spp_server_demo) diff --git a/examples/bluetooth/ble_spp_server/main/CMakeLists.txt b/examples/bluetooth/ble_spp_server/main/CMakeLists.txt new file mode 100644 index 0000000000..99f35ee072 --- /dev/null +++ b/examples/bluetooth/ble_spp_server/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "ble_spp_server_demo.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/ble_throughput/throughput_client/CMakeLists.txt b/examples/bluetooth/ble_throughput/throughput_client/CMakeLists.txt index c557a916ef..3a592ef4f0 100644 --- a/examples/bluetooth/ble_throughput/throughput_client/CMakeLists.txt +++ b/examples/bluetooth/ble_throughput/throughput_client/CMakeLists.txt @@ -2,9 +2,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS - main/example_ble_client_throughput.c - ) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(throughput_client_demo) diff --git a/examples/bluetooth/ble_throughput/throughput_client/main/CMakeLists.txt b/examples/bluetooth/ble_throughput/throughput_client/main/CMakeLists.txt new file mode 100644 index 0000000000..1fe275526d --- /dev/null +++ b/examples/bluetooth/ble_throughput/throughput_client/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "example_ble_client_throughput.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/ble_throughput/throughput_server/CMakeLists.txt b/examples/bluetooth/ble_throughput/throughput_server/CMakeLists.txt index 8d3bd0cbb1..adcc12d731 100644 --- a/examples/bluetooth/ble_throughput/throughput_server/CMakeLists.txt +++ b/examples/bluetooth/ble_throughput/throughput_server/CMakeLists.txt @@ -2,9 +2,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS - main/example_ble_server_throughput.c - ) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(throughput_server_demo) diff --git a/examples/bluetooth/ble_throughput/throughput_server/main/CMakeLists.txt b/examples/bluetooth/ble_throughput/throughput_server/main/CMakeLists.txt new file mode 100644 index 0000000000..3c1f62ac89 --- /dev/null +++ b/examples/bluetooth/ble_throughput/throughput_server/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "example_ble_server_throughput.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/blufi/CMakeLists.txt b/examples/bluetooth/blufi/CMakeLists.txt index e016e161a3..b85d34bbbf 100644 --- a/examples/bluetooth/blufi/CMakeLists.txt +++ b/examples/bluetooth/blufi/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/blufi_security.c main/blufi_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(blufi_demo) diff --git a/examples/bluetooth/blufi/main/CMakeLists.txt b/examples/bluetooth/blufi/main/CMakeLists.txt new file mode 100644 index 0000000000..cbb9b24c36 --- /dev/null +++ b/examples/bluetooth/blufi/main/CMakeLists.txt @@ -0,0 +1,5 @@ +set(COMPONENT_SRCS "blufi_example_main.c" + "blufi_security.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/bt_discovery/CMakeLists.txt b/examples/bluetooth/bt_discovery/CMakeLists.txt index b79d221bdd..6b73adc360 100644 --- a/examples/bluetooth/bt_discovery/CMakeLists.txt +++ b/examples/bluetooth/bt_discovery/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/bt_discovery.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(bt_discovery) diff --git a/examples/bluetooth/bt_discovery/main/CMakeLists.txt b/examples/bluetooth/bt_discovery/main/CMakeLists.txt new file mode 100644 index 0000000000..68ddbfb4c8 --- /dev/null +++ b/examples/bluetooth/bt_discovery/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "bt_discovery.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/bt_spp_acceptor/CMakeLists.txt b/examples/bluetooth/bt_spp_acceptor/CMakeLists.txt index 5ed97b3876..8b26ee3f56 100644 --- a/examples/bluetooth/bt_spp_acceptor/CMakeLists.txt +++ b/examples/bluetooth/bt_spp_acceptor/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/example_spp_acceptor_demo.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(bt_spp_acceptor_demo) diff --git a/examples/bluetooth/bt_spp_acceptor/main/CMakeLists.txt b/examples/bluetooth/bt_spp_acceptor/main/CMakeLists.txt new file mode 100644 index 0000000000..0694503f92 --- /dev/null +++ b/examples/bluetooth/bt_spp_acceptor/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "example_spp_acceptor_demo.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/bt_spp_initiator/CMakeLists.txt b/examples/bluetooth/bt_spp_initiator/CMakeLists.txt index fc8eb551bb..4ee5f07788 100644 --- a/examples/bluetooth/bt_spp_initiator/CMakeLists.txt +++ b/examples/bluetooth/bt_spp_initiator/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/example_spp_initiator_demo.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(bt_spp_initiator_demo) diff --git a/examples/bluetooth/bt_spp_initiator/main/CMakeLists.txt b/examples/bluetooth/bt_spp_initiator/main/CMakeLists.txt new file mode 100644 index 0000000000..1eae1b74c9 --- /dev/null +++ b/examples/bluetooth/bt_spp_initiator/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "example_spp_initiator_demo.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/bt_spp_vfs_acceptor/CMakeLists.txt b/examples/bluetooth/bt_spp_vfs_acceptor/CMakeLists.txt index b37ab5f683..46030210a0 100644 --- a/examples/bluetooth/bt_spp_vfs_acceptor/CMakeLists.txt +++ b/examples/bluetooth/bt_spp_vfs_acceptor/CMakeLists.txt @@ -1,10 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS - main/example_spp_vfs_acceptor_demo.c - main/spp_task.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(bt_spp_vfs_acceptor_demo) diff --git a/examples/bluetooth/bt_spp_vfs_acceptor/main/CMakeLists.txt b/examples/bluetooth/bt_spp_vfs_acceptor/main/CMakeLists.txt new file mode 100644 index 0000000000..b224db80b6 --- /dev/null +++ b/examples/bluetooth/bt_spp_vfs_acceptor/main/CMakeLists.txt @@ -0,0 +1,5 @@ +set(COMPONENT_SRCS "example_spp_vfs_acceptor_demo.c" + "spp_task.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/bt_spp_vfs_initiator/CMakeLists.txt b/examples/bluetooth/bt_spp_vfs_initiator/CMakeLists.txt index 94c7b230de..a133903920 100644 --- a/examples/bluetooth/bt_spp_vfs_initiator/CMakeLists.txt +++ b/examples/bluetooth/bt_spp_vfs_initiator/CMakeLists.txt @@ -1,10 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS - main/example_spp_vfs_initiator_demo.c - main/spp_task.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(bt_spp_vfs_initiator_demo) diff --git a/examples/bluetooth/bt_spp_vfs_initiator/main/CMakeLists.txt b/examples/bluetooth/bt_spp_vfs_initiator/main/CMakeLists.txt new file mode 100644 index 0000000000..f3b9111353 --- /dev/null +++ b/examples/bluetooth/bt_spp_vfs_initiator/main/CMakeLists.txt @@ -0,0 +1,5 @@ +set(COMPONENT_SRCS "example_spp_vfs_initiator_demo.c" + "spp_task.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/controller_hci_uart/CMakeLists.txt b/examples/bluetooth/controller_hci_uart/CMakeLists.txt index 0c7fcbdd94..49c95f4da4 100644 --- a/examples/bluetooth/controller_hci_uart/CMakeLists.txt +++ b/examples/bluetooth/controller_hci_uart/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/controller_hci_uart_demo.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(controller_hci_uart) diff --git a/examples/bluetooth/controller_hci_uart/main/CMakeLists.txt b/examples/bluetooth/controller_hci_uart/main/CMakeLists.txt new file mode 100644 index 0000000000..2f40a64c69 --- /dev/null +++ b/examples/bluetooth/controller_hci_uart/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "controller_hci_uart_demo.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/gatt_client/CMakeLists.txt b/examples/bluetooth/gatt_client/CMakeLists.txt index 5e41444abb..d32eb6bee1 100644 --- a/examples/bluetooth/gatt_client/CMakeLists.txt +++ b/examples/bluetooth/gatt_client/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/gattc_demo.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(gatt_client_demo) diff --git a/examples/bluetooth/gatt_client/main/CMakeLists.txt b/examples/bluetooth/gatt_client/main/CMakeLists.txt new file mode 100644 index 0000000000..7c79edceaa --- /dev/null +++ b/examples/bluetooth/gatt_client/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "gattc_demo.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/gatt_security_client/CMakeLists.txt b/examples/bluetooth/gatt_security_client/CMakeLists.txt index 787f0b7630..8f468d7644 100644 --- a/examples/bluetooth/gatt_security_client/CMakeLists.txt +++ b/examples/bluetooth/gatt_security_client/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/example_ble_sec_gattc_demo.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(sec_gattc_demo) diff --git a/examples/bluetooth/gatt_security_client/main/CMakeLists.txt b/examples/bluetooth/gatt_security_client/main/CMakeLists.txt new file mode 100644 index 0000000000..32cea7e2e3 --- /dev/null +++ b/examples/bluetooth/gatt_security_client/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "example_ble_sec_gattc_demo.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/gatt_security_server/CMakeLists.txt b/examples/bluetooth/gatt_security_server/CMakeLists.txt index d232d02b31..8e9d61ff9f 100644 --- a/examples/bluetooth/gatt_security_server/CMakeLists.txt +++ b/examples/bluetooth/gatt_security_server/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/example_ble_sec_gatts_demo.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(sec_gatts_demo) diff --git a/examples/bluetooth/gatt_security_server/main/CMakeLists.txt b/examples/bluetooth/gatt_security_server/main/CMakeLists.txt new file mode 100644 index 0000000000..87df03c692 --- /dev/null +++ b/examples/bluetooth/gatt_security_server/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "example_ble_sec_gatts_demo.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/gatt_server/CMakeLists.txt b/examples/bluetooth/gatt_server/CMakeLists.txt index 74a0560be5..fb1760c1ef 100644 --- a/examples/bluetooth/gatt_server/CMakeLists.txt +++ b/examples/bluetooth/gatt_server/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/gatts_demo.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(gatt_server_demos) diff --git a/examples/bluetooth/gatt_server/main/CMakeLists.txt b/examples/bluetooth/gatt_server/main/CMakeLists.txt new file mode 100644 index 0000000000..d23e5ffc7d --- /dev/null +++ b/examples/bluetooth/gatt_server/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "gatts_demo.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/gatt_server_service_table/CMakeLists.txt b/examples/bluetooth/gatt_server_service_table/CMakeLists.txt index 2f5653065d..d6dc6a416b 100644 --- a/examples/bluetooth/gatt_server_service_table/CMakeLists.txt +++ b/examples/bluetooth/gatt_server_service_table/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/gatts_table_creat_demo.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(gatt_server_service_table_demo) diff --git a/examples/bluetooth/gatt_server_service_table/main/CMakeLists.txt b/examples/bluetooth/gatt_server_service_table/main/CMakeLists.txt new file mode 100644 index 0000000000..7588b5a7a1 --- /dev/null +++ b/examples/bluetooth/gatt_server_service_table/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "gatts_table_creat_demo.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/bluetooth/gattc_multi_connect/CMakeLists.txt b/examples/bluetooth/gattc_multi_connect/CMakeLists.txt index 73566a731c..6a7a6b3b8d 100644 --- a/examples/bluetooth/gattc_multi_connect/CMakeLists.txt +++ b/examples/bluetooth/gattc_multi_connect/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/gattc_multi_connect.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(gatt_multi_connect) diff --git a/examples/bluetooth/gattc_multi_connect/main/CMakeLists.txt b/examples/bluetooth/gattc_multi_connect/main/CMakeLists.txt new file mode 100644 index 0000000000..19dcf60d3a --- /dev/null +++ b/examples/bluetooth/gattc_multi_connect/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "gattc_multi_connect.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/ethernet/ethernet/CMakeLists.txt b/examples/ethernet/ethernet/CMakeLists.txt index 0b4d20f088..ccd3c7cbe8 100644 --- a/examples/ethernet/ethernet/CMakeLists.txt +++ b/examples/ethernet/ethernet/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/ethernet_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ethernet_demo) diff --git a/examples/ethernet/ethernet/main/CMakeLists.txt b/examples/ethernet/ethernet/main/CMakeLists.txt new file mode 100644 index 0000000000..8c0c9fa0fc --- /dev/null +++ b/examples/ethernet/ethernet/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "ethernet_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/get-started/blink/CMakeLists.txt b/examples/get-started/blink/CMakeLists.txt index 56450928b6..33a52a5d5d 100644 --- a/examples/get-started/blink/CMakeLists.txt +++ b/examples/get-started/blink/CMakeLists.txt @@ -2,7 +2,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/blink.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(blink) diff --git a/examples/get-started/blink/main/CMakeLists.txt b/examples/get-started/blink/main/CMakeLists.txt new file mode 100644 index 0000000000..69f12a3847 --- /dev/null +++ b/examples/get-started/blink/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "blink.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/get-started/hello_world/CMakeLists.txt b/examples/get-started/hello_world/CMakeLists.txt index 1d4853e774..8a022b8486 100644 --- a/examples/get-started/hello_world/CMakeLists.txt +++ b/examples/get-started/hello_world/CMakeLists.txt @@ -2,7 +2,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/hello_world_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(hello-world) diff --git a/examples/get-started/hello_world/main/CMakeLists.txt b/examples/get-started/hello_world/main/CMakeLists.txt new file mode 100644 index 0000000000..b79b831950 --- /dev/null +++ b/examples/get-started/hello_world/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "hello_world_main.c") +set(COMPONENT_ADD_INCLUDEDIRS "") + +register_component() \ No newline at end of file diff --git a/examples/mesh/internal_communication/CMakeLists.txt b/examples/mesh/internal_communication/CMakeLists.txt index 485f63621a..d0cf18781a 100644 --- a/examples/mesh/internal_communication/CMakeLists.txt +++ b/examples/mesh/internal_communication/CMakeLists.txt @@ -2,10 +2,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/mesh_light.c main/mesh_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(internal_transceiver) - -include_directories(main/include) - diff --git a/examples/mesh/internal_communication/main/CMakeLists.txt b/examples/mesh/internal_communication/main/CMakeLists.txt new file mode 100644 index 0000000000..451eeceed6 --- /dev/null +++ b/examples/mesh/internal_communication/main/CMakeLists.txt @@ -0,0 +1,5 @@ +set(COMPONENT_SRCS "mesh_light.c" + "mesh_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ". include") + +register_component() diff --git a/examples/mesh/manual_networking/CMakeLists.txt b/examples/mesh/manual_networking/CMakeLists.txt index 485f63621a..d0cf18781a 100644 --- a/examples/mesh/manual_networking/CMakeLists.txt +++ b/examples/mesh/manual_networking/CMakeLists.txt @@ -2,10 +2,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/mesh_light.c main/mesh_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(internal_transceiver) - -include_directories(main/include) - diff --git a/examples/mesh/manual_networking/main/CMakeLists.txt b/examples/mesh/manual_networking/main/CMakeLists.txt new file mode 100644 index 0000000000..451eeceed6 --- /dev/null +++ b/examples/mesh/manual_networking/main/CMakeLists.txt @@ -0,0 +1,5 @@ +set(COMPONENT_SRCS "mesh_light.c" + "mesh_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ". include") + +register_component() diff --git a/examples/peripherals/adc/CMakeLists.txt b/examples/peripherals/adc/CMakeLists.txt index 2232b277cd..b01d635218 100644 --- a/examples/peripherals/adc/CMakeLists.txt +++ b/examples/peripherals/adc/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/adc1_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(adc) diff --git a/examples/peripherals/adc/main/CMakeLists.txt b/examples/peripherals/adc/main/CMakeLists.txt new file mode 100644 index 0000000000..9b5d48fc60 --- /dev/null +++ b/examples/peripherals/adc/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "adc1_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/adc2/CMakeLists.txt b/examples/peripherals/adc2/CMakeLists.txt index 650e3100ae..7ea7329c1e 100644 --- a/examples/peripherals/adc2/CMakeLists.txt +++ b/examples/peripherals/adc2/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/adc2_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(adc2) diff --git a/examples/peripherals/adc2/main/CMakeLists.txt b/examples/peripherals/adc2/main/CMakeLists.txt new file mode 100644 index 0000000000..1d7776ecf0 --- /dev/null +++ b/examples/peripherals/adc2/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "adc2_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/gpio/CMakeLists.txt b/examples/peripherals/gpio/CMakeLists.txt index 82873edc4a..6ac490d38a 100644 --- a/examples/peripherals/gpio/CMakeLists.txt +++ b/examples/peripherals/gpio/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/gpio_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(gpio) diff --git a/examples/peripherals/gpio/main/CMakeLists.txt b/examples/peripherals/gpio/main/CMakeLists.txt new file mode 100644 index 0000000000..d768cb8252 --- /dev/null +++ b/examples/peripherals/gpio/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "gpio_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/i2c/CMakeLists.txt b/examples/peripherals/i2c/CMakeLists.txt index 048d75fb36..1db34db220 100644 --- a/examples/peripherals/i2c/CMakeLists.txt +++ b/examples/peripherals/i2c/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/i2c_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(i2c) diff --git a/examples/peripherals/i2c/main/CMakeLists.txt b/examples/peripherals/i2c/main/CMakeLists.txt new file mode 100644 index 0000000000..02386f7197 --- /dev/null +++ b/examples/peripherals/i2c/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "i2c_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/i2s/CMakeLists.txt b/examples/peripherals/i2s/CMakeLists.txt index 6520061d4e..19c5f88308 100644 --- a/examples/peripherals/i2s/CMakeLists.txt +++ b/examples/peripherals/i2s/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/i2s_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(esp32-i2s-driver-example) diff --git a/examples/peripherals/i2s/main/CMakeLists.txt b/examples/peripherals/i2s/main/CMakeLists.txt new file mode 100644 index 0000000000..dbb7b172a3 --- /dev/null +++ b/examples/peripherals/i2s/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "i2s_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/i2s_adc_dac/CMakeLists.txt b/examples/peripherals/i2s_adc_dac/CMakeLists.txt index 8e7fe3c073..4b27d7cd68 100644 --- a/examples/peripherals/i2s_adc_dac/CMakeLists.txt +++ b/examples/peripherals/i2s_adc_dac/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/app_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(i2s-adc-dac) diff --git a/examples/peripherals/i2s_adc_dac/main/CMakeLists.txt b/examples/peripherals/i2s_adc_dac/main/CMakeLists.txt new file mode 100644 index 0000000000..6b03500639 --- /dev/null +++ b/examples/peripherals/i2s_adc_dac/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "app_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/ledc/CMakeLists.txt b/examples/peripherals/ledc/CMakeLists.txt index c0c15b6f9d..0ce275c8e0 100644 --- a/examples/peripherals/ledc/CMakeLists.txt +++ b/examples/peripherals/ledc/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/ledc_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ledc) diff --git a/examples/peripherals/ledc/main/CMakeLists.txt b/examples/peripherals/ledc/main/CMakeLists.txt new file mode 100644 index 0000000000..6405eb95ff --- /dev/null +++ b/examples/peripherals/ledc/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "ledc_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/mcpwm/mcpwm_basic_config/CMakeLists.txt b/examples/peripherals/mcpwm/mcpwm_basic_config/CMakeLists.txt index a3ee8315fb..53eb976ea4 100644 --- a/examples/peripherals/mcpwm/mcpwm_basic_config/CMakeLists.txt +++ b/examples/peripherals/mcpwm/mcpwm_basic_config/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/mcpwm_basic_config_example.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mcpwm_basic_config) diff --git a/examples/peripherals/mcpwm/mcpwm_basic_config/main/CMakeLists.txt b/examples/peripherals/mcpwm/mcpwm_basic_config/main/CMakeLists.txt new file mode 100644 index 0000000000..d5fdbf5600 --- /dev/null +++ b/examples/peripherals/mcpwm/mcpwm_basic_config/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "mcpwm_basic_config_example.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/mcpwm/mcpwm_bldc_control/CMakeLists.txt b/examples/peripherals/mcpwm/mcpwm_bldc_control/CMakeLists.txt index ed09e85b2c..10ed869e1b 100644 --- a/examples/peripherals/mcpwm/mcpwm_bldc_control/CMakeLists.txt +++ b/examples/peripherals/mcpwm/mcpwm_bldc_control/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/mcpwm_bldc_control_hall_sensor_example.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mcpwm_bldc_control_hall_sensor) diff --git a/examples/peripherals/mcpwm/mcpwm_bldc_control/main/CMakeLists.txt b/examples/peripherals/mcpwm/mcpwm_bldc_control/main/CMakeLists.txt new file mode 100644 index 0000000000..a52ad94513 --- /dev/null +++ b/examples/peripherals/mcpwm/mcpwm_bldc_control/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "mcpwm_bldc_control_hall_sensor_example.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/mcpwm/mcpwm_brushed_dc_control/CMakeLists.txt b/examples/peripherals/mcpwm/mcpwm_brushed_dc_control/CMakeLists.txt index 4076c28394..a4baf8b40c 100644 --- a/examples/peripherals/mcpwm/mcpwm_brushed_dc_control/CMakeLists.txt +++ b/examples/peripherals/mcpwm/mcpwm_brushed_dc_control/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/mcpwm_brushed_dc_control_example.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mcpwm_brushed_dc_control) diff --git a/examples/peripherals/mcpwm/mcpwm_brushed_dc_control/main/CMakeLists.txt b/examples/peripherals/mcpwm/mcpwm_brushed_dc_control/main/CMakeLists.txt new file mode 100644 index 0000000000..1259035cbf --- /dev/null +++ b/examples/peripherals/mcpwm/mcpwm_brushed_dc_control/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "mcpwm_brushed_dc_control_example.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/mcpwm/mcpwm_servo_control/CMakeLists.txt b/examples/peripherals/mcpwm/mcpwm_servo_control/CMakeLists.txt index fc3fab8093..524c0ec97c 100644 --- a/examples/peripherals/mcpwm/mcpwm_servo_control/CMakeLists.txt +++ b/examples/peripherals/mcpwm/mcpwm_servo_control/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/mcpwm_servo_control_example.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mcpwm_servo_control) diff --git a/examples/peripherals/mcpwm/mcpwm_servo_control/main/CMakeLists.txt b/examples/peripherals/mcpwm/mcpwm_servo_control/main/CMakeLists.txt new file mode 100644 index 0000000000..c8fa3d96b9 --- /dev/null +++ b/examples/peripherals/mcpwm/mcpwm_servo_control/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "mcpwm_servo_control_example.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/pcnt/CMakeLists.txt b/examples/peripherals/pcnt/CMakeLists.txt index 2a7c8f40e8..8f9d35a794 100644 --- a/examples/peripherals/pcnt/CMakeLists.txt +++ b/examples/peripherals/pcnt/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/pcnt_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(pcnt) diff --git a/examples/peripherals/pcnt/main/CMakeLists.txt b/examples/peripherals/pcnt/main/CMakeLists.txt new file mode 100644 index 0000000000..2bd2779553 --- /dev/null +++ b/examples/peripherals/pcnt/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "pcnt_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/rmt_nec_tx_rx/CMakeLists.txt b/examples/peripherals/rmt_nec_tx_rx/CMakeLists.txt index 468032294c..5e3f6b3658 100644 --- a/examples/peripherals/rmt_nec_tx_rx/CMakeLists.txt +++ b/examples/peripherals/rmt_nec_tx_rx/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/infrared_nec_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(infrared_nec) diff --git a/examples/peripherals/rmt_nec_tx_rx/main/CMakeLists.txt b/examples/peripherals/rmt_nec_tx_rx/main/CMakeLists.txt new file mode 100644 index 0000000000..80c75b2285 --- /dev/null +++ b/examples/peripherals/rmt_nec_tx_rx/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "infrared_nec_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/rmt_tx/CMakeLists.txt b/examples/peripherals/rmt_tx/CMakeLists.txt index 7aa64fedb8..cf5f789fdc 100644 --- a/examples/peripherals/rmt_tx/CMakeLists.txt +++ b/examples/peripherals/rmt_tx/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/rmt_tx_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(rmt_tx) diff --git a/examples/peripherals/rmt_tx/main/CMakeLists.txt b/examples/peripherals/rmt_tx/main/CMakeLists.txt new file mode 100644 index 0000000000..a0a9147a2a --- /dev/null +++ b/examples/peripherals/rmt_tx/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "rmt_tx_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/sigmadelta/CMakeLists.txt b/examples/peripherals/sigmadelta/CMakeLists.txt index 3f4df2cfc7..3a7098cb25 100644 --- a/examples/peripherals/sigmadelta/CMakeLists.txt +++ b/examples/peripherals/sigmadelta/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/sigmadelta_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(sigmadelta) diff --git a/examples/peripherals/sigmadelta/main/CMakeLists.txt b/examples/peripherals/sigmadelta/main/CMakeLists.txt new file mode 100644 index 0000000000..1b0f2299f0 --- /dev/null +++ b/examples/peripherals/sigmadelta/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "sigmadelta_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/spi_master/CMakeLists.txt b/examples/peripherals/spi_master/CMakeLists.txt index d27864187f..6494ac1fda 100644 --- a/examples/peripherals/spi_master/CMakeLists.txt +++ b/examples/peripherals/spi_master/CMakeLists.txt @@ -1,17 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS - main/spi_master_example_main.c - main/pretty_effect.c - main/decode_image.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(spi_master) - -# Embed the image into the final binary -# -# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) -target_add_binary_data(spi_master.elf - "main/image.jpg" BINARY) diff --git a/examples/peripherals/spi_master/main/CMakeLists.txt b/examples/peripherals/spi_master/main/CMakeLists.txt new file mode 100644 index 0000000000..806ccae2b6 --- /dev/null +++ b/examples/peripherals/spi_master/main/CMakeLists.txt @@ -0,0 +1,9 @@ +set(COMPONENT_SRCS "decode_image.c" + "pretty_effect.c" + "spi_master_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + + +set(COMPONENT_EMBED_FILES image.jpg) + +register_component() diff --git a/examples/peripherals/spi_slave/receiver/CMakeLists.txt b/examples/peripherals/spi_slave/receiver/CMakeLists.txt index 21c05d9e67..a55b703ab5 100644 --- a/examples/peripherals/spi_slave/receiver/CMakeLists.txt +++ b/examples/peripherals/spi_slave/receiver/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/app_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(spi-slave-receiver) diff --git a/examples/peripherals/spi_slave/receiver/main/CMakeLists.txt b/examples/peripherals/spi_slave/receiver/main/CMakeLists.txt new file mode 100644 index 0000000000..6b03500639 --- /dev/null +++ b/examples/peripherals/spi_slave/receiver/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "app_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/spi_slave/sender/CMakeLists.txt b/examples/peripherals/spi_slave/sender/CMakeLists.txt index 0c95698e96..f9144aa842 100644 --- a/examples/peripherals/spi_slave/sender/CMakeLists.txt +++ b/examples/peripherals/spi_slave/sender/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/app_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(spi-slave-sender) diff --git a/examples/peripherals/spi_slave/sender/main/CMakeLists.txt b/examples/peripherals/spi_slave/sender/main/CMakeLists.txt new file mode 100644 index 0000000000..6b03500639 --- /dev/null +++ b/examples/peripherals/spi_slave/sender/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "app_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/timer_group/CMakeLists.txt b/examples/peripherals/timer_group/CMakeLists.txt index 7f851e1649..247819ef30 100644 --- a/examples/peripherals/timer_group/CMakeLists.txt +++ b/examples/peripherals/timer_group/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/timer_group_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(timer_group) diff --git a/examples/peripherals/timer_group/main/CMakeLists.txt b/examples/peripherals/timer_group/main/CMakeLists.txt new file mode 100644 index 0000000000..9a96ce9068 --- /dev/null +++ b/examples/peripherals/timer_group/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "timer_group_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/touch_pad_interrupt/CMakeLists.txt b/examples/peripherals/touch_pad_interrupt/CMakeLists.txt index efdecaba1d..9ab076f8e9 100644 --- a/examples/peripherals/touch_pad_interrupt/CMakeLists.txt +++ b/examples/peripherals/touch_pad_interrupt/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/tp_interrupt_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(touch_pad_interrupt) diff --git a/examples/peripherals/touch_pad_interrupt/main/CMakeLists.txt b/examples/peripherals/touch_pad_interrupt/main/CMakeLists.txt new file mode 100644 index 0000000000..b77bf9c7be --- /dev/null +++ b/examples/peripherals/touch_pad_interrupt/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "tp_interrupt_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/touch_pad_read/CMakeLists.txt b/examples/peripherals/touch_pad_read/CMakeLists.txt index f246a1ad53..828816fe4d 100644 --- a/examples/peripherals/touch_pad_read/CMakeLists.txt +++ b/examples/peripherals/touch_pad_read/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/tp_read_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(touch_pad_read) diff --git a/examples/peripherals/touch_pad_read/main/CMakeLists.txt b/examples/peripherals/touch_pad_read/main/CMakeLists.txt new file mode 100644 index 0000000000..b556e8c0ee --- /dev/null +++ b/examples/peripherals/touch_pad_read/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "tp_read_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/uart_async_rxtxtasks/CMakeLists.txt b/examples/peripherals/uart_async_rxtxtasks/CMakeLists.txt index 4ab23a834d..ea67b8aa62 100644 --- a/examples/peripherals/uart_async_rxtxtasks/CMakeLists.txt +++ b/examples/peripherals/uart_async_rxtxtasks/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/uart_async_rxtxtasks_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(uart_async_rxtxtasks) diff --git a/examples/peripherals/uart_async_rxtxtasks/main/CMakeLists.txt b/examples/peripherals/uart_async_rxtxtasks/main/CMakeLists.txt new file mode 100644 index 0000000000..b572323523 --- /dev/null +++ b/examples/peripherals/uart_async_rxtxtasks/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "uart_async_rxtxtasks_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/uart_echo/CMakeLists.txt b/examples/peripherals/uart_echo/CMakeLists.txt index b7ab8a5824..0dc35072c2 100644 --- a/examples/peripherals/uart_echo/CMakeLists.txt +++ b/examples/peripherals/uart_echo/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/uart_echo_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(uart_echo) diff --git a/examples/peripherals/uart_echo/main/CMakeLists.txt b/examples/peripherals/uart_echo/main/CMakeLists.txt new file mode 100644 index 0000000000..1ca803f131 --- /dev/null +++ b/examples/peripherals/uart_echo/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "uart_echo_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/uart_events/CMakeLists.txt b/examples/peripherals/uart_events/CMakeLists.txt index 464886f254..d89fe7267f 100644 --- a/examples/peripherals/uart_events/CMakeLists.txt +++ b/examples/peripherals/uart_events/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/uart_events_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(uart_events) diff --git a/examples/peripherals/uart_events/main/CMakeLists.txt b/examples/peripherals/uart_events/main/CMakeLists.txt new file mode 100644 index 0000000000..5a408ef1ef --- /dev/null +++ b/examples/peripherals/uart_events/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "uart_events_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/uart_select/CMakeLists.txt b/examples/peripherals/uart_select/CMakeLists.txt index c761f9d605..8cf5a7bd19 100644 --- a/examples/peripherals/uart_select/CMakeLists.txt +++ b/examples/peripherals/uart_select/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/uart_select_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(uart_select) diff --git a/examples/peripherals/uart_select/main/CMakeLists.txt b/examples/peripherals/uart_select/main/CMakeLists.txt new file mode 100644 index 0000000000..4e3ae00def --- /dev/null +++ b/examples/peripherals/uart_select/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "uart_select_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/protocols/aws_iot/subscribe_publish/CMakeLists.txt b/examples/protocols/aws_iot/subscribe_publish/CMakeLists.txt index c7cfd88f4d..9058298059 100644 --- a/examples/protocols/aws_iot/subscribe_publish/CMakeLists.txt +++ b/examples/protocols/aws_iot/subscribe_publish/CMakeLists.txt @@ -1,13 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/subscribe_publish_sample.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(subscribe_publish) - -# Embed the certificate data directly in the built binary -target_add_binary_data(subscribe_publish.elf main/certs/aws-root-ca.pem TEXT) -target_add_binary_data(subscribe_publish.elf main/certs/certificate.pem.crt TEXT) -target_add_binary_data(subscribe_publish.elf main/certs/private.pem.key TEXT) +project(subscribe_publish) \ No newline at end of file diff --git a/examples/protocols/aws_iot/subscribe_publish/main/CMakeLists.txt b/examples/protocols/aws_iot/subscribe_publish/main/CMakeLists.txt new file mode 100644 index 0000000000..d5fc09071e --- /dev/null +++ b/examples/protocols/aws_iot/subscribe_publish/main/CMakeLists.txt @@ -0,0 +1,28 @@ +set(COMPONENT_SRCS "subscribe_publish_sample.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + + +register_component() + +if(CONFIG_EXAMPLE_EMBEDDED_CERTS) +target_add_binary_data(${COMPONENT_NAME} "certs/aws-root-ca.pem" TEXT) + +if(NOT IDF_CI_BUILD) + add_custom_command(OUTPUT certs/certificate.pem.crt certs/private.pem.key + COMMAND echo "Dummy certificate data for continuous integration" > + certs/certificate.pem.crt + COMMAND echo "Dummy certificate data for continuous integration" > + certs/private.pem.key + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + VERBATIM) + add_custom_target(example_certificates DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/certs/certificate.pem.crt ${CMAKE_CURRENT_BINARY_DIR}/certs/private.pem.key) + + add_dependencies(${COMPONENT_NAME} example_certificates) + + target_add_binary_data(${COMPONENT_NAME} "${CMAKE_CURRENT_BINARY_DIR}/certs/certificate.pem.crt" TEXT) + target_add_binary_data(${COMPONENT_NAME} "${CMAKE_CURRENT_BINARY_DIR}/certs/private.pem.key" TEXT) +else() + target_add_binary_data(${COMPONENT_NAME} "certs/certificate.pem.crt" TEXT) + target_add_binary_data(${COMPONENT_NAME} "certs/private.pem.key" TEXT) +endif() +endif() \ No newline at end of file diff --git a/examples/protocols/aws_iot/thing_shadow/CMakeLists.txt b/examples/protocols/aws_iot/thing_shadow/CMakeLists.txt index 37d5d9a9cf..fe87b29cc3 100644 --- a/examples/protocols/aws_iot/thing_shadow/CMakeLists.txt +++ b/examples/protocols/aws_iot/thing_shadow/CMakeLists.txt @@ -1,13 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/thing_shadow_sample.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(thing_shadow) - -# Embed the certificate data directly in the built binary -target_add_binary_data(thing_shadow.elf main/certs/aws-root-ca.pem TEXT) -target_add_binary_data(thing_shadow.elf main/certs/certificate.pem.crt TEXT) -target_add_binary_data(thing_shadow.elf main/certs/private.pem.key TEXT) diff --git a/examples/protocols/aws_iot/thing_shadow/main/CMakeLists.txt b/examples/protocols/aws_iot/thing_shadow/main/CMakeLists.txt new file mode 100644 index 0000000000..ee14baf02f --- /dev/null +++ b/examples/protocols/aws_iot/thing_shadow/main/CMakeLists.txt @@ -0,0 +1,28 @@ +set(COMPONENT_SRCS "thing_shadow_sample.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + + +register_component() + +if(CONFIG_EXAMPLE_EMBEDDED_CERTS) +target_add_binary_data(${COMPONENT_NAME} "certs/aws-root-ca.pem" TEXT) + +if(NOT IDF_CI_BUILD) + add_custom_command(OUTPUT certs/certificate.pem.crt certs/private.pem.key + COMMAND echo "Dummy certificate data for continuous integration" > + certs/certificate.pem.crt + COMMAND echo "Dummy certificate data for continuous integration" > + certs/private.pem.key + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + VERBATIM) + add_custom_target(example_certificates DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/certs/certificate.pem.crt ${CMAKE_CURRENT_BINARY_DIR}/certs/private.pem.key) + + add_dependencies(${COMPONENT_NAME} example_certificates) + + target_add_binary_data(${COMPONENT_NAME} "${CMAKE_CURRENT_BINARY_DIR}/certs/certificate.pem.crt" TEXT) + target_add_binary_data(${COMPONENT_NAME} "${CMAKE_CURRENT_BINARY_DIR}/certs/private.pem.key" TEXT) +else() + target_add_binary_data(${COMPONENT_NAME} "certs/certificate.pem.crt" TEXT) + target_add_binary_data(${COMPONENT_NAME} "certs/private.pem.key" TEXT) +endif() +endif() \ No newline at end of file diff --git a/examples/protocols/coap_client/CMakeLists.txt b/examples/protocols/coap_client/CMakeLists.txt index 43378b8b64..495538d3df 100644 --- a/examples/protocols/coap_client/CMakeLists.txt +++ b/examples/protocols/coap_client/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/coap_client_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(coap_client) diff --git a/examples/protocols/coap_client/main/CMakeLists.txt b/examples/protocols/coap_client/main/CMakeLists.txt new file mode 100644 index 0000000000..eb1a1db15d --- /dev/null +++ b/examples/protocols/coap_client/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "coap_client_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/protocols/coap_server/CMakeLists.txt b/examples/protocols/coap_server/CMakeLists.txt index 8495b85782..16689d2e3b 100644 --- a/examples/protocols/coap_server/CMakeLists.txt +++ b/examples/protocols/coap_server/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/coap_server_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(coap_server) diff --git a/examples/protocols/coap_server/main/CMakeLists.txt b/examples/protocols/coap_server/main/CMakeLists.txt new file mode 100644 index 0000000000..8650fb1147 --- /dev/null +++ b/examples/protocols/coap_server/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "coap_server_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/protocols/esp_http_client/CMakeLists.txt b/examples/protocols/esp_http_client/CMakeLists.txt index 5241b97bd2..6896d5acd9 100644 --- a/examples/protocols/esp_http_client/CMakeLists.txt +++ b/examples/protocols/esp_http_client/CMakeLists.txt @@ -2,13 +2,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/esp_http_client_example.c main/app_wifi.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(esp-http-client-example) - -# Embed the server root certificate into the final binary -# -# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) -target_add_binary_data(esp-http-client-example.elf - "main/howsmyssl_com_root_cert.pem" TEXT) diff --git a/examples/protocols/esp_http_client/main/CMakeLists.txt b/examples/protocols/esp_http_client/main/CMakeLists.txt new file mode 100644 index 0000000000..093811e664 --- /dev/null +++ b/examples/protocols/esp_http_client/main/CMakeLists.txt @@ -0,0 +1,11 @@ +set(COMPONENT_SRCS "app_wifi.c" + "esp_http_client_example.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + + +# Embed the server root certificate into the final binary +# +# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) +set(COMPONENT_EMBED_TXTFILES howsmyssl_com_root_cert.pem) + +register_component() diff --git a/examples/protocols/http2_request/CMakeLists.txt b/examples/protocols/http2_request/CMakeLists.txt index b49128d5e4..edda2c42f6 100644 --- a/examples/protocols/http2_request/CMakeLists.txt +++ b/examples/protocols/http2_request/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/http2_request_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(http2-request) diff --git a/examples/protocols/http2_request/components/sh2lib/CMakeLists.txt b/examples/protocols/http2_request/components/sh2lib/CMakeLists.txt index 6d19bf48b6..ec1b5a1e12 100644 --- a/examples/protocols/http2_request/components/sh2lib/CMakeLists.txt +++ b/examples/protocols/http2_request/components/sh2lib/CMakeLists.txt @@ -1,6 +1,6 @@ set(COMPONENT_ADD_INCLUDEDIRS .) -set(COMPONENT_SRCDIRS .) +set(COMPONENT_SRCS "sh2lib.c") set(COMPONENT_REQUIRES nghttp) set(COMPONENT_PRIV_REQUIRES lwip esp-tls) diff --git a/examples/protocols/http2_request/main/CMakeLists.txt b/examples/protocols/http2_request/main/CMakeLists.txt new file mode 100644 index 0000000000..6139002258 --- /dev/null +++ b/examples/protocols/http2_request/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "http2_request_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/protocols/http_request/CMakeLists.txt b/examples/protocols/http_request/CMakeLists.txt index a8f1470b9e..1c818eb23e 100644 --- a/examples/protocols/http_request/CMakeLists.txt +++ b/examples/protocols/http_request/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/http_request_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(http-request) diff --git a/examples/protocols/http_request/main/CMakeLists.txt b/examples/protocols/http_request/main/CMakeLists.txt new file mode 100644 index 0000000000..8e346e8bb3 --- /dev/null +++ b/examples/protocols/http_request/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "http_request_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/protocols/https_mbedtls/CMakeLists.txt b/examples/protocols/https_mbedtls/CMakeLists.txt index b564db2fa3..a1f41ff875 100644 --- a/examples/protocols/https_mbedtls/CMakeLists.txt +++ b/examples/protocols/https_mbedtls/CMakeLists.txt @@ -2,13 +2,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/https_mbedtls_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(https-mbedtls) - -# Embed the server root certificate into the final binary -# -# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) -target_add_binary_data(https-mbedtls.elf - "main/server_root_cert.pem" TEXT) +project(https-mbedtls) \ No newline at end of file diff --git a/examples/protocols/https_mbedtls/main/CMakeLists.txt b/examples/protocols/https_mbedtls/main/CMakeLists.txt new file mode 100644 index 0000000000..c9b097c6b9 --- /dev/null +++ b/examples/protocols/https_mbedtls/main/CMakeLists.txt @@ -0,0 +1,10 @@ +set(COMPONENT_SRCS "https_mbedtls_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + + +# Embed the server root certificate into the final binary +# +# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) +set(COMPONENT_EMBED_TXTFILES server_root_cert.pem) + +register_component() diff --git a/examples/protocols/https_request/CMakeLists.txt b/examples/protocols/https_request/CMakeLists.txt index 22118c45cb..f77bc66101 100644 --- a/examples/protocols/https_request/CMakeLists.txt +++ b/examples/protocols/https_request/CMakeLists.txt @@ -2,13 +2,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/https_request_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(https_request) - -# Embed the server root certificate into the final binary -# -# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) -target_add_binary_data(https_request.elf - "main/server_root_cert.pem" TEXT) diff --git a/examples/protocols/https_request/main/CMakeLists.txt b/examples/protocols/https_request/main/CMakeLists.txt new file mode 100644 index 0000000000..60a1a0664c --- /dev/null +++ b/examples/protocols/https_request/main/CMakeLists.txt @@ -0,0 +1,10 @@ +set(COMPONENT_SRCS "https_request_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + + +# Embed the server root certificate into the final binary +# +# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) +set(COMPONENT_EMBED_TXTFILES server_root_cert.pem) + +register_component() diff --git a/examples/protocols/mdns/CMakeLists.txt b/examples/protocols/mdns/CMakeLists.txt index 57c5e9a2e6..88b7c1e3f1 100644 --- a/examples/protocols/mdns/CMakeLists.txt +++ b/examples/protocols/mdns/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/mdns_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mdns-test) diff --git a/examples/protocols/mdns/main/CMakeLists.txt b/examples/protocols/mdns/main/CMakeLists.txt new file mode 100644 index 0000000000..814837ea97 --- /dev/null +++ b/examples/protocols/mdns/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "mdns_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/protocols/openssl_client/CMakeLists.txt b/examples/protocols/openssl_client/CMakeLists.txt index 0fc241ddf2..5449461ce7 100644 --- a/examples/protocols/openssl_client/CMakeLists.txt +++ b/examples/protocols/openssl_client/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/openssl_client_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(openssl_client) diff --git a/examples/protocols/openssl_client/main/CMakeLists.txt b/examples/protocols/openssl_client/main/CMakeLists.txt new file mode 100644 index 0000000000..d8e15c98cd --- /dev/null +++ b/examples/protocols/openssl_client/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "openssl_client_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/protocols/openssl_server/CMakeLists.txt b/examples/protocols/openssl_server/CMakeLists.txt index dba98fc685..d3e5c5ccbe 100644 --- a/examples/protocols/openssl_server/CMakeLists.txt +++ b/examples/protocols/openssl_server/CMakeLists.txt @@ -1,12 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/openssl_server_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(openssl_server) - -# Embed the certificate & key data directly in the built binary -target_add_binary_data(openssl_server.elf main/cacert.pem TEXT) -target_add_binary_data(openssl_server.elf main/prvtkey.pem TEXT) diff --git a/examples/protocols/openssl_server/main/CMakeLists.txt b/examples/protocols/openssl_server/main/CMakeLists.txt new file mode 100644 index 0000000000..07b57ef293 --- /dev/null +++ b/examples/protocols/openssl_server/main/CMakeLists.txt @@ -0,0 +1,8 @@ +set(COMPONENT_SRCS "openssl_server_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + + +# Embed the certificate & key data directly in the built binary +set(COMPONENT_EMBED_TXTFILES cacert.pem prvtkey.pem) + +register_component() diff --git a/examples/protocols/pppos_client/CMakeLists.txt b/examples/protocols/pppos_client/CMakeLists.txt index c9378d72fa..9609525782 100644 --- a/examples/protocols/pppos_client/CMakeLists.txt +++ b/examples/protocols/pppos_client/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/pppos_client_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(pppos_client) diff --git a/examples/protocols/pppos_client/main/CMakeLists.txt b/examples/protocols/pppos_client/main/CMakeLists.txt new file mode 100644 index 0000000000..e4ef1373fa --- /dev/null +++ b/examples/protocols/pppos_client/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "pppos_client_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/protocols/sntp/CMakeLists.txt b/examples/protocols/sntp/CMakeLists.txt index d083f8fe1a..dd46b088b1 100644 --- a/examples/protocols/sntp/CMakeLists.txt +++ b/examples/protocols/sntp/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/sntp_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(sntp) diff --git a/examples/protocols/sntp/main/CMakeLists.txt b/examples/protocols/sntp/main/CMakeLists.txt new file mode 100644 index 0000000000..c7c035ca03 --- /dev/null +++ b/examples/protocols/sntp/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "sntp_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/protocols/udp_multicast/CMakeLists.txt b/examples/protocols/udp_multicast/CMakeLists.txt index 998524292a..fe4b8fe8ef 100644 --- a/examples/protocols/udp_multicast/CMakeLists.txt +++ b/examples/protocols/udp_multicast/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/udp_multicast_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(udp-multicast) diff --git a/examples/protocols/udp_multicast/main/CMakeLists.txt b/examples/protocols/udp_multicast/main/CMakeLists.txt new file mode 100644 index 0000000000..d3caeb6ed7 --- /dev/null +++ b/examples/protocols/udp_multicast/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "udp_multicast_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/storage/nvs_rw_blob/CMakeLists.txt b/examples/storage/nvs_rw_blob/CMakeLists.txt index 1dd6023f30..a4c9141fd0 100644 --- a/examples/storage/nvs_rw_blob/CMakeLists.txt +++ b/examples/storage/nvs_rw_blob/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/nvs_blob_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(nvs-rw-blob) diff --git a/examples/storage/nvs_rw_blob/main/CMakeLists.txt b/examples/storage/nvs_rw_blob/main/CMakeLists.txt new file mode 100644 index 0000000000..675c11a0e9 --- /dev/null +++ b/examples/storage/nvs_rw_blob/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "nvs_blob_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/storage/nvs_rw_value/CMakeLists.txt b/examples/storage/nvs_rw_value/CMakeLists.txt index 971a306efe..d0e9215d30 100644 --- a/examples/storage/nvs_rw_value/CMakeLists.txt +++ b/examples/storage/nvs_rw_value/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/nvs_value_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(nvs-rw-value) diff --git a/examples/storage/nvs_rw_value/main/CMakeLists.txt b/examples/storage/nvs_rw_value/main/CMakeLists.txt new file mode 100644 index 0000000000..1383460018 --- /dev/null +++ b/examples/storage/nvs_rw_value/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "nvs_value_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/storage/sd_card/CMakeLists.txt b/examples/storage/sd_card/CMakeLists.txt index ab4bcf2fa4..00153c74c9 100644 --- a/examples/storage/sd_card/CMakeLists.txt +++ b/examples/storage/sd_card/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/sd_card_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(sd_card) diff --git a/examples/storage/sd_card/main/CMakeLists.txt b/examples/storage/sd_card/main/CMakeLists.txt new file mode 100644 index 0000000000..d0a4b53d93 --- /dev/null +++ b/examples/storage/sd_card/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "sd_card_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/storage/spiffs/CMakeLists.txt b/examples/storage/spiffs/CMakeLists.txt index 0356e25bf7..1894b31ca3 100644 --- a/examples/storage/spiffs/CMakeLists.txt +++ b/examples/storage/spiffs/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/spiffs_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(spiffs) diff --git a/examples/storage/spiffs/main/CMakeLists.txt b/examples/storage/spiffs/main/CMakeLists.txt new file mode 100644 index 0000000000..8d041d56d1 --- /dev/null +++ b/examples/storage/spiffs/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "spiffs_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/storage/wear_levelling/CMakeLists.txt b/examples/storage/wear_levelling/CMakeLists.txt index bd35e0843c..d404d3c243 100644 --- a/examples/storage/wear_levelling/CMakeLists.txt +++ b/examples/storage/wear_levelling/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/wear_levelling_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(wear_levelling_example) diff --git a/examples/storage/wear_levelling/main/CMakeLists.txt b/examples/storage/wear_levelling/main/CMakeLists.txt new file mode 100644 index 0000000000..e344e9a767 --- /dev/null +++ b/examples/storage/wear_levelling/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "wear_levelling_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/system/app_trace_to_host/CMakeLists.txt b/examples/system/app_trace_to_host/CMakeLists.txt index f26a0fdb6f..7182f8cca5 100644 --- a/examples/system/app_trace_to_host/CMakeLists.txt +++ b/examples/system/app_trace_to_host/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/app_trace_to_host_test.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(app_trace_to_host_test) diff --git a/examples/system/app_trace_to_host/main/CMakeLists.txt b/examples/system/app_trace_to_host/main/CMakeLists.txt new file mode 100644 index 0000000000..05e91af748 --- /dev/null +++ b/examples/system/app_trace_to_host/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "app_trace_to_host_test.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/system/base_mac_address/CMakeLists.txt b/examples/system/base_mac_address/CMakeLists.txt index 984dbb978d..986095de5a 100644 --- a/examples/system/base_mac_address/CMakeLists.txt +++ b/examples/system/base_mac_address/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/base_mac_address_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(base_mac_address) diff --git a/examples/system/base_mac_address/main/CMakeLists.txt b/examples/system/base_mac_address/main/CMakeLists.txt new file mode 100644 index 0000000000..364317db42 --- /dev/null +++ b/examples/system/base_mac_address/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "base_mac_address_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/system/console/CMakeLists.txt b/examples/system/console/CMakeLists.txt index 416fc704a0..d3f354f7fc 100644 --- a/examples/system/console/CMakeLists.txt +++ b/examples/system/console/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/cmd_wifi.c main/console_example_main.c main/cmd_system.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(console) diff --git a/examples/system/console/main/CMakeLists.txt b/examples/system/console/main/CMakeLists.txt new file mode 100644 index 0000000000..5f8bc46374 --- /dev/null +++ b/examples/system/console/main/CMakeLists.txt @@ -0,0 +1,6 @@ +set(COMPONENT_SRCS "cmd_system.c" + "cmd_wifi.c" + "console_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/system/deep_sleep/CMakeLists.txt b/examples/system/deep_sleep/CMakeLists.txt index cf3d195aa9..38e606ff25 100644 --- a/examples/system/deep_sleep/CMakeLists.txt +++ b/examples/system/deep_sleep/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/deep_sleep_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(deep_sleep) diff --git a/examples/system/deep_sleep/main/CMakeLists.txt b/examples/system/deep_sleep/main/CMakeLists.txt new file mode 100644 index 0000000000..e99ca4de9d --- /dev/null +++ b/examples/system/deep_sleep/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "deep_sleep_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/system/esp_timer/CMakeLists.txt b/examples/system/esp_timer/CMakeLists.txt index 5165f3d2a0..4222f063cb 100644 --- a/examples/system/esp_timer/CMakeLists.txt +++ b/examples/system/esp_timer/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/esp_timer_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(esp_timer_example) diff --git a/examples/system/esp_timer/main/CMakeLists.txt b/examples/system/esp_timer/main/CMakeLists.txt new file mode 100644 index 0000000000..09db9ec296 --- /dev/null +++ b/examples/system/esp_timer/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "esp_timer_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/system/gcov/CMakeLists.txt b/examples/system/gcov/CMakeLists.txt index b1cb9fd775..8a1f715683 100644 --- a/examples/system/gcov/CMakeLists.txt +++ b/examples/system/gcov/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/gcov_example_func.c main/gcov_example.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(gcov_example) diff --git a/examples/system/gcov/main/CMakeLists.txt b/examples/system/gcov/main/CMakeLists.txt new file mode 100644 index 0000000000..170d5c5521 --- /dev/null +++ b/examples/system/gcov/main/CMakeLists.txt @@ -0,0 +1,5 @@ +set(COMPONENT_SRCS "gcov_example.c" + "gcov_example_func.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/system/ota/native_ota_example/CMakeLists.txt b/examples/system/ota/native_ota_example/CMakeLists.txt index c4aa4d0d48..9e1828169e 100644 --- a/examples/system/ota/native_ota_example/CMakeLists.txt +++ b/examples/system/ota/native_ota_example/CMakeLists.txt @@ -1,14 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/native_ota_example.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(native_ota) - -# Embed the server root certificate into the final binary -# -# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) -target_add_binary_data(native_ota.elf - "../server_certs/ca_cert.pem" TEXT) diff --git a/examples/system/ota/native_ota_example/main/CMakeLists.txt b/examples/system/ota/native_ota_example/main/CMakeLists.txt new file mode 100644 index 0000000000..f7e58ac26a --- /dev/null +++ b/examples/system/ota/native_ota_example/main/CMakeLists.txt @@ -0,0 +1,10 @@ +set(COMPONENT_SRCS "native_ota_example.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + + +# Embed the server root certificate into the final binary +# +# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) +set(COMPONENT_EMBED_TXTFILES ../../server_certs/ca_cert.pem) + +register_component() diff --git a/examples/system/ota/simple_ota_example/CMakeLists.txt b/examples/system/ota/simple_ota_example/CMakeLists.txt index f15e708741..ae979292de 100644 --- a/examples/system/ota/simple_ota_example/CMakeLists.txt +++ b/examples/system/ota/simple_ota_example/CMakeLists.txt @@ -1,14 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/simple_ota_example.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(simple_ota) - -# Embed the server root certificate into the final binary -# -# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) -target_add_binary_data(simple_ota.elf - "../server_certs/ca_cert.pem" TEXT) +project(simple_ota) \ No newline at end of file diff --git a/examples/system/ota/simple_ota_example/main/CMakeLists.txt b/examples/system/ota/simple_ota_example/main/CMakeLists.txt new file mode 100644 index 0000000000..6d7b303916 --- /dev/null +++ b/examples/system/ota/simple_ota_example/main/CMakeLists.txt @@ -0,0 +1,11 @@ +set(COMPONENT_SRCS "simple_ota_example.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + + +# Embed the server root certificate into the final binary +# +# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) +set(COMPONENT_EMBED_TXTFILES ../../server_certs/ca_cert.pem) + + +register_component() diff --git a/examples/system/select/CMakeLists.txt b/examples/system/select/CMakeLists.txt index 3175ceeb0a..2e8180b5d3 100644 --- a/examples/system/select/CMakeLists.txt +++ b/examples/system/select/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/select_example.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(select) diff --git a/examples/system/select/main/CMakeLists.txt b/examples/system/select/main/CMakeLists.txt new file mode 100644 index 0000000000..bf59f84c44 --- /dev/null +++ b/examples/system/select/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "select_example.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/system/task_watchdog/CMakeLists.txt b/examples/system/task_watchdog/CMakeLists.txt index e0f24b03f6..4d3e6f98c9 100644 --- a/examples/system/task_watchdog/CMakeLists.txt +++ b/examples/system/task_watchdog/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/task_watchdog_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(task_watchdog) diff --git a/examples/system/task_watchdog/main/CMakeLists.txt b/examples/system/task_watchdog/main/CMakeLists.txt new file mode 100644 index 0000000000..ef06f3cc55 --- /dev/null +++ b/examples/system/task_watchdog/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "task_watchdog_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/wifi/espnow/CMakeLists.txt b/examples/wifi/espnow/CMakeLists.txt index 446cf5ccf1..73c190ccbd 100644 --- a/examples/wifi/espnow/CMakeLists.txt +++ b/examples/wifi/espnow/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/espnow_example_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(espnow_example) diff --git a/examples/wifi/espnow/main/CMakeLists.txt b/examples/wifi/espnow/main/CMakeLists.txt new file mode 100644 index 0000000000..151eab724b --- /dev/null +++ b/examples/wifi/espnow/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "espnow_example_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/wifi/iperf/CMakeLists.txt b/examples/wifi/iperf/CMakeLists.txt index 7463023e9e..069eeae866 100644 --- a/examples/wifi/iperf/CMakeLists.txt +++ b/examples/wifi/iperf/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/cmd_wifi.c main/main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(iperf) diff --git a/examples/wifi/iperf/components/CMakeLists.txt b/examples/wifi/iperf/components/CMakeLists.txt index 352403c414..d51a810196 100644 --- a/examples/wifi/iperf/components/CMakeLists.txt +++ b/examples/wifi/iperf/components/CMakeLists.txt @@ -1,6 +1,6 @@ set(COMPONENT_ADD_INCLUDEDIRS .) -set(COMPONENT_SRCDIRS .) +set(COMPONENT_SRCS "iperf.c") set(COMPONENT_PRIV_REQUIRES lwip) diff --git a/examples/wifi/iperf/main/CMakeLists.txt b/examples/wifi/iperf/main/CMakeLists.txt new file mode 100644 index 0000000000..2487dec22c --- /dev/null +++ b/examples/wifi/iperf/main/CMakeLists.txt @@ -0,0 +1,5 @@ +set(COMPONENT_SRCS "cmd_wifi.c" + "main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/wifi/power_save/CMakeLists.txt b/examples/wifi/power_save/CMakeLists.txt index 65cc2011df..a9a182fe6f 100644 --- a/examples/wifi/power_save/CMakeLists.txt +++ b/examples/wifi/power_save/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/power_save.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(power_save) diff --git a/examples/wifi/power_save/main/CMakeLists.txt b/examples/wifi/power_save/main/CMakeLists.txt new file mode 100644 index 0000000000..f7fc34d94a --- /dev/null +++ b/examples/wifi/power_save/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "power_save.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/wifi/scan/CMakeLists.txt b/examples/wifi/scan/CMakeLists.txt index 9de12341a3..0b74ad3db7 100644 --- a/examples/wifi/scan/CMakeLists.txt +++ b/examples/wifi/scan/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/scan.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(scan) diff --git a/examples/wifi/scan/main/CMakeLists.txt b/examples/wifi/scan/main/CMakeLists.txt new file mode 100644 index 0000000000..0b789863af --- /dev/null +++ b/examples/wifi/scan/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "scan.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/wifi/simple_wifi/CMakeLists.txt b/examples/wifi/simple_wifi/CMakeLists.txt index 57158b16b8..83a0f1dbc4 100644 --- a/examples/wifi/simple_wifi/CMakeLists.txt +++ b/examples/wifi/simple_wifi/CMakeLists.txt @@ -2,7 +2,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/simple_wifi.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(simple_wifi) diff --git a/examples/wifi/simple_wifi/main/CMakeLists.txt b/examples/wifi/simple_wifi/main/CMakeLists.txt new file mode 100644 index 0000000000..e7c00ec94c --- /dev/null +++ b/examples/wifi/simple_wifi/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "simple_wifi.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/wifi/smart_config/CMakeLists.txt b/examples/wifi/smart_config/CMakeLists.txt index ae0b88ee6d..71bda67e5b 100644 --- a/examples/wifi/smart_config/CMakeLists.txt +++ b/examples/wifi/smart_config/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/smartconfig_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(smart_config) diff --git a/examples/wifi/smart_config/main/CMakeLists.txt b/examples/wifi/smart_config/main/CMakeLists.txt new file mode 100644 index 0000000000..a716681e47 --- /dev/null +++ b/examples/wifi/smart_config/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "smartconfig_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/wifi/wpa2_enterprise/CMakeLists.txt b/examples/wifi/wpa2_enterprise/CMakeLists.txt index a489894e38..d50e6df219 100644 --- a/examples/wifi/wpa2_enterprise/CMakeLists.txt +++ b/examples/wifi/wpa2_enterprise/CMakeLists.txt @@ -1,17 +1,9 @@ # (Automatically converted from project Makefile by convert_to_cmake.py.) -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/wpa2_enterprise_main.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(wpa2-enterprise) - -# Embed CA, certificate & key directly into binary -target_add_binary_data(wpa2-enterprise.elf main/wpa2_ca.pem TEXT) -target_add_binary_data(wpa2-enterprise.elf main/wpa2_client.crt TEXT) -target_add_binary_data(wpa2-enterprise.elf main/wpa2_client.key TEXT) - diff --git a/examples/wifi/wpa2_enterprise/main/CMakeLists.txt b/examples/wifi/wpa2_enterprise/main/CMakeLists.txt new file mode 100644 index 0000000000..10640a32db --- /dev/null +++ b/examples/wifi/wpa2_enterprise/main/CMakeLists.txt @@ -0,0 +1,8 @@ +set(COMPONENT_SRCS "wpa2_enterprise_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + + +# Embed CA, certificate & key directly into binary +set(COMPONENT_EMBED_TXTFILES wpa2_ca.pem wpa2_client.crt wpa2_client.key) + +register_component() diff --git a/examples/wifi/wps/CMakeLists.txt b/examples/wifi/wps/CMakeLists.txt index fd23de9aa4..8bf9b9a8d2 100644 --- a/examples/wifi/wps/CMakeLists.txt +++ b/examples/wifi/wps/CMakeLists.txt @@ -1,8 +1,6 @@ -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(MAIN_SRCS main/wps.c) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(wps_example) diff --git a/examples/wifi/wps/main/CMakeLists.txt b/examples/wifi/wps/main/CMakeLists.txt new file mode 100644 index 0000000000..c0a1063f66 --- /dev/null +++ b/examples/wifi/wps/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "wps.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/tools/ci/build_examples_cmake.sh b/tools/ci/build_examples_cmake.sh index e4f728cbde..d86d30fbd9 100755 --- a/tools/ci/build_examples_cmake.sh +++ b/tools/ci/build_examples_cmake.sh @@ -65,7 +65,7 @@ RESULT_ISSUES=22 # magic number result code for issues found LOG_SUSPECTED=${LOG_PATH}/common_log.txt touch ${LOG_SUSPECTED} -EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name CMakeLists.txt | grep -v "/components/" | sort ) +EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name CMakeLists.txt | grep -v "/components/" | grep -v "/main/" | sort ) if [ $# -eq 0 ] then diff --git a/tools/ci/check_examples_cmake_make.sh b/tools/ci/check_examples_cmake_make.sh index 2f2d844132..079d185431 100755 --- a/tools/ci/check_examples_cmake_make.sh +++ b/tools/ci/check_examples_cmake_make.sh @@ -2,7 +2,7 @@ # While we support GNU Make & CMake together, check the same examples are present for both -CMAKE_EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name CMakeLists.txt | grep -v "/components/") +CMAKE_EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name CMakeLists.txt | grep -v "/components/" | grep -v "/main/") MAKE_EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name Makefile ) # temporary: ignore ULP examples as no ULP toolchain support diff --git a/tools/ci/test_build_system_cmake.sh b/tools/ci/test_build_system_cmake.sh index de400fcb7d..bb57375d1e 100755 --- a/tools/ci/test_build_system_cmake.sh +++ b/tools/ci/test_build_system_cmake.sh @@ -78,7 +78,7 @@ function run_tests() take_build_snapshot touch ${IDF_PATH}/components/bootloader/subproject/main/bootloader_start.c idf.py build || failure "Failed to partial build bootloader" - assert_rebuilt ${BOOTLOADER_BINS} bootloader/CMakeFiles/bootloader.elf.dir/main/bootloader_start.c.obj + assert_rebuilt ${BOOTLOADER_BINS} bootloader/main/CMakeFiles/main.dir/bootloader_start.c.obj assert_not_rebuilt ${APP_BINS} ${PARTITION_BIN} print_status "Partition CSV file rebuilds partitions" diff --git a/tools/cmake/components.cmake b/tools/cmake/components.cmake index 0056a3b4a0..bb4be0c862 100644 --- a/tools/cmake/components.cmake +++ b/tools/cmake/components.cmake @@ -22,8 +22,14 @@ function(register_component) spaces2list(COMPONENT_ADD_INCLUDEDIRS) spaces2list(COMPONENT_SRCEXCLUDE) - # Add to COMPONENT_SRCS by globbing in COMPONENT_SRCDIRS - if(NOT COMPONENT_SRCS) + if(COMPONENT_SRCDIRS) + # Warn user if both COMPONENT_SRCDIRS and COMPONENT_SRCS are set + if(COMPONENT_SRCS) + message(WARNING "COMPONENT_SRCDIRS and COMPONENT_SRCS are both set, COMPONENT_SRCS will be ignored") + endif() + + set(COMPONENT_SRCS "") + foreach(dir ${COMPONENT_SRCDIRS}) get_filename_component(abs_dir ${dir} ABSOLUTE BASE_DIR ${component_dir}) if(NOT IS_DIRECTORY ${abs_dir}) diff --git a/tools/cmake/convert_to_cmake.py b/tools/cmake/convert_to_cmake.py index 82e6971715..be0b42510e 100755 --- a/tools/cmake/convert_to_cmake.py +++ b/tools/cmake/convert_to_cmake.py @@ -82,10 +82,20 @@ def get_component_variables(project_path, component_path): if src is not None: srcs.append(src) make_vars["COMPONENT_SRCS"] = " ".join(srcs) - else: # Use COMPONENT_SRCDIRS - make_vars["COMPONENT_SRCDIRS"] = make_vars.get("COMPONENT_SRCDIRS", ".") + else: + component_srcs = list() + for component_srcdir in make_vars.get("COMPONENT_SRCDIRS", ".").split(" "): + component_srcdir_path = os.path.abspath(os.path.join(component_path, component_srcdir)) + + srcs = list() + srcs += glob.glob(os.path.join(component_srcdir_path, "*.[cS]")) + srcs += glob.glob(os.path.join(component_srcdir_path, "*.cpp")) + srcs = [('"%s"' % str(os.path.relpath(s, component_path))) for s in srcs] make_vars["COMPONENT_ADD_INCLUDEDIRS"] = make_vars.get("COMPONENT_ADD_INCLUDEDIRS", "include") + component_srcs += srcs + make_vars["COMPONENT_SRCS"] = " ".join(component_srcs) + return make_vars @@ -106,32 +116,10 @@ def convert_project(project_path): component_paths = project_vars["COMPONENT_PATHS"].split(" ") - # "main" component is made special in cmake, so extract it from the component_paths list - try: - main_component_path = [ p for p in component_paths if os.path.basename(p) == "main" ][0] - if debug: - print("Found main component %s" % main_component_path) - main_vars = get_component_variables(project_path, main_component_path) - except IndexError: - print("WARNING: Project has no 'main' component, but CMake-based system requires at least one file in MAIN_SRCS...") - main_vars = { "COMPONENT_SRCS" : ""} # dummy for MAIN_SRCS - - # Remove main component from list of components we're converting to cmake - component_paths = [ p for p in component_paths if os.path.basename(p) != "main" ] - # Convert components as needed for p in component_paths: convert_component(project_path, p) - # Look up project variables before we start writing the file, so nothing - # is created if there is an error - - main_srcs = main_vars["COMPONENT_SRCS"].split(" ") - # convert from component-relative to absolute paths - main_srcs = [ os.path.normpath(os.path.join(main_component_path, m)) for m in main_srcs ] - # convert to make relative to the project directory - main_srcs = [ os.path.relpath(m, project_path) for m in main_srcs ] - project_name = project_vars["PROJECT_NAME"] # Generate the project CMakeLists.txt file @@ -139,12 +127,11 @@ def convert_project(project_path): f.write(""" # (Automatically converted from project Makefile by convert_to_cmake.py.) -# The following four lines of boilerplate have to be in your project's CMakeLists +# The following lines of boilerplate have to be in your project's CMakeLists # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) """) - f.write("set(MAIN_SRCS %s)\n" % " ".join(main_srcs)) f.write(""" include($ENV{IDF_PATH}/tools/cmake/project.cmake) """) @@ -164,16 +151,6 @@ def convert_component(project_path, component_path): # Look up all the variables before we start writing the file, so it's not # created if there's an erro component_srcs = v.get("COMPONENT_SRCS", None) - component_srcdirs = None - if component_srcs is not None: - # see if we should be using COMPONENT_SRCS or COMPONENT_SRCDIRS, if COMPONENT_SRCS is everything in SRCDIRS - component_allsrcs = [] - for d in v.get("COMPONENT_SRCDIRS", "").split(" "): - component_allsrcs += glob.glob(os.path.normpath(os.path.join(component_path, d, "*.[cS]"))) - component_allsrcs += glob.glob(os.path.normpath(os.path.join(component_path, d, "*.cpp"))) - abs_component_srcs = [os.path.normpath(os.path.join(component_path, p)) for p in component_srcs.split(" ")] - if set(component_allsrcs) == set(abs_component_srcs): - component_srcdirs = v.get("COMPONENT_SRCDIRS") component_add_includedirs = v["COMPONENT_ADD_INCLUDEDIRS"] cflags = v.get("CFLAGS", None) @@ -185,10 +162,7 @@ def convert_component(project_path, component_path): f.write("set(COMPONENT_REQUIRES "")\n") f.write("set(COMPONENT_PRIV_REQUIRES "")\n\n") - if component_srcdirs is not None: - f.write("set(COMPONENT_SRCDIRS %s)\n\n" % component_srcdirs) - f.write("register_component()\n") - elif component_srcs is not None: + if component_srcs is not None: f.write("set(COMPONENT_SRCS %s)\n\n" % component_srcs) f.write("register_component()\n") else: diff --git a/tools/cmake/idf_functions.cmake b/tools/cmake/idf_functions.cmake index b8c0f221d1..9f6474ca1d 100644 --- a/tools/cmake/idf_functions.cmake +++ b/tools/cmake/idf_functions.cmake @@ -22,8 +22,15 @@ macro(idf_set_global_variables) # (cmake calls this CMAKE_SOURCE_DIR, keeping old name for compatibility.) set(PROJECT_PATH "${CMAKE_SOURCE_DIR}") - # Note: Unlike older build system, "main" is no longer a component. See build docs for details. - set_default(COMPONENT_DIRS "${PROJECT_PATH}/components ${EXTRA_COMPONENT_DIRS} ${IDF_PATH}/components") + if(MAIN_SRCS) + message(WARNING "main is now a component, use of MAIN_SRCS is deprecated") + set_default(COMPONENT_DIRS "${PROJECT_PATH}/components ${EXTRA_COMPONENT_DIRS} \ + ${IDF_PATH}/components") + else() + set_default(COMPONENT_DIRS "${PROJECT_PATH}/components ${EXTRA_COMPONENT_DIRS} \ + ${IDF_PATH}/components ${PROJECT_PATH}/main") + endif() + spaces2list(COMPONENT_DIRS) spaces2list(COMPONENTS) @@ -140,8 +147,22 @@ endfunction() function(idf_add_executable) set(exe_target ${PROJECT_NAME}.elf) - spaces2list(MAIN_SRCS) - add_executable(${exe_target} "${MAIN_SRCS}") + if(MAIN_SRCS) + spaces2list(MAIN_SRCS) + add_executable(${exe_target} ${MAIN_SRCS}) + else() + # Create a dummy file to work around CMake requirement of having a source + # file while adding an executable + add_executable(${exe_target} "${CMAKE_CURRENT_BINARY_DIR}/dummy_main_src.c") + add_custom_command(OUTPUT dummy_main_src.c + COMMAND echo "" > dummy_main_src.c + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + VERBATIM) + + add_custom_target(dummy_main_src DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dummy_main_src.c) + + add_dependencies(${exe_target} dummy_main_src) + endif() add_map_file(${exe_target}) endfunction() diff --git a/tools/cmake/scripts/expand_requirements.cmake b/tools/cmake/scripts/expand_requirements.cmake index a825a76473..d8660dcc6b 100644 --- a/tools/cmake/scripts/expand_requirements.cmake +++ b/tools/cmake/scripts/expand_requirements.cmake @@ -37,8 +37,16 @@ endfunction() # (expand_component_requirements() includes the component CMakeLists.txt, which then sets its component variables, # calls this dummy macro, and immediately exits again.) macro(register_component) - spaces2list(COMPONENT_REQUIRES) - set_property(GLOBAL PROPERTY "${COMPONENT}_REQUIRES" "${COMPONENT_REQUIRES}") + if(COMPONENT STREQUAL main AND NOT COMPONENT_REQUIRES) + set(main_component_requires ${COMPONENTS}) + list(REMOVE_ITEM main_component_requires "main") + + set_property(GLOBAL PROPERTY "${COMPONENT}_REQUIRES" "${main_component_requires}") + else() + spaces2list(COMPONENT_REQUIRES) + set_property(GLOBAL PROPERTY "${COMPONENT}_REQUIRES" "${COMPONENT_REQUIRES}") + endif() + spaces2list(COMPONENT_PRIV_REQUIRES) set_property(GLOBAL PROPERTY "${COMPONENT}_PRIV_REQUIRES" "${COMPONENT_PRIV_REQUIRES}") diff --git a/tools/cmake/utilities.cmake b/tools/cmake/utilities.cmake index e1c682c898..74d90d317d 100644 --- a/tools/cmake/utilities.cmake +++ b/tools/cmake/utilities.cmake @@ -179,3 +179,14 @@ function(make_json_list list variable) string(REPLACE ";" "\", \"" result "[ \"${list}\" ]") set("${variable}" "${result}" PARENT_SCOPE) endfunction() + +# add_prefix +# +# Adds a prefix to each item in the specified list. +# +function(add_prefix var prefix) + foreach(elm ${ARGN}) + list(APPEND newlist "${prefix}${elm}") + endforeach() + set(${var} "${newlist}" PARENT_SCOPE) +endfunction() \ No newline at end of file