Hello,
I want to include an Adafruit BNO055 sensor to my Qt project using CMAke.
I downloaded the drivers from: GitHub - adafruit/Adafruit_BNO055: Unified sensor driver for the Adafruit BNO055 orientation sensor breakout
The driver does not have a CMakeLists.txt. So i tried to make one of my own:
cmake_minimum_required (VERSION 2.6)
SET( UTILITY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/utility )
SET( ARDUINO_PATH ${CMAKE_CURRENT_SOURCE_DIR}/arduino )
SET( INCLUDEPATH ${CMAKE_CURRENT_SOURCE_DIR} )
set(CMAKE_AUTOMOC ON)
include_directories(${INCLUDEPATH})
SET( SOURCES ${SOURCES}
Adafruit_BNO055.cpp
${UTILITY_PATH}/imumaths.h
${UTILITY_PATH}/matrix.h
${UTILITY_PATH}/quaternion.h
${UTILITY_PATH}/vector.h
${ARDUINO_PATH}/Arduino.h
${ARDUINO_PATH}/WProgram.h
)
IF(WIN32)
SET(SOURCES ${SOURCES}
Adafruit_BNO055.h
${UTILITY_PATH}/imumaths.h
${UTILITY_PATH}/matrix.h
${UTILITY_PATH}/quaternion.h
${UTILITY_PATH}/vector.h
${ARDUINO_PATH}/Arduino.h
${ARDUINO_PATH}/WProgram.h
)
ENDIF(WIN32)
add_executable(${PROJECTNAME} ${SOURCES})
SETUP_TARGET_BUILD(${PROJECTNAME})
INSTALL(TARGETS ${PROJECTNAME} RUNTIME
DESTINATION ${CMAKE_INSTALL_PREFIX}
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX})
When I compile my code, I get the following error:
In file included from /home/user/projekte/arNew/source/ext.drivers/src/ext/drivers/imu/adafruit/Adafruit_BNO055.cpp:24:0:
/home/user/projekte/arNew/source/ext.drivers/src/ext/drivers/imu/adafruit/arduino/WProgram.h:8:27: fatal error: avr/interrupt.h: No such file or directory
#include <avr/interrupt.h>
^
compilation terminated.
make[2]: *** [ext.drivers/src/ext/drivers/imu/adafruit/CMakeFiles/ext.drivers.dir/Adafruit_BNO055.cpp.o] Error 1
I have installed the Arduino 1-8.7 in my usr/share location
Do I have to include something like find_package(Arduino REQUIRED xyz) to make this work?