Skip to content

Change framework.lib from object to static lib. - #1562

Merged
marty-johnson59 merged 1 commit into
KhronosGroup:mainfrom
asuessenbach:framework_lib
Aug 24, 2026
Merged

Change framework.lib from object to static lib.#1562
marty-johnson59 merged 1 commit into
KhronosGroup:mainfrom
asuessenbach:framework_lib

Conversation

@asuessenbach

Copy link
Copy Markdown
Contributor

Description

Changing the framework.lib from object to static reduces the size of each samples lib from about 300MB to about 25MB.

Build tested on Win11 with VS2026. Run tested on Win11 with NVidia GPU.

Fixes #1555

General Checklist:

Please ensure the following points are checked:

  • My code follows the coding style
  • I have reviewed file licenses
  • I have commented any added functions (in line with Doxygen)
  • I have commented any code that could be hard to understand
  • My changes do not add any new compiler warnings
  • My changes do not add any new validation layer errors or warnings
  • I have used existing framework/helper functions where possible
  • My changes do not add any regressions
  • I have tested every sample to ensure everything runs correctly
  • This PR describes the scope and expected impact of the changes I am making

Note: The Samples CI runs a number of checks including:

  • I have updated the header Copyright to reflect the current year (CI build will fail if Copyright is out of date)
  • My changes build on Windows, Linux, macOS and Android. Otherwise I have documented any exceptions

If this PR contains framework changes:

  • I did a full batch run using the batch command line argument to make sure all samples still work properly

Sample Checklist

If your PR contains a new or modified sample, these further checks must be carried out in addition to the General Checklist:

  • I have tested the sample on at least one compliant Vulkan implementation
  • If the sample is vendor-specific, I have tagged it appropriately
  • I have stated on what implementation the sample has been tested so that others can test on different implementations and platforms
  • Any dependent assets have been merged and published in downstream modules
  • For new samples, I have added a paragraph with a summary to the appropriate chapter in the readme of the folder that the sample belongs to e.g. api samples readme
  • For new samples, I have added a tutorial README.md file to guide users through what they need to know to implement code using this feature. For example, see conditional_rendering
  • For new samples, I have added a link to the Antora navigation so that the sample will be listed at the Vulkan documentation site

@SaschaWillems

Copy link
Copy Markdown
Collaborator

Also see #1561 which gets build size down to ~18 GByte for me. What's the size with this one? If this also lowers it, I could adopt this to my PR.

@asuessenbach

Copy link
Copy Markdown
Contributor Author

which gets build size down to ~18 GByte for me

I don't see anything small like this.
With the framework.lib as OBJECT and the per-sample libs as STATIC (the current situation in main), my build directory is 60.6 GB.
With this change only (all libs as STATIC), I have 27.3 GB.
With your change only (all libs as OBJECT), I have 30.1 GB.
With both changes (framework.lib as STATIC, per-sample libs as OBJECT), I have 30.3 GB.

That is by just switching the framework.lib to STATIC (this PR) I get the best size reduction.
Plus: no need to distinguish between local and CI build.

@SaschaWillems Could you please check the sizes with your environment as well?

@asuessenbach
asuessenbach requested a review from a team August 18, 2026 10:02
@asuessenbach

Copy link
Copy Markdown
Contributor Author

... as a side note: when I try to change the framework.lib to shared, I get unresolved externals of 2 functions, that would be resolved from apps.cpp. But that file is cmake-generated into the build tree.
To resolve that would require some more in-depth investigations...

@SaschaWillems

Copy link
Copy Markdown
Collaborator

Welp. Ignore my PR. I forgot that I only had a few samples enabled, so size change wasn't what I thought it would be.

@gpx1000

gpx1000 commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

#1563 <-- I'm doing a few things here to address this issue. Would you test how much we save by using this version? Basically I'm looking to make a few changes to the build flags, switch to static libs and remove the .obj files once they get into the .libs. This combo should keep sccache working, keep debugging symbols available, and dramatically reduce the size of the build folder in Windows by removing duplicated debug symbols.

@asuessenbach

Copy link
Copy Markdown
Contributor Author

Would you test how much we save by using this version?

@gpx1000 I get the same reduction (more than 30GB) as with this PR. Probably because it's the switch from OBJECT to STATIC for the framework.lib. None of your other changes in #1563 seem to happen with my build environment.

@gpx1000

gpx1000 commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

@asuessenbach, if you get a chance, give it another try, I had the cmake looking for my build setup and not all msvc setups... opps.

@asuessenbach

Copy link
Copy Markdown
Contributor Author

@gpx1000 I don't see any additional size reduction with your latest changes.

And, by the way, I don't see anything at "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET_NAME}.dir".
Maybe you wanted to remove files at "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.dir"?

@tomek-brcm tomek-brcm left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Builds fine on Linux, no regressions.

@marty-johnson59
marty-johnson59 merged commit e214200 into KhronosGroup:main Aug 24, 2026
19 checks passed
@asuessenbach
asuessenbach deleted the framework_lib branch August 24, 2026 16:05
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.

Excessive disk space requirements for builds

5 participants