Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Arduino lib to arduino as IDF component #8721

Merged
merged 5 commits into from
Oct 6, 2023
Merged

Conversation

me-no-dev
Copy link
Member

Redo of: #8115

This Doc update is based on "for reference" issue #7839
This update provides info on how to add Arduino library when using arduino-esp32 as an ESP_IDF component.
There is also new script in tools/add_lib.sh which helps with that. The script also creates the CMakefileLists.txt

Usage of the script:

This script help to add library when using arduino-esp32 as an ESP-IDF component
The script accepts up to three arguments:
-n  NEW: URL address to new library on GIThub (cannot be combined with -e)
-l  LOCAL: Path to the project where the library should be placed locally (must be paired with -e or -n)
-e  EXISTING: path to existing libary- this will simply skip the download (cannot be combined with -n)

Examples:
./add_lib.sh -n https://github.com/me-no-dev/ESPAsyncWebServer
./add_lib.sh -l ~/esp/esp-idf/examples/your_project
./add_lib.sh -e ~/Arduino/libraries/existing_library

./add_lib.sh -n https://github.com/me-no-dev/ESPAsyncWebServer -l ~/esp/esp-idf/examples/your_project
./add_lib.sh -e ~/Arduino/libraries/existing_library -l ~/esp/esp-idf/examples/your_project"

The script was tested with this (manually checked the results):

#!/bin/bash

# test all possible combinations of parameters for the add_lib.sh script

# define test cases
test_cases=(
    "-n https://github.com/me-no-dev/ESPAsyncWebServer -l ~/esp/esp-idf/examples/add_lib"
    "-n https://github.com/me-no-dev/ESPAsyncWebServer -e ~/Arduino/libraries/ESPAsyncWebSrv"
    "-l ~/esp/esp-idf/examples/add_lib -e ~/Arduino/libraries/ESPAsyncWebSrv"
    "-n https://github.com/me-no-dev/ESPAsyncWebServer -l ~/esp/esp-idf/examples/add_lib -e ~/Arduino/libraries/ESPAsyncWebSrv"
    "-n https://github.com/me-no-dev/ESPAsyncWebServer -e ~/nonexistent/folder"
    "-n https://github.com/me-no-dev/ESPAsyncWebServer"
    "-l ~/esp/esp-idf/examples/add_lib"
    "-e ~/Arduino/libraries/ESPAsyncWebSrv"
)

# run each test case
for test_case in "${test_cases[@]}"; do
    echo "Running test case: ./add_lib.sh $test_case"
    ./add_lib.sh $test_case
    if [ $? -eq 1 ]; then
        echo "Test case failed: $test_case"
    else
        echo "Test case passed: $test_case"
    fi
    echo "============================================="
done

@VojtechBartoska VojtechBartoska added the Type: Documentation Issue pertains to Documentation of Arduino ESP32 label Oct 6, 2023
@me-no-dev me-no-dev merged commit 64fa120 into master Oct 6, 2023
38 checks passed
@me-no-dev me-no-dev deleted the feature/tomas_add_lib branch October 6, 2023 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Documentation Issue pertains to Documentation of Arduino ESP32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants