fix: make GPAC dependency optional in CMake - #2320
Conversation
There was a problem hiding this comment.
Pull request overview
Makes the GPAC (libgpac) dependency optional for CMake builds so CCExtractor can still configure/build on systems where GPAC is unavailable (e.g., newer Ubuntu releases), while keeping GPAC-backed MP4 functionality enabled when the library is detected.
Changes:
- Added
WITH_GPACCMake option and made GPAC detection non-fatal, compiling without GPAC when not found. - Introduced
#ifdef ENABLE_GPACguards for GPAC headers/version reporting, and added GPAC-disabled stub implementations for MP4 entry points. - Updated the Windows MSVC project to define
ENABLE_GPACso GPAC-backed code remains enabled there.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| windows/ccextractor.vcxproj | Defines ENABLE_GPAC for MSVC “*-Full” configs to keep GPAC-backed code enabled in that build. |
| src/lib_ccx/params.c | Guards GPAC header includes and version-printing behind ENABLE_GPAC. |
| src/lib_ccx/mp4.c | Wraps GPAC MP4 implementation behind ENABLE_GPAC and adds non-GPAC stubs. |
| src/lib_ccx/CMakeLists.txt | Makes GPAC discovery conditional/optional and toggles ENABLE_GPAC when found. |
| src/CMakeLists.txt | Adds WITH_GPAC option and avoids unconditional GPAC-related definitions/linking. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (WITH_GPAC) | ||
| pkg_check_modules (GPAC gpac) | ||
| if (GPAC_FOUND) | ||
| set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${GPAC_INCLUDE_DIRS}) | ||
| set (EXTRA_LIBS ${EXTRA_LIBS} ${GPAC_LIBRARIES}) | ||
| set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_GPAC") | ||
| else () | ||
| message(WARNING "GPAC not found. Compiling without GPAC support.") | ||
| endif () | ||
| endif () |
| if (WITH_GPAC) | ||
| set (EXTRA_LIBS ${EXTRA_LIBS} ${GPAC_LIBRARIES}) | ||
| endif() |
| int processmp4(struct lib_ccx_ctx *ctx, struct ccx_s_mp4Cfg *cfg, char *file) | ||
| { | ||
| mprint("GPAC support is disabled. MP4 parsing will not work.\n"); | ||
| return -1; | ||
| } | ||
|
|
||
| int dumpchapters(struct lib_ccx_ctx *ctx, struct ccx_s_mp4Cfg *cfg, char *file) | ||
| { | ||
| return -1; | ||
| } |
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 128175e...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
Congratulations: Merging this PR would fix the following tests:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 128175e...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
Congratulations: Merging this PR would fix the following tests:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
Resolves #2254
What changed: Made the GPAC library dependency optional via a CMake option flag. When GPAC is not found or disabled, CCExtractor builds without GPAC-dependent features. Added ifdef ENABLE_GPAC guards with graceful fallback stubs. Updated the Windows MSVC project file.
Why: libgpac-dev was removed from Ubuntu 24.10+ repositories, causing hard build failures.