diff --git a/.gitignore b/.gitignore index 029eb5ba..dbd06bb0 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,9 @@ compile_commands.json libsrc/flatbufserver/hyperion_reply_generated.h libsrc/flatbufserver/hyperion_request_generated.h +# Copied ws281x header files +/dependencies/include/ws2811 + # Kdevelop project files *.kdev* diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index bc5044be..e2c50f70 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -12,6 +12,23 @@ if(ENABLE_DEV_WS281XPWM) external/rpi_ws281x/pwm.c external/rpi_ws281x/dma.c external/rpi_ws281x/pcm.c external/rpi_ws281x/rpihw.c) + + #Workaround: Copy ws281x headers to avoid that the "version" file is treated as a header file. + set(WS281X_SOURCE_DIR "${CMAKE_SOURCE_DIR}/dependencies/external/rpi_ws281x") + set(WS281X_DEST_DIR "${CMAKE_SOURCE_DIR}/dependencies/include/ws2811") + file(GLOB WS281X_HEADER_FILES "${WS281X_SOURCE_DIR}/*.h") + + message(STATUS "WS281X_SOURCE_DIR = ${WS281X_SOURCE_DIR}") + message(STATUS "WS281X_DEST_DIR = ${WS281X_DEST_DIR}") + message(STATUS "WS281X_HEADER_FILES = ${WS281X_HEADER_FILES}") + + add_custom_command( + TARGET ws281x + PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory "${WS281X_DEST_DIR}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${WS281X_HEADER_FILES} "${WS281X_DEST_DIR}" + ) + endif() #============================================================================= @@ -133,9 +150,9 @@ endif() if(ENABLE_PROTOBUF_SERVER) set(USE_SYSTEM_PROTO_LIBS ${DEFAULT_USE_SYSTEM_PROTO_LIBS} CACHE BOOL "use protobuf library from system") - + # defines for 3rd party sub-modules - set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "Build abseil-cpp with C++ version requirements propagated") + set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "Build abseil-cpp with C++ version requirements propagated") if (USE_SYSTEM_PROTO_LIBS) find_package(Protobuf REQUIRED) @@ -163,7 +180,7 @@ if(ENABLE_PROTOBUF_SERVER) # define the protobuf library set(PROTOBUF_LIBRARIES protobuf::libprotobuf) - + endif() # redefine at parent scope diff --git a/libsrc/leddevice/CMakeLists.txt b/libsrc/leddevice/CMakeLists.txt index 233bb9fd..0862d81f 100644 --- a/libsrc/leddevice/CMakeLists.txt +++ b/libsrc/leddevice/CMakeLists.txt @@ -60,7 +60,7 @@ if ( ENABLE_DEV_USB_HID ) endif() if ( ENABLE_DEV_WS281XPWM ) - include_directories(../../dependencies/external/rpi_ws281x) + target_include_directories(ws281x PRIVATE "${CMAKE_SOURCE_DIR}/include/ws2811") FILE ( GLOB Leddevice_PWM_SOURCES "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.h" "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.cpp") endif() diff --git a/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.h b/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.h index d5d4f123..795b5a60 100644 --- a/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.h +++ b/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.h @@ -3,7 +3,7 @@ // LedDevice includes #include -#include +#include /// /// Implementation of the LedDevice interface for writing to WS281x LED-device via pwm.