-
-
Notifications
You must be signed in to change notification settings - Fork 619
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2187 from theComputeKid/patch-1
Enable code analysis via clang-tidy in Visual Studio
- Loading branch information
Showing
6 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
-- | ||
-- tests/actions/vstudio/vc2019/test_output_props.lua | ||
-- Validate generation of the output property groups. | ||
-- Copyright (c) 2024 Jason Perkins and the Premake project | ||
-- | ||
|
||
local p = premake | ||
local suite = test.declare("vstudio_vs2019_output_props") | ||
local vc2010 = p.vstudio.vc2010 | ||
|
||
|
||
-- | ||
-- Setup | ||
-- | ||
|
||
local wks, prj | ||
|
||
function suite.setup() | ||
p.action.set("vs2019") | ||
wks, prj = test.createWorkspace() | ||
end | ||
|
||
local function prepare() | ||
local cfg = test.getconfig(prj, "Debug") | ||
vc2010.outputProperties(cfg) | ||
end | ||
|
||
-- | ||
-- Check clangtidy code analysis enabled. | ||
-- | ||
|
||
function suite.onClangTidy_Enabled() | ||
clangtidy "On" | ||
prepare() | ||
test.capture [[ | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
<OutDir>bin\Debug\</OutDir> | ||
<IntDir>obj\Debug\</IntDir> | ||
<TargetName>MyProject</TargetName> | ||
<TargetExt>.exe</TargetExt> | ||
<EnableClangTidyCodeAnalysis>true</EnableClangTidyCodeAnalysis> | ||
</PropertyGroup> | ||
]] | ||
end | ||
|
||
-- | ||
-- Check clangtidy code analysis disabled. | ||
-- | ||
|
||
function suite.onClangTidy_Disabled() | ||
clangtidy "Off" | ||
prepare() | ||
test.capture [[ | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
<OutDir>bin\Debug\</OutDir> | ||
<IntDir>obj\Debug\</IntDir> | ||
<TargetName>MyProject</TargetName> | ||
<TargetExt>.exe</TargetExt> | ||
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis> | ||
</PropertyGroup> | ||
]] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Enables clang-tidy code analysis for Visual Studio. | ||
|
||
The `clangtidy` option enables running clang-tidy code analysis in Visual Studio projects. | ||
|
||
```lua | ||
clangtidy("value") | ||
``` | ||
|
||
### Parameters ### | ||
|
||
`value` is one of: | ||
|
||
- `On` | ||
- `Off` | ||
|
||
### Applies To ### | ||
|
||
The `config` scope. | ||
|
||
### Availability ### | ||
|
||
Premake 5.0.0 beta 3 or later for Visual Studio 2019 and later. | ||
|
||
### See Also ### | ||
|
||
* [Using Clang-Tidy in Visual Studio](https://learn.microsoft.com/en-us/cpp/code-quality/clang-tidy?view=msvc-170) |