Skip to content

Allow enabling tinyexr module compilation in export templates#73003

Closed
Calinou wants to merge 2 commits intogodotengine:masterfrom
Calinou:tinyexr-allow-enable-export-templates
Closed

Allow enabling tinyexr module compilation in export templates#73003
Calinou wants to merge 2 commits intogodotengine:masterfrom
Calinou:tinyexr-allow-enable-export-templates

Conversation

@Calinou
Copy link
Member

@Calinou Calinou commented Feb 9, 2023

After enabling the tinyexr module at build-time by passing the tinyexr_export_templates=yes SCons option, this makes it possible to use Image.save_exr() in export templates. When the module is enabled, Image.load() can also be used to load images in OpenEXR format.

When tinyexr is enabled in an export template, binary size is about 100 KB larger (stripped on Linux x86_64). As a result, this remains disabled by default.

@Calinou Calinou requested review from a team as code owners February 9, 2023 23:07
@Calinou Calinou added enhancement topic:buildsystem cherrypick:3.x Considered for cherry-picking into a future 3.x release labels Feb 9, 2023
@Calinou Calinou modified the milestones: 4.x, 4.1 Feb 9, 2023
@Calinou Calinou force-pushed the tinyexr-allow-enable-export-templates branch from 5a23ac6 to 94a47fd Compare February 9, 2023 23:13
fire
fire previously approved these changes Feb 10, 2023
SConstruct Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Would it work to move this option to the tinyexr module's config.py, so we don't bloat the main script? I think modules support adding options, see the Mono module.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've pushed a second commit where I attempted this, but it fails when using target=template_release:

KeyError: 'tinyexr_export_templates':
  File "/home/hugo/Documents/Git/godotengine/godot/SConstruct", line 794:
    if config.can_build(env, selected_platform):
  File "/home/hugo/Documents/Git/godotengine/godot/modules/tinyexr/config.py", line 2:
    return env.editor_build or env["tinyexr_export_templates"]
  File "/home/hugo/.local/opt/pyston/lib/python3.8-pyston2.3/site-packages/SCons/Environment.py", line 387:
    return self._dict[key]

The option is listed in scons -h's output still.

After enabling the tinyexr module at build-time by passing the
`tinyexr_export_templates=yes` SCons option, this makes it possible to use
`Image.save_exr()` in export templates. When the module is enabled, `Image.load()`
can also be used to load images in OpenEXR format.

When tinyexr is enabled in an export template, binary size is about 100 KB larger
(stripped on Linux x86_64). As a result, this remains disabled by default.
Comment on lines +6 to +17
from SCons.Script import BoolVariable, Variables, Help

envvars = Variables()
envvars.Add(
BoolVariable(
"tinyexr_export_templates",
"Enable saving and loading OpenEXR images in export template builds (increases binary size)",
False,
)
)
envvars.Update(env)
Help(envvars.GenerateHelpText(env))
Copy link
Member

Choose a reason for hiding this comment

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

This isn't the correct way to do it, see akien-mga@e75da97 for an example.

@Calinou
Copy link
Member Author

Calinou commented Feb 23, 2026

@Calinou Calinou closed this Feb 23, 2026
@Calinou Calinou added archived and removed cherrypick:3.x Considered for cherry-picking into a future 3.x release labels Feb 23, 2026
@Calinou Calinou removed this from the 4.x milestone Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants