-
-
Notifications
You must be signed in to change notification settings - Fork 646
Fixes filters using an aliased value #2615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| -- | ||
| -- test_target_name.lua | ||
| -- Test target names. | ||
| -- Author: Nick Clark | ||
| -- Copyright (c) 2026 Jess Perkins and the Premake project | ||
| -- | ||
|
|
||
| local p = premake | ||
| local suite = test.declare("vstudio_vs2010_target_name") | ||
| local vc2010 = p.vstudio.vc2010 | ||
|
|
||
| -- | ||
| -- Setup | ||
| -- | ||
|
|
||
| local wks, prj | ||
|
|
||
| function suite.setup() | ||
| p.action.set("vs2010") | ||
| wks, prj = test.createWorkspace() | ||
| end | ||
|
|
||
| local function prepare(platform) | ||
| local cfg = test.getconfig(prj, "Debug", platform) | ||
| vc2010.targetName(cfg) | ||
| end | ||
|
|
||
|
|
||
| -- | ||
| -- Default target name is the project name | ||
| -- | ||
|
|
||
| function suite.defaultTargetName() | ||
| prepare() | ||
| test.capture [[ | ||
| <TargetName>MyProject</TargetName> | ||
| ]] | ||
| end | ||
|
|
||
|
|
||
| function suite.targetWithSuffix() | ||
| targetsuffix "_suffix" | ||
|
|
||
| prepare() | ||
| test.capture [[ | ||
| <TargetName>MyProject_suffix</TargetName> | ||
| ]] | ||
| end | ||
|
|
||
|
|
||
| -- | ||
| -- Target name with targetsuffix with AARCH architecture | ||
| -- | ||
|
|
||
| function suite.targetWithAarch64FilterSuffix() | ||
| architecture "AARCH64" | ||
|
|
||
| filter { "architecture:AARCH64" } -- Fails if it is set to ARM64 | ||
| targetsuffix "_ARM64" | ||
|
|
||
| prepare() | ||
| test.capture [[ | ||
| <TargetName>MyProject_ARM64</TargetName> | ||
| ]] | ||
| end | ||
|
|
||
|
|
||
| -- | ||
| -- Target name with targetsuffix with ARM64 architecture | ||
| -- | ||
|
|
||
| function suite.targetWithArm64FilterSuffix() | ||
| architecture "ARM64" | ||
|
|
||
| filter { "architecture:ARM64" } -- Should match when architecture is AARCH64 | ||
| targetsuffix "_ARM64" | ||
|
|
||
| prepare() | ||
| test.capture [[ | ||
| <TargetName>MyProject_ARM64</TargetName> | ||
| ]] | ||
| end | ||
|
|
||
|
|
||
| -- | ||
| -- Target name with targetsuffix and x64 architecture | ||
| -- | ||
|
|
||
| function suite.targetWithX64FilterSuffix() | ||
| architecture "x64" | ||
|
|
||
| filter { "architecture:x64" } | ||
| targetsuffix "_x64" | ||
|
|
||
| prepare() | ||
| test.capture [[ | ||
| <TargetName>MyProject_x64</TargetName> | ||
| ]] | ||
| end | ||
|
|
||
|
|
||
| -- | ||
| -- Target name with targetprefix | ||
| -- | ||
|
|
||
| function suite.targetWithPrefix() | ||
| targetprefix "lib" | ||
|
|
||
| prepare() | ||
| test.capture [[ | ||
| <TargetName>libMyProject</TargetName> | ||
| ]] | ||
| end | ||
|
|
||
|
|
||
| -- | ||
| -- Target name with targetprefix and targetsuffix | ||
| -- | ||
|
|
||
| function suite.targetWithPrefixAndSuffix() | ||
| targetprefix "lib" | ||
| targetsuffix "_suffix" | ||
|
|
||
| prepare() | ||
| test.capture [[ | ||
| <TargetName>libMyProject_suffix</TargetName> | ||
| ]] | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,10 @@ | |
| vstudio.vs2010_architectures = | ||
| { | ||
| win32 = "x86", | ||
| x86 = "x86", | ||
| x86_64 = "x64", | ||
| ARM = "ARM", | ||
| AARCH64 = "ARM64", | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is now identical to
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keeping is separate in case any plugins are relying on this. |
||
|
|
||
| local function architecture(system, arch) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be worth adding a lowercase test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or better yet, a mixed case test, e.g.
aRm64.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should, but that sort of test would be better fit elsewhere in the filter logic, not the VS logic.