Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
BartSte committed Jan 18, 2024
2 parents 315a425 + f7d7bb6 commit e1dd655
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 75 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ jobs:
- name: Build project
run: |
./scripts/configure
cmake --build "$PWD/build" --target package
./scripts/configure -- -DBUILD_TESTING=ON
cmake --build ./build --target package
- name: Run tests
run: ctest --test-dir ./build --verbose

- name: Publish
uses: "marvinpinto/action-automatic-releases@latest"
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project(
LANGUAGES CXX)

option(BUILD_TESTING "Build tests" OFF)
option(INSTALL_GTEST OFF)

message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Build tests: ${BUILD_TESTING}")
Expand Down
56 changes: 6 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,56 +417,12 @@ more information.
to run the app.
- [ ] Publish the directory tree as an archive as a release. Other more
sophisticated release methods can be used later.
- Issue FFmpeg:

- On ubuntu, the includes (headers I guess) are not included in the apt
package, in contrast to the arch package. As a solution, I build ffmpeg
from source. I build them with static linking which gives some new
issues when building the project. Now I am thinking.. I guess I have 3
options:

1. statical link ffmpeg to the project.
2. dynamically link ffmpeg to the project and include the ffmpeg libs in
the release.
3. dynamically link ffmpeg to the project and let the user install ffmpeg
themselves. This could be useful when the user needs different
versions of ffmpeg to make it work with their hardware.

On arch, I can just install static ffmpeg using AUR (its located at
/opt/ffmpeg063).

Update: I think I fixed it:

- I created the install-ffmpeg script to build ffmpeg from source. It is
installed in ./3rdparty/ffmpeg.
- After that, the -DFFMPEG_DIR=$PWD/3rdparty/ffmpeg flag is added to the
cmake command. This makes sure that the ffmpeg libs are found. This
results in:

```
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DFFMPEG_DIR=$PWD/3rdparty/ffmpeg
```
Now I hit a known bug: https://bugreports.qt.io/browse/QTBUG-115052 when
building ffmpeg statically. So, I can apply the patch that is provided
and try again -> now I get an error that some functions are not undefined
so I probably miss some libs... I will go forward with the shared ffmpeg.
In the pipeline, I get the following error:
```
CMake Error at /home/runner/work/snapshot/snapshot/build/app/cmake_install.cmake:66 (file):
file Could not resolve runtime dependencies:
libavcodec.so.60
libavutil.so.58
libswresample.so.4
Call Stack (most recent call first):
/home/runner/work/snapshot/snapshot/build/cmake_install.cmake:48 (include)
CPack Error: Error when generating package: snapshot
FAILED: CMakeFiles/package.util
cd /home/runner/work/snapshot/snapshot/build && /usr/local/bin/cpack --config ./CPackConfig.cmake
ninja: build stopped: subcommand failed.
Error: Process completed with exit code
```

- When install the runtime deps, how can I:

- Resolve conflicting dependency names for ffmpeg (issue on my laptop)?
- Add the custom build of ffmpeg libs to the search path of the install
function of cmake (issue on pipeline)?

- Issues graphics:

Expand Down
21 changes: 9 additions & 12 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
add_executable(snapshot main.cpp ${CMAKE_SOURCE_DIR}/resources/resources.qrc)
target_link_libraries(snapshot PRIVATE snapshotapp)

message(STATUS "Adding directory of FFmpeg libraries to the install search path: ${FFMPEG_LIBRARY_DIRS}")
install(
TARGETS snapshot
RUNTIME_DEPENDENCIES
POST_EXCLUDE_REGEXES
".*libc.*"
".*libm\..*"
".*libavcodec.*"
".*libavdevice.*"
".*libavfilter.*"
".*libavformat.*"
".*libavutil.*"
".*libpostproc.*"
".*libswresample.*"
".*libswscale.*"
".*libvmaf.*")
install(FILES ${FFMPEG_LIBRARIES} DESTINATION lib)
# Compatability with standard C libraries across linux distributions
# is assumed.
".*libc\.so.*"
".*libm\.so.*"
".*libdbm\.so.*"
".*libpthread\.so.*")

# Copy the entrypoint to the install directory.
install(PROGRAMS ${CMAKE_SOURCE_DIR}/scripts/snapshot DESTINATION .)

set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
Expand Down
15 changes: 11 additions & 4 deletions scripts/configure
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@ Additionally, the following is supported by default:
- 3rdparty/ffmpeg/include contains the headers
Options:
--help Show this help message
--clean Remove the build folder before configuring
--no-patch Do not patch FindFFmpeg.cmake to fix a bug in Qt 6.6"
--help Show this help message
--clean Remove the build folder before configuring
--no-patch Do not patch FindFFmpeg.cmake to fix a bug in Qt 6.6
--build-type <type> Set the build type to Debug, Release, or
RelWithDebInfo (default: Release)"

this_dir=$(dirname "$(realpath "${BASH_SOURCE:-$0}")")

root="$this_dir/.."
patch=true
qt_dir="$root/3rdparty/Qt"
ffmpeg_dir="$root/3rdparty/ffmpeg"
build_type="Release"

clean() {
echo "Remove old build folder"
Expand All @@ -48,7 +51,7 @@ configure() {
-S "$root" \
-B "$root/build" \
-DBUILD_TESTING=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_BUILD_TYPE="$build_type" \
-DFFMPEG_DIR="$ffmpeg_dir" \
-DCMAKE_PREFIX_PATH="$qt_dir/lib/cmake" \
"$@"
Expand All @@ -64,6 +67,10 @@ while [[ $# -gt 0 ]]; do
clean
shift
;;
--build-type)
build_type="$2"
shift 2
;;
--no-patch)
patch=false
shift
Expand Down
23 changes: 16 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ find_package(Qt6 REQUIRED COMPONENTS Widgets Multimedia MultimediaWidgets
WaylandClient)

message(STATUS "Qt6 was found at ${Qt6_DIR}")
message(STATUS "FFmpeg libraries are: ${FFMPEG_LIBRARIES}")

file(GLOB_RECURSE SOURCES "${CMAKE_SOURCE_DIR}/src/*")
file(GLOB_RECURSE INCLUDES "${CMAKE_SOURCE_DIR}/include/*")
Expand All @@ -16,6 +17,18 @@ target_include_directories(
${Boost_INCLUDE_DIRS}
INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/snapshotapp_autogen/include)

set(PLATFORM_PLUGINS
Qt6::QEglFSIntegrationPlugin
Qt6::QLinuxFbIntegrationPlugin
Qt6::QMinimalEglIntegrationPlugin
Qt6::QMinimalIntegrationPlugin
Qt6::QOffscreenIntegrationPlugin
Qt6::QVkKhrDisplayIntegrationPlugin
Qt6::QVncIntegrationPlugin
Qt6::QWaylandEglPlatformIntegrationPlugin
Qt6::QWaylandIntegrationPlugin
Qt6::QXcbIntegrationPlugin)

target_link_libraries(
snapshotapp
PUBLIC spdlog::spdlog_header_only
Expand All @@ -24,18 +37,14 @@ target_link_libraries(
Qt6::Widgets
Qt6::Multimedia
Qt6::MultimediaWidgets
Qt6::QWaylandEglPlatformIntegrationPlugin
Qt6::QWaylandIntegrationPlugin
Qt6::QXcbIntegrationPlugin
Qt6::QFFmpegMediaPlugin)
Qt6::QFFmpegMediaPlugin
${PLATFORM_PLUGINS})

qt_import_plugins(
snapshotapp
INCLUDE_BY_TYPE
platforms
Qt6::QWaylandEglPlatformIntegrationPlugin
Qt6::QWaylandIntegrationPlugin
Qt6::QXcbIntegrationPlugin
${PLATFORM_PLUGINS}
INCLUDE_BY_TYPE
multimedia
Qt6::QFFmpegMediaPlugin)

0 comments on commit e1dd655

Please sign in to comment.