From 8ea326e42945825de7549b353c895488f53a4e19 Mon Sep 17 00:00:00 2001 From: TheJackiMonster Date: Wed, 5 Apr 2023 22:51:55 +0200 Subject: [PATCH] Specify languages and allow C++ usage Signed-off-by: TheJackiMonster --- CMakeLists.txt | 2 +- examples/debug_d3/CMakeLists.txt | 2 +- examples/debug_d4/CMakeLists.txt | 2 +- interface_lib/CMakeLists.txt | 2 +- interface_lib/include/device3.h | 15 +++++++++++++++ interface_lib/include/device4.h | 15 +++++++++++++++ 6 files changed, 34 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b1dfc02..c072cd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.16) -project(nrealAirLinuxDriver) +project(nrealAirLinuxDriver C) set(CMAKE_C_STANDARD 17) diff --git a/examples/debug_d3/CMakeLists.txt b/examples/debug_d3/CMakeLists.txt index 237edbd..939576f 100644 --- a/examples/debug_d3/CMakeLists.txt +++ b/examples/debug_d3/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.16) -project(nrealAirDebugD3) +project(nrealAirDebugD3 C) set(CMAKE_C_STANDARD 17) diff --git a/examples/debug_d4/CMakeLists.txt b/examples/debug_d4/CMakeLists.txt index fbb52b9..0ddd4e3 100644 --- a/examples/debug_d4/CMakeLists.txt +++ b/examples/debug_d4/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.16) -project(nrealAirDebugD4) +project(nrealAirDebugD4 C) set(CMAKE_C_STANDARD 17) diff --git a/interface_lib/CMakeLists.txt b/interface_lib/CMakeLists.txt index 7bfdef8..a77daa4 100644 --- a/interface_lib/CMakeLists.txt +++ b/interface_lib/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.16) -project(nrealAirLibrary) +project(nrealAirLibrary C) set(CMAKE_C_STANDARD 17) diff --git a/interface_lib/include/device3.h b/interface_lib/include/device3.h index e0602a8..23674be 100644 --- a/interface_lib/include/device3.h +++ b/interface_lib/include/device3.h @@ -23,8 +23,19 @@ // THE SOFTWARE. // +#ifndef __cplusplus #include +#endif + +#ifndef __cplusplus #include +#else +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif struct __attribute__((__packed__)) device3_packet_t { uint8_t signature [2]; @@ -133,3 +144,7 @@ device3_quat_type device3_get_orientation(const device3_ahrs_type* ahrs); device3_vec3_type device3_get_euler(device3_quat_type quat); void device3_close(device3_type* device); + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/interface_lib/include/device4.h b/interface_lib/include/device4.h index 085f0e7..3d583c5 100644 --- a/interface_lib/include/device4.h +++ b/interface_lib/include/device4.h @@ -23,8 +23,15 @@ // THE SOFTWARE. // +#ifndef __cplusplus #include +#endif + +#ifndef __cplusplus #include +#else +#include +#endif #define DEVICE4_ACTION_PASSIVE_POLL_START 0b00010 #define DEVICE4_ACTION_BRIGHTNESS_COMMAND 0b00011 @@ -36,6 +43,10 @@ #define DEVICE4_BUTTON_BRIGHTNESS_UP 0x2 #define DEVICE4_BUTTON_BRIGHTNESS_DOWN 0x3 +#ifdef __cplusplus +extern "C" { +#endif + struct __attribute__((__packed__)) device4_packet_t { uint8_t signature; uint32_t checksum; @@ -100,3 +111,7 @@ device4_type* device4_open(device4_event_callback callback); int device4_read(device4_type* device, int timeout); void device4_close(device4_type* device); + +#ifdef __cplusplus +} // extern "C" +#endif