Skip to content

feat(build): make this a fullblown cmake project#370

Merged
ReenigneArcher merged 4 commits intomasterfrom
feat/build/make-this-a-fullblown-cmake-project
Oct 30, 2024
Merged

feat(build): make this a fullblown cmake project#370
ReenigneArcher merged 4 commits intomasterfrom
feat/build/make-this-a-fullblown-cmake-project

Conversation

@ReenigneArcher
Copy link
Member

@ReenigneArcher ReenigneArcher commented Oct 20, 2024

Description

This PR will make the whole project able to be built using CMake.

Known TODOs:

  • find category for lone misc patch
  • move third-party to cmake build directory and only apply patches to that location (keep git tree clean)
  • add custom targets for each step
  • properly define paths for each dependency/step: https://stackoverflow.com/a/40285224/11214013
  • final step to depend on previous targets
  • update readme with build instructions
  • use Ninja (edit, switched back to make)
  • update CI
  • no working c compiler found for x264 in Windows (GitHub runner only, local is okay)
  • FFmpeg on Windows is not installing to the defined prefix
  • FFmpeg is not respecting the configure arguments
  • Linux cross compiling not working, no working compiler
  • PKG_CONFIG_PATH is not set right on Windows in GitHub runner (okay locally)
  • macOS x86_64, FFmpeg complains that cc is a cross compiler
  • Select a default option for MSYS on Windows
  • re-enable CBS target
  • verify build works in Sunshine
  • run make with -j arg

TODOs for later

  • allow skipping dependency steps and instead use system installed versions ... avoid over complicating this PR
  • include source code as part of dist branch (allow easy building of ffmpeg directly in Sunshine if packager doesn't want to use a pre-compiled target) ... I have an idea how to handle this but would like to do it in a separate PR
  • ninja not working for Linux cross compilers, probably something in the toolchain messing with the environment

Once this PR is complete, it will be easier to add new targets such as for Fedora using the container option in CI.

This PR is marked as a breaking change because it will require the following change to Sunshine.

diff --git a/src/cbs.cpp b/src/cbs.cpp
index 211541d0..0b795a55 100644
--- a/src/cbs.cpp
+++ b/src/cbs.cpp
@@ -3,10 +3,10 @@
  * @brief Definitions for FFmpeg Coded Bitstream API.
  */
 extern "C" {
-#include <cbs/cbs_h264.h>
-#include <cbs/cbs_h265.h>
-#include <cbs/h264_levels.h>
 #include <libavcodec/avcodec.h>
+#include <libavcodec/cbs_h264.h>
+#include <libavcodec/cbs_h265.h>
+#include <libavcodec/h264_levels.h>
 #include <libavutil/pixdesc.h>
 }

Additionally, ffmpeg will be replaced by dist in the published path. This is done to plan for item 2 in the future TODO list.

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

@ReenigneArcher ReenigneArcher marked this pull request as draft October 20, 2024 22:12
@ReenigneArcher ReenigneArcher force-pushed the feat/build/make-this-a-fullblown-cmake-project branch 29 times, most recently from 6fb99e1 to cc1b6b1 Compare October 24, 2024 03:16
@ReenigneArcher ReenigneArcher force-pushed the feat/build/make-this-a-fullblown-cmake-project branch 25 times, most recently from a164fc6 to a9b4874 Compare October 26, 2024 03:55
@ReenigneArcher
Copy link
Member Author

@brad-richardson sorry for the ping, but hoping you can help shed some light on this question.

I am trying to work towards making our whole FFmpeg build a cmake project, which would then allow us to include it as a subdirectory in Sunshine for cases where our pre-builts are not sufficient.

I'm struggling to understand the cbs aspect, and why FFmpeg was configured and built 2 times. Is there some reason why we can't just configure FFmpeg once with the --enable-bsfs flag?

#54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant