Skip to content

Commit

Permalink
CMake: Improve Dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Oct 25, 2024
1 parent d915ef0 commit ce38290
Show file tree
Hide file tree
Showing 25 changed files with 1,014 additions and 179 deletions.
34 changes: 17 additions & 17 deletions .github/actions/gstreamer/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,32 @@ runs:
run: meson setup
--prefix=${{ inputs.install_directory }}
--buildtype=${{ inputs.build_type }}
--wrap_mode=forcefallback
-Dgst-full-libraries=base,video,gl
--wrap-mode=forcefallback
--strip
-Dauto_features=disabled
-Dgst-full-libraries=video,gl
-Dgpl=enabled
-Dlibav=enabled
-Dorc=enabled
-Dbase=enabled
-Dvaapi=enabled
-Dqt6=enabled
-Dvaapi=enabled
-Dbase=enabled
-Dgst-plugins-base:app=enabled
-Dgst-plugins-base:gl=enabled
-Dgst-plugins-base:gl_api=opengl,gles2
-Dgst-plugins-base:gl_platform=glx,egl
-Dgst-plugins-base:gl_winsys=x11,egl,wayland
-Dgst-plugins-base:gl_api=opengl,gles2
-Dgst-plugins-base:x11=enabled
-Dgst-plugins-base:playback=enabled
-Dgst-plugins-base:tcp=enabled
-Dgst-plugins-base:app=enabled
-Dgst-plugins-base:x11=enabled
-Dgood=enabled
-Dgst-plugins-good:qt6=enabled
-Dgst-plugins-good:qt-x11=enabled
-Dgst-plugins-good:qt-egl=enabled
-Dgst-plugins-good:qt-wayland=enabled
-Dgst-plugins-good:qt-method=auto
-Dgst-plugins-good:isomp4=enabled
-Dgst-plugins-good:matroska=enabled
-Dgst-plugins-good:qt-egl=enabled
-Dgst-plugins-good:qt-method=auto
-Dgst-plugins-good:qt-wayland=enabled
-Dgst-plugins-good:qt-x11=enabled
-Dgst-plugins-good:qt6=enabled
-Dgst-plugins-good:rtp=enabled
-Dgst-plugins-good:rtpmanager=enabled
-Dgst-plugins-good:rtsp=enabled
Expand All @@ -66,19 +68,17 @@ runs:
-Dgst-plugins-bad:gl=enabled
-Dgst-plugins-bad:mpegtsdemux=enabled
-Dgst-plugins-bad:rtp=enabled
-Dgst-plugins-bad:videoparsers=enabled
-Dgst-plugins-bad:sdp=enabled
-Dgst-plugins-bad:x11=enabled
-Dgst-plugins-bad:wayland=enabled
-Dgst-plugins-bad:va=enabled
-Dgst-plugins-bad:videoparsers=enabled
-Dgst-plugins-bad:wayland=enabled
-Dgst-plugins-bad:x11=enabled
-Dgst-plugins-bad:x265=enabled
-Dugly=enabled
-Dgst-plugins-ugly:x264=enabled
builddir
# --strip=true
# --default-library=static
# --prefer_static=true
# -Dauto_features=disabled
# -Dgst-full-target-type=static_library
# -Dgstreamer:gstreamer-static-full=true
shell: bash
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,57 @@ jobs:
uses: blinemedical/setup-gstreamer@v1
with:
version: ${{ env.GST_VERSION }}
gstreamerOptions: |
--buildtype=release
--wrap-mode=forcefallback
--strip
-Dauto_features=disabled
-Dbase=enabled
-Ddoc=disabled
-Dexamples=disabled
-Dges=disabled
-Dgpl=enabled
-Dgst-examples=disabled
-Dgtk_doc=disabled
-Dlibav=enabled
-Dlibnice=disabled
-Dnls=disabled
-Dorc=enabled
-Dpython=disabled
-Dqt5=disabled
-Drtsp_server=disabled
-Dtests=disabled
-Dgst-plugins-base:app=enabled
-Dgst-plugins-base:gl=enabled
-Dgst-plugins-base:gl_api=opengl,gles2
-Dgst-plugins-base:gl_platform=glx,egl
-Dgst-plugins-base:gl_winsys=x11,egl,wayland
-Dgst-plugins-base:playback=enabled
-Dgst-plugins-base:tcp=enabled
-Dgst-plugins-base:x11=enabled
-Dgood=enabled
-Dgst-plugins-good:isomp4=enabled
-Dgst-plugins-good:matroska=enabled
-Dgst-plugins-good:qt-egl=enabled
-Dgst-plugins-good:qt-method=auto
-Dgst-plugins-good:qt-wayland=enabled
-Dgst-plugins-good:qt-x11=enabled
-Dgst-plugins-good:rtp=enabled
-Dgst-plugins-good:rtpmanager=enabled
-Dgst-plugins-good:rtsp=enabled
-Dgst-plugins-good:udp=enabled
-Dbad=enabled
-Dgst-plugins-bad:gl=enabled
-Dgst-plugins-bad:mpegtsdemux=enabled
-Dgst-plugins-bad:rtp=enabled
-Dgst-plugins-bad:sdp=enabled
-Dgst-plugins-bad:videoparsers=enabled
-Dgst-plugins-bad:wayland=enabled
-Dgst-plugins-bad:x11=enabled
-Dgst-plugins-bad:x265=enabled
-Dugly=enabled
-Dgst-plugins-ugly:x264=enabled
builddir
- uses: lukka/get-cmake@latest

Expand Down
16 changes: 9 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,28 +150,24 @@ if(ANDROID)
message(STATUS "QT_ANDROID_KEYSTORE_ALIAS $ENV{QT_ANDROID_KEYSTORE_ALIAS}")
# QT_ANDROID_KEYSTORE_STORE_PASS, QT_ANDROID_KEYSTORE_KEY_PASS
endif()

if(NOT Qt6LinguistTools_DIR)
set(Qt6LinguistTools_DIR ${QT_HOST_PATH}/lib/cmake/Qt6LinguistTools)
endif()
endif()

find_package(Qt6
REQUIRED
COMPONENTS
Bluetooth
Charts
Concurrent
Core
Core5Compat
Location
Multimedia
Network
OpenGL
Positioning
Qml
QmlIntegration
Quick
QuickControls2
QuickWidgets
OpenGL
Sensors
Sql
Svg
Expand All @@ -180,6 +176,8 @@ find_package(Qt6
Widgets
Xml
OPTIONAL_COMPONENTS
Bluetooth
Charts
LinguistTools
MultimediaQuickPrivate
Quick3D
Expand All @@ -189,6 +187,10 @@ find_package(Qt6
${QT_LIBRARY_HINTS}
)

if(NOT Qt6LinguistTools_DIR)
set(Qt6LinguistTools_DIR ${QT_HOST_PATH}/lib/cmake/Qt6LinguistTools)
endif()

# Require 6.6.3 because otherwise libQt6QuickControls2Basic.so.6 &
# libQt6QuickControls2BasicStyleImpl.so.6 are missing.
qt_standard_project_setup(REQUIRES 6.6.3)
Expand Down
14 changes: 14 additions & 0 deletions cmake/find-modules/FindAVFoundation.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause

find_library(AVFoundation_LIBRARY NAMES AVFoundation)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(AVFoundation DEFAULT_MSG AVFoundation_LIBRARY)

if(AVFoundation_FOUND AND NOT TARGET AVFoundation::AVFoundation)
add_library(AVFoundation::AVFoundation INTERFACE IMPORTED)
set_target_properties(AVFoundation::AVFoundation PROPERTIES
INTERFACE_LINK_LIBRARIES "${AVFoundation_LIBRARY}")
endif()

mark_as_advanced(AVFoundation_LIBRARY)
12 changes: 12 additions & 0 deletions cmake/find-modules/FindBlueZ.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause

set(BlueZ_FOUND 0)

find_package(PkgConfig QUIET)

pkg_check_modules(BLUEZ bluez IMPORTED_TARGET)

if(TARGET PkgConfig::BLUEZ)
set(BlueZ_FOUND 1)
endif()
18 changes: 17 additions & 1 deletion cmake/find-modules/FindFFmpeg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,11 @@ endfunction()
# and adds them to the target library.
function(__ffmpeg_internal_set_dependencies _component)
string(TOLOWER ${_component} lib)
set(PC_FILE ${${_component}_LIBRARY_DIR}/pkgconfig/lib${lib}.pc)

# The pkgconfig directory is always in lib/pkgconfig/, even on Windows
# where libs and dlls are in bin/
set(PC_FILE ${${_component}_LIBRARY_DIR}/../lib/pkgconfig/lib${lib}.pc)

if(EXISTS ${PC_FILE})
file(READ ${PC_FILE} pcfile)

Expand Down Expand Up @@ -370,8 +374,20 @@ foreach (_component ${FFmpeg_FIND_COMPONENTS})
list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARY ${_component}_INCLUDE_DIR)
endforeach ()

set(FIND_FFMPEG_HELP_STRING
[=[FFMPEG_DIR CMake variable is not correct.
Make sure that the FFMPEG_DIR CMake variable is set to a path that
contains FFmpeg 'lib' and 'include' directories and that the FFmpeg
installation is built with the avformat, avcodec, swresample,
swscale, and avutil libraries. To resolve the issue, please delete
CMakeCache.txt and run configure again with the correct FFMPEG_DIR
CMake variable set.
]=])

# Give a nice error message if some of the required vars are missing.
find_package_handle_standard_args(FFmpeg
REQUIRED_VARS ${_FFmpeg_REQUIRED_VARS}
HANDLE_COMPONENTS
REASON_FAILURE_MESSAGE
${FIND_FFMPEG_HELP_STRING}
)
97 changes: 97 additions & 0 deletions cmake/find-modules/FindFlite.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause

# We can't create the same interface imported target multiple times, CMake will complain if we do
# that. This can happen if the find_package call is done in multiple different subdirectories.
if(TARGET Flite::Flite)
set(Flite_FOUND 1)
return()
endif()

find_path(Flite_INCLUDE_DIR
NAMES
flite/flite.h
)
find_library(Flite_LIBRARY
NAMES
flite
)

if(NOT Flite_INCLUDE_DIR OR NOT Flite_LIBRARY)
set(Flite_FOUND 0)
return()
endif()

include(CMakePushCheckState)
include(CheckCXXSourceCompiles)

# Flite can be built with ALSA support,
# in which case we need to link ALSA as well
find_package(ALSA QUIET)

cmake_push_check_state(RESET)

set(CMAKE_REQUIRED_INCLUDES "${Flite_INCLUDE_DIR}")
set(CMAKE_REQUIRED_LIBRARIES "${Flite_LIBRARY}")

if(ALSA_FOUND)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${ALSA_LIBRARIES}")
endif()

check_cxx_source_compiles("
#include <flite/flite.h>
static int fliteAudioCb(const cst_wave *w, int start, int size,
int last, cst_audio_streaming_info *asi)
{
(void)w;
(void)start;
(void)size;
(void)last;
(void)asi;
return CST_AUDIO_STREAM_STOP;
}
int main()
{
cst_audio_streaming_info *asi = new_audio_streaming_info();
asi->asc = fliteAudioCb; // This fails for old Flite
new_audio_streaming_info();
return 0;
}
" HAVE_FLITE)

cmake_pop_check_state()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Flite
FOUND_VAR
Flite_FOUND
REQUIRED_VARS
Flite_LIBRARY
Flite_INCLUDE_DIR
HAVE_FLITE
)

if(Flite_FOUND)
add_library(Flite::Flite UNKNOWN IMPORTED)
set_target_properties(Flite::Flite PROPERTIES
IMPORTED_LOCATION "${Flite_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${Flite_INCLUDE_DIR}"
)
if(ALSA_FOUND)
set_target_properties(Flite::Flite PROPERTIES
INTERFACE_LINK_LIBRARIES "${ALSA_LIBRARIES}"
)
endif()
endif()

mark_as_advanced(Flite_LIBRARY Flite_INCLUDE_DIR HAVE_FLITE)


if(HAVE_FLITE)
set(Flite_FOUND 1)
else()
message("Flite was found, but the version is too old (<2.0.0)")
set(Flite_FOUND 0)
endif()
Loading

0 comments on commit ce38290

Please sign in to comment.