Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.

Commit fef34df

Browse files
committed
Merge pull request #159 from maxnet/master
Misc build improvements
2 parents b4eb2e7 + d1e57e9 commit fef34df

File tree

8 files changed

+77
-44
lines changed

8 files changed

+77
-44
lines changed

CMakeLists.txt

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ message(STATUS "ENABLE_V4L2 = " ${ENABLE_V4L2})
1919
option(ENABLE_TINKERFORGE "Enable the TINKERFORGE device" ON)
2020
message(STATUS "ENABLE_TINKERFORGE = " ${ENABLE_TINKERFORGE})
2121

22+
option(ENABLE_PROTOBUF "Enable PROTOBUF server" ON)
23+
message(STATUS "ENABLE_PROTOBUF = " ${ENABLE_PROTOBUF})
24+
25+
if (ENABLE_V4L2 AND NOT ENABLE_PROTOBUF)
26+
message(FATAL_ERROR "V4L2 grabber requires PROTOBUF. Disable V4L2 or enable PROTOBUF")
27+
endif (ENABLE_V4L2 AND NOT ENABLE_PROTOBUF)
28+
2229
# Createt the configuration file
2330
# configure a header file to pass some of the CMake settings
2431
# to the source code
@@ -54,12 +61,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall")
5461
# Configure the use of QT4
5562
find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED QUIET)
5663

57-
# add protocol buffers (make sure to find the static version)
58-
set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES})
59-
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
60-
find_package(Protobuf REQUIRED)
61-
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD})
62-
set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD)
64+
if (ENABLE_PROTOBUF)
65+
# add protocol buffers (make sure to find the static version)
66+
set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES})
67+
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
68+
find_package(Protobuf REQUIRED)
69+
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD})
70+
set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD)
71+
endif (ENABLE_PROTOBUF)
6372

6473
#add libusb and pthreads
6574
find_package(libusb-1.0 REQUIRED)

HyperionConfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@
1111

1212
// Define to enable the spi-device
1313
#cmakedefine ENABLE_TINKERFORGE
14+
15+
// Define to enable PROTOBUF server
16+
#cmakedefine ENABLE_PROTOBUF

cmake/Findlibusb-1.0.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ else (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
8787
message(STATUS " - Libraries: ${LIBUSB_1_LIBRARIES}")
8888
endif (NOT libusb_1_FIND_QUIETLY)
8989
else (LIBUSB_1_FOUND)
90+
unset(LIBUSB_1_LIBRARY CACHE)
9091
if (libusb_1_FIND_REQUIRED)
9192
message(FATAL_ERROR "Could not find libusb")
9293
endif (libusb_1_FIND_REQUIRED)

cmake/qt4/Qt4ConfigDependentSettings.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,16 @@ if(Q_WS_X11)
270270

271271
endif()
272272

273+
if(Q_WS_QWS)
274+
set(CMAKE_THREAD_PREFER_PTHREADS 1)
275+
find_package(Threads)
276+
if(CMAKE_USE_PTHREADS_INIT)
277+
set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT})
278+
endif()
279+
280+
set (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_DL_LIBS})
281+
282+
endif()
273283

274284
if(Q_WS_WIN)
275285
set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} imm32 winmm)

libsrc/CMakeLists.txt

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
2-
# Define the current source locations
3-
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include)
4-
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc)
5-
6-
add_subdirectory(hyperion)
7-
add_subdirectory(blackborder)
8-
add_subdirectory(jsonserver)
9-
add_subdirectory(protoserver)
10-
add_subdirectory(boblightserver)
11-
add_subdirectory(leddevice)
12-
add_subdirectory(utils)
13-
add_subdirectory(xbmcvideochecker)
14-
add_subdirectory(effectengine)
15-
add_subdirectory(grabber)
1+
2+
# Define the current source locations
3+
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include)
4+
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc)
5+
6+
add_subdirectory(hyperion)
7+
add_subdirectory(blackborder)
8+
add_subdirectory(jsonserver)
9+
10+
if (ENABLE_PROTOBUF)
11+
add_subdirectory(protoserver)
12+
endif (ENABLE_PROTOBUF)
13+
14+
add_subdirectory(boblightserver)
15+
add_subdirectory(leddevice)
16+
add_subdirectory(utils)
17+
add_subdirectory(xbmcvideochecker)
18+
add_subdirectory(effectengine)
19+
add_subdirectory(grabber)

src/hyperion-remote/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 2.8)
22

33
project(hyperion-remote)
44

5-
# add protocol buffers
6-
find_package(Protobuf REQUIRED)
7-
85
# find Qt4
96
find_package(Qt4 REQUIRED QtCore QtGui QtNetwork)
107

src/hyperiond/CMakeLists.txt

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
2-
add_executable(hyperiond
3-
hyperiond.cpp)
4-
5-
target_link_libraries(hyperiond
6-
hyperion
7-
xbmcvideochecker
8-
effectengine
9-
jsonserver
10-
protoserver
11-
boblightserver
12-
)
13-
14-
if (ENABLE_DISPMANX)
15-
target_link_libraries(hyperiond dispmanx-grabber)
16-
endif (ENABLE_DISPMANX)
17-
18-
if (ENABLE_V4L2)
19-
target_link_libraries(hyperiond v4l2-grabber)
20-
endif (ENABLE_V4L2)
1+
2+
add_executable(hyperiond
3+
hyperiond.cpp)
4+
5+
target_link_libraries(hyperiond
6+
hyperion
7+
xbmcvideochecker
8+
effectengine
9+
jsonserver
10+
boblightserver
11+
)
12+
13+
if (ENABLE_DISPMANX)
14+
target_link_libraries(hyperiond dispmanx-grabber)
15+
endif (ENABLE_DISPMANX)
16+
17+
if (ENABLE_V4L2)
18+
target_link_libraries(hyperiond v4l2-grabber)
19+
endif (ENABLE_V4L2)
20+
21+
if (ENABLE_PROTOBUF)
22+
target_link_libraries(hyperiond protoserver)
23+
endif (ENABLE_PROTOBUF)

src/hyperiond/hyperiond.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@
3636
// JsonServer includes
3737
#include <jsonserver/JsonServer.h>
3838

39+
#ifdef ENABLE_PROTOBUF
3940
// ProtoServer includes
4041
#include <protoserver/ProtoServer.h>
42+
#endif
4143

4244
// BoblightServer includes
4345
#include <boblightserver/BoblightServer.h>
@@ -233,6 +235,7 @@ int main(int argc, char** argv)
233235
std::cout << "Json server created and started on port " << jsonServer->getPort() << std::endl;
234236
}
235237

238+
#ifdef ENABLE_PROTOBUF
236239
// Create Proto server if configuration is present
237240
ProtoServer * protoServer = nullptr;
238241
if (config.isMember("protoServer"))
@@ -241,6 +244,7 @@ int main(int argc, char** argv)
241244
protoServer = new ProtoServer(&hyperion, protoServerConfig["port"].asUInt());
242245
std::cout << "Proto server created and started on port " << protoServer->getPort() << std::endl;
243246
}
247+
#endif
244248

245249
// Create Boblight server if configuration is present
246250
BoblightServer * boblightServer = nullptr;
@@ -264,7 +268,9 @@ int main(int argc, char** argv)
264268
#endif
265269
delete xbmcVideoChecker;
266270
delete jsonServer;
271+
#ifdef ENABLE_PROTOBUF
267272
delete protoServer;
273+
#endif
268274
delete boblightServer;
269275

270276
// leave application

0 commit comments

Comments
 (0)