Skip to content

Cmake use FetchContent for compression libraries - #3151

Merged
wzchu-lunarg merged 8 commits into
LunarG:devfrom
wzchu-lunarg:wzchu-fetch-content-compression
Sep 30, 2026
Merged

wzchu-lunarg merged 8 commits into
LunarG:devfrom
wzchu-lunarg:wzchu-fetch-content-compression

Conversation

@wzchu-lunarg

@wzchu-lunarg wzchu-lunarg commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Build GFXR's compression libraries from source rather than precompiled binaries.

@wzchu-lunarg wzchu-lunarg added the approved-to-run-ci Can run CI check on internal LunarG machines label Jul 29, 2026
@wzchu-lunarg
wzchu-lunarg marked this pull request as ready for review July 30, 2026 22:27
@wzchu-lunarg
wzchu-lunarg marked this pull request as draft July 30, 2026 22:28
@wzchu-lunarg
wzchu-lunarg marked this pull request as ready for review August 3, 2026 15:41
@bradgrantham-lunarg

Copy link
Copy Markdown
Contributor

@johnzupin @richard-lunarg @KarenGhavam-lunarG This would change GFXR's compression library policy from "it's whatever binary we checked in" to "build from pinned source revision by default".

Notably downstream distro packaging may balk at not using the system libraries, but this shouldn't be any worse than before, just requires GFXRECON_COMPRESSION_FROM_SOURCE=OFF to build with the system.

Take a moment please to consider if this affects the SDK build or packaging in downstream distros.

@per-mathisen-arm

Copy link
Copy Markdown
Contributor

Having worked with packagers before, I think they would be fine as long as they have a switch to disable included libraries and use system ones instead. I (and I assume package maintainers) would prefer that it tries to use system libraries first and only falls back to fetching its own library sources, as then it tries to do the arguably correct thing first and (possibly significantly) reduces initial compile time.

@wzchu-lunarg wzchu-lunarg changed the title Test: Cmake use FetchContent for compression libraries Cmake use FetchContent for compression libraries Aug 4, 2026
@jzulauf-lunarg

Copy link
Copy Markdown
Contributor

CI testing of a version change should catch interface changes at compile time, and hopefully cover any behavioral changes as well.

@antonio-lunarg

Copy link
Copy Markdown
Contributor

This means ci jobs can be updated, dropping lines like apt install liblz4-dev/libzstd-dev, right?

Comment thread cmake/FindLZ4.cmake Outdated
@wzchu-lunarg

Copy link
Copy Markdown
Contributor Author

Was under the assumption that we would get this approved before a subsequent PR with the GFXRECON_COMPRESSION_FROM_SOURCE=OFF, however made a draft so maybe we can get this through soon.

@richard-lunarg

Copy link
Copy Markdown
Contributor

This does affect SDK builds for Windows ARM. These packages last I checked did not support building a combined binary (Intel/ARM), so I have to build both sets and combine them. I then checked them into the repository for ARM builds. Whenever we update the version, I either need to leave it as is, or do a manual build to update them.

@charles-lunarg charles-lunarg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its a good start - just needs some cleanup work to remove the code and documentation that became stale with the changes.

Comment thread cmake/FindLZ4.cmake Outdated
Comment thread cmake/FindZLIB.cmake Outdated
Comment thread cmake/FindZLIB.cmake Outdated
Comment thread cmake/FindZSTD.cmake Outdated
Comment thread cmake/FindZLIB.cmake Outdated
Comment thread cmake/FindLZ4.cmake Outdated
Comment thread cmake/FindZSTD.cmake Outdated

@charles-lunarg charles-lunarg left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed something in the top level CMakeLists.txt - we add the precompiled libraries to CMAKE_PREFIX_PATH, but we are deleting those libraries (except for windows, which still has some). Meaning, we can delete those calls to set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ...)

I think there are only three places which need removal, linked here.

set(CMAKE_PREFIX_PATH

set(CMAKE_PREFIX_PATH

set(CMAKE_PREFIX_PATH

Other than that I think its good to go.

Note that we likely will need to amend building to allow using system libraries instead of fetch content. This could be as simple as a build option, like GFXRECON_COMPRESSION_FROM_SYSTEM or a similar name, that just uses find_package().
E.G

if (GFXRECON_COMPRESSION_FROM_SYSTEM)
    find_package(LZ4 REQUIRED) 
    return()
endif()
<rest of the FindLZ4.cmake file>

@wzchu-lunarg
wzchu-lunarg added this pull request to the merge queue Sep 30, 2026
Merged via the queue into LunarG:dev with commit 0727e98 Sep 30, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved-to-run-ci Can run CI check on internal LunarG machines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants