Skip to content

Commit eec1fb6

Browse files
authored
Support for precompiled headers (#359)
1 parent 785fc77 commit eec1fb6

File tree

63 files changed

+229
-47
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+229
-47
lines changed

Diff for: .ci/ci_build.sh

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ elif [[ "$CI_NAME" == 'linux' ]]; then
108108
make -j $(nproc) package || exit 3 &&
109109
cp /hyperhdr/build/bin/h* /deploy/ 2>/dev/null || : &&
110110
cp /hyperhdr/build/Hyper* /deploy/ 2>/dev/null || : &&
111+
ccache -s &&
111112
exit 0;
112113
exit 1 " || { echo "---> HyperHDR compilation failed! Abort"; exit 5; }
113114
ls -a .ccache

Diff for: CMakeLists.txt

+33-28
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,36 @@ set(CMAKE_AUTORCC ON)
1717

1818
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
1919

20+
# Set build variables
21+
SET ( DEFAULT_PROTOBUF ON )
22+
SET ( DEFAULT_BOBLIGHT ON )
23+
SET ( DEFAULT_WS281XPWM OFF )
24+
SET ( DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS OFF )
25+
SET ( DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF )
26+
SET ( DEFAULT_MF OFF )
27+
SET ( DEFAULT_DX OFF )
28+
SET ( DEFAULT_AVF OFF )
29+
SET ( DEFAULT_MAC_SYSTEM OFF )
30+
SET ( DEFAULT_V4L2 OFF )
31+
SET ( DEFAULT_X11 OFF )
32+
SET ( DEFAULT_PIPEWIRE OFF )
33+
SET ( DEFAULT_FRAMEBUFFER OFF )
34+
SET ( DEFAULT_SOUNDCAPWINDOWS OFF )
35+
SET ( DEFAULT_SOUNDCAPMACOS OFF )
36+
SET ( DEFAULT_CEC OFF )
37+
SET ( DEFAULT_BONJOUR ON )
38+
SET ( DEFAULT_MQTT ON )
39+
SET ( DEFAULT_STATIC_QT_PLUGINS OFF )
40+
SET ( DEFAULT_PRECOMPILED_HEADERS ON )
41+
2042
# Configure CCache if available
2143
find_program(CCACHE_FOUND ccache)
2244
if ( CCACHE_FOUND )
2345
if (DEFINED ENV{CCACHE_DIR})
24-
message ( STATUS "Found CCache and its env settings: $ENV{CCACHE_DIR}. Will try to use it." )
46+
message ( STATUS "Found CCache and its env settings: $ENV{CCACHE_DIR}. Will try to use it. Disabling precompiled headers." )
2547
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
2648
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
49+
SET ( DEFAULT_PRECOMPILED_HEADERS OFF )
2750
else()
2851
message ( WARNING "Found CCache but env settings: CCACHE_DIR is not set. Skipping." )
2952
endif()
@@ -52,29 +75,6 @@ ELSE()
5275
SET( Qt_VERSION 5 )
5376
ENDIF()
5477

55-
56-
# Set build variables
57-
SET ( DO_NOT_USE_QT_VERSION_6_LIBS OFF )
58-
SET ( DEFAULT_PROTOBUF ON )
59-
SET ( DEFAULT_BOBLIGHT ON )
60-
SET ( DEFAULT_WS281XPWM OFF )
61-
SET ( DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS OFF )
62-
SET ( DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF )
63-
SET ( DEFAULT_MF OFF )
64-
SET ( DEFAULT_DX OFF )
65-
SET ( DEFAULT_AVF OFF )
66-
SET ( DEFAULT_MAC_SYSTEM OFF )
67-
SET ( DEFAULT_V4L2 OFF )
68-
SET ( DEFAULT_X11 OFF )
69-
SET ( DEFAULT_PIPEWIRE OFF )
70-
SET ( DEFAULT_FRAMEBUFFER OFF )
71-
SET ( DEFAULT_SOUNDCAPWINDOWS OFF )
72-
SET ( DEFAULT_SOUNDCAPMACOS OFF )
73-
SET ( DEFAULT_CEC OFF )
74-
SET ( DEFAULT_BONJOUR ON )
75-
SET ( DEFAULT_MQTT ON )
76-
SET ( DEFAULT_STATIC_QT_PLUGINS OFF )
77-
7878
IF ( ${CMAKE_SYSTEM} MATCHES "Linux" )
7979
SET ( DEFAULT_SOUNDCAPLINUX ON )
8080
SET ( DEFAULT_V4L2 ON )
@@ -149,8 +149,9 @@ if ( "${PLATFORM}" MATCHES "osx" )
149149
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
150150
endif()
151151

152-
SET ( DEFAULT_AVF ON )
153-
SET ( DEFAULT_MAC_SYSTEM ON )
152+
SET ( DEFAULT_AVF ON )
153+
SET ( DEFAULT_MAC_SYSTEM ON )
154+
SET ( DEFAULT_PRECOMPILED_HEADERS OFF )
154155
elseif ( "${PLATFORM}" MATCHES "rpi" )
155156
SET ( DEFAULT_WS281XPWM ON )
156157
SET ( DEFAULT_CEC ON )
@@ -357,6 +358,9 @@ message(STATUS "ENABLE_MQTT = ${ENABLE_MQTT}")
357358
option(USE_STATIC_QT_PLUGINS "Enable static QT plugins" ${DEFAULT_STATIC_QT_PLUGINS})
358359
message(STATUS "USE_STATIC_QT_PLUGINS = ${USE_STATIC_QT_PLUGINS}")
359360

361+
option(USE_PRECOMPILED_HEADERS "Enable precompiled headers (PCH)" ${DEFAULT_PRECOMPILED_HEADERS})
362+
message(STATUS "USE_PRECOMPILED_HEADERS = ${USE_PRECOMPILED_HEADERS}")
363+
360364
SET ( FLATBUFFERS_INSTALL_BIN_DIR ${CMAKE_BINARY_DIR}/flatbuf )
361365
SET ( FLATBUFFERS_INSTALL_LIB_DIR ${CMAKE_BINARY_DIR}/flatbuf )
362366

@@ -453,6 +457,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
453457
endif()
454458

455459
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT hyperhdr)
460+
add_definitions(/MP)
456461
endif()
457462

