Skip to content

Possibility of compiling static libraries with the cli #1407

Open
@victorChB

Description

@victorChB

I was wondering if it's possible to compile a static library (.a) with the arduino-cli and specify the SDK I want to use (e.g. avr, esp32, due,etc).

My current use case is the following:

I have a library for Arduino which will be built for different platforms and distributed as a static lib, which in the library.properties file is set with precompiled=true. Since the library is targeted for Arduino I am using the Arduino SDK of each platform. This brings me to the case where I need to include the core libraries for each platform, compiler flags, toolchain, etc. As I understand the arduino-cli detects the installed toolchains and one can select the platform for which the Sketch will be compiled. In my case I would like to make the compiled objects into a static lib instead of an hex,elf or bin.

I currently use the Arduino-Cmake-toolchain where I can specify which SDK I want to use (esp32,avr,due,nano,etc) and then it parses the platforms.txt and boards.txt file to allow me to use the specific toolchain and compiler flags. Afterward, I have a pipeline that creates a new build for each target with CMake, and voila I have all the static libraries for each platform/cpu which I then use with a script to create the library for Arduino according to its specification.

If its not possible at the moment I was wondering if this will be in the roadmap of the project?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions