2016-06-03 16:46:45 +02:00
|
|
|
add_subdirectory(build/hidapi)
|
2020-05-12 19:51:19 +02:00
|
|
|
|
|
|
|
if ( ENABLE_TINKERFORGE )
|
|
|
|
add_subdirectory(build/tinkerforge)
|
|
|
|
endif()
|
2016-06-03 16:46:45 +02:00
|
|
|
|
|
|
|
if(ENABLE_WS281XPWM)
|
|
|
|
add_library(ws281x
|
|
|
|
external/rpi_ws281x/mailbox.c external/rpi_ws281x/ws2811.c
|
|
|
|
external/rpi_ws281x/pwm.c external/rpi_ws281x/dma.c
|
2017-05-23 18:14:27 +02:00
|
|
|
external/rpi_ws281x/pcm.c
|
2016-06-03 16:46:45 +02:00
|
|
|
external/rpi_ws281x/rpihw.c)
|
2016-06-13 08:11:57 +02:00
|
|
|
endif()
|
2016-06-03 16:46:45 +02:00
|
|
|
|
2019-02-17 15:26:11 +01:00
|
|
|
#=============================================================================
|
|
|
|
# FLATBUFFER
|
|
|
|
#=============================================================================
|
|
|
|
|
2018-12-28 18:12:45 +01:00
|
|
|
set(USE_SYSTEM_FLATBUFFERS_LIBS ${DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS} CACHE BOOL "use flatbuffers library from system")
|
|
|
|
|
|
|
|
if (USE_SYSTEM_FLATBUFFERS_LIBS)
|
2020-08-30 14:47:12 +02:00
|
|
|
find_program(FLATBUFFERS_FLATC_EXECUTABLE NAMES flatc REQUIRED)
|
|
|
|
find_package(Flatbuffers REQUIRED)
|
2018-12-28 18:12:45 +01:00
|
|
|
else ()
|
|
|
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared flatbuffers library")
|
|
|
|
set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "Build Flatbuffers with tests")
|
|
|
|
add_subdirectory(external/flatbuffers)
|
|
|
|
|
|
|
|
if(CMAKE_CROSSCOMPILING)
|
|
|
|
# when crosscompiling import the flatc executable targets from a file generated by a native build
|
|
|
|
option(IMPORT_FLATC "flatc export file (flatc_export.cmake) from a native build" "IMPORT_FLATC-FILE_NOT_FOUND")
|
|
|
|
include(${IMPORT_FLATC})
|
|
|
|
else()
|
|
|
|
# export the flatc compiler so it can be used when cross compiling
|
|
|
|
export(TARGETS flatc FILE "${CMAKE_BINARY_DIR}/flatc_export.cmake")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# define the include for the flatbuffers library at the parent scope
|
|
|
|
set(FLATBUFFERS_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/flatbuffers/include")
|
|
|
|
|
2019-06-10 20:50:37 +02:00
|
|
|
IF (NOT CMAKE_CROSSCOMPILING)
|
|
|
|
# define the flatc executable at the parent scope
|
|
|
|
get_property(FLATBUFFERS_FLATC_EXECUTABLE TARGET flatc PROPERTY LOCATION)
|
|
|
|
else()
|
2019-06-10 20:41:42 +02:00
|
|
|
#Workaround, set flatc comiplier directory hard, as cmake definitions of flatc do not cater for crosscompile correctly.
|
|
|
|
#Includ of flatc_export.cmake detects that flatc target is defined aand returns before using the definitions written by export
|
|
|
|
set ( FLATBUFFERS_FLATC_EXECUTABLE "${CMAKE_BINARY_DIR}/../build-x86x64/bin/flatc")
|
2019-06-10 20:50:37 +02:00
|
|
|
endif()
|
2018-12-28 18:12:45 +01:00
|
|
|
endif()
|
2020-08-30 14:47:12 +02:00
|
|
|
set(FLATBUFFERS_FLATC_EXECUTABLE ${FLATBUFFERS_FLATC_EXECUTABLE} PARENT_SCOPE)
|
|
|
|
set(FLATBUFFERS_INCLUDE_DIRS ${FLATBUFFERS_INCLUDE_DIRS} PARENT_SCOPE)
|
|
|
|
include_directories(${FLATBUFFERS_INCLUDE_DIRS})
|
|
|
|
|
2018-12-28 18:12:45 +01:00
|
|
|
|
|
|
|
message(STATUS "Using flatbuffers compiler: " ${FLATBUFFERS_FLATC_EXECUTABLE})
|
|
|
|
|
|
|
|
function(compile_flattbuffer_schema SRC_FBS OUTPUT_DIR)
|
2019-02-12 14:55:36 +01:00
|
|
|
string(REGEX REPLACE "\\.fbs$" "_generated.h" GEN_HEADER ${SRC_FBS})
|
2020-05-12 19:51:19 +02:00
|
|
|
set_property(SOURCE ${GEN_HEADER} PROPERTY SKIP_AUTOMOC ON)
|
2020-07-21 19:35:25 +02:00
|
|
|
|
2020-08-30 14:47:12 +02:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${GEN_HEADER}
|
|
|
|
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}" -c --no-includes --gen-mutable
|
|
|
|
--gen-object-api
|
|
|
|
-o "${OUTPUT_DIR}"
|
|
|
|
"${SRC_FBS}"
|
|
|
|
DEPENDS "${FLATBUFFERS_FLATC_EXECUTABLE}" ${SRC_FBS})
|
2018-12-28 18:12:45 +01:00
|
|
|
endfunction()
|
2019-02-17 15:26:11 +01:00
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
# PROTOBUFFER
|
|
|
|
#=============================================================================
|
|
|
|
|
|
|
|
set(USE_SYSTEM_PROTO_LIBS ${DEFAULT_USE_SYSTEM_PROTO_LIBS} CACHE BOOL "use protobuf library from system")
|
|
|
|
|
|
|
|
if (USE_SYSTEM_PROTO_LIBS)
|
|
|
|
find_package(Protobuf REQUIRED)
|
|
|
|
else ()
|
|
|
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared protobuf library")
|
|
|
|
add_subdirectory(external/protobuf)
|
|
|
|
|
|
|
|
if(CMAKE_CROSSCOMPILING)
|
|
|
|
# when crosscompiling import the protoc executable targets from a file generated by a native build
|
|
|
|
option(IMPORT_PROTOC "Protoc export file (protoc_export.cmake) from a native build" "IMPORT_PROTOC-FILE_NOT_FOUND")
|
|
|
|
include(${IMPORT_PROTOC})
|
|
|
|
else()
|
|
|
|
# export the protoc compiler so it can be used when cross compiling
|
|
|
|
export(TARGETS protoc_compiler FILE "${CMAKE_BINARY_DIR}/protoc_export.cmake")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# define the include for the protobuf library at the parent scope
|
2020-08-30 14:47:12 +02:00
|
|
|
set(PROTOBUF_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf/src")
|
2019-02-17 15:26:11 +01:00
|
|
|
|
|
|
|
# define the protoc executable at the parent scope
|
|
|
|
get_property(PROTOBUF_PROTOC_EXECUTABLE TARGET protoc_compiler PROPERTY LOCATION)
|
|
|
|
endif()
|
2020-08-30 14:47:12 +02:00
|
|
|
set(PROTOBUF_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE} PARENT_SCOPE)
|
|
|
|
set(PROTOBUF_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS} PARENT_SCOPE)
|
|
|
|
include_directories(${PROTOBUF_INCLUDE_DIRS})
|
2019-02-17 15:26:11 +01:00
|
|
|
|
|
|
|
message(STATUS "Using protobuf compiler: " ${PROTOBUF_PROTOC_EXECUTABLE})
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
# Copyright 2009 Kitware, Inc.
|
|
|
|
# Copyright 2009-2011 Philip Lowman <philip@yhbt.com>
|
|
|
|
# Copyright 2008 Esben Mose Hansen, Ange Optimization ApS
|
|
|
|
#
|
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
|
|
|
#
|
|
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the License for more information.
|
|
|
|
#=============================================================================
|
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
|
|
|
# License text for the above reference.)
|
|
|
|
function(PROTOBUF_GENERATE_CPP SRCS HDRS)
|
|
|
|
if(NOT ARGN)
|
|
|
|
message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(PROTOBUF_GENERATE_CPP_APPEND_PATH)
|
|
|
|
# Create an include path for each file specified
|
|
|
|
foreach(FIL ${ARGN})
|
|
|
|
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
|
|
|
|
get_filename_component(ABS_PATH ${ABS_FIL} PATH)
|
|
|
|
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
|
|
|
|
if(${_contains_already} EQUAL -1)
|
|
|
|
list(APPEND _protobuf_include_path -I ${ABS_PATH})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
else()
|
|
|
|
set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(DEFINED PROTOBUF_IMPORT_DIRS)
|
|
|
|
foreach(DIR ${PROTOBUF_IMPORT_DIRS})
|
|
|
|
get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
|
|
|
|
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
|
|
|
|
if(${_contains_already} EQUAL -1)
|
|
|
|
list(APPEND _protobuf_include_path -I ${ABS_PATH})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_CROSSCOMPILING OR USE_SYSTEM_PROTO_LIBS)
|
|
|
|
set(PROTOC_DEPENDENCY ${PROTOBUF_PROTOC_EXECUTABLE})
|
|
|
|
else()
|
|
|
|
set(PROTOC_DEPENDENCY protoc_compiler)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(${SRCS})
|
|
|
|
set(${HDRS})
|
|
|
|
foreach(FIL ${ARGN})
|
|
|
|
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
|
|
|
|
get_filename_component(FIL_WE ${FIL} NAME_WE)
|
|
|
|
|
|
|
|
list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc")
|
|
|
|
list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h")
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h"
|
|
|
|
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
|
|
|
|
ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
|
|
|
|
DEPENDS ${ABS_FIL} ${PROTOC_DEPENDENCY}
|
|
|
|
COMMENT "Running C++ protocol buffer compiler on ${FIL}"
|
|
|
|
VERBATIM
|
|
|
|
)
|
2020-05-12 19:51:19 +02:00
|
|
|
set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc" PROPERTY SKIP_AUTOMOC ON)
|
|
|
|
set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h" PROPERTY SKIP_AUTOMOC ON)
|
2019-02-17 15:26:11 +01:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE)
|
|
|
|
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
|
|
|
|
set(${HDRS} ${${HDRS}} PARENT_SCOPE)
|
|
|
|
endfunction()
|
add Hue EntertainmentAPI + Forwarder & other Fixes (#592)
* whitespaces + typo fixes
* JS / LGTM fixes
* SSDP Handler crash fix
* MessageForwarder handlePriorityChanges Slave fixes
* use aboutToQuit Signal
* complete rewriten Hue Entertainment API structure
combined Philips Hue and Entertainment API
with new MbedTLS based SSL UDP Provider
* add required cross-compile submodules
* logical rebuild fn: initLeds, setLights + new logs
-more detailed checks and error handling inside iniLeds and setLights
- logical script procedure before ProviderUdpSSL init
- first steps for multiple ProviderUdpSSL usage
- better fallback support to old RestAPI, if entertainment api is not supported
- just 4 u LordGrey: new log fn for cosmetic config outputs ;)
* add OSX CompileHowTo - undo from CrossCompileHowTo
* whitespace fixes
* lightID toString fix
* fix unsigned int E-API + debug output
* bugfixes, reworked black signal detection, wizard:
- change device config field light-ids from int to string -> real unsigned int fix
- add signal detection brightness minimum threshold value
0.0 for 0% brightness - 1.0 for 100% brightness to count for blacklight signal detection
reason: input may not 100% black, like mine - i have a deep dark gray input signal
-> my threshold value is set to 0.005 for 0.5% minimum brightness = 1 (from max 255) to count as black
- wizard optimations, with fallback without entertainment support (beta state)
- whitespace fixes
* cleanup + minor fixes
* change fixed Hue UPD SSL config to _devConfig paras
* Hotfix SSL Connection, new light models, wizard:
- Fix UPD SSL Connection failed Problems
- add new supported gamut C light models: LCG002, LCA001, LCA002, LCA003
- wizard: extend fallback support to classic mode + hints
* whitespace, typo fix
* uncheck useEntertainmentAPI, if noAPISupport detected + hint
* coredump fix -> add _blackLightsTimer nullptr init
* code cleanup / remove old debugs + whitespacefixes
* add gamut C LCP001, LCP002
* SSL UDP config made more flexible + remove qDebug
-> switch to hyerion.ng _log
-> replace logCommand with verbose
-> code cleanups etc...
* extended mbedtls debugging infos
* add adjustable ssl timeout settings
* error handling
* streamdebugger bugfixes
* UPDSSL psk / psk_identity bugfixes! + hue wizard fn typo fix +
- verbose option available without dependencies
- whitespace fixes
* Philips Hue Assistant now recognizes non-original bridges better...
+ Added note if no clientkey is set when using the entertainment API
+ User creation (+ clientkey) for non-original bridges can now also be used
+ Minor changes and bug fixes
* CMAKE mbedTLS detection
* minor bug fixes + code cleanups
* FindMbedTLS.cmake remove Path-Hints + wizard.js: ajax timeout handling
Test - content_grabber.js: run relevant code only, if V4L2_AVAIL is true:
conf_grabber don't displays other devices, if V4L2 is not available
* compile mbedtls via cmake as static lib
* remove libmbedtls-dev from compileHowto / scripts
* Fix Windows build
* Fix windows build (part 2)
* removed unnecessary osx x11 include directory path
* QTimer Shutdown bugfix
* cmake win32 fix + minor bugfixes
* cmake debug msg used mbedtls libs
* Bugfix: noSignalDetection wasn't switchedOn again
if no signal was previously detected
* Some code fixes based on alerts from lgtm.com
Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
2020-05-22 19:40:50 +02:00
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
# MBEDTLS
|
|
|
|
#=============================================================================
|
|
|
|
|
|
|
|
set(USE_SYSTEM_MBEDTLS_LIBS ${DEFAULT_USE_SYSTEM_MBEDTLS_LIBS} CACHE BOOL "use mbedtls library from system")
|
|
|
|
|
|
|
|
if (USE_SYSTEM_MBEDTLS_LIBS)
|
|
|
|
find_package(mbedtls REQUIRED)
|
|
|
|
if (NOT MBEDTLS_FOUND)
|
|
|
|
message(STATUS "Could NOT find mbedtls system libraries, build static mbedtls libraries")
|
|
|
|
#Fallback: build mbedtls static libray inside project
|
|
|
|
set(DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF PARENT_SCOPE)
|
|
|
|
set(USE_SYSTEM_MBEDTLS_LIBS OFF)
|
|
|
|
endif (NOT MBEDTLS_FOUND)
|
|
|
|
endif (USE_SYSTEM_MBEDTLS_LIBS)
|
|
|
|
|
|
|
|
if (NOT USE_SYSTEM_MBEDTLS_LIBS)
|
|
|
|
set(DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF CACHE BOOL "system mbedtls libraries not found, disable use system mbedtls libraries")
|
|
|
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared mbedtls libraries")
|
|
|
|
|
|
|
|
set(ENABLE_TESTING OFF CACHE BOOL "Disable mbedTLS tests")
|
|
|
|
set(ENABLE_PROGRAMS OFF CACHE BOOL "Disable mbedTLS programs")
|
|
|
|
set(USE_SHARED_MBEDTLS_LIBRARY OFF CACHE BOOL "Disable mbedTLS shared libraries")
|
|
|
|
set(USE_STATIC_MBEDTLS_LIBRARY ON CACHE BOOL "Enable mbedTLS static libraries")
|
|
|
|
|
|
|
|
set(MBEDTLS_DOWNLOAD_DIR "${CMAKE_BINARY_DIR}/dependencies/external/mbedtls/download")
|
|
|
|
set(MBEDTLS_SOURCE_DIR "${CMAKE_BINARY_DIR}/dependencies/external/mbedtls/src")
|
|
|
|
set(MBEDTLS_BINARY_DIR "${CMAKE_BINARY_DIR}/dependencies/external/mbedtls/build")
|
|
|
|
set(MBEDTLS_INSTALL_DIR "${CMAKE_BINARY_DIR}")
|
2020-05-27 22:31:57 +02:00
|
|
|
if(${CMAKE_BUILD_TYPE} AND ${CMAKE_BUILD_TYPE} EQUAL "Debug")
|
add Hue EntertainmentAPI + Forwarder & other Fixes (#592)
* whitespaces + typo fixes
* JS / LGTM fixes
* SSDP Handler crash fix
* MessageForwarder handlePriorityChanges Slave fixes
* use aboutToQuit Signal
* complete rewriten Hue Entertainment API structure
combined Philips Hue and Entertainment API
with new MbedTLS based SSL UDP Provider
* add required cross-compile submodules
* logical rebuild fn: initLeds, setLights + new logs
-more detailed checks and error handling inside iniLeds and setLights
- logical script procedure before ProviderUdpSSL init
- first steps for multiple ProviderUdpSSL usage
- better fallback support to old RestAPI, if entertainment api is not supported
- just 4 u LordGrey: new log fn for cosmetic config outputs ;)
* add OSX CompileHowTo - undo from CrossCompileHowTo
* whitespace fixes
* lightID toString fix
* fix unsigned int E-API + debug output
* bugfixes, reworked black signal detection, wizard:
- change device config field light-ids from int to string -> real unsigned int fix
- add signal detection brightness minimum threshold value
0.0 for 0% brightness - 1.0 for 100% brightness to count for blacklight signal detection
reason: input may not 100% black, like mine - i have a deep dark gray input signal
-> my threshold value is set to 0.005 for 0.5% minimum brightness = 1 (from max 255) to count as black
- wizard optimations, with fallback without entertainment support (beta state)
- whitespace fixes
* cleanup + minor fixes
* change fixed Hue UPD SSL config to _devConfig paras
* Hotfix SSL Connection, new light models, wizard:
- Fix UPD SSL Connection failed Problems
- add new supported gamut C light models: LCG002, LCA001, LCA002, LCA003
- wizard: extend fallback support to classic mode + hints
* whitespace, typo fix
* uncheck useEntertainmentAPI, if noAPISupport detected + hint
* coredump fix -> add _blackLightsTimer nullptr init
* code cleanup / remove old debugs + whitespacefixes
* add gamut C LCP001, LCP002
* SSL UDP config made more flexible + remove qDebug
-> switch to hyerion.ng _log
-> replace logCommand with verbose
-> code cleanups etc...
* extended mbedtls debugging infos
* add adjustable ssl timeout settings
* error handling
* streamdebugger bugfixes
* UPDSSL psk / psk_identity bugfixes! + hue wizard fn typo fix +
- verbose option available without dependencies
- whitespace fixes
* Philips Hue Assistant now recognizes non-original bridges better...
+ Added note if no clientkey is set when using the entertainment API
+ User creation (+ clientkey) for non-original bridges can now also be used
+ Minor changes and bug fixes
* CMAKE mbedTLS detection
* minor bug fixes + code cleanups
* FindMbedTLS.cmake remove Path-Hints + wizard.js: ajax timeout handling
Test - content_grabber.js: run relevant code only, if V4L2_AVAIL is true:
conf_grabber don't displays other devices, if V4L2 is not available
* compile mbedtls via cmake as static lib
* remove libmbedtls-dev from compileHowto / scripts
* Fix Windows build
* Fix windows build (part 2)
* removed unnecessary osx x11 include directory path
* QTimer Shutdown bugfix
* cmake win32 fix + minor bugfixes
* cmake debug msg used mbedtls libs
* Bugfix: noSignalDetection wasn't switchedOn again
if no signal was previously detected
* Some code fixes based on alerts from lgtm.com
Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
2020-05-22 19:40:50 +02:00
|
|
|
set(MBEDTLS_LOGGING 1)
|
|
|
|
else ()
|
|
|
|
set(MBEDTLS_LOGGING 0)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
set(MBEDTLS_CMAKE_ARGS
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH=${MBEDTLS_INSTALL_DIR}
|
|
|
|
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
|
|
|
|
-DUSE_SHARED_MBEDTLS_LIBRARY:BOOL=OFF
|
|
|
|
-DUSE_STATIC_MBEDTLS_LIBRARY:BOOL=ON
|
|
|
|
-DENABLE_TESTING:BOOL=OFF
|
|
|
|
-DENABLE_PROGRAMS:BOOL=OFF
|
|
|
|
-DLINK_WITH_PTHREAD:BOOL=ON
|
|
|
|
-Wno-dev
|
|
|
|
#-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=TRUE
|
|
|
|
)
|
|
|
|
|
|
|
|
set(ENABLE_MBEDTLS_FETCH_CONTENT ON)
|
|
|
|
|
|
|
|
if (ENABLE_MBEDTLS_FETCH_CONTENT AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.11)
|
|
|
|
|
|
|
|
include(FetchContent)
|
|
|
|
|
|
|
|
FetchContent_Declare(
|
|
|
|
mbedtls
|
|
|
|
GIT_REPOSITORY https://github.com/ARMmbed/mbedtls.git
|
|
|
|
GIT_TAG origin/master
|
|
|
|
BUILD_ALWAYS OFF
|
|
|
|
GIT_PROGRESS 1
|
|
|
|
DOWNLOAD_DIR "${MBEDTLS_DOWNLOAD_DIR}"
|
|
|
|
SOURCE_DIR "${MBEDTLS_SOURCE_DIR}"
|
|
|
|
BINARY_DIR "${MBEDTLS_BINARY_DIR}"
|
|
|
|
INSTALL_DIR "${MBEDTLS_INSTALL_DIR}"
|
|
|
|
CMAKE_ARGS ${MBEDTLS_CMAKE_ARGS}
|
|
|
|
BUILD_COMMAND ""
|
|
|
|
INSTALL_COMMAND ""
|
|
|
|
LOG_DOWNLOAD ${MBEDTLS_LOGGING}
|
|
|
|
LOG_UPDATE ${MBEDTLS_LOGGING}
|
|
|
|
LOG_PATCH ${MBEDTLS_LOGGING}
|
|
|
|
LOG_CONFIGURE ${MBEDTLS_LOGGING}
|
|
|
|
LOG_BUILD ${MBEDTLS_LOGGING}
|
|
|
|
LOG_INSTALL ${MBEDTLS_LOGGING}
|
|
|
|
LOG_TEST ${MBEDTLS_LOGGING}
|
|
|
|
LOG_MERGED_STDOUTERR ${MBEDTLS_LOGGING}
|
|
|
|
LOG_OUTPUT_ON_FAILURE ${MBEDTLS_LOGGING}
|
|
|
|
)
|
|
|
|
|
|
|
|
if (CMAKE_VERSION VERSION_LESS 3.14)
|
|
|
|
macro (FetchContent_MakeAvailable NAME)
|
|
|
|
FetchContent_GetProperties(${NAME})
|
|
|
|
if (NOT ${NAME}_POPULATED)
|
|
|
|
FetchContent_Populate(${NAME})
|
|
|
|
add_subdirectory(${${NAME}_SOURCE_DIR} ${${NAME}_BINARY_DIR})
|
|
|
|
endif ()
|
|
|
|
endmacro ()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
FetchContent_MakeAvailable(mbedtls)
|
|
|
|
else ()
|
|
|
|
set(ENABLE_MBEDTLS_FETCH_CONTENT OFF PARENT_SCOPE)
|
|
|
|
if(NOT DEFINED BUILD_MBEDTLS_ONCE)
|
|
|
|
set(BUILD_MBEDTLS_ONCE CACHE INTERNAL "Done")
|
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/dependencies/CMakeLists-mbedtls.txt.in ${MBEDTLS_DOWNLOAD_DIR}/CMakeLists.txt @ONLY)
|
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX:PATH=${MBEDTLS_INSTALL_DIR} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY ${MBEDTLS_DOWNLOAD_DIR})
|
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} --build . WORKING_DIRECTORY ${MBEDTLS_DOWNLOAD_DIR})
|
|
|
|
add_subdirectory(${MBEDTLS_SOURCE_DIR} ${MBEDTLS_BINARY_DIR})
|
|
|
|
endif()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
set (MBEDTLS_INCLUDE_DIR "${MBEDTLS_SOURCE_DIR}/include")
|
|
|
|
set (MBEDTLS_INCLUDE_DIR ${MBEDTLS_INCLUDE_DIR} PARENT_SCOPE)
|
|
|
|
if (MBEDTLS_INCLUDE_DIR AND EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h")
|
|
|
|
file(STRINGS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h" _MBEDTLS_VERSION_STRING REGEX "^#[\t ]*define[\t ]+MBEDTLS_VERSION_STRING[\t ]+\"[0-9]+.[0-9]+.[0-9]+\"")
|
|
|
|
string(REGEX REPLACE "^.*MBEDTLS_VERSION_STRING.*([0-9]+.[0-9]+.[0-9]+).*" "\\1" MBEDTLS_VERSION "${_MBEDTLS_VERSION_STRING}")
|
|
|
|
message(STATUS "Using static mbedtls libraries (build version \"${MBEDTLS_VERSION}\")")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
include_directories(${MBEDTLS_INCLUDE_DIR})
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
set (MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX "${MBEDTLS_INSTALL_DIR}/lib/${CMAKE_CFG_INTDIR}/")
|
|
|
|
else()
|
|
|
|
set (MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX "${MBEDTLS_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
set (MBEDTLS_SSL_LIBRARY "${MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX}mbedtls${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
|
|
|
set (MBEDTLS_X509_LIBRARY "${MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX}mbedx509${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
|
|
|
set (MBEDTLS_CRYPTO_LIBRARY "${MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX}mbedcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
|
|
|
set (MBEDTLS_LIBRARIES ${MBEDTLS_SSL_LIBRARY} ${MBEDTLS_X509_LIBRARY} ${MBEDTLS_CRYPTO_LIBRARY})
|
|
|
|
set (MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARIES} PARENT_SCOPE)
|
|
|
|
|
2020-05-27 22:31:57 +02:00
|
|
|
if(${CMAKE_BUILD_TYPE} AND ${CMAKE_BUILD_TYPE} EQUAL "Debug")
|
add Hue EntertainmentAPI + Forwarder & other Fixes (#592)
* whitespaces + typo fixes
* JS / LGTM fixes
* SSDP Handler crash fix
* MessageForwarder handlePriorityChanges Slave fixes
* use aboutToQuit Signal
* complete rewriten Hue Entertainment API structure
combined Philips Hue and Entertainment API
with new MbedTLS based SSL UDP Provider
* add required cross-compile submodules
* logical rebuild fn: initLeds, setLights + new logs
-more detailed checks and error handling inside iniLeds and setLights
- logical script procedure before ProviderUdpSSL init
- first steps for multiple ProviderUdpSSL usage
- better fallback support to old RestAPI, if entertainment api is not supported
- just 4 u LordGrey: new log fn for cosmetic config outputs ;)
* add OSX CompileHowTo - undo from CrossCompileHowTo
* whitespace fixes
* lightID toString fix
* fix unsigned int E-API + debug output
* bugfixes, reworked black signal detection, wizard:
- change device config field light-ids from int to string -> real unsigned int fix
- add signal detection brightness minimum threshold value
0.0 for 0% brightness - 1.0 for 100% brightness to count for blacklight signal detection
reason: input may not 100% black, like mine - i have a deep dark gray input signal
-> my threshold value is set to 0.005 for 0.5% minimum brightness = 1 (from max 255) to count as black
- wizard optimations, with fallback without entertainment support (beta state)
- whitespace fixes
* cleanup + minor fixes
* change fixed Hue UPD SSL config to _devConfig paras
* Hotfix SSL Connection, new light models, wizard:
- Fix UPD SSL Connection failed Problems
- add new supported gamut C light models: LCG002, LCA001, LCA002, LCA003
- wizard: extend fallback support to classic mode + hints
* whitespace, typo fix
* uncheck useEntertainmentAPI, if noAPISupport detected + hint
* coredump fix -> add _blackLightsTimer nullptr init
* code cleanup / remove old debugs + whitespacefixes
* add gamut C LCP001, LCP002
* SSL UDP config made more flexible + remove qDebug
-> switch to hyerion.ng _log
-> replace logCommand with verbose
-> code cleanups etc...
* extended mbedtls debugging infos
* add adjustable ssl timeout settings
* error handling
* streamdebugger bugfixes
* UPDSSL psk / psk_identity bugfixes! + hue wizard fn typo fix +
- verbose option available without dependencies
- whitespace fixes
* Philips Hue Assistant now recognizes non-original bridges better...
+ Added note if no clientkey is set when using the entertainment API
+ User creation (+ clientkey) for non-original bridges can now also be used
+ Minor changes and bug fixes
* CMAKE mbedTLS detection
* minor bug fixes + code cleanups
* FindMbedTLS.cmake remove Path-Hints + wizard.js: ajax timeout handling
Test - content_grabber.js: run relevant code only, if V4L2_AVAIL is true:
conf_grabber don't displays other devices, if V4L2 is not available
* compile mbedtls via cmake as static lib
* remove libmbedtls-dev from compileHowto / scripts
* Fix Windows build
* Fix windows build (part 2)
* removed unnecessary osx x11 include directory path
* QTimer Shutdown bugfix
* cmake win32 fix + minor bugfixes
* cmake debug msg used mbedtls libs
* Bugfix: noSignalDetection wasn't switchedOn again
if no signal was previously detected
* Some code fixes based on alerts from lgtm.com
Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
2020-05-22 19:40:50 +02:00
|
|
|
message(STATUS "mbedtls libraries: ${MBEDTLS_LIBRARIES}")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
mark_as_advanced (MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARIES MBEDTLS_SSL_LIBRARY MBEDTLS_X509_LIBRARY MBEDTLS_CRYPTO_LIBRARY)
|
|
|
|
|
|
|
|
endif (NOT USE_SYSTEM_MBEDTLS_LIBS)
|