458463
add_definitions(${QT_DEFINITIONS})
@@ -542,8 +547,8 @@ add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_D
542547
include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/packages.cmake)
543548

544549
# external targets
545-
if (WIN32 AND TARGET apidoc AND TARGET flatbuffers AND TARGET flatc AND TARGET mbedcrypto AND TARGET qmqtt)
546-
set_target_properties(qmqtt apidoc flatbuffers flatc flathash lib mbedcrypto mbedtls mbedx509 resources uninstall PROPERTIES FOLDER ExternalLibsTargets)
550+
if (WIN32 AND TARGET precompiled_hyperhdr_headers AND TARGET apidoc AND TARGET flatbuffers AND TARGET flatc AND TARGET mbedcrypto AND TARGET qmqtt)
551+
set_target_properties(precompiled_hyperhdr_headers qmqtt apidoc flatbuffers flatc flathash lib mbedcrypto mbedtls mbedx509 resources uninstall PROPERTIES FOLDER ExternalLibsTargets)
547552
else()
548553
set_target_properties(resources uninstall PROPERTIES FOLDER ExternalLibsTargets)
549554
endif()

Diff for: assets/webconfig/content/connection_lost.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ <h4 class="reconstop" data-i18n="info_conlost_label_autorecon">We reconnect agai
3030
var connectionTimer;
3131
var animationTimer;
3232
var count = 1;
33-
var reconnectInterval = 4000;
33+
var reconnectInterval = 2000;
3434
var connURL = window.location.protocol + "//" + window.location.hostname + ":" + window.jsonPort + window.location.pathname + window.location.hash;
3535
var animation = -1;
3636
var animation_value = 0;
@@ -91,7 +91,7 @@ <h4 class="reconstop" data-i18n="info_conlost_label_autorecon">We reconnect agai
9191
$.ajax({ url: connURL })
9292
.done(function (data) {
9393
window.clearInterval(connectionTimer);
94-
if (reconnectInterval <= 2000) {
94+
if (reconnectInterval < 2000) {
9595
let url = connURL;
9696
if (window.connURL.includes("#")) url = window.connURL.slice(0, window.connURL.indexOf("#"));
9797
window.location.replace(url);
@@ -110,7 +110,7 @@ <h4 class="reconstop" data-i18n="info_conlost_label_autorecon">We reconnect agai
110110
// if we changed the webui port we connect faster
111111
if (window.fastReconnect) {
112112
window.fastReconnect = false;
113-
reconnectInterval = 2000;
113+
reconnectInterval = 1000;
114114
}
115115
connectionTimer = window.setInterval(tryReconnect, reconnectInterval);
116116
animationTimer = window.setInterval(animate, 100);

Diff for: include/base/AllHeaders_pch.h

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#ifndef ALLHEADERS_PCH_H_
2+
#define ALLHEADERS_PCH_H_
3+
4+
#include <QAtomicInteger>
5+
#include <QBuffer>
6+
#include <QByteArray>
7+
#include <QColor>
8+
#include <QCoreApplication>
9+
#include <QCryptographicHash>
10+
#include <QDateTime>
11+
#include <QExplicitlySharedDataPointer>
12+
#include <QFile>
13+
#include <QHostAddress>
14+
#include <QHostInfo>
15+
#include <QImage>
16+
#include <QJsonDocument>
17+
#include <QJsonObject>
18+
#include <QJsonArray>
19+
#include <QJsonValue>
20+
#include <QList>
21+
#include <QMap>
22+
#include <QMultiMap>
23+
#include <QMutex>
24+
#include <QMutexLocker>
25+
#include <QPair>
26+
#include <QPainter>
27+
#include <QRectF>
28+
#include <QRegularExpression>
29+
#include <QResource>
30+
#include <QSet>
31+
#include <QSize>
32+
#include <QSocketNotifier>
33+
#include <QStack>
34+
#include <QString>
35+
#include <QStringList>
36+
#include <QSemaphore>
37+
#include <QSharedData>
38+
#include <QQueue>
39+
#include <QTcpSocket>
40+
#include <QTimer>
41+
#include <QTextStream>
42+
#include <QThread>
43+
#include <QThreadStorage>
44+
#include <QUdpSocket>
45+
#include <QUuid>
46+
#include <QVariant>
47+
#include <QVector>
48+
49+
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
50+
#include <QStringView>
51+
#else
52+
#include <QStringRef>
53+
#endif
54+
55+
#include <algorithm>
56+
#include <atomic>
57+
#include <cassert>
58+
#include <chrono>
59+
#include <cmath>
60+
#include <cstdint>
61+
#include <cstring>
62+
#include <ctime>
63+
#include <exception>
64+
#include <functional>
65+
#include <iterator>
66+
#include <inttypes.h>
67+
#include <iostream>
68+
#include <limits>
69+
#include <list>
70+
#include <stdexcept>
71+
#include <stdlib.h>
72+
#include <stdio.h>
73+
#include <stdarg.h>
74+
#include <sstream>
75+
#include <map>
76+
#include <math.h>
77+
#include <memory>
78+
#include <type_traits>
79+
#include <vector>
80+
81+
82+
#endif // ALLHEADERS_PCH_H_

Diff for: include/base/SoundCapture.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#pragma once
22

3-
4-
#include <utils/Logger.h>
5-
#include <utils/settings.h>
63
#include <QString>
74
#include <QSemaphore>
85
#include <QJsonObject>
96
#include <QJsonArray>
107
#include <QColor>
118
#include <effectengine/AnimationBaseMusic.h>
9+
#include <utils/settings.h>
1210

1311
#define SOUNDCAP_N_WAVE 1024
1412
#define SOUNDCAP_LOG2_N_WAVE 10

Diff for: include/db/DBManager.h

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <QCryptographicHash>
1010
#include <QDateTime>
1111
#include <QUuid>
12-
#include <QNetworkInterface>
1312
#include <QJsonDocument>
1413
#include <QThreadStorage>
1514

Diff for: include/effectengine/AnimationBase.h

-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
#pragma once
22

3-
#include <QDateTime>
4-
#include <QSize>
5-
#include <QImage>
63
#include <QPainter>
7-
#include <QJsonObject>
8-
#include <QList>
9-
104
#include <utils/Image.h>
115
#include <effectengine/EffectDefinition.h>
126
#include <utils/ColorSys.h>

Diff for: include/effectengine/AnimationBaseMusic.h

-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,3 @@ class AnimationBaseMusic : public AnimationBase
4242

4343
};
4444

45-
#include <base/SoundCapture.h>

Diff for: sources/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers)
2+
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/precompiled_hyperhdr_headers.cpp "void precompiledHeadersHyperHDR(){};")
3+
add_library(precompiled_hyperhdr_headers ${CMAKE_CURRENT_BINARY_DIR}/precompiled_hyperhdr_headers.cpp)
4+
target_link_libraries(precompiled_hyperhdr_headers Qt${Qt_VERSION}::Gui Qt${Qt_VERSION}::Network)
5+
6+
target_precompile_headers(precompiled_hyperhdr_headers PRIVATE ${CMAKE_SOURCE_DIR}/include/base/AllHeaders_pch.h)
7+
endif()
18

29
# Define the current source locations
310
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include)

