Skip to content

Commit

Permalink
More HyperHDR libs
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed Jun 21, 2024
1 parent 5e83d6f commit f068727
Show file tree
Hide file tree
Showing 145 changed files with 693 additions and 1,393 deletions.
32 changes: 25 additions & 7 deletions .ci/ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then
CCACHE_PATH=$PWD
cd ..
cachecommand="-DCMAKE_C_COMPILER_LAUNCHER=ccache ${IS_ARCHIVE_SKIPPED}"
export CCACHE_DIR=${CCACHE_PATH} && export CCACHE_COMPRESS=true && export CCACHE_COMPRESSLEVEL=1 && export CCACHE_MAXSIZE=400M
export CCACHE_SLOPPINESS=pch_defines,time_macros && export CCACHE_DIR=${CCACHE_PATH} && export CCACHE_COMPRESS=true && export CCACHE_COMPRESSLEVEL=1 && export CCACHE_MAXSIZE=400M
echo "CCache parameters: ${cachecommand}"
ls -a .ccache

Expand All @@ -70,15 +70,33 @@ if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then
exit 1 || { echo "---> HyperHDR compilation failed! Abort"; exit 5; }
fi
elif [[ $CI_NAME == *"mingw64_nt"* || "$CI_NAME" == 'windows_nt' ]]; then
echo "Start: windows"

echo "Number of Cores $NUMBER_OF_PROCESSORS"
mkdir build || exit 1
echo "Start: windows"
echo "Number of cores: $NUMBER_OF_PROCESSORS"

if [[ "$USE_CCACHE" == '1' ]]; then
echo "Using ccache"

mkdir -p .ccache

if [[ "$RESET_CACHE" == '1' ]]; then
echo "Clearing ccache"
pushd .
cd .ccache && rm -rf ..?* .[!.]* *
popd
fi
export CCACHE_SLOPPINESS=pch_defines,time_macros && export CCACHE_DIR=$PWD/.ccache && export CCACHE_NOCOMPRESS=true && export CCACHE_MAXSIZE=600M
fi

mkdir -p build || exit 1
cd build
cmake -G "Visual Studio 17 2022" -A x64 -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_GITHUB_ACTION=1 ${IS_ARCHIVE_SKIPPED} ../ || exit 2
cmake --build . --target package --config Release -- -nologo -v:m -maxcpucount || exit 3

if [[ "$USE_CCACHE" == '1' ]]; then
./ccache.exe -s
fi
exit 0;
exit 1 || { echo "---> Hyperhdr compilation failed! Abort"; exit 5; }

elif [[ "$CI_NAME" == 'linux' ]]; then
echo "Compile Hyperhdr with DOCKER_IMAGE = ${DOCKER_IMAGE}, DOCKER_TAG = ${DOCKER_TAG} and friendly name DOCKER_NAME = ${DOCKER_NAME}"

Expand All @@ -98,7 +116,7 @@ elif [[ "$CI_NAME" == 'linux' ]]; then
fi

if [[ "$USE_CCACHE" == '1' ]]; then
echo "Using cache"
echo "Using ccache"

mkdir -p .ccache

Expand Down
32 changes: 30 additions & 2 deletions .github/workflows/push-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
file(APPEND "$ENV{GITHUB_OUTPUT}" "timestamp=${current_date}")
# download cache
- name: ccache cache files
- name: Download ccache files
if: ( env.USE_CACHE == '1' )
uses: actions/cache@v4
with:
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
file(APPEND "$ENV{GITHUB_OUTPUT}" "timestamp=${current_date}")
# Download cache
- name: ccache cache files
- name: Download ccache files
if: ( env.USE_CACHE == '1' )
uses: actions/cache@v4
with:
Expand Down Expand Up @@ -234,12 +234,40 @@ jobs:
pip install aqtinstall
aqt install-qt -O ${{ runner.workspace }}/Qt windows desktop ${{ env.QT_VERSION }} win64_msvc2019_64 -m qtserialport
# Generate cache id
- name: Prepare ccache timestamp
if: env.USE_CACHE == '1'
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H-%M-%S" UTC)
file(APPEND "$ENV{GITHUB_OUTPUT}" "timestamp=${current_date}")
# Download cache
- name: Download ccache files
if: ( env.USE_CACHE == '1' )
uses: actions/cache@v4
with:
path: .ccache
key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: ${{ runner.os }}-ccache

