Hey all,
I am trying to use the C++ boilerplate for the first time to build the BME688 C/C++ in visual studio code. I have followed the instructions and now I am at the point where I need to edit the CMakelists.txt to pull in the Pimoroni librares ect…
And…I’m stuck…
I noticed the base boilerplate example is for “Pico explorer” main.cpp pulls in this .h file based on the CMake file they provide and the library is detected by main.cpp.
So I used that as my guide post to try and start to setup the BME68X libraries,
Immediately after editing the CMakelists, the following fail as cannot find the location/file:
#include “pico/stdlib.h”
#include “bme68x.hpp”
#include “common/pimoroni_i2c.hpp”
I decided to tackle one at a time, starting with common/pimoroni_i2c.hpp
Edit CMakelists, and nothing. Also why is it bombing on pico/stdlib.
My folder structure is as such
/home/pi/Desktop/pico/pico
in there I have my Pico SDK installed fine per the instructions from Raspberry ( I can use visual studio code on my projects no problem)
SDK path has been saved in my .bashrc file as well as added to the VS settings.json as the Pimoroni documentation talks about.
folders are right next to each other
/pico/pico-sdk (official from RPi)
/pico/pico-boilerplate (where I’m trying to build the BME example
/pico/pimoroni-pico
The build process finds the compiler, version ect…but bombs out.
I have cleared out main.cpp because I dragged in the cpp and hpp files from:
/home/pi/Desktop/pico/pico/pimoroni-pico/examples/breakout_bme688
just the cpp and hpp files.
here is my CMakelist.txt file I know this is what I need to fix somehow and I probably dont/shouldn’t drag those cpp .hpp files into my workspace.
cmake_minimum_required(VERSION 3.12)
# Change your executable name to something creative!
set(NAME bme688) # <-- Name your project/executable here!
include(pimoroni_pico_import.cmake)
include(pico_sdk_import.cmake)
# Gooey boilerplate
project(${NAME} C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
# Initialize the SDK
pico_sdk_init()
# Add your source files
add_executable(${NAME}
main.cpp # <-- Add source files here!
)
#common/pimoroni_i2c.hpp
#include(libraries/pico_explorer/pico_explorer) <------this was the orginial code in the shell boilerplate
# Include required libraries
# This assumes `pimoroni-pico` is stored alongside your project
include(/home/pi/Desktop/pico/pico/pimoroni-pico/common/pimoroni_common.hpp) #<---here I tried just /common/pimoroni orginially, by giving the full path I get less errors.
include(drivers/bme68x/src) #<-----added this, didnt do anything
include(pico_stdlib hardware_i2c) #<----addded this didn't do anything
# Pull in pico libraries that we need
target_link_libraries(${OUTPUT_NAME} pico_stdlib hardware_i2c pimoroni_i2c bme68x) #<---added pico_stdlib, hardware_i2c and bme68x, pimoroni_i2c was there from the example
# create map/bin/hex file etc.
pico_add_extra_outputs(${OUTPUT_NAME})
# We can't control the uninitialized result variables in the BME68X API
# so demote unitialized to a warning for this target.
target_compile_options(${DRIVER_NAME} INTERFACE -Wno-error=uninitialized)
# Don't forget to link the libraries you need!
target_link_libraries(${NAME}
pimoroni_i2c
bme68x #<----I added this the above was already there
)
# <-- List libraries here! (I didn't write this array its part of the example)
#Display command line
#pico_enable_stdio_uart(bme688 1)
#pico_enable_stdio_usb(bme88 1) <----had to comment this out, I added it but, throwing errors so I figured deal with that later.
# create map/bin/hex file etc.
pico_add_extra_outputs(${NAME})
#<--I removed some code here that was basically creating a zip file and packing it up, I dont need that.
How the heck to I get a proper CMakelists.txt to make this work to compile the BME688? I’m terrible at CMAKE, I have two book on it and it still confuses me!
I was able to compile all of the examples using the instructions provided so I have U2F’s of every project. I have a BME 680 hooked up and I put the 688 U2F on it but nothing happens, well maybe something happens but nothing is outputted to the terminal (don’t know if that was setup or not). Also its a 680 not a 688 so I don’t know if maybe its not compatible, and I also don’t know what I2C pins the U2F is using I figured the default ones so I hooked up to pins 4 and 5. I have no way of knowing if the U2F is doing anything.
I need someone with wizard magic skills to help me out and tell me what my CMakelist.txt files needs to look like and if I should be copy/pasting any files into my Visual Studio workplace. I just need one solid example that pulls things in from multiple locations from the Pimoroni-pico so I can understand it.
The boilerplate is too barebones for me and I’m sure I can mess with it for decades trying to figure it out. Hoping someone out there is gracious enough to help me. I admit I suck at this, I’ve tried to research it on my own but I’m not getting anywhere.
I would literally paypal someone some cash for a working CMakelist.txt file that pulls in everything (with some explanation commented out) I need and compiles the program so I can and also tells me which files I need to add to Visual Studio Workspace. That way I can start to edit it and build my program (the 680 is just part of my program I want to build). I just need some instructions for super dummies :(
I don’t use Micropython. I am a C/C++ guy. So please don’t suggest “just use the python version”.
Respectfully,
-A very confused and loyal customer.