Diff for: sources/api/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ target_link_libraries(hyperhdr-api
1919
Qt${Qt_VERSION}::Gui
2020
Qt${Qt_VERSION}::Network
2121
)
22+
23+
if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers)
24+
target_precompile_headers(hyperhdr-api REUSE_FROM precompiled_hyperhdr_headers)
25+
endif()

Diff for: sources/base/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ endif()
3434
if (ENABLE_BONJOUR)
3535
target_link_libraries(hyperhdr-base bonjour)
3636
endif ()
37+
38+
if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers)
39+
target_precompile_headers(hyperhdr-base REUSE_FROM precompiled_hyperhdr_headers)
40+
endif()

Diff for: sources/base/SoundCapture.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <utils/settings.h>
3030
#include <utils/Logger.h>
3131
#include <cmath>
32+
3233
uint32_t SoundCapture::_noSoundCounter = 0;
3334
bool SoundCapture::_noSoundWarning = false;
3435
bool SoundCapture::_soundDetectedInfo = false;

Diff for: sources/blackborder/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ target_link_libraries(blackborder
1111
hyperhdr-utils
1212
hyperhdr-base
1313
)
14+
15+
if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers)
16+
target_precompile_headers(blackborder REUSE_FROM precompiled_hyperhdr_headers)
17+
endif()

Diff for: sources/boblightserver/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ target_link_libraries(boblightserver
1212
hyperhdr-utils
1313
${QT_LIBRARIES}
1414
)
15+
16+
if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers)
17+
target_precompile_headers(boblightserver REUSE_FROM precompiled_hyperhdr_headers)
18+
endif()
19+

Diff for: sources/bonjour/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ target_link_libraries(bonjour
1414
hyperhdr-utils
1515
Qt${Qt_VERSION}::Network
1616
)
17+
18+
if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers)
19+
target_precompile_headers(bonjour REUSE_FROM precompiled_hyperhdr_headers)
20+
endif()

Diff for: sources/commandline/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ target_link_libraries(commandline
1010
hyperhdr-base
1111
Qt${Qt_VERSION}::Gui
1212
)
13+
14+
if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers)
15+
target_precompile_headers(commandline REUSE_FROM precompiled_hyperhdr_headers)
16+
endif()

Diff for: sources/db/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ target_link_libraries(database
1818
if (USE_STATIC_QT_PLUGINS)
1919
target_link_libraries(database ${STATIC_QT_PLUGINS_LIBS})
2020
endif()
21+
22+
if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers)
23+
target_precompile_headers(database REUSE_FROM precompiled_hyperhdr_headers)
24+
endif()

Diff for: sources/db/MetaTable.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <db/MetaTable.h>
2+
#include <QNetworkInterface>
23

34

45
MetaTable::MetaTable(QObject* parent, bool readonlyMode)

Diff for: sources/effectengine/Animation4Music_PulseBlue.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
#include <effectengine/Animation4Music_PulseBlue.h>
29+
#include <base/SoundCapture.h>
2930

3031
Animation4Music_PulseBlue::Animation4Music_PulseBlue() :
3132
AnimationBaseMusic(AMUSIC_PULSEBLUE),

Diff for: sources/effectengine/Animation4Music_PulseGreen.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
#include <effectengine/Animation4Music_PulseGreen.h>
29+
#include <base/SoundCapture.h>
2930

3031
Animation4Music_PulseGreen::Animation4Music_PulseGreen() :
3132
AnimationBaseMusic(AMUSIC_PULSEGREEN),

Diff for: sources/effectengine/Animation4Music_PulseMulti.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
#include <effectengine/Animation4Music_PulseMulti.h>
29+
#include <base/SoundCapture.h>
2930

3031
Animation4Music_PulseMulti::Animation4Music_PulseMulti() :
3132
AnimationBaseMusic(AMUSIC_PULSEMULTI),

Diff for: sources/effectengine/Animation4Music_PulseMultiFast.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
#include <effectengine/Animation4Music_PulseMultiFast.h>
29+
#include <base/SoundCapture.h>
2930

3031
Animation4Music_PulseMultiFast::Animation4Music_PulseMultiFast() :
3132
AnimationBaseMusic(AMUSIC_PULSEMULTIFAST),

Diff for: sources/effectengine/Animation4Music_PulseMultiSlow.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
#include <effectengine/Animation4Music_PulseMultiSlow.h>
29+
#include <base/SoundCapture.h>
2930

3031
Animation4Music_PulseMultiSlow::Animation4Music_PulseMultiSlow() :
3132
AnimationBaseMusic(AMUSIC_PULSEMULTISLOW),

Diff for: sources/effectengine/Animation4Music_PulseRed.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
#include <effectengine/Animation4Music_PulseRed.h>
29+
#include <base/SoundCapture.h>
2930

3031
Animation4Music_PulseRed::Animation4Music_PulseRed() :
3132
AnimationBaseMusic(AMUSIC_PULSERED),

0 commit comments

Comments
 (0)