- name: Install TurboJPEG
shell: powershell
run: |
Invoke-WebRequest -Method Get -Uri https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.3/libjpeg-turbo-3.0.3-vc64.exe -OutFile turbojpeg.exe -UseBasicParsing
Start-Process -Wait turbojpeg.exe -ArgumentList "/S"
- name: Download CCache
shell: powershell
run: |
Invoke-WebRequest -Method Get -Uri https://github.com/ccache/ccache/releases/download/v4.10/ccache-4.10-windows-x86_64.zip -OutFile ccache.zip -UseBasicParsing
- name: Install CCache
shell: cmd
run: |
7z e ccache.zip -o.\build *.exe -r
- name: Set up x64 build architecture environment
shell: cmd
run: call "${{env.VCINSTALLDIR}}\Auxiliary\Build\vcvars64.bat"
Expand Down
35 changes: 24 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# Set build variables
SET ( DEFAULT_PROTOBUF ON )
SET ( DEFAULT_BOBLIGHT OFF )
SET ( DEFAULT_WS281XPWM OFF )
SET ( DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS OFF )
SET ( DEFAULT_USE_SYSTEM_MQTT_LIBS OFF )
Expand All @@ -53,12 +52,30 @@ SET ( DEFAULT_SYSTRAY ON )
SET ( DEFAULT_SHARED_LIBS ON )

# Configure CCache if available
find_program(CCACHE_FOUND ccache)
find_program(CCACHE_FOUND ccache HINTS "${CMAKE_CURRENT_SOURCE_DIR}/build")
if ( CCACHE_FOUND )
if (DEFINED ENV{CCACHE_DIR})
message ( STATUS "Found CCache and its env settings: $ENV{CCACHE_DIR}. Will try to use it." )
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
set( CCACHE_ENABLED ON )
message ( STATUS "Found CCache (${CCACHE_FOUND}) and its env settings ($ENV{CCACHE_DIR}). Will try to use it." )
if (WIN32)
file(COPY_FILE
${CCACHE_FOUND} ${CMAKE_BINARY_DIR}/cl.exe
ONLY_IF_DIFFERENT
)

message(STATUS "Setting MSVC debug information format to 'Embedded'")
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>")

set(CMAKE_VS_GLOBALS
"CLToolExe=cl.exe"
"CLToolPath=${CMAKE_BINARY_DIR}"
"TrackFileAccess=false"
"UseMultiToolTask=true"
"DebugInformationFormat=OldStyle"
)
else()
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}")
endif()
else()
message ( WARNING "Found CCache but env settings: CCACHE_DIR is not set. Skipping." )
endif()
Expand Down Expand Up @@ -163,7 +180,6 @@ if ( "${PLATFORM}" MATCHES "osx" )

SET ( DEFAULT_AVF ON )
SET ( DEFAULT_MAC_SYSTEM ON )
SET ( DEFAULT_PRECOMPILED_HEADERS OFF )
elseif ( "${PLATFORM}" MATCHES "rpi" )
SET ( DEFAULT_WS281XPWM ON )
SET ( DEFAULT_CEC ON )
Expand Down Expand Up @@ -417,9 +433,6 @@ colorMe("ENABLE_SOUNDCAPWINDOWS = " ${ENABLE_SOUNDCAPWINDOWS})

message( STATUS "\n${CyanColor}SERVICE SUPPORT${ColorReset}")

option(ENABLE_BOBLIGHT "Enable BOBLIGHT component" ${DEFAULT_BOBLIGHT} )
colorMe("ENABLE_BOBLIGHT = " ${ENABLE_BOBLIGHT})

option(ENABLE_BONJOUR "Enable the network discovery service" ${DEFAULT_BONJOUR} )
colorMe("ENABLE_BONJOUR = " ${ENABLE_BONJOUR})

Expand Down Expand Up @@ -647,8 +660,8 @@ add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_D
include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/packages.cmake)

