Skip to content

Commit 69dccc6

Browse files
committed
Add support for cmake
usb and camera might not compile yet
1 parent eb3d6cc commit 69dccc6

19 files changed

+2548
-422
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ out/
88
build/
99
xtensa-esp32-elf/
1010
dist/
11+
env.sh
12+
sdkconfig

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# The following lines of boilerplate have to be in your project's
2+
# CMakeLists in this exact order for cmake to work correctly
3+
cmake_minimum_required(VERSION 3.5)
4+
5+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6+
project(arduino-lib-builder)
7+
8+
add_custom_command(
9+
OUTPUT out
10+
COMMAND ${CMAKE_SOURCE_DIR}/tools/prepare-libs.sh ${IDF_TARGET}
11+
DEPENDS ${CMAKE_PROJECT_NAME}.elf gen_project_binary bootloader partition_table
12+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
13+
)
14+
add_custom_target(idf-libs ALL DEPENDS out)
15+

Makefile

Lines changed: 0 additions & 17 deletions
This file was deleted.

build.sh

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,6 @@ if ! [ -x "$(command -v git)" ]; then
1010
exit 1
1111
fi
1212

13-
if ! [ -x "$(command -v make)" ]; then
14-
echo "ERROR: Make is not installed! Please install Make first."
15-
exit 1
16-
fi
17-
18-
if ! [ -x "$(command -v flex)" ]; then
19-
echo "ERROR: flex is not installed! Please install flex first."
20-
exit 1
21-
fi
22-
23-
if ! [ -x "$(command -v bison)" ]; then
24-
echo "ERROR: bison is not installed! Please install bison first."
25-
exit 1
26-
fi
27-
28-
if ! [ -x "$(command -v gperf)" ]; then
29-
echo "ERROR: gperf is not installed! Please install gperf first."
30-
exit 1
31-
fi
32-
33-
if ! [ -x "$(command -v stat)" ]; then
34-
echo "ERROR: stat is not installed! Please install stat first."
35-
exit 1
36-
fi
37-
3813
mkdir -p dist
3914

4015
# update components from git
@@ -45,17 +20,25 @@ if [ $? -ne 0 ]; then exit 1; fi
4520
source ./tools/install-esp-idf.sh
4621
if [ $? -ne 0 ]; then exit 1; fi
4722

48-
# build and prepare libs
49-
./tools/build-libs.sh
50-
if [ $? -ne 0 ]; then exit 1; fi
23+
TARGETS="esp32s2 esp32"
5124

52-
# bootloader
53-
./tools/build-bootloaders.sh
54-
if [ $? -ne 0 ]; then exit 1; fi
25+
rm -rf out build sdkconfig sdkconfig.old
26+
27+
for target in $TARGETS; do
28+
# configure the build for the target
29+
rm -rf build sdkconfig sdkconfig.old
30+
cp "sdkconfig.$target" sdkconfig
31+
# build and prepare libs
32+
idf.py idf-libs
33+
if [ $? -ne 0 ]; then exit 1; fi
34+
cp sdkconfig "sdkconfig.$target"
35+
# build bootloaders
36+
./tools/build-bootloaders.sh
37+
if [ $? -ne 0 ]; then exit 1; fi
38+
done
5539

5640
# archive the build
5741
./tools/archive-build.sh
5842
if [ $? -ne 0 ]; then exit 1; fi
5943

60-
# POST Build
6144
#./tools/copy-to-arduino.sh

main/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
idf_component_register(SRCS "sketch.cpp" "arduino-lib-builder-gcc.c" "arduino-lib-builder-cpp.cpp" "arduino-lib-builder-as.S" INCLUDE_DIRS ".")

main/arduino-lib-builder-as.S

Whitespace-only changes.

main/arduino-lib-builder-cpp.cpp

Whitespace-only changes.

main/arduino-lib-builder-gcc.c

Whitespace-only changes.

main/sketch.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#include "Arduino.h"
22

3-
void setup(){
4-
3+
void setup() {
4+
Serial.begin(115200);
55
}
66

7-
void loop(){
8-
7+
void loop() {
8+
Serial.println("Hello World!");
9+
delay(1000);
910
}

0 commit comments

Comments
 (0)