mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Merge branch 'feature-embed-protobuf'
Former-commit-id: 2411d376a08ed69e39538f995f77c7ed2ac67785
This commit is contained in:
commit
820946b33d
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,5 +1,4 @@
|
||||
/*.user
|
||||
/build
|
||||
/build-x86
|
||||
/build*
|
||||
.DS_Store
|
||||
|
||||
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "dependencies/external/protobuf"]
|
||||
path = dependencies/external/protobuf
|
||||
url = https://github.com/tvdzwan/protobuf.git
|
@ -19,7 +19,7 @@ message(STATUS "ENABLE_WS2812BPWM = " ${ENABLE_WS2812BPWM})
|
||||
option(ENABLE_V4L2 "Enable the V4L2 grabber" ON)
|
||||
message(STATUS "ENABLE_V4L2 = " ${ENABLE_V4L2})
|
||||
|
||||
option(ENABLE_X11 "Enable the X11 grabber" ON)
|
||||
option(ENABLE_X11 "Enable the X11 grabber" OFF)
|
||||
message(STATUS "ENABLE_X11 = " ${ENABLE_X11})
|
||||
|
||||
option(ENABLE_TINKERFORGE "Enable the TINKERFORGE device" ON)
|
||||
@ -67,15 +67,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall")
|
||||
# Configure the use of QT4
|
||||
find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED QUIET)
|
||||
|
||||
if (ENABLE_PROTOBUF)
|
||||
# add protocol buffers (make sure to find the static version)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
find_package(Protobuf REQUIRED)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD)
|
||||
endif (ENABLE_PROTOBUF)
|
||||
|
||||
#add libusb and pthreads
|
||||
find_package(libusb-1.0 REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Install the required tools and dependencies
|
||||
sudo apt-get update
|
||||
sudo apt-get install git cmake build-essential libprotobuf-dev libQt4-dev libusb-1.0-0-dev protobuf-compiler python-dev
|
||||
sudo apt-get install git cmake build-essential libQt4-dev libusb-1.0-0-dev python-dev
|
||||
|
||||
# RPI ONLY: when you build on the rapberry pi and inlcude the dispmanx grabber (which is the default)
|
||||
# you also need the firmware including headers installed. This downloads the firmware from the raspberrypi github
|
||||
@ -11,7 +11,7 @@ sudo cp -R "$FIRMWARE_DIR/hardfp/opt/*" /opt
|
||||
|
||||
# create hyperion directory and checkout the code from github
|
||||
export HYPERION_DIR="hyperion"
|
||||
git clone https://github.com/tvdzwan/hyperion.git "$HYPERION_DIR"
|
||||
git clone --recursive https://github.com/tvdzwan/hyperion.git "$HYPERION_DIR"
|
||||
|
||||
# create and enter the build directory
|
||||
mkdir "$HYPERION_DIR/build"
|
||||
@ -20,7 +20,7 @@ cd "$HYPERION_DIR/build"
|
||||
# run cmake to generate make files on the rsapberry pi
|
||||
cmake ..
|
||||
# or if you are not compiling on the raspberry pi and need to disable the Dispmanx grabber and support for spi devices
|
||||
cmake -DENABLE_DISPMANX=OFF -DENABLE_SPIDEV=OFF ..
|
||||
cmake -DENABLE_DISPMANX=OFF -DENABLE_SPIDEV=OFF -DENABLE_X11=ON ..
|
||||
|
||||
# run make to build Hyperion
|
||||
make
|
||||
|
@ -1,6 +1,6 @@
|
||||
ON RASPBERRY
|
||||
--------------
|
||||
sudo apt-get install libprotobuf-dev libQt4-dev libusb-1.0-0-dev python-dev rsync
|
||||
sudo apt-get install libQt4-dev libusb-1.0-0-dev python-dev rsync
|
||||
|
||||
ON HOST
|
||||
---------
|
||||
@ -8,21 +8,31 @@ export RASPI=192.168.1.17
|
||||
export RASCROSS_DIR="$HOME/raspberrypi"
|
||||
export HYPERION_DIR="$HOME/hyperion"
|
||||
|
||||
sudo apt-get install git rsync cmake ia32-libs protobuf-compiler
|
||||
# install required packages
|
||||
sudo apt-get install git rsync cmake build-essential libQt4-dev libusb-1.0-0-dev python-dev
|
||||
|
||||
# create the rootfs by copying it from an rpi running for example raspbmc
|
||||
mkdir -p "$RASCROSS_DIR/rootfs"
|
||||
git clone git://github.com/raspberrypi/tools.git "$RASCROSS_DIR/tools"
|
||||
|
||||
git clone https://github.com/raspberrypi/firmware.git "$RASCROSS_DIR/firmware"
|
||||
ln -s "$RASCROSS_DIR/firmware/opt" "$RASCROSS_DIR/rootfs/opt"
|
||||
|
||||
rsync -rl --delete-after --safe-links pi@$RASPI:/{lib,usr} "$RASCROSS_DIR/rootfs"
|
||||
|
||||
git clone https://github.com/tvdzwan/hyperion.git "$HYPERION_DIR"
|
||||
# get the raspberry pi firmware and add it to the rootfs
|
||||
git clone https://github.com/raspberrypi/firmware.git "$RASCROSS_DIR/firmware"
|
||||
ln -s "$RASCROSS_DIR/firmware/hardfp/opt" "$RASCROSS_DIR/rootfs/opt"
|
||||
|
||||
# get the compile tools
|
||||
git clone git://github.com/raspberrypi/tools.git "$RASCROSS_DIR/tools"
|
||||
|
||||
# get the Hyperion sources
|
||||
git clone --recursive https://github.com/tvdzwan/hyperion.git "$HYPERION_DIR"
|
||||
|
||||
# do a native build (to build the protobuf compiler for the native platform)
|
||||
mkdir "$HYPERION_DIR/build"
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE="$HYPERION_DIR/Toolchain-RaspberryPi.cmake" --build "$HYPERION_DIR/build" "$HYPERION_DIR"
|
||||
|
||||
cmake -DENABLE_DISPMANX=OFF --build "$HYPERION_DIR/build" "$HYPERION_DIR"
|
||||
|
||||
# do the rpi build
|
||||
# specify the protoc export file to import the protobuf compiler from the native build
|
||||
mkdir "$HYPERION_DIR/build-rpi"
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE="$HYPERION_DIR/Toolchain-RaspberryPi.cmake" -DIMPORT_PROTOC=$HYPERION_DIR/build/protoc_export.cmake --build "$HYPERION_DIR/build-rpi" "$HYPERION_DIR"
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
These instructions are based on the guide given by:
|
||||
|
@ -4,8 +4,8 @@ SET(CMAKE_SYSTEM_NAME Linux)
|
||||
SET(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
# specify the cross compiler
|
||||
SET(CMAKE_C_COMPILER ${RASPCROSS_DIR}/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc)
|
||||
SET(CMAKE_CXX_COMPILER ${RASPCROSS_DIR}/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++)
|
||||
SET(CMAKE_C_COMPILER ${RASPCROSS_DIR}/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc)
|
||||
SET(CMAKE_CXX_COMPILER ${RASPCROSS_DIR}/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++)
|
||||
|
||||
# where is the target environment
|
||||
SET(CMAKE_FIND_ROOT_PATH ${RASPCROSS_DIR}/rootfs)
|
||||
|
103
dependencies/CMakeLists.txt
vendored
103
dependencies/CMakeLists.txt
vendored
@ -1,2 +1,103 @@
|
||||
add_subdirectory(build/getoptPlusPlus)
|
||||
add_subdirectory(build/hidapi)
|
||||
add_subdirectory(build/jsoncpp)
|
||||
add_subdirectory(build/serial)
|
||||
add_subdirectory(build/tinkerforge)
|
||||
|
||||
add_subdirectory(build)
|
||||
if(ENABLE_PROTOBUF)
|
||||
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
|
||||
set(PROTOBUF_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf/src")
|
||||
set(PROTOBUF_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS} PARENT_SCOPE)
|
||||
|
||||
# define the protoc executable at the parent scope
|
||||
get_property(PROTOBUF_PROTOC_EXECUTABLE TARGET protoc_compiler PROPERTY LOCATION)
|
||||
set(PROTOBUF_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE} PARENT_SCOPE)
|
||||
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)
|
||||
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
|
||||
)
|
||||
endforeach()
|
||||
|
||||
set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE)
|
||||
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
|
||||
set(${HDRS} ${${HDRS}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
endif()
|
||||
|
6
dependencies/build/CMakeLists.txt
vendored
6
dependencies/build/CMakeLists.txt
vendored
@ -1,6 +0,0 @@
|
||||
|
||||
add_subdirectory(getoptPlusPlus)
|
||||
add_subdirectory(hidapi)
|
||||
add_subdirectory(jsoncpp)
|
||||
add_subdirectory(serial)
|
||||
add_subdirectory(tinkerforge)
|
1
dependencies/external/protobuf
vendored
Submodule
1
dependencies/external/protobuf
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit efb59b79e5a8f26eae4d15f38bbfb5667e23df60
|
@ -4,49 +4,51 @@ set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/protoserver)
|
||||
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/protoserver)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROTOBUF_INCLUDE_DIRS})
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROTOBUF_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
# Group the headers that go through the MOC compiler
|
||||
set(ProtoServer_QT_HEADERS
|
||||
${CURRENT_HEADER_DIR}/ProtoServer.h
|
||||
${CURRENT_HEADER_DIR}/ProtoConnection.h
|
||||
${CURRENT_SOURCE_DIR}/ProtoClientConnection.h
|
||||
${CURRENT_HEADER_DIR}/ProtoConnectionWrapper.h
|
||||
${CURRENT_HEADER_DIR}/ProtoServer.h
|
||||
${CURRENT_HEADER_DIR}/ProtoConnection.h
|
||||
${CURRENT_SOURCE_DIR}/ProtoClientConnection.h
|
||||
${CURRENT_HEADER_DIR}/ProtoConnectionWrapper.h
|
||||
)
|
||||
|
||||
set(ProtoServer_HEADERS
|
||||
)
|
||||
|
||||
set(ProtoServer_SOURCES
|
||||
${CURRENT_SOURCE_DIR}/ProtoServer.cpp
|
||||
${CURRENT_SOURCE_DIR}/ProtoClientConnection.cpp
|
||||
${CURRENT_SOURCE_DIR}/ProtoConnection.cpp
|
||||
${CURRENT_SOURCE_DIR}/ProtoConnectionWrapper.cpp
|
||||
${CURRENT_SOURCE_DIR}/ProtoServer.cpp
|
||||
${CURRENT_SOURCE_DIR}/ProtoClientConnection.cpp
|
||||
${CURRENT_SOURCE_DIR}/ProtoConnection.cpp
|
||||
${CURRENT_SOURCE_DIR}/ProtoConnectionWrapper.cpp
|
||||
)
|
||||
|
||||
set(ProtoServer_PROTOS
|
||||
${CURRENT_SOURCE_DIR}/message.proto
|
||||
${CURRENT_SOURCE_DIR}/message.proto
|
||||
)
|
||||
|
||||
protobuf_generate_cpp(ProtoServer_PROTO_SRCS ProtoServer_PROTO_HDRS
|
||||
${ProtoServer_PROTOS}
|
||||
${ProtoServer_PROTOS}
|
||||
)
|
||||
|
||||
qt4_wrap_cpp(ProtoServer_HEADERS_MOC ${ProtoServer_QT_HEADERS})
|
||||
|
||||
add_library(protoserver
|
||||
${ProtoServer_HEADERS}
|
||||
${ProtoServer_QT_HEADERS}
|
||||
${ProtoServer_SOURCES}
|
||||
${ProtoServer_HEADERS_MOC}
|
||||
${ProtoServer_PROTOS}
|
||||
${ProtoServer_PROTO_SRCS}
|
||||
${ProtoServer_PROTO_HDRS}
|
||||
${ProtoServer_HEADERS}
|
||||
${ProtoServer_QT_HEADERS}
|
||||
${ProtoServer_SOURCES}
|
||||
${ProtoServer_HEADERS_MOC}
|
||||
${ProtoServer_PROTOS}
|
||||
${ProtoServer_PROTO_SRCS}
|
||||
${ProtoServer_PROTO_HDRS}
|
||||
)
|
||||
|
||||
target_link_libraries(protoserver
|
||||
hyperion
|
||||
hyperion-utils
|
||||
${PROTOBUF_LIBRARIES}
|
||||
${QT_LIBRARIES})
|
||||
hyperion
|
||||
hyperion-utils
|
||||
protobuf
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
|
@ -1,12 +1,15 @@
|
||||
add_subdirectory(hyperiond)
|
||||
add_subdirectory(hyperion-remote)
|
||||
|
||||
# Add the 'Video 4 Linux' grabber if it is enabled
|
||||
if(ENABLE_V4L2)
|
||||
add_subdirectory(hyperion-v4l2)
|
||||
endif(ENABLE_V4L2)
|
||||
# The following clients depend on the protobuf library
|
||||
if(ENABLE_PROTOBUF)
|
||||
# Add the 'Video 4 Linux' grabber if it is enabled
|
||||
if(ENABLE_V4L2)
|
||||
add_subdirectory(hyperion-v4l2)
|
||||
endif()
|
||||
|
||||
# Add the X11 grabber if it is enabled
|
||||
if(ENABLE_X11)
|
||||
add_subdirectory(hyperion-x11)
|
||||
endif(ENABLE_X11)
|
||||
# Add the X11 grabber if it is enabled
|
||||
if(ENABLE_X11)
|
||||
add_subdirectory(hyperion-x11)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -14,6 +14,7 @@ include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver
|
||||
${QT_INCLUDES}
|
||||
${X11_INCLUDES}
|
||||
${PROTOBUF_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(Hyperion_X11_QT_HEADERS
|
||||
|
Loading…
Reference in New Issue
Block a user