Skip to content

add defaultconfiguration API and config.getdefault - #2718

Merged
nickclark2016 merged 1 commit into
premake:masterfrom
mercury233:patch-default-config
Jun 25, 2026
Merged

nickclark2016 merged 1 commit into
premake:masterfrom
mercury233:patch-default-config

Conversation

@mercury233

@mercury233 mercury233 commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Close #2709

  • Adds the defaultconfiguration API to specify the default build configuration. For example, in gmake this controls which configuration is used when running make without explicitly passing config=release.
  • Adds config.getdefault() to centralize the logic for selecting the default configuration.
  • Updates generators/modules to use the new shared default-selection logic.
  • Add warning for defaultplatform when a non-existent value is specified, and update the documentation.
  • Adds related tests.

How does this PR change Premake's behavior?

When defaultconfiguration is specified, generators that support a default configuration will use it when selecting their default build target/configuration.

When defaultconfiguration is not specified, the expected behavior should remain consistent with the existing tests. The sorting performed by config.getdefault() is aligned with the workspace configuration ordering introduced by #2675, which sorted workspace.eachconfig() for deterministic output.

This can also be seen as a follow-up to #2675, extending the default-selection logic so it is shared and consistent across modules.

Anything else we should know?

There were existing design comments using the name defaultConfiguration, so this PR preserves that API name conceptually while exposing it in Premake's usual lowercase style as defaultconfiguration.

#2675 did not update project.eachconfig() to sort project configurations. That may have been intentional, but whether project-level configuration iteration should also be sorted may be worth discussing separately.

Did you check all the boxes?

  • Focus on a single fix or feature; remove any unrelated formatting or code changes
  • Add unit tests showing fix or feature works; all tests pass
  • Mention any related issues (put closes #XXXX in comment to auto-close issue when PR is merged)
  • Follow our coding conventions
  • Minimize the number of commits
  • Align documentation to your changes

You can now support Premake on our OpenCollective. Your contributions help us spend more time responding to requests like these!

@mercury233

Copy link
Copy Markdown
Contributor Author

The CI failure was primarily caused by some NuGet API error (504) encountered during testing.

@seragh

seragh commented Jun 19, 2026

Copy link
Copy Markdown

Tested and works for me, thanks for the effort.

Comment thread src/base/config.lua
Comment thread modules/vstudio/tests/sln2005/test_platforms.lua Outdated
Comment thread modules/vstudio/vs2005_solution.lua Outdated
Comment thread modules/xcode/xcode_common.lua Outdated
Comment thread src/_premake_init.lua Outdated
Comment thread tests/base/test_config_getdefault.lua Outdated
Comment thread website/docs/defaultconfiguration.md
Comment thread src/base/config.lua
Comment thread tests/base/test_config_getdefault.lua Outdated
Comment thread website/docs/defaultconfiguration.md
Comment thread src/_premake_init.lua
@nickclark2016
nickclark2016 merged commit 27d5ce8 into premake:master Jun 25, 2026
135 of 136 checks passed
@mercury233
mercury233 deleted the patch-default-config branch June 25, 2026 00: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.

Default config changed from release to debug for gmake action

5 participants