Skip to content

Commit

Permalink
Dependency reductions: removal of heavy QT Gui lib (#861)
Browse files Browse the repository at this point in the history
* Remove another dependency behemoth: QT Gui (#861)

* Remove Qt Gui from the project

* Fix effects (1)

* Disable GA for now

* Update ColorRgb.h

* Fix effects (2)

* Fix effects (3)

* Fix effect (4)

* QT Gui has been removed

* Remove Ubuntu Mantic 23.10

* Fix warning

* Improvements

* Improvements (2)

* Improvements  (3)

* Improvements (4)

* Improvements (5)
  • Loading branch information
awawa-dev authored May 24, 2024
1 parent ebacfeb commit aa20079
Show file tree
Hide file tree
Showing 158 changed files with 1,480 additions and 1,067 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/push-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ jobs:
linuxVersion: jammy
dockerName: Ubuntu 22.04 LTS (x86_64)
platform: linux
- dockerImage: x86_64
linuxVersion: mantic
dockerName: Ubuntu 23.10 (x86_64)
platform: linux
- dockerImage: x86_64
linuxVersion: noble
dockerName: Ubuntu 24.04 LTS (x86_64)
Expand Down Expand Up @@ -174,7 +170,7 @@ jobs:
# Install deps
- name: Install deps
shell: bash
run: brew install qt@${{ matrix.QT_VERSION }} xz ccache zstd webp jpeg-turbo || true
run: brew install -q qt@${{ matrix.QT_VERSION }} xz ccache zstd webp jpeg-turbo || true

# Set env
- name: Set QT5 env
Expand Down Expand Up @@ -238,6 +234,12 @@ jobs:
pip install aqtinstall
aqt install-qt -O ${{ runner.workspace }}/Qt windows desktop ${{ env.QT_VERSION }} win64_msvc2019_64 -m qtserialport
- 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: Set up x64 build architecture environment
shell: cmd
run: call "${{env.VCINSTALLDIR}}\Auxiliary\Build\vcvars64.bat"
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/upload-to-github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ jobs:
arch: amd64
platform: linux
niceName: Ubuntu 22.04 LTS
- dockerImage: x86_64
linuxVersion: mantic
dockerName: Ubuntu 23.10 (x86_64)
arch: amd64
platform: linux
niceName: Ubuntu 23.10
- dockerImage: x86_64
linuxVersion: noble
dockerName: Ubuntu 24.04 LTS (x86_64)
Expand Down
80 changes: 27 additions & 53 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
cmake_minimum_required(VERSION 3.16.0)
if (WIN32)
cmake_minimum_required(VERSION 3.24.0)
else()
cmake_minimum_required(VERSION 3.16.0)
endif()

message( STATUS "CMake Version: ${CMAKE_VERSION}" )

Expand Down Expand Up @@ -59,7 +63,7 @@ else()
endif(CCACHE_FOUND)

# find QT libs
find_package(Qt6 COMPONENTS Core Gui Network Sql Widgets SerialPort QUIET)
find_package(Qt6 COMPONENTS Core Network Sql Widgets SerialPort QUIET)

if (Qt6Core_FOUND AND NOT (DO_NOT_USE_QT_VERSION_6_LIBS STREQUAL "ON"))
message( STATUS "Found Qt Version: ${Qt6Core_VERSION}" )
Expand All @@ -71,7 +75,7 @@ ELSE()
message( STATUS "QT version 6 not found. Searching for QT version 5 instead." )
endif()
SET(QT_MIN_VERSION "5.10.0")
find_package(Qt5 COMPONENTS Core Gui Network SerialPort Sql REQUIRED)
find_package(Qt5 COMPONENTS Core Network SerialPort Sql REQUIRED)
message( STATUS "Found Qt Version: ${Qt5Core_VERSION}" )
IF ( "${Qt5Core_VERSION}" VERSION_LESS "${QT_MIN_VERSION}" )
message( FATAL_ERROR "Your Qt version is to old! Minimum required ${QT_MIN_VERSION}" )
Expand Down Expand Up @@ -567,61 +571,15 @@ endif()
add_definitions(${QT_DEFINITIONS})

# libjpegturbo
if(WIN32)
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/windows)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/external/windows)
endif()

if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/windows/libs4windows.zip OR
NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/windows/libjpeg-turbo_x64-windows)
message( STATUS "Downloading libraries for HyperHDR (Windows)")
file(DOWNLOAD https://github.com/awawa-dev/HyperHDR.libs.provider/releases/download/2023.08.07/libs4windows.zip
${CMAKE_CURRENT_SOURCE_DIR}/external/windows/libs4windows.zip
STATUS WIN_LIBS_DOWNLOAD_STATUS
EXPECTED_HASH SHA256=2a0fc14eaad35d8cc36b262c8dcb501d1fac3a72d7bedcca51b71b60395c6c3f)
list(GET WIN_LIBS_DOWNLOAD_STATUS 0 WIN_LIBS_DOWNLOAD_STATUS_CODE)
if(WIN_LIBS_DOWNLOAD_STATUS_CODE AND NOT WIN_LIBS_DOWNLOAD_STATUS_CODE EQUAL 0)
file( REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/external/windows/libs4windows.zip )
message( FATAL_ERROR "Could not download libraries needed by HyperHDR (Windows)")
endif()
endif()
find_package(TurboJPEG REQUIRED)

execute_process(
COMMAND ${SEVENZIP_BIN} x ${CMAKE_CURRENT_SOURCE_DIR}/external/windows/libs4windows.zip -o${CMAKE_CURRENT_SOURCE_DIR}/external/windows/ -aoa -y
RESULT_VARIABLE STATUS_EXTRACT
OUTPUT_VARIABLE OUTPUT1
)

if(STATUS_EXTRACT AND NOT STATUS_EXTRACT EQUAL 0)
message( FATAL_ERROR "Could not extract libraries for HyperHDR (Windows)")
else()
message( STATUS "Package of libraries for HyperHDR extracted (Windows)")
endif()

set (TURBOJPEG_FOUND 1)
set (TURBOJPEG_LIBRARY_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/windows/libjpeg-turbo_x64-windows/bin")
set (TURBOJPEG_LINK_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/external/windows/libjpeg-turbo_x64-windows/lib/turbojpeg.lib")
set (TURBOJPEG_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/windows/libjpeg-turbo_x64-windows/include")
else()
FIND_PACKAGE(PkgConfig REQUIRED)
pkg_check_modules(TURBOJPEG REQUIRED libturbojpeg>=2.0)
endif ()

message( STATUS "TURBOJPEG_LIBRARY_DIRS=${TURBOJPEG_LIBRARY_DIRS}")
message( STATUS "TURBOJPEG_LINK_LIBRARIES=${TURBOJPEG_LINK_LIBRARIES}")
message( STATUS "TURBOJPEG_INCLUDE_DIRS=${TURBOJPEG_INCLUDE_DIRS}")
message( STATUS "TURBOJPEG_LIBRARY_DIRS=${TurboJPEG_LIBRARY}")
message( STATUS "TURBOJPEG_INCLUDE_DIRS=${TurboJPEG_INCLUDE_DIRS}")

# Embedded QT plugins
if (USE_STATIC_QT_PLUGINS)
foreach(guiPlugin ${Qt${Qt_VERSION}Gui_PLUGINS} Qt${Qt_VERSION}::Gui)
get_target_property(file ${guiPlugin} LOCATION)
if (NOT IS_SYMLINK ${file})
message("Using static QT plugin: " ${file})
set(STATIC_QT_PLUGINS_LIBS ${STATIC_QT_PLUGINS_LIBS} ${file})
endif()
endforeach()
foreach(sqlPlugin ${Qt${Qt_VERSION}Sql_PLUGINS} Qt${Qt_VERSION}::Sql)
message( STATUS "TURBOJPEG_INCLUDE_DIRS=${sqlPlugin}")
message( STATUS "PLUGIN=${sqlPlugin}")
get_target_property(file ${sqlPlugin} LOCATION)
if (NOT IS_SYMLINK ${file})
message("Using static QT plugin: " ${file})
Expand All @@ -630,6 +588,22 @@ if (USE_STATIC_QT_PLUGINS)
endforeach()
endif()

if (WIN32)
if(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
${${PROJECT_NAME}_BINARY_DIR}/Bin
CACHE PATH
"Single Directory for all Libraries")
endif()

if(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
${${PROJECT_NAME}_BINARY_DIR}/Bin
CACHE PATH
"Single Directory for all Executables")
endif()
endif()

# Add the source/lib directories
add_subdirectory(external)
add_subdirectory(sources)
Expand Down
Loading

0 comments on commit aa20079

Please sign in to comment.