# external targets
if (WIN32 AND TARGET flatbuffers AND TARGET protobuf-nanopb AND TARGET lunasvg AND TARGET flatc AND TARGET qmqtt AND TARGET liblzma AND TARGET sqlite3)
set_target_properties(qmqtt flatbuffers protobuf-nanopb lunasvg flatc resources uninstall liblzma sqlite3 PROPERTIES FOLDER ExternalLibsTargets)
if (WIN32 AND TARGET stb AND TARGET flatbuffers AND TARGET protobuf-nanopb AND TARGET lunasvg AND TARGET flatc AND TARGET qmqtt AND TARGET liblzma AND TARGET sqlite3)
set_target_properties(stb qmqtt flatbuffers protobuf-nanopb lunasvg flatc resources uninstall liblzma sqlite3 PROPERTIES FOLDER ExternalLibsTargets)
else()
set_target_properties(resources uninstall PROPERTIES FOLDER ExternalLibsTargets)
endif()
Expand Down
3 changes: 0 additions & 3 deletions HyperhdrConfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
// PipeWire EGL extension
#cmakedefine ENABLE_PIPEWIRE_EGL

// Define to enable boblight server
#cmakedefine ENABLE_BOBLIGHT

// Define to enable sound linux
#cmakedefine ENABLE_SOUNDCAPLINUX

Expand Down
11 changes: 10 additions & 1 deletion cmake/installers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ macro(DeployApple TARGET)
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:utils-xz> DESTINATION "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/lib" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
endif()

# Copy utils-image
if (USE_SHARED_LIBS AND TARGET utils-image)
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:utils-image> DESTINATION "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/lib" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
endif()

if ( Qt5Core_FOUND )
get_target_property(MYQT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
else()
Expand Down Expand Up @@ -344,7 +349,6 @@ macro(DeployUnix TARGET)
"librt"
"libstdc++"
"libudev"
"libutil"
"libz"
"libxrender1"
"libxi6"
Expand Down Expand Up @@ -566,6 +570,11 @@ macro(DeployWindows TARGET)
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:utils-xz> DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
endif()

# Copy utils-image
if (USE_SHARED_LIBS AND TARGET utils-image)
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:utils-image> DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
endif()

# Create a qt.conf file in 'bin' to override hard-coded search paths in Qt plugins
file(WRITE "${CMAKE_BINARY_DIR}/qt.conf" "[Paths]\nPlugins=../lib/\n")
install(
Expand Down
20 changes: 20 additions & 0 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ endif()
set(no_dev_warnings_backup "$CACHE{CMAKE_WARN_DEPRECATED}")
set(CMAKE_WARN_DEPRECATED OFF CACHE INTERNAL "" FORCE)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lunasvg)
set_target_properties(lunasvg PROPERTIES POSITION_INDEPENDENT_CODE ON)
set(CMAKE_WARN_DEPRECATED ${no_dev_warnings_backup} CACHE INTERNAL "" FORCE)

#=============================================================================
Expand Down Expand Up @@ -245,3 +246,22 @@ if (UNIX AND NOT APPLE AND (ENABLE_POWER_MANAGEMENT OR ENABLE_PIPEWIRE))
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/sdbus-cpp)
set_target_properties(sdbus-c++-objlib PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()

#=============================================================================
# STB
#=============================================================================

add_library(stb ${CMAKE_CURRENT_SOURCE_DIR}/stb/stb_image.h ${CMAKE_CURRENT_SOURCE_DIR}/lunasvg/3rdparty/stb/stb_image_write.h )

install(
TARGETS stb
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)

target_include_directories(stb PUBLIC ${CMAKE_SOURCE_DIR}/external/lunasvg/3rdparty/stb ${CMAKE_SOURCE_DIR}/external/stb)

target_compile_definitions(stb PUBLIC
STB_IMAGE_WRITE_IMPLEMENTATION
STB_IMAGE_IMPLEMENTATION
)
File renamed without changes.
2 changes: 1 addition & 1 deletion include/api/CallbackAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <utils/Components.h>
#include <api/BaseAPI.h>
#include <base/AccessManager.h>
#include <utils/LutCalibrator.h>
#include <lut-calibrator/LutCalibrator.h>

#ifdef ENABLE_BONJOUR
#include <bonjour/DiscoveryWrapper.h>
Expand Down
4 changes: 2 additions & 2 deletions include/base/DetectionAutomatic.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include <vector>
#endif

#include <utils/Image.h>
#include <utils/ColorRgb.h>
#include <image/Image.h>
#include <image/ColorRgb.h>
#include <utils/Logger.h>
#include <utils/Components.h>

Expand Down
4 changes: 2 additions & 2 deletions include/base/DetectionManual.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <cstdint>
#endif

#include <utils/ColorRgb.h>
#include <utils/Image.h>
#include <image/ColorRgb.h>
#include <image/Image.h>
#include <utils/Logger.h>
#include <utils/Components.h>

Expand Down
6 changes: 3 additions & 3 deletions include/base/Grabber.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
#include <atomic>
#endif

#include <utils/ColorRgb.h>
#include <utils/Image.h>
#include <image/ColorRgb.h>
#include <image/Image.h>
#include <utils/Logger.h>
#include <utils/Components.h>
#include <utils/MemoryBuffer.h>
#include <utils/FrameDecoder.h>
#include <base/DetectionManual.h>
#include <base/DetectionAutomatic.h>
#include <utils/PerformanceCounters.h>
#include <performance-counters/PerformanceCounters.h>

#if defined(_WIN32) || defined(WIN32)
// Windows
Expand Down
4 changes: 2 additions & 2 deletions include/base/GrabberWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <QMultiMap>
#endif

#include <utils/ColorRgb.h>
#include <utils/Image.h>
#include <image/ColorRgb.h>
#include <image/Image.h>
#include <utils/Logger.h>
#include <utils/settings.h>
#include <utils/Components.h>
Expand Down
6 changes: 2 additions & 4 deletions include/base/HyperHdrInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include <atomic>
#endif

#include <utils/ColorRgb.h>
#include <utils/Image.h>
#include <image/ColorRgb.h>
#include <image/Image.h>
#include <utils/settings.h>
#include <utils/Components.h>
#include <base/LedString.h>
Expand All @@ -36,7 +36,6 @@ class ColorAdjustment;
class InstanceConfig;
class VideoControl;
class SystemControl;
class BoblightServer;
class RawUdpServer;
class LedDeviceWrapper;
class Logger;
Expand Down Expand Up @@ -142,7 +141,6 @@ private slots:
std::unique_ptr<EffectEngine> _effectEngine;
std::unique_ptr<VideoControl> _videoControl;
std::unique_ptr<SystemControl> _systemControl;
std::unique_ptr<BoblightServer> _boblightServer;
std::unique_ptr<RawUdpServer> _rawUdpServer;

Logger* _log;
Expand Down
2 changes: 1 addition & 1 deletion include/base/HyperHdrManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <QStringList>
#endif

#include <utils/ColorRgb.h>
#include <image/ColorRgb.h>
#include <utils/Logger.h>
#include <utils/settings.h>
#include <utils/Components.h>
Expand Down
2 changes: 1 addition & 1 deletion include/base/ImageColorAveraging.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <algorithm>
#endif

#include <utils/Image.h>
#include <image/Image.h>
#include <utils/Logger.h>
#include <base/LedString.h>

Expand Down
2 changes: 1 addition & 1 deletion include/base/ImageToLedManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <vector>
#endif

#include <utils/Image.h>
#include <image/Image.h>
#include <utils/Logger.h>
#include <base/LedString.h>
#include <base/ImageColorAveraging.h>
Expand Down
2 changes: 1 addition & 1 deletion include/base/LedCalibration.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <vector>
#endif

#include <utils/ColorRgb.h>
#include <image/ColorRgb.h>
#include <base/ColorCalibration.h>

class LedCalibration
Expand Down
2 changes: 1 addition & 1 deletion include/base/LedString.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <vector>
#endif

#include <utils/ColorRgb.h>
#include <image/ColorRgb.h>

namespace Json { class Value; }

Expand Down
Loading

0 comments on commit f068727

Please sign in to comment.