mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	Fix build with embedded protobuf library
Former-commit-id: 5c60566f2d4a9c65fc0fe677841a34d7ef73549a
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
							
								
								
									
										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) | ||||
							
								
								
									
										2
									
								
								dependencies/external/protobuf
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								dependencies/external/protobuf
									
									
									
									
										vendored
									
									
								
							 Submodule dependencies/external/protobuf updated: f644b9c732...efb59b79e5
									
								
							| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user