brainstorming: how would you recommend to compile / "install" an external non arduino library #36
-
I am asking here, as I feel that having a platformio core set up may actually make things quite a bit easier (ie the right compiler options etc are already in place), but I may be wrong; if this is off topic, just let me know :) . I would like to use this library in a project: https://github.com/drowe67/codec2 . However, it does not come as an arduino library, but as a standard C++ library with CMake. There is a way to compile it for ARM microcontrollers it seems though:
Any idea if I can take "advantage" of the platformio core to help me compile this / how I could do so? :) |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Hi @jerabaul29, You could try checking out the library in your Then fiddle with the settings and see how you go. If I get some time I will see if I can get it to compile. |
Beta Was this translation helpful? Give feedback.
-
Ok, thanks, will have a try some day soon :) . This is very kind of you to provide some pointers, don t feel forced to do any work on your side of course :) . |
Beta Was this translation helpful? Give feedback.
-
Hi @jerabaul29, How did you go with this? I had a play. If you run these commands to create a new project: mkdir code2_test
cd code2_test
pio init --board SparkFun_RedBoard_Artemis_ATP
mkdir scripts
cd lib
mkdir Trace
mkdir Trace/src
git clone https://github.com/drowe67/codec2.git Then create #ifndef TRACE_H
#define TRACE_H
#include "stdlib.h"
size_t trace_write(char* buffer, size_t buf_idx_ptr);
#endif and create {
"name": "Trace",
"version": "0.0.1",
"description": "",
"repository": {
"type": "git",
"url": ""
},
"keywords": [
],
"authors": [
{
"name": ""
}
],
"frameworks": [
"arduino"
],
"dependencies": {
"Trace": ">=0.01"
},
"license": "",
"libArchive": false,
"build": {
"srcFilter": [
"+<*.c>",
"+<*.h>"
]
}
} Then create {
"name": "Codec 2",
"version": "1.0.3",
"description": "Codec 2 is an open source (LGPL 2.1) low bit rate speech codec: http://rowetel.com/codec2.html",
"repository": {
"type": "git",
"url": "https://github.com/drowe67/codec2.git"
},
"keywords": [
"codec"
],
"authors": [
{
"name": "drowe67"
}
],
"frameworks": [
"arduino"
],
"dependencies": {
"Trace": ">=0.01"
},
"license": "LGPL 2.1",
"libArchive": true,
"build": {
"srcFilter": [
"+<*.c>",
"+<*.h>",
"-<ldpc_enc_test.c>",
"-<ldpc_dec_test.c>"
]
}
} Then run these commands: cd codec2
mkdir build
cd build
cmake ..
mkdir ../src/codec2
cp ./codec2/version.h ../src/codec2/
make
.
.
.
cp src/codebook* ../src/
cd ../../.. And create the file #include "codec2.h"
void setup()
{
}
void loop()
{
} Add the the following line to build_flags = -DGIT_HASH=\"665f15eac22897cd8a6076a08b195b1cecfcc456\" Then, assuming that I have transcribed everything correctly, we can compile it:
Now you may have some more issues when you actually start to use the library. |
Beta Was this translation helpful? Give feedback.
-
Sorry, I got a big bunch of work and I have not had the time to look at this myself :( . Unsure of when I will have time. But many thanks, this indeed looks very good. Is it ok to either keep this issue open, or move it to a discussion, so that I can easily find it back when I come back to this? :) . |
Beta Was this translation helpful? Give feedback.
-
Hi @jerabaul29, I will convert this Issue to a discussion under Q & A. |
Beta Was this translation helpful? Give feedback.
Hi @jerabaul29,
How did you go with this? I had a play.
If you run these commands to create a new project:
Then create
Trace/src/Trace.h
and create
Trace/library.json
: