Hello,
I'm wondering if someone might help me figure out how to get the Q DSP Library (qlib) working with an ESP-IDF project for processing analog signals via ADC. It's available here: https://github.com/cycfi/q
But, I'm having a really difficult time figuring out how to make it work with the main CMakeLists.txt. I've tried adding the Q library inside the components/ directory and I've also tried setting it up standalone with an EXTRA_COMPONENT_DIRS directive. I guess I'm still just confused.
As far as I understand, I only need the q_lib directory (qlib) which is header-only based code. That should be able to be done by turning off examples, test, and io in this file: https://github.com/cycfi/q/blob/develop/CMakeLists.txt
Any suggestions? Is there something simple I'm missing?
Help getting a 3rd party library to work with an ESP-IDF project
Re: Help getting a 3rd party library to work with an ESP-IDF project
Ok, I was able to track this down a little more.
If I clone https://github.com/cycfi/q as a submodule so that the q/ directory is at the root of my project and change the CMakeLists.txt file at the root of my project to be this:
...and then change the CMakeLists.txt file inside the q/q_lib/ directory and add the following:
...then, in my main.c file, I try to include one of the .hpp files like this:
That file gets included and it appears to be able to navigate to the other included header files fine, but then it errors out because it can't find standard C++ headers, like:
Basically anything like this it's complaining about:
Are the standard C++ libraries not available at all in ESP-IDF 5.3?
If I clone https://github.com/cycfi/q as a submodule so that the q/ directory is at the root of my project and change the CMakeLists.txt file at the root of my project to be this:
Code: Select all
# 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.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(EXTRA_COMPONENT_DIRS "q/q_lib")
project(continuous_read)
link_libraries(PUBLIC q_lib)
Code: Select all
cmake_minimum_required(VERSION 3.5.1)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add this near the top of t
idf_component_register(
INCLUDE_DIRS ./include
)
# project(qlib) # comment this line out because ESP-IDF complains
...
...
...
# Replace the lines at the bottom with this:
add_library(q_lib INTERFACE)
target_include_directories(q_lib INTERFACE include/)
target_link_libraries(q_lib INTERFACE cycfi::infra)
target_compile_options(q_lib INTERFACE "/std:c++20")
Code: Select all
#include <q/pitch/pitch_detector.hpp>
Code: Select all
fatal error: cstdint: No such file or directory
fatal error: type_traits: No such file or directory
...etc.
Code: Select all
#include <type_traits>
#include <cstdint>
#include <cstring>
#include <algorithm>
...etc.
Re: Help getting a 3rd party library to work with an ESP-IDF project
I think I at least figured out part of it. I’ve got it building. Part of the issue is that I needed to make my main code be a CPP file. So it’s now main.cpp. That’s got me past the build errors.
Re: Help getting a 3rd party library to work with an ESP-IDF project
Hey Timothy did you get anywhere with this?
I also want to use Q on teensy (the bitstream correlation for pitch detection is state of the art), but running into similar issues to you.
Using PlatformIO.
Did you have any repos up or example project I could take a look at?
Thanks!
I also want to use Q on teensy (the bitstream correlation for pitch detection is state of the art), but running into similar issues to you.
Using PlatformIO.
Did you have any repos up or example project I could take a look at?
Thanks!
Re: Help getting a 3rd party library to work with an ESP-IDF project
Yes. I finally got it building and have some code that “works.” I’m still working on refining it all. The trick in getting it to build, in my case, was forking QLib so that I could change the CMakeLists.txt files in the `q` and `infra` directories so that the `project()` directive would NOT be used.
```
# Allow building with ESP-IDF
if(DEFINED ENV{IDF_PATH})
idf_component_register(
INCLUDE_DIRS ./include
)
else()
project(infra)
endif()
```
If you’d like to take a look at the code and project, it’s here: https://github.com/joulupukki/esp32-chromatic-tuner
```
# Allow building with ESP-IDF
if(DEFINED ENV{IDF_PATH})
idf_component_register(
INCLUDE_DIRS ./include
)
else()
project(infra)
endif()
```
If you’d like to take a look at the code and project, it’s here: https://github.com/joulupukki/esp32-chromatic-tuner
Who is online
Users browsing this forum: Bing [Bot] and 